mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Merge branch 'release' of https://github.com/VOREStation/VOREStation
# Conflicts: # code/game/area/Away Mission areas.dm # code/game/objects/items/weapons/stunbaton.dm # code/game/objects/items/weapons/teleportation.dm # code/modules/clothing/glasses/glasses.dm # code/modules/events/event_container_vr.dm # code/modules/mining/ore_box.dm # code/modules/paperwork/paper.dm # code/modules/rogueminer_vr/zone_console.dm # config/custom_items.txt # icons/mob/items/lefthand_suits.dmi # icons/mob/items/righthand_suits.dmi # icons/mob/species/vulpkanin/helmet.dmi # icons/mob/species/vulpkanin/suit.dmi # icons/mob/suit.dmi # icons/obj/clothing/suits.dmi # maps/tether/tether_defines.dm
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
set name = "Toggle Debug Messages"
|
||||
set category = "Debug"
|
||||
M.debug = !M.debug
|
||||
usr << "[M]: Debug messages toggled [M.debug? "on" : "off"]."
|
||||
to_chat(usr, "[M]: Debug messages toggled [M.debug? "on" : "off"].")
|
||||
|
||||
//Generalized gas pumping proc.
|
||||
//Moves gas from one gas_mixture to another and returns the amount of power needed (assuming 1 second), or -1 if no gas was pumped.
|
||||
|
||||
@@ -201,7 +201,7 @@
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/examine(mob/user)
|
||||
if(..(user, 1))
|
||||
user << "A small gauge in the corner reads [round(last_flow_rate, 0.1)] L/s; [round(last_power_draw)] W"
|
||||
to_chat(user, "A small gauge in the corner reads [round(last_flow_rate, 0.1)] L/s; [round(last_power_draw)] W")
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/power_change()
|
||||
|
||||
@@ -67,6 +67,8 @@
|
||||
pressure_delta = input_starting_pressure - target_pressure
|
||||
if (REGULATE_OUTPUT)
|
||||
pressure_delta = target_pressure - output_starting_pressure
|
||||
if (REGULATE_NONE)
|
||||
pressure_delta = input_starting_pressure - output_starting_pressure
|
||||
|
||||
//-1 if pump_gas() did not move any gas, >= 0 otherwise
|
||||
var/returnval = -1
|
||||
@@ -82,9 +84,46 @@
|
||||
transfer_moles = min(transfer_moles, calculate_transfer_moles(air2, air1, pressure_delta, (network1)? network1.volume : 0))
|
||||
if (REGULATE_OUTPUT)
|
||||
transfer_moles = min(transfer_moles, calculate_transfer_moles(air1, air2, pressure_delta, (network2)? network2.volume : 0))
|
||||
if (REGULATE_NONE)
|
||||
var/source = air1
|
||||
var/sink = air2
|
||||
// If node1 is a network of more than 1 pipe, we want to transfer from that whole network, otw use just node1, as current
|
||||
if(istype(node1, /obj/machinery/atmospherics/pipe))
|
||||
var/obj/machinery/atmospherics/pipe/p = node1
|
||||
if(istype(p.parent, /datum/pipeline)) // Nested if-blocks to avoid the mystical :
|
||||
var/datum/pipeline/l = p.parent
|
||||
if(istype(l.air, /datum/gas_mixture))
|
||||
source = l.air
|
||||
// If node2 is a network of more than 1 pipe, we want to transfer to that whole network, otw use just node2, as current
|
||||
if(istype(node2, /obj/machinery/atmospherics/pipe))
|
||||
var/obj/machinery/atmospherics/pipe/p = node2
|
||||
if(istype(p.parent, /datum/pipeline))
|
||||
var/datum/pipeline/l = p.parent
|
||||
if(istype(l.air, /datum/gas_mixture))
|
||||
sink = l.air
|
||||
transfer_moles = max(0, calculate_equalize_moles(source, sink)) // Not regulated, don't care about flow rate
|
||||
|
||||
//pump_gas() will return a negative number if no flow occurred
|
||||
returnval = pump_gas_passive(src, air1, air2, transfer_moles)
|
||||
if(regulate_mode == REGULATE_NONE) // ACTUALLY move gases from the whole network, not just the immediate pipes
|
||||
var/source = air1
|
||||
var/sink = air2
|
||||
// If node1 is a network of more than 1 pipe, we want to transfer from that whole network, otw use just node1, as current
|
||||
if(istype(node1, /obj/machinery/atmospherics/pipe))
|
||||
var/obj/machinery/atmospherics/pipe/p = node1
|
||||
if(istype(p.parent, /datum/pipeline)) // Nested if-blocks to avoid the mystical :
|
||||
var/datum/pipeline/l = p.parent
|
||||
if(istype(l.air, /datum/gas_mixture))
|
||||
source = l.air
|
||||
// If node2 is a network of more than 1 pipe, we want to transfer to that whole network, otw use just node2, as current
|
||||
if(istype(node2, /obj/machinery/atmospherics/pipe))
|
||||
var/obj/machinery/atmospherics/pipe/p = node2
|
||||
if(istype(p.parent, /datum/pipeline))
|
||||
var/datum/pipeline/l = p.parent
|
||||
if(istype(l.air, /datum/gas_mixture))
|
||||
sink = l.air
|
||||
returnval = pump_gas_passive(src, source, sink, transfer_moles)
|
||||
else
|
||||
returnval = pump_gas_passive(src, air1, air2, transfer_moles)
|
||||
|
||||
if (returnval >= 0)
|
||||
if(network1)
|
||||
|
||||
@@ -7,6 +7,7 @@ GLOBAL_LIST_EMPTY(shutoff_valves)
|
||||
|
||||
name = "automatic shutoff valve"
|
||||
desc = "An automatic valve with control circuitry and pipe integrity sensor, capable of automatically isolating damaged segments of the pipe network."
|
||||
description_info = "Clicking this will toggle the automatic control. Alt-clicking this when the automatic control is disabled will manually open or close the valve."
|
||||
var/close_on_leaks = TRUE // If false it will be always open
|
||||
level = 1
|
||||
|
||||
@@ -37,21 +38,97 @@ GLOBAL_LIST_EMPTY(shutoff_valves)
|
||||
to_chat(user, "You [close_on_leaks ? "enable" : "disable"] the automatic shutoff circuit.")
|
||||
return TRUE
|
||||
|
||||
// Alt+Click now toggles the open/close function, when the autoseal is disabled
|
||||
/obj/machinery/atmospherics/valve/shutoff/AltClick(var/mob/user)
|
||||
if(isliving(user))
|
||||
if(close_on_leaks)
|
||||
to_chat(user, "You try to manually [open ? "close" : "open"] the valve, but it [open ? "opens" : "closes"] automatically again.")
|
||||
return
|
||||
|
||||
open ? close() : open()
|
||||
to_chat(user, "You manually [open ? "open" : "close"] the valve.")
|
||||
|
||||
/obj/machinery/atmospherics/valve/shutoff/process()
|
||||
..()
|
||||
|
||||
if (!network_node1 || !network_node2)
|
||||
if(open)
|
||||
if(!network_node1 || !network_node2 || !node1 || !node2)
|
||||
if(open && close_on_leaks)
|
||||
close()
|
||||
return
|
||||
|
||||
if (!close_on_leaks)
|
||||
if (!open)
|
||||
if(close_on_leaks)
|
||||
if(open && (network_node1.leaks.len || network_node2.leaks.len))
|
||||
find_leaks() // If we can see the leak, then this will find it, close the valve, and cut off that network
|
||||
// If we cannot see the leak, then this will not close the valve, and any valves that can see the leak will cut it off from us
|
||||
else if(!open && !network_node1.leaks.len && !network_node2.leaks.len)
|
||||
open()
|
||||
return
|
||||
|
||||
// Breadth-first search for any leaking pipes that we can directly see
|
||||
/obj/machinery/atmospherics/valve/shutoff/proc/find_leaks()
|
||||
var/obj/machinery/atmospherics/list/search = list()
|
||||
|
||||
// We're the leak!
|
||||
if(!node1 || !node2)
|
||||
close()
|
||||
return
|
||||
|
||||
if (network_node1.leaks.len || network_node2.leaks.len)
|
||||
if (open)
|
||||
close()
|
||||
else if (!open)
|
||||
open()
|
||||
// Only searching pipes
|
||||
if(istype(node1, /obj/machinery/atmospherics))
|
||||
search |= node1
|
||||
if(istype(node2, /obj/machinery/atmospherics))
|
||||
search |= node2
|
||||
|
||||
// Breadth-first search
|
||||
for(var/i = 1, i <= search.len, i++) // wooo, proper for loop syntax!
|
||||
var/obj/machinery/atmospherics/A = search[i]
|
||||
if(!A)
|
||||
continue
|
||||
|
||||
if(istype(A, /obj/machinery/atmospherics/pipe))
|
||||
var/obj/machinery/atmospherics/pipe/L = A
|
||||
if(L.leaking)
|
||||
close() // Found the leak!
|
||||
return
|
||||
|
||||
|
||||
if(istype(A, /obj/machinery/atmospherics/valve/shutoff))
|
||||
var/obj/machinery/atmospherics/valve/shutoff/S = A
|
||||
if(S.close_on_leaks || !S.open)
|
||||
continue // Either it will close, or it is closed. We don't care what's on the other side
|
||||
search |= list(S.node1, S.node2) // |= skips existing nodes, so we don't search loops infinitely
|
||||
|
||||
else if(istype(A, /obj/machinery/atmospherics/valve)) // Putting the shutoff before this means this won't catch shutoffs
|
||||
var/obj/machinery/atmospherics/valve/V = A
|
||||
if(V.open)
|
||||
search |= list(V.node1, V.node2)
|
||||
else
|
||||
continue // Closed valve, dead end
|
||||
|
||||
else if(istype(A, /obj/machinery/atmospherics/tvalve))
|
||||
var/obj/machinery/atmospherics/tvalve/T = A
|
||||
if(T.state)
|
||||
search |= list(T.node1, T.node2)
|
||||
else
|
||||
search |= list(T.node1, T.node3)
|
||||
|
||||
else if(istype(A, /obj/machinery/atmospherics/pipe/zpipe))
|
||||
var/obj/machinery/atmospherics/pipe/zpipe/P = A
|
||||
search |= list(P.node1, P.node2)
|
||||
|
||||
else if(istype(A, /obj/machinery/atmospherics/pipe/simple))
|
||||
var/obj/machinery/atmospherics/pipe/P = A
|
||||
search |= list(P.node1, P.node2)
|
||||
|
||||
else if(istype(A, /obj/machinery/atmospherics/pipe/manifold))
|
||||
var/obj/machinery/atmospherics/pipe/manifold/M = A
|
||||
search |= list(M.node1, M.node2, M.node3)
|
||||
|
||||
else if(istype(A, /obj/machinery/atmospherics/pipe/manifold4w))
|
||||
var/obj/machinery/atmospherics/pipe/manifold4w/M = A
|
||||
search |= list(M.node1, M.node2, M.node3, M.node4)
|
||||
|
||||
// else continue, dead end
|
||||
// We broke out of the loop, so we see no leaks
|
||||
// The leaks therefore must be on the other side of another shutoff valve
|
||||
return
|
||||
|
||||
@@ -405,11 +405,11 @@
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/examine(mob/user)
|
||||
if(..(user, 1))
|
||||
user << "A small gauge in the corner reads [round(last_flow_rate, 0.1)] L/s; [round(last_power_draw)] W"
|
||||
to_chat(user, "A small gauge in the corner reads [round(last_flow_rate, 0.1)] L/s; [round(last_power_draw)] W")
|
||||
else
|
||||
user << "You are too far away to read the gauge."
|
||||
to_chat(user, "You are too far away to read the gauge.")
|
||||
if(welded)
|
||||
user << "It seems welded shut."
|
||||
to_chat(user, "It seems welded shut.")
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/power_change()
|
||||
var/old_stat = stat
|
||||
|
||||
@@ -288,6 +288,6 @@
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/examine(mob/user)
|
||||
if(..(user, 1))
|
||||
user << "A small gauge in the corner reads [round(last_flow_rate, 0.1)] L/s; [round(last_power_draw)] W"
|
||||
to_chat(user, "A small gauge in the corner reads [round(last_flow_rate, 0.1)] L/s; [round(last_power_draw)] W")
|
||||
else
|
||||
user << "You are too far away to read the gauge."
|
||||
to_chat(user, "You are too far away to read the gauge.")
|
||||
|
||||
@@ -308,4 +308,4 @@
|
||||
|
||||
/obj/machinery/atmospherics/valve/examine(mob/user)
|
||||
..()
|
||||
user << "It is [open ? "open" : "closed"]."
|
||||
to_chat(user, "It is [open ? "open" : "closed"].")
|
||||
|
||||
Reference in New Issue
Block a user