[Ready] Shuttle dock() rewrite (#2040)
This commit is contained in:
committed by
kevinz000
parent
bbc28aa856
commit
e522f715a2
@@ -390,7 +390,7 @@ By design, d1 is the smallest direction and d2 is the highest
|
||||
qdel(PN)
|
||||
|
||||
// cut the cable's powernet at this cable and updates the powergrid
|
||||
/obj/structure/cable/proc/cut_cable_from_powernet()
|
||||
/obj/structure/cable/proc/cut_cable_from_powernet(remove=TRUE)
|
||||
var/turf/T1 = loc
|
||||
var/list/P_list
|
||||
if(!T1)
|
||||
@@ -412,7 +412,8 @@ By design, d1 is the smallest direction and d2 is the highest
|
||||
|
||||
var/obj/O = P_list[1]
|
||||
// remove the cut cable from its turf and powernet, so that it doesn't get count in propagate_network worklist
|
||||
loc = null
|
||||
if(remove)
|
||||
loc = null
|
||||
powernet.remove_cable(src) //remove the cut cable from its powernet
|
||||
|
||||
spawn(0) //so we don't rebuild the network X times when singulo/explosion destroys a line of X cables
|
||||
@@ -426,43 +427,6 @@ By design, d1 is the smallest direction and d2 is the highest
|
||||
if(!P.connect_to_network()) //can't find a node cable on a the turf to connect to
|
||||
P.disconnect_from_network() //remove from current network
|
||||
|
||||
// Ugly procs that ensure proper separation and reconnection of wires on shuttle movement/rotation
|
||||
/obj/structure/cable/beforeShuttleMove(turf/T1, rotation)
|
||||
var/on_edge = FALSE
|
||||
var/A = get_area(src)
|
||||
|
||||
for(var/D in GLOB.alldirs)
|
||||
if(A != get_area(get_step(src, D)))
|
||||
on_edge = TRUE
|
||||
break
|
||||
|
||||
if(on_edge && powernet)
|
||||
var/tmp_loc = loc
|
||||
cut_cable_from_powernet()
|
||||
loc = tmp_loc
|
||||
|
||||
/obj/structure/cable/afterShuttleMove()
|
||||
var/on_edge = FALSE
|
||||
var/A = get_area(src)
|
||||
|
||||
for(var/D in GLOB.alldirs)
|
||||
if(A != get_area(get_step(src, D)))
|
||||
on_edge = TRUE
|
||||
break
|
||||
|
||||
if(on_edge)
|
||||
var/datum/powernet/PN = new()
|
||||
PN.add_cable(src)
|
||||
|
||||
mergeConnectedNetworks(d1) //merge the powernet with adjacents powernets
|
||||
mergeConnectedNetworks(d2)
|
||||
mergeConnectedNetworksOnTurf() //merge the powernet with on turf powernets
|
||||
|
||||
if(d1 & (d1 - 1))// if the cable is layed diagonally, check the others 2 possible directions
|
||||
mergeDiagonalsNetworks(d1)
|
||||
if(d2 & (d2 - 1))
|
||||
mergeDiagonalsNetworks(d2)
|
||||
|
||||
/obj/structure/cable/shuttleRotate(rotation)
|
||||
//..() is not called because wires are not supposed to have a non-default direction
|
||||
//Rotate connections
|
||||
|
||||
Reference in New Issue
Block a user