Adds a plumbing layer manifold (#57494)

Adds a multilayer plumbing manifold, I also murdered the multilayer duct

You can now alt-click the plumbing RCD to change the layer it prints. I made a whole thing where right clicking changed the settings and you could use that to change machinery aswell. I even did that with the plunger, it was absolutely beautiful. Anyway that drained the life out of me because apparently there's no attack_obj_secondary and afterattack_secondary ALSO called attack_obj (left click). I just hate whoever made it with intensity

Plumbing now uses three layers. They should be easier to navigate. I tried to make layer connecting the same as cross-color connecting, but that would take more of my soul then there is to take
This commit is contained in:
Time-Green
2021-03-24 13:57:00 -04:00
committed by GitHub
parent 463872d402
commit 635079aa98
25 changed files with 106 additions and 110 deletions
@@ -1020,14 +1020,6 @@
category = CAT_MISC
tool_behaviors = list(TOOL_WRENCH, TOOL_WELDER, TOOL_WIRECUTTER)
/datum/crafting_recipe/multiduct
name = "Multi-layer duct"
result = /obj/machinery/duct/multilayered
time = 5
reqs = list(/obj/item/stack/ducts = 5)
category = CAT_MISC
tool_behaviors = list(TOOL_WELDER)
/datum/crafting_recipe/rib
name = "Collosal Rib"
always_available = FALSE
+2 -2
View File
@@ -5,9 +5,9 @@
methods = INJECT
/datum/component/plumbing/iv_drip/Initialize()
/datum/component/plumbing/iv_drip/Initialize(start=TRUE, _ducting_layer, _turn_connects=TRUE, datum/reagents/custom_receiver)
. = ..()
recipient_reagents_holder = null
/datum/component/plumbing/iv_drip/RegisterWithParent()
+16 -5
View File
@@ -1,4 +1,5 @@
/datum/component/plumbing
dupe_mode = COMPONENT_DUPE_ALLOWED
///Index with "1" = /datum/ductnet/theductpointingnorth etc. "1" being the num2text from NORTH define
var/list/datum/ductnet/ducts = list()
///shortcut to our parents' reagent holder
@@ -27,12 +28,12 @@
var/supply_color = "blue"
///turn_connects is for wheter or not we spin with the object to change our pipes
/datum/component/plumbing/Initialize(start=TRUE, _turn_connects=TRUE, _ducting_layer, datum/reagents/custom_receiver)
/datum/component/plumbing/Initialize(start=TRUE, _ducting_layer, _turn_connects=TRUE, datum/reagents/custom_receiver)
if(!ismovable(parent))
return COMPONENT_INCOMPATIBLE
if(_ducting_layer)
ducting_layer = ducting_layer
ducting_layer = _ducting_layer
var/atom/movable/AM = parent
if(!AM.reagents && !custom_receiver)
@@ -230,9 +231,12 @@
var/obj/machinery/duct/duct = A
duct.attempt_connect()
else
var/datum/component/plumbing/P = A.GetComponent(/datum/component/plumbing)
if(P && P.ducting_layer == ducting_layer)
direct_connect(P, D)
for(var/plumber in A.GetComponents(/datum/component/plumbing))
if(!plumber) //apparently yes it will be null hahahaasahsdvashufv
continue
var/datum/component/plumbing/plumb = plumber
if(plumb && plumb.ducting_layer == ducting_layer)
direct_connect(plumb, D)
/// Toggle our machinery on or off. This is called by a hook from default_unfasten_wrench with anchored as only param, so we dont have to copypaste this on every object that can move
/datum/component/plumbing/proc/toggle_active(obj/O, new_state)
@@ -317,6 +321,13 @@
demand_connects = WEST
supply_connects = EAST
/datum/component/plumbing/manifold
demand_connects = NORTH
supply_connects = SOUTH
/datum/component/plumbing/manifold/change_ducting_layer(obj/caller, obj/O, new_layer)
return
#define READY 2
///Baby component for the buffer plumbing machine
/datum/component/plumbing/buffer
@@ -3,7 +3,7 @@
supply_connects = EAST
var/obj/machinery/plumbing/acclimator/myacclimator
/datum/component/plumbing/acclimator/Initialize(start=TRUE, _turn_connects=TRUE)
/datum/component/plumbing/acclimator/Initialize(start=TRUE, _ducting_layer, _turn_connects=TRUE, datum/reagents/custom_receiver)
. = ..()
if(!istype(parent, /obj/machinery/plumbing/acclimator))
return COMPONENT_INCOMPATIBLE
+1 -1
View File
@@ -3,7 +3,7 @@
demand_connects = NORTH
supply_connects = SOUTH | EAST | WEST //SOUTH is straight, EAST is left and WEST is right. We look from the perspective of the insert
/datum/component/plumbing/filter/Initialize()
/datum/component/plumbing/filter/Initialize(start=TRUE, _ducting_layer, _turn_connects=TRUE, datum/reagents/custom_receiver)
. = ..()
if(!istype(parent, /obj/machinery/plumbing/filter))
return COMPONENT_INCOMPATIBLE
@@ -2,7 +2,7 @@
demand_connects = NORTH
supply_connects = SOUTH
/datum/component/plumbing/reaction_chamber/Initialize(start=TRUE, _turn_connects=TRUE)
/datum/component/plumbing/reaction_chamber/Initialize(start=TRUE, _ducting_layer, _turn_connects=TRUE, datum/reagents/custom_receiver)
. = ..()
if(!istype(parent, /obj/machinery/plumbing/reaction_chamber))
return COMPONENT_INCOMPATIBLE
+1 -1
View File
@@ -2,7 +2,7 @@
demand_connects = NORTH
supply_connects = SOUTH | EAST
/datum/component/plumbing/splitter/Initialize()
/datum/component/plumbing/splitter/Initialize(start=TRUE, _ducting_layer, _turn_connects=TRUE, datum/reagents/custom_receiver)
. = ..()
if(. && !istype(parent, /obj/machinery/plumbing/splitter))
return FALSE
+21 -2
View File
@@ -990,6 +990,10 @@ RLD
var/list/machinery_data = list("cost" = list())
///This list that holds all the plumbing design types the plumberer can construct. Its purpose is to make it easy to make new plumberer subtypes with a different selection of machines.
var/list/plumbing_design_types
///Possible layers to pick from
var/static/list/layers = list("Second Layer" = SECOND_DUCT_LAYER, "Default Layer" = DUCT_LAYER_DEFAULT, "Fourth Layer" = FOURTH_DUCT_LAYER)
///Current selected layer
var/current_layer = "Default Layer"
/obj/item/construction/plumbing/Initialize(mapload)
. = ..()
@@ -1022,8 +1026,9 @@ RLD
/obj/machinery/plumbing/synthesizer = 15,
/obj/machinery/plumbing/reaction_chamber = 15,
/obj/machinery/plumbing/buffer = 10,
/obj/machinery/plumbing/layer_manifold = 5,
//Above are the most common machinery which is shown on the first cycle. Keep new additions below THIS line, unless they're probably gonna be needed alot
/obj/machinery/plumbing/pill_press = 20,
//Above are the most common machinery which is shown on the first cycle. Keep new additions below THIS line
/obj/machinery/plumbing/acclimator = 10,
/obj/machinery/plumbing/bottler = 50,
/obj/machinery/plumbing/disposer = 10,
@@ -1048,7 +1053,7 @@ RLD
useResource(machinery_data["cost"][blueprint], user)
activate()
playsound(src.loc, 'sound/machines/click.ogg', 50, TRUE)
new blueprint (A, FALSE, FALSE)
new blueprint (A, FALSE, layers[current_layer])
return TRUE
/obj/item/construction/plumbing/proc/canPlace(turf/T)
@@ -1074,6 +1079,20 @@ RLD
else
create_machine(A, user)
/obj/item/construction/plumbing/AltClick(mob/user)
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE))
return
//this is just cycling options through a list
var/current_loc = layers.Find(current_layer) + 1
if(current_loc > layers.len)
current_loc = 1
//We want the key (the define), not the index (the string)
current_layer = layers[current_loc]
to_chat(user, "<span class='notice'>You switch [src] to [current_layer].</span>")
/obj/item/construction/plumbing/research
name = "research plumbing constructor"
desc = "A type of plumbing constructor designed to rapidly deploy the machines needed to conduct cytological research."
@@ -76,7 +76,7 @@
var/target_layer = DUCT_LAYER_DEFAULT
///Assoc list for possible layers
var/list/layers = list("Alternate Layer" = SECOND_DUCT_LAYER, "Default Layer" = DUCT_LAYER_DEFAULT)
var/list/layers = list("Second Layer" = SECOND_DUCT_LAYER, "Default Layer" = DUCT_LAYER_DEFAULT, "Fourth Layer" = FOURTH_DUCT_LAYER)
/obj/item/plunger/attack_obj(obj/O, mob/living/user, params)
if(layer_mode)
+15 -56
View File
@@ -72,10 +72,14 @@ All the important duct code:
/obj/machinery/duct/proc/attempt_connect()
for(var/atom/movable/AM in loc)
var/datum/component/plumbing/P = AM.GetComponent(/datum/component/plumbing)
if(P?.active)
disconnect_duct() //let's not built under plumbing machinery
return
for(var/plumber in AM.GetComponents(/datum/component/plumbing))
if(!plumber) //apparently yes it will be null hahahaasahsdvashufv
continue
var/datum/component/plumbing/plumb = plumber
if(plumb.active)
disconnect_duct() //let's not built under plumbing machinery
return
for(var/D in GLOB.cardinals)
if(dumb && !(D & connects))
continue
@@ -91,7 +95,7 @@ All the important duct code:
for(var/plumber in AM.GetComponents(/datum/component/plumbing))
if(!plumber) //apparently yes it will be null hahahaasahsdvashufv
return
continue
. += connect_plumber(plumber, direction) //so that if one is true, all is true. beautiful.
///connect to a duct
@@ -183,10 +187,11 @@ All the important duct code:
duct.add_duct(D)
D.reconnect()
else
var/datum/component/plumbing/P = AM.GetComponent(/datum/component/plumbing)
if(AM in get_step(src, neighbours[AM])) //did we move?
if(P)
connect_plumber(P, neighbours[AM])
for(var/plumber in AM.GetComponents(/datum/component/plumbing))
if(!plumber) //apparently yes it will be null hahahaasahsdvashufv
return
connect_plumber(plumber, neighbours[AM])
else
neighbours -= AM //we moved
@@ -296,6 +301,7 @@ All the important duct code:
"<span class='notice'>You [anchored ? null : "un"]fasten \the [src].</span>", \
"<span class='hear'>You hear ratcheting.</span>")
return TRUE
///collection of all the sanity checks to prevent us from stacking ducts that shouldn't be stacked
/obj/machinery/duct/proc/can_anchor(turf/T)
if(!T)
@@ -338,53 +344,6 @@ All the important duct code:
connect_network(D, direction, TRUE)
update_appearance()
///has a total of 5 layers and doesnt give a shit about color. its also dumb so doesnt autoconnect.
/obj/machinery/duct/multilayered
name = "duct layer-manifold"
icon = 'icons/obj/2x2.dmi'
icon_state = "multiduct"
pixel_x = -15
pixel_y = -15
color_to_color_support = FALSE
duct_layer = FIRST_DUCT_LAYER | SECOND_DUCT_LAYER | THIRD_DUCT_LAYER | FOURTH_DUCT_LAYER | FIFTH_DUCT_LAYER
drop_on_wrench = null
lock_connects = TRUE
lock_layers = TRUE
ignore_colors = TRUE
dumb = TRUE
active = FALSE
anchored = FALSE
/obj/machinery/duct/multilayered/Initialize(mapload, no_anchor, color_of_duct, layer_of_duct = DUCT_LAYER_DEFAULT, force_connects)
. = ..()
update_connects()
/obj/machinery/duct/multilayered/ComponentInitialize()
. = ..()
AddElement(/datum/element/update_icon_blocker)
/obj/machinery/duct/multilayered/wrench_act(mob/living/user, obj/item/I)
. = ..()
update_connects()
/obj/machinery/duct/multilayered/proc/update_connects()
if(dir & NORTH || dir & SOUTH)
connects = NORTH | SOUTH
else
connects = EAST | WEST
///don't connect to other multilayered stuff because honestly it shouldn't be done and I dont wanna deal with it
/obj/machinery/duct/multilayered/connect_duct(obj/machinery/duct/D, direction, ignore_color)
if(istype(D, /obj/machinery/duct/multilayered))
return
return ..()
/obj/machinery/duct/multilayered/handle_layer()
return
/obj/item/stack/ducts
name = "stack of duct"
desc = "A stack of fluid ducts."
@@ -402,7 +361,7 @@ All the important duct code:
///Default layer of our duct
var/duct_layer = "Default Layer"
///Assoc index with all the available layers. yes five might be a bit much. Colors uses a global by the way
var/list/layers = list("Alternate Layer" = SECOND_DUCT_LAYER, "Default Layer" = DUCT_LAYER_DEFAULT)
var/list/layers = list("Second Layer" = SECOND_DUCT_LAYER, "Default Layer" = DUCT_LAYER_DEFAULT, "Fourth Layer" = FOURTH_DUCT_LAYER)
/obj/item/stack/ducts/examine(mob/user)
. = ..()
@@ -60,9 +60,9 @@
icon_state = "pipe_input"
reagent_flags = TRANSPARENT | REFILLABLE
/obj/machinery/plumbing/input/Initialize(mapload, bolt)
/obj/machinery/plumbing/input/Initialize(mapload, bolt, layer)
. = ..()
AddComponent(/datum/component/plumbing/simple_supply, bolt)
AddComponent(/datum/component/plumbing/simple_supply, bolt, layer)
///We can fill beakers in here and everything. we dont inheret from input because it has nothing that we need
/obj/machinery/plumbing/output
@@ -71,9 +71,9 @@
icon_state = "pipe_output"
reagent_flags = TRANSPARENT | DRAINABLE
/obj/machinery/plumbing/output/Initialize(mapload, bolt)
/obj/machinery/plumbing/output/Initialize(mapload, bolt, layer)
. = ..()
AddComponent(/datum/component/plumbing/simple_demand, bolt)
AddComponent(/datum/component/plumbing/simple_demand, bolt, layer)
/obj/machinery/plumbing/tank
name = "chemical tank"
@@ -81,6 +81,21 @@
icon_state = "tank"
buffer = 400
/obj/machinery/plumbing/tank/Initialize(mapload, bolt)
/obj/machinery/plumbing/tank/Initialize(mapload, bolt, layer)
. = ..()
AddComponent(/datum/component/plumbing/tank, bolt)
AddComponent(/datum/component/plumbing/tank, bolt, layer)
///Layer manifold machine that connects a bunch of layers
/obj/machinery/plumbing/layer_manifold
name = "layer manifold"
desc = "A plumbing manifold for layers."
icon_state = "manifold"
density = FALSE
/obj/machinery/plumbing/layer_manifold/Initialize(mapload, bolt, layer)
. = ..()
AddComponent(/datum/component/plumbing/manifold, bolt, SECOND_DUCT_LAYER)
AddComponent(/datum/component/plumbing/manifold, bolt, THIRD_DUCT_LAYER)
AddComponent(/datum/component/plumbing/manifold, bolt, FOURTH_DUCT_LAYER)
+2 -2
View File
@@ -27,9 +27,9 @@
*/
var/emptying = FALSE
/obj/machinery/plumbing/acclimator/Initialize(mapload, bolt)
/obj/machinery/plumbing/acclimator/Initialize(mapload, bolt, layer)
. = ..()
AddComponent(/datum/component/plumbing/acclimator, bolt)
AddComponent(/datum/component/plumbing/acclimator, bolt, layer)
/obj/machinery/plumbing/acclimator/process(delta_time)
if(machine_stat & NOPOWER || !enabled || !reagents.total_volume || reagents.chem_temp == target_temperature)
+2 -2
View File
@@ -16,9 +16,9 @@
///where beakers that are already full will be sent
var/turf/badspot = null
/obj/machinery/plumbing/bottler/Initialize(mapload, bolt)
/obj/machinery/plumbing/bottler/Initialize(mapload, bolt, layer)
. = ..()
AddComponent(/datum/component/plumbing/simple_demand, bolt)
AddComponent(/datum/component/plumbing/simple_demand, bolt, layer)
setDir(dir)
/obj/machinery/plumbing/bottler/examine(mob/user)
+2 -2
View File
@@ -5,9 +5,9 @@
///we remove 5 reagents per second
var/disposal_rate = 5
/obj/machinery/plumbing/disposer/Initialize(mapload, bolt)
/obj/machinery/plumbing/disposer/Initialize(mapload, bolt, layer)
. = ..()
AddComponent(/datum/component/plumbing/simple_demand, bolt)
AddComponent(/datum/component/plumbing/simple_demand, bolt, layer)
/obj/machinery/plumbing/disposer/process(delta_time)
if(machine_stat & NOPOWER)
+2 -2
View File
@@ -10,9 +10,9 @@
///input dir
var/eat_dir = SOUTH
/obj/machinery/plumbing/fermenter/Initialize(mapload, bolt)
/obj/machinery/plumbing/fermenter/Initialize(mapload, bolt, layer)
. = ..()
AddComponent(/datum/component/plumbing/simple_supply, bolt)
AddComponent(/datum/component/plumbing/simple_supply, bolt, layer)
/obj/machinery/plumbing/grinder_chemical/can_be_rotated(mob/user, rotation_type)
if(anchored)
+2 -2
View File
@@ -14,9 +14,9 @@
///whitelist of chems but their name instead of path
var/list/english_right = list()
/obj/machinery/plumbing/filter/Initialize(mapload, bolt)
/obj/machinery/plumbing/filter/Initialize(mapload, bolt, layer)
. = ..()
AddComponent(/datum/component/plumbing/filter, bolt)
AddComponent(/datum/component/plumbing/filter, bolt, layer)
/obj/machinery/plumbing/filter/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
@@ -9,9 +9,9 @@
var/eat_dir = SOUTH
/obj/machinery/plumbing/grinder_chemical/Initialize(mapload, bolt)
/obj/machinery/plumbing/grinder_chemical/Initialize(mapload, bolt, layer)
. = ..()
AddComponent(/datum/component/plumbing/simple_supply, bolt)
AddComponent(/datum/component/plumbing/simple_supply, bolt, layer)
/obj/machinery/plumbing/grinder_chemical/can_be_rotated(mob/user, rotation_type)
if(anchored)
+2 -2
View File
@@ -33,9 +33,9 @@
. = ..()
. += "<span class='notice'>The [name] currently has [stored_products.len] stored. There needs to be less than [max_floor_products] on the floor to continue dispensing.</span>"
/obj/machinery/plumbing/pill_press/Initialize(mapload, bolt)
/obj/machinery/plumbing/pill_press/Initialize(mapload, bolt, layer)
. = ..()
AddComponent(/datum/component/plumbing/simple_demand, bolt)
AddComponent(/datum/component/plumbing/simple_demand, bolt, layer)
//expertly copypasted from chemmasters
var/datum/asset/spritesheet/simple/assets = get_asset_datum(/datum/asset/spritesheet/simple/pills)
@@ -12,10 +12,10 @@
var/activation_volume = 100
var/mode
/obj/machinery/plumbing/buffer/Initialize(mapload, bolt)
/obj/machinery/plumbing/buffer/Initialize(mapload, bolt, layer)
. = ..()
AddComponent(/datum/component/plumbing/buffer, bolt)
AddComponent(/datum/component/plumbing/buffer, bolt, layer)
/obj/machinery/plumbing/buffer/create_reagents(max_vol, flags)
. = ..()
+2 -2
View File
@@ -19,9 +19,9 @@
///volume of our internal buffer
var/volume = 200
/obj/machinery/plumbing/liquid_pump/Initialize(mapload, bolt)
/obj/machinery/plumbing/liquid_pump/Initialize(mapload, bolt, layer)
. = ..()
AddComponent(/datum/component/plumbing/simple_supply, bolt)
AddComponent(/datum/component/plumbing/simple_supply, bolt, layer)
///please note that the component has a hook in the parent call, wich handles activating and deactivating
/obj/machinery/plumbing/liquid_pump/default_unfasten_wrench(mob/user, obj/item/I, time = 20)
@@ -24,9 +24,9 @@
///beaker that holds the alkaline buffer.
var/obj/item/reagent_containers/glass/beaker/alkaline_beaker
/obj/machinery/plumbing/reaction_chamber/Initialize(mapload, bolt)
/obj/machinery/plumbing/reaction_chamber/Initialize(mapload, bolt, layer)
. = ..()
AddComponent(/datum/component/plumbing/reaction_chamber, bolt)
AddComponent(/datum/component/plumbing/reaction_chamber, bolt, layer)
acidic_beaker = new (src)
alkaline_beaker = new (src)
+2 -2
View File
@@ -16,9 +16,9 @@
//the maximum you can set the transfer to
var/max_transfer = 9
/obj/machinery/plumbing/splitter/Initialize(mapload, bolt)
/obj/machinery/plumbing/splitter/Initialize(mapload, bolt, layer)
. = ..()
AddComponent(/datum/component/plumbing/splitter, bolt)
AddComponent(/datum/component/plumbing/splitter, bolt, layer)
/obj/machinery/plumbing/splitter/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
@@ -41,9 +41,9 @@
/datum/reagent/fuel,
)
/obj/machinery/plumbing/synthesizer/Initialize(mapload, bolt)
/obj/machinery/plumbing/synthesizer/Initialize(mapload, bolt, layer)
. = ..()
AddComponent(/datum/component/plumbing/simple_supply, bolt)
AddComponent(/datum/component/plumbing/simple_supply, bolt, layer)
/obj/machinery/plumbing/synthesizer/process(delta_time)
if(machine_stat & NOPOWER || !reagent_id || !amount)
+2 -2
View File
@@ -9,9 +9,9 @@
///whoever we teleport our chems to
var/obj/machinery/plumbing/receiver/target = null
/obj/machinery/plumbing/sender/Initialize(mapload, bolt)
/obj/machinery/plumbing/sender/Initialize(mapload, bolt, layer)
. = ..()
AddComponent(/datum/component/plumbing/simple_demand, bolt)
AddComponent(/datum/component/plumbing/simple_demand, bolt, layer)
/obj/machinery/plumbing/sender/multitool_act(mob/living/user, obj/item/I)
if(!multitool_check_buffer(user, I))
Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 20 KiB