Files
Bubberstation/code/modules/atmospherics/machinery/components/binary_devices/temperature_gate.dm
Waterpig bb70889f6e TG Upstream Part 1
3591 individual conflicts

Update build.js

Update install_node.sh

Update byond.js

oh my fucking god

hat

slow

huh

holy shit

we all fall down

2 more I missed

2900 individual conflicts

2700 Individual conflicts

replaces yarn file with tg version, bumping us down to 2200-ish

Down to 2000 individual conflicts

140 down

mmm

aaaaaaaaaaaaaaaaaaa

not yt

575

soon

900 individual conflicts

600 individual conflicts, 121 file conflicts

im not okay

160 across 19 files

29 in 4 files

0 conflicts, compiletime fix time

some minor incap stuff

missed ticks

weird dupe definition stuff

missed ticks 2

incap fixes

undefs and pie fix

Radio update and some extra minor stuff

returns a single override

no more dupe definitions, 175 compiletime errors

Unticked file fix

sound and emote stuff

honk and more radio stuff
2024-10-19 08:04:33 -07:00

157 lines
5.9 KiB
Plaintext

/obj/machinery/atmospherics/components/binary/temperature_gate
icon_state = "tgate_map-3"
name = "temperature gate"
desc = "An activable gate that compares the input temperature with the interface set temperature to check if the gas can flow from the input side to the output side or not."
can_unwrench = TRUE
shift_underlay_only = FALSE
construction_type = /obj/item/pipe/directional
pipe_state = "tgate"
///If the temperature of the mix before the gate is lower than this, the gas will flow (if inverted, if the temperature of the mix before the gate is higher than this)
var/target_temperature = T0C
///Minimum allowed temperature
var/minimum_temperature = TCMB
///Maximum allowed temperature to be set
var/max_temperature = 4500
///Check if the sensor should let gas pass if temperature in the mix is less/higher than the target one
var/inverted = FALSE
///Check if the gas is moving from one pipenet to the other
var/is_gas_flowing = FALSE
/obj/machinery/atmospherics/components/binary/temperature_gate/Initialize(mapload)
. = ..()
register_context()
/obj/machinery/atmospherics/components/binary/temperature_gate/add_context(atom/source, list/context, obj/item/held_item, mob/user)
. = ..()
context[SCREENTIP_CONTEXT_CTRL_LMB] = "Turn [on ? "off" : "on"]"
context[SCREENTIP_CONTEXT_ALT_LMB] = "Maximize target temperature"
return CONTEXTUAL_SCREENTIP_SET
/obj/machinery/atmospherics/components/binary/temperature_gate/click_ctrl(mob/user)
if(is_operational)
on = !on
balloon_alert(user, "turned [on ? "on" : "off"]")
investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS)
update_appearance()
return CLICK_ACTION_SUCCESS
return CLICK_ACTION_BLOCKING
/obj/machinery/atmospherics/components/binary/temperature_gate/click_alt(mob/user)
if(target_temperature == max_temperature)
return CLICK_ACTION_BLOCKING
target_temperature = max_temperature
investigate_log("was set to [target_temperature] K by [key_name(user)]", INVESTIGATE_ATMOS)
balloon_alert(user, "target temperature set to [target_temperature] K")
update_appearance()
return CLICK_ACTION_SUCCESS
/obj/machinery/atmospherics/components/binary/temperature_gate/examine(mob/user)
. = ..()
. += "This device will let gas flow if the temperature of the gas in the input is [inverted ? "higher" : "lower"] than the temperature set in the interface."
if(inverted)
. += "The device settings can be restored if a multitool is used on it."
else
. += "The sensor's settings can be changed by using a multitool on the device."
/obj/machinery/atmospherics/components/binary/temperature_gate/update_icon_nopipes()
if(on && is_operational && is_gas_flowing)
icon_state = "tgate_flow-[set_overlay_offset(piping_layer)]"
else if(on && is_operational && !is_gas_flowing)
icon_state = "tgate_on-[set_overlay_offset(piping_layer)]"
else
icon_state = "tgate_off-[set_overlay_offset(piping_layer)]"
/obj/machinery/atmospherics/components/binary/temperature_gate/process_atmos()
if(!on || !is_operational)
return
var/datum/gas_mixture/input_air = airs[1]
var/datum/gas_mixture/output_air = airs[2]
var/datum/gas_mixture/output_pipenet_air = parents[2].air
if(!inverted)
if(input_air.temperature < target_temperature)
if(input_air.release_gas_to(output_air, input_air.return_pressure(), output_pipenet_air = output_pipenet_air))
update_parents()
is_gas_flowing = TRUE
else
is_gas_flowing = FALSE
else
if(input_air.temperature > target_temperature)
if(input_air.release_gas_to(output_air, input_air.return_pressure(), output_pipenet_air = output_pipenet_air))
update_parents()
is_gas_flowing = TRUE
else
is_gas_flowing = FALSE
update_icon_nopipes()
/obj/machinery/atmospherics/components/binary/temperature_gate/relaymove(mob/living/user, direction)
if(!on || direction != dir)
return
. = ..()
/obj/machinery/atmospherics/components/binary/temperature_gate/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "AtmosTempGate", name)
ui.open()
/obj/machinery/atmospherics/components/binary/temperature_gate/ui_data()
var/data = list()
data["on"] = on
data["temperature"] = round(target_temperature)
data["min_temperature"] = round(minimum_temperature)
data["max_temperature"] = round(max_temperature)
return data
/obj/machinery/atmospherics/components/binary/temperature_gate/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
switch(action)
if("power")
on = !on
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS)
. = TRUE
if("temperature")
var/temperature = params["temperature"]
if(temperature == "max")
temperature = max_temperature
. = TRUE
else if(text2num(temperature) != null)
temperature = text2num(temperature)
. = TRUE
if(.)
target_temperature = clamp(minimum_temperature, temperature, max_temperature)
investigate_log("was set to [target_temperature] K by [key_name(usr)]", INVESTIGATE_ATMOS)
update_appearance()
/obj/machinery/atmospherics/components/binary/temperature_gate/can_unwrench(mob/user)
. = ..()
if(. && on && is_operational)
to_chat(user, span_warning("You cannot unwrench [src], turn it off first!"))
return FALSE
/obj/machinery/atmospherics/components/binary/temperature_gate/multitool_act(mob/living/user, obj/item/multitool/I)
. = ..()
if (istype(I))
inverted = !inverted
if(inverted)
to_chat(user, span_notice("You set the [src]'s sensors to release gases when the temperature is higher than the setted one."))
else
to_chat(user, span_notice("You set the [src]'s sensors to the default settings."))
return TRUE
//mapping
/obj/machinery/atmospherics/components/binary/temperature_gate/layer2
piping_layer = 2
icon_state = "tgate_map-2"
/obj/machinery/atmospherics/components/binary/temperature_gate/layer4
piping_layer = 4
icon_state = "tgate_map-4"