Files
Bubberstation/code/modules/atmospherics/machinery/components/binary_devices/temperature_pump.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

134 lines
4.7 KiB
Plaintext

/obj/machinery/atmospherics/components/binary/temperature_pump
icon_state = "tpump_map-3"
name = "temperature pump"
desc = "A pump that moves heat from one pipeline to another. The input will get cooler, and the output will get hotter."
can_unwrench = TRUE
shift_underlay_only = FALSE
construction_type = /obj/item/pipe/directional
pipe_state = "tpump"
vent_movement = NONE
///Percent of the heat delta to transfer
var/heat_transfer_rate = 0
///Maximum allowed transfer percentage
var/max_heat_transfer_rate = 100
/obj/machinery/atmospherics/components/binary/temperature_pump/Initialize(mapload)
. = ..()
register_context()
/obj/machinery/atmospherics/components/binary/temperature_pump/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 transfer rate"
return CONTEXTUAL_SCREENTIP_SET
/obj/machinery/atmospherics/components/binary/temperature_pump/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_pump/click_alt(mob/user)
if(heat_transfer_rate == max_heat_transfer_rate)
return CLICK_ACTION_BLOCKING
heat_transfer_rate = max_heat_transfer_rate
investigate_log("was set to [heat_transfer_rate]% by [key_name(user)]", INVESTIGATE_ATMOS)
balloon_alert(user, "transfer rate set to [heat_transfer_rate]%")
update_appearance()
return CLICK_ACTION_SUCCESS
/obj/machinery/atmospherics/components/binary/temperature_pump/update_icon_nopipes()
icon_state = "tpump_[on && is_operational ? "on" : "off"]-[set_overlay_offset(piping_layer)]"
/obj/machinery/atmospherics/components/binary/temperature_pump/process_atmos()
if(!on || !is_operational)
return
var/datum/gas_mixture/air_input = airs[1]
var/datum/gas_mixture/air_output = airs[2]
if(!QUANTIZE(air_input.total_moles()) || !QUANTIZE(air_output.total_moles())) //Don't transfer if there's no gas
return
var/datum/gas_mixture/remove_input = air_input.remove_ratio(0.9)
var/datum/gas_mixture/remove_output = air_output.remove_ratio(0.9)
var/coolant_temperature_delta = remove_input.temperature - remove_output.temperature
if(coolant_temperature_delta > 0)
var/input_capacity = remove_input.heat_capacity()
var/output_capacity = remove_output.heat_capacity()
var/cooling_heat_amount = (heat_transfer_rate * 0.01) * CALCULATE_CONDUCTION_ENERGY(coolant_temperature_delta, output_capacity, input_capacity)
remove_output.temperature = max(remove_output.temperature + (cooling_heat_amount / output_capacity), TCMB)
remove_input.temperature = max(remove_input.temperature - (cooling_heat_amount / input_capacity), TCMB)
update_parents()
var/power_usage = 200
air_input.merge(remove_input)
air_output.merge(remove_output)
if(power_usage)
use_energy(power_usage)
/obj/machinery/atmospherics/components/binary/temperature_pump/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "AtmosTempPump", name)
ui.open()
/obj/machinery/atmospherics/components/binary/temperature_pump/ui_data()
var/data = list()
data["on"] = on
data["rate"] = round(heat_transfer_rate)
data["max_heat_transfer_rate"] = round(max_heat_transfer_rate)
return data
/obj/machinery/atmospherics/components/binary/temperature_pump/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("rate")
var/rate = params["rate"]
if(rate == "max")
rate = max_heat_transfer_rate
. = TRUE
else if(text2num(rate) != null)
rate = text2num(rate)
. = TRUE
if(.)
heat_transfer_rate = clamp(rate, 0, max_heat_transfer_rate)
investigate_log("was set to [heat_transfer_rate]% by [key_name(usr)]", INVESTIGATE_ATMOS)
update_appearance()
//mapping
/obj/machinery/atmospherics/components/binary/temperature_pump/layer2
icon_state = "tpump_map-2"
piping_layer = 2
/obj/machinery/atmospherics/components/binary/temperature_pump/layer4
icon_state = "tpump_map-4"
piping_layer = 4
/obj/machinery/atmospherics/components/binary/temperature_pump/on
on = TRUE
icon_state = "tpump_on_map-3"
/obj/machinery/atmospherics/components/binary/temperature_pump/on/layer2
icon_state = "tpump_on_map-2"
piping_layer = 2
/obj/machinery/atmospherics/components/binary/temperature_pump/on/layer4
icon_state = "tpump_on_map-4"
piping_layer = 4