It's been a problem for weeks now, and every time I thought of something that may work, I keep over-complicating it, or it just doesn't work at all.
My system works off of the cable's "cabledirs" list, which indicates, based on the icon state's number, what directions it can accept other lines from. Done so:
/obj/cable/New()
..()
spawn(10)
switch(icon_state)
if("0-1")
if(master)
for(var/obj/machinery/M in src.loc.contents)
master.machinery.Add(M)
M.connected = 1
cabledirs = list(SOUTH)
if("0-2")
if(master)
for(var/obj/machinery/M in src.loc.contents)
master.machinery.Add(M)
M.connected = 1
cabledirs = list(NORTH)
if("0-4")
if(master)
for(var/obj/machinery/M in src.loc.contents)
master.machinery.Add(M)
M.connected = 1
cabledirs = list(EAST)
if("0-8")
if(master)
for(var/obj/machinery/M in src.loc.contents)
master.machinery.Add(M)
M.connected = 1
cabledirs = list(WEST)
if("1-2")
cabledirs = list(NORTH, SOUTH)
if("1-4")
cabledirs = list(NORTH, EAST)
if("1-8")
cabledirs = list(NORTH, WEST)
if("2-4")
cabledirs = list(SOUTH, EAST)
if("2-8")
cabledirs = list(SOUTH, WEST)
if("4-8")
cabledirs = list(EAST, WEST)
if("1-2-4")
cabledirs = list(NORTH, SOUTH, EAST)
if("1-4-8")
cabledirs = list(NORTH, EAST, WEST)
if("2-4-8")
cabledirs = list(SOUTH, EAST, WEST)
if("1-2-8")
cabledirs = list(NORTH, SOUTH, WEST)
if("1-2-4-8")
cabledirs = list(NORTH, SOUTH, EAST, WEST)
That works fine, as it is, but I am just completely stuck on how I'll be handling cable placement. So I hope someone here may have the will to think of something that will get me there.
Do you see how much easier that is, to use binary?