mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 13:10:02 +01:00
Merge pull request #47190 from Time-Green/plumbing-fixes
Plumbing fixes and tweaks
This commit is contained in:
@@ -27,8 +27,9 @@
|
||||
#define DEL_REAGENT 1 // reagent deleted (fully cleared)
|
||||
#define ADD_REAGENT 2 // reagent added
|
||||
#define REM_REAGENT 3 // reagent removed (may still exist)
|
||||
#define CLEAR_REAGENTS 4 // all reagents were cleared
|
||||
|
||||
#define MIMEDRINK_SILENCE_DURATION 30 //ends up being 60 seconds given 1 tick every 2 seconds
|
||||
//used by chem masters and pill presses
|
||||
#define PILL_STYLE_COUNT 22 //Update this if you add more pill icons or you die
|
||||
#define RANDOM_PILL_STYLE 22 //Dont change this one though
|
||||
#define RANDOM_PILL_STYLE 22 //Dont change this one though
|
||||
|
||||
@@ -142,15 +142,24 @@
|
||||
return
|
||||
update_dir()
|
||||
active = TRUE
|
||||
var/atom/movable/AM = parent
|
||||
for(var/obj/machinery/duct/D in AM.loc) //Destroy any ducts under us. Ducts also self destruct if placed under a plumbing machine. machines disable when they get moved
|
||||
if(D.anchored) //that should cover everything
|
||||
D.disconnect_duct()
|
||||
|
||||
if(demand_connects)
|
||||
START_PROCESSING(SSfluids, src)
|
||||
|
||||
for(var/D in GLOB.cardinals)
|
||||
if(D & (demand_connects | supply_connects))
|
||||
for(var/obj/machinery/duct/duct in get_step(parent, D))
|
||||
duct.attempt_connect()
|
||||
|
||||
//TODO: Let plumbers directly plumb into one another without ducts if placed adjacent to each other
|
||||
for(var/atom/movable/A in get_step(parent, D))
|
||||
if(istype(A, /obj/machinery/duct))
|
||||
var/obj/machinery/duct/duct = A
|
||||
duct.attempt_connect()
|
||||
else
|
||||
var/datum/component/plumbing/P = A.GetComponent(/datum/component/plumbing)
|
||||
if(P)
|
||||
direct_connect(P, 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)
|
||||
@@ -184,6 +193,15 @@
|
||||
/datum/component/plumbing/proc/get_original_direction(dir)
|
||||
var/atom/movable/AM = parent
|
||||
return turn(dir, dir2angle(AM.dir) - 180)
|
||||
//special case in-case we want to connect directly with another machine without a duct
|
||||
/datum/component/plumbing/proc/direct_connect(datum/component/plumbing/P, dir)
|
||||
if(!P.active)
|
||||
return
|
||||
var/opposite_dir = turn(dir, 180)
|
||||
if(P.demand_connects & opposite_dir && supply_connects & dir || P.supply_connects & opposite_dir && demand_connects & dir) //make sure we arent connecting two supplies or demands
|
||||
var/datum/ductnet/net = new()
|
||||
net.add_plumber(src, dir)
|
||||
net.add_plumber(P, opposite_dir)
|
||||
|
||||
///has one pipe input that only takes, example is manual output pipe
|
||||
/datum/component/plumbing/simple_demand
|
||||
@@ -194,4 +212,4 @@
|
||||
///input and output, like a holding tank
|
||||
/datum/component/plumbing/tank
|
||||
demand_connects = WEST
|
||||
supply_connects = EAST
|
||||
supply_connects = EAST
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
direction = get_original_direction(text2num(A))
|
||||
break
|
||||
if(reagent)
|
||||
reagents.trans_id_to(target.reagents, reagent, amount)
|
||||
reagents.trans_id_to(target.parent, reagent, amount)
|
||||
else
|
||||
for(var/A in reagents.reagent_list)
|
||||
var/datum/reagent/R = A
|
||||
@@ -56,4 +56,4 @@
|
||||
return TRUE
|
||||
if(EAST) //left
|
||||
if(F.left.Find(reagent))
|
||||
return TRUE
|
||||
return TRUE
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
for(var/dir in P.ducts)
|
||||
if(P.ducts[dir] == src)
|
||||
P.ducts -= dir
|
||||
if(!ducts.len) //there were no ducts, so it was a direct connection. we destroy ourselves since a ductnet with only one plumber and no ducts is worthless
|
||||
destroy_network()
|
||||
///we combine ductnets. this occurs when someone connects to seperate sets of fluid ducts
|
||||
/datum/ductnet/proc/assimilate(datum/ductnet/D)
|
||||
ducts.Add(D.ducts)
|
||||
@@ -49,7 +51,8 @@
|
||||
for(var/A in D.ducts)
|
||||
var/obj/machinery/duct/M = A
|
||||
M.duct = src //forget your old master
|
||||
qdel(D)
|
||||
|
||||
destroy_network()
|
||||
///destroy the network and tell all our ducts and plumbers we are gone
|
||||
/datum/ductnet/proc/destroy_network(delete=TRUE)
|
||||
for(var/A in suppliers + demanders)
|
||||
@@ -58,4 +61,4 @@
|
||||
var/obj/machinery/duct/D = A
|
||||
D.duct = null
|
||||
if(delete) //I don't want code to run with qdeleted objects because that can never be good, so keep this in-case the ductnet has some business left to attend to before commiting suicide
|
||||
qdel(src)
|
||||
qdel(src)
|
||||
|
||||
@@ -64,6 +64,11 @@ All the important duct code:
|
||||
/obj/machinery/duct/proc/attempt_connect()
|
||||
reset_connects() //All connects are gathered here again eitherway, we might aswell reset it so they properly update when reconnecting
|
||||
|
||||
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/D in GLOB.cardinals)
|
||||
if(dumb && !(D & connects))
|
||||
continue
|
||||
@@ -263,10 +268,12 @@ All the important duct code:
|
||||
var/direction = get_dir(src, D)
|
||||
if(!(direction in GLOB.cardinals))
|
||||
return
|
||||
if(duct_layer != D.duct_layer)
|
||||
return
|
||||
|
||||
add_connects(direction) //the connect of the other duct is handled in connect_network, but do this here for the parent duct because it's not necessary in normal cases
|
||||
add_neighbour(D)
|
||||
connect_network(D, direction, TRUE)
|
||||
add_connects(direction)
|
||||
update_icon()
|
||||
///has a total of 5 layers and doesnt give a shit about color. its also dumb so doesnt autoconnect.
|
||||
/obj/machinery/duct/multilayered
|
||||
@@ -311,6 +318,9 @@ All the important duct code:
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/machinery/duct/multilayered/handle_layer()
|
||||
return
|
||||
|
||||
/obj/item/stack/ducts
|
||||
name = "stack of duct"
|
||||
desc = "A stack of fluid ducts."
|
||||
|
||||
@@ -566,6 +566,8 @@
|
||||
for(var/reagent in cached_reagents)
|
||||
var/datum/reagent/R = reagent
|
||||
del_reagent(R.type)
|
||||
if(my_atom)
|
||||
my_atom.on_reagent_change(CLEAR_REAGENTS)
|
||||
return 0
|
||||
|
||||
/datum/reagents/proc/reaction(atom/A, method = TOUCH, volume_modifier = 1, show_message = 1)
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
if(lastkey)
|
||||
var/mob/toucher = get_mob_by_key(lastkey)
|
||||
touch_msg = "[ADMIN_LOOKUPFLW(toucher)]"
|
||||
message_admins("Reagent explosion reaction occurred at [ADMIN_VERBOSEJMP(T)][inside_msg]. Last Fingerprint: [touch_msg].")
|
||||
if(!istype(holder.my_atom, /obj/machinery/plumbing)) //excludes standard plumbing equipment from spamming admins with this shit
|
||||
message_admins("Reagent explosion reaction occurred at [ADMIN_VERBOSEJMP(T)][inside_msg]. Last Fingerprint: [touch_msg].")
|
||||
log_game("Reagent explosion reaction occurred at [AREACOORD(T)]. Last Fingerprint: [lastkey ? lastkey : "N/A"]." )
|
||||
var/datum/effect_system/reagents_explosion/e = new()
|
||||
e.set_up(modifier + round(created_volume/strengthdiv, 1), T, 0, 0)
|
||||
|
||||
@@ -700,14 +700,6 @@
|
||||
build_path = /obj/item/pipe_dispenser
|
||||
category = list("hacked", "Construction")
|
||||
|
||||
/datum/design/plumbing_rcd
|
||||
name = "Plumbing Constructor"
|
||||
id = "plumbing_rcd"
|
||||
build_type = AUTOLATHE
|
||||
materials = list(/datum/material/iron = 75000, /datum/material/glass = 37500)
|
||||
build_path = /obj/item/construction/plumbing
|
||||
category = list("hacked", "Construction")
|
||||
|
||||
/datum/design/electropack
|
||||
name = "Electropack"
|
||||
id = "electropack"
|
||||
@@ -991,3 +983,4 @@
|
||||
materials = list(/datum/material/iron = 500)
|
||||
build_path = /obj/item/stack/ducts
|
||||
category = list("initial", "Construction")
|
||||
maxstack = 50
|
||||
|
||||
@@ -493,4 +493,11 @@
|
||||
category = list("Equipment")
|
||||
departmental_flags = DEPARTMENTAL_FLAG_SECURITY
|
||||
|
||||
|
||||
/datum/design/plumbing_rcd
|
||||
name = "Plumbing Constructor"
|
||||
id = "plumbing_rcd"
|
||||
build_type = PROTOLATHE
|
||||
materials = list(/datum/material/iron = 75000, /datum/material/glass = 37500, /datum/material/plastic = 1000)
|
||||
build_path = /obj/item/construction/plumbing
|
||||
category = list("Equipment")
|
||||
departmental_flags = DEPARTMENTAL_FLAG_MEDICAL
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
design_ids = list("basic_matter_bin", "basic_cell", "basic_scanning", "basic_capacitor", "basic_micro_laser", "micro_mani", "desttagger", "handlabel", "packagewrap",
|
||||
"destructive_analyzer", "circuit_imprinter", "experimentor", "rdconsole", "design_disk", "tech_disk", "rdserver", "rdservercontrol", "mechfab", "paystand",
|
||||
"space_heater", "beaker", "large_beaker", "bucket", "xlarge_beaker", "sec_rshot", "sec_beanbag_slug", "sec_bshot", "sec_slug", "sec_Islug", "sec_dart", "sec_38",
|
||||
"rglass","plasteel","plastitanium","plasmaglass","plasmareinforcedglass","titaniumglass","plastitaniumglass")
|
||||
"rglass","plasteel","plastitanium","plasmaglass","plasmareinforcedglass","titaniumglass","plastitaniumglass","plumbing_rcd")
|
||||
|
||||
/datum/techweb_node/mmi
|
||||
id = "mmi"
|
||||
|
||||
+22
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user