happythink
This commit is contained in:
@@ -6,11 +6,13 @@
|
||||
|
||||
icon = 'icons/effects/mapping_helpers.dmi'
|
||||
|
||||
late = TRUE
|
||||
/// what directions we know connections are in
|
||||
var/list/network_directions = list()
|
||||
|
||||
/obj/effect/mapping_helpers/network_builder/Initialize(mapload)
|
||||
. = ..()
|
||||
to_chat(world, "DEBUG: Initializing [COORD(src)]")
|
||||
var/conflict = check_duplicates()
|
||||
if(conflict)
|
||||
stack_trace("WARNING: [type] network building helper found check_duplicates() conflict [conflict] in its location.!")
|
||||
@@ -25,6 +27,7 @@
|
||||
|
||||
/// How this works: On LateInitialize, detect all directions that this should be applicable to, and do what it needs to do, and then inform all network builders in said directions that it's been around since it won't be around afterwards.
|
||||
/obj/effect/mapping_helpers/network_builder/LateInitialize()
|
||||
to_chat(world, "DEBUG: LateInitializing [COORD(src)]")
|
||||
scan_directions()
|
||||
build_network()
|
||||
if(!custom_spawned)
|
||||
|
||||
@@ -58,16 +58,16 @@
|
||||
return network_directions
|
||||
|
||||
/// Directions should only ever have cardinals.
|
||||
/obj/effect/mapping_helpers/network_builder/atmos_pipe/build_network(list/directions = network_directions)
|
||||
if(!length(directions) <= 1)
|
||||
/obj/effect/mapping_helpers/network_builder/atmos_pipe/build_network()
|
||||
if(length(network_directions) <= 1)
|
||||
return
|
||||
var/obj/machinery/atmospherics/pipe/built
|
||||
switch(length(directions))
|
||||
switch(length(network_directions))
|
||||
if(2) //straight pipe
|
||||
built = new /obj/machinery/atmospherics/pipe/simple(loc)
|
||||
built.setDir(directions[1] | directions[2])
|
||||
built.setDir(network_directions[1] | network_directions[2])
|
||||
if(3) //manifold
|
||||
var/list/missing = directions ^ GLOB.cardinals
|
||||
var/list/missing = network_directions ^ GLOB.cardinals
|
||||
missing = missing[1]
|
||||
built = new /obj/machinery/atmospherics/pipe/manifold(loc)
|
||||
built.setDir(missing)
|
||||
@@ -75,6 +75,7 @@
|
||||
built = new /obj/machinery/atmospherics/pipe/manifold4w(loc)
|
||||
built.SetInitDirections()
|
||||
built.on_construction(pipe_color, pipe_layer)
|
||||
built.hide(!visible_pipes)
|
||||
|
||||
/obj/effect/mapping_helpers/network_builder/atmos_pipe/distro
|
||||
name = "distro line autobuilder"
|
||||
|
||||
@@ -45,27 +45,28 @@
|
||||
return network_directions
|
||||
|
||||
/// Directions should only ever have cardinals.
|
||||
/obj/effect/mapping_helpers/network_builder/power_cable/build_network(list/directions = network_directions)
|
||||
if(!length(directions))
|
||||
/obj/effect/mapping_helpers/network_builder/power_cable/build_network()
|
||||
if(!length(network_directions))
|
||||
return
|
||||
else if(length(directions) == 1)
|
||||
var/do_knot = (knot == KNOT_FORCED) || ((knot == KNOT_AUTO) && should_auto_knot())
|
||||
if(do_knot)
|
||||
new /obj/structure/cable(loc, cable_color, NONE, directions[1])
|
||||
else if(length(network_directions) == 1)
|
||||
new /obj/structure/cable(loc, cable_color, NONE, network_directions[1])
|
||||
else
|
||||
if(knot == KNOT_FORCED)
|
||||
for(var/d in directions)
|
||||
for(var/d in network_directions)
|
||||
new /obj/structure/cable(loc, cable_color, NONE, d)
|
||||
else
|
||||
var/do_knot = (knot == KNOT_FORCED) || ((knot == KNOT_AUTO) && should_auto_knot())
|
||||
var/dirs = length(directions)
|
||||
for(var/i in dirs)
|
||||
var/li = i - 1
|
||||
if(li < 1)
|
||||
li = dirs + li
|
||||
new /obj/structure/cable(loc, cable_color, directions[i], directions[li])
|
||||
var/dirs = length(network_directions)
|
||||
for(var/i in 1 to dirs)
|
||||
var/li = (i == 1)? dirs : (i - 1)
|
||||
var/d1 = network_directions[i]
|
||||
var/d2 = network_directions[li]
|
||||
if(d1 > d2) //this is ugly please help me
|
||||
d1 = network_directions[li]
|
||||
d2 = network_directions[i]
|
||||
new /obj/structure/cable(loc, cable_color, d1, d2)
|
||||
if(do_knot)
|
||||
new /obj/structure/cable(loc, cable_color, NONE, directions[i])
|
||||
new /obj/structure/cable(loc, cable_color, NONE, network_directions[i])
|
||||
do_knot = FALSE
|
||||
|
||||
/obj/effect/mapping_helpers/network_builder/power_cable/proc/should_auto_knot()
|
||||
|
||||
@@ -79,13 +79,17 @@ By design, d1 is the smallest direction and d2 is the highest
|
||||
color = "#ffffff"
|
||||
|
||||
// the power cable object
|
||||
/obj/structure/cable/Initialize(mapload, param_color)
|
||||
/obj/structure/cable/Initialize(mapload, param_color, _d1, _d2)
|
||||
. = ..()
|
||||
|
||||
// ensure d1 & d2 reflect the icon_state for entering and exiting cable
|
||||
var/dash = findtext(icon_state, "-")
|
||||
d1 = text2num( copytext( icon_state, 1, dash ) )
|
||||
d2 = text2num( copytext( icon_state, dash+1 ) )
|
||||
if(isnull(_d1) || isnull(_d2))
|
||||
// ensure d1 & d2 reflect the icon_state for entering and exiting cable
|
||||
var/dash = findtext(icon_state, "-")
|
||||
d1 = text2num( copytext( icon_state, 1, dash ) )
|
||||
d2 = text2num( copytext( icon_state, dash+1 ) )
|
||||
else
|
||||
d1 = _d1
|
||||
d2 = _d2
|
||||
|
||||
var/turf/T = get_turf(src) // hide if turf is not intact
|
||||
if(level==1)
|
||||
|
||||
Reference in New Issue
Block a user