[MIRROR] new item, temperature pump (#775)

* new item, temperature pump

* aa

Co-authored-by: Ghilker <42839747+Ghilker@users.noreply.github.com>
Co-authored-by: Azarak <azarak10@gmail.com>
This commit is contained in:
SkyratBot
2020-09-13 03:53:23 +02:00
committed by GitHub
co-authored by Ghilker Azarak
parent 25a87fbf4f
commit 9ffa525ff3
9 changed files with 134 additions and 3 deletions
+1
View File
@@ -34,6 +34,7 @@ GLOBAL_LIST_INIT(atmos_pipe_recipes, list(
new /datum/pipe_info/pipe("Manual Valve", /obj/machinery/atmospherics/components/binary/valve, TRUE),
new /datum/pipe_info/pipe("Digital Valve", /obj/machinery/atmospherics/components/binary/valve/digital, TRUE),
new /datum/pipe_info/pipe("Pressure Valve", /obj/machinery/atmospherics/components/binary/pressure_valve, TRUE),
new /datum/pipe_info/pipe("Temperature Pump", /obj/machinery/atmospherics/components/binary/temperature_pump, TRUE),
new /datum/pipe_info/meter("Meter"),
),
"Heat Exchange" = list(
@@ -0,0 +1,82 @@
/obj/machinery/atmospherics/components/binary/temperature_pump
icon_state = "tpump_map-3"
name = "temperature pump"
desc = "A pump that moves heat only."
can_unwrench = TRUE
shift_underlay_only = FALSE
///Value of the amount of rate of heat exchange
var/heat_transfer_rate = 0
///Maximum allowed amount for the heat exchange
var/max_heat_transfer_rate = 4500
construction_type = /obj/item/pipe/directional
pipe_state = "tpump"
/obj/machinery/atmospherics/components/binary/temperature_pump/CtrlClick(mob/user)
if(can_interact(user))
on = !on
investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS)
update_icon()
return ..()
/obj/machinery/atmospherics/components/binary/temperature_pump/AltClick(mob/user)
if(can_interact(user) && !(heat_transfer_rate == max_heat_transfer_rate))
heat_transfer_rate = max_heat_transfer_rate
investigate_log("was set to [heat_transfer_rate] K/s by [key_name(user)]", INVESTIGATE_ATMOS)
update_icon()
return ..()
/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((air_output.temperature + heat_transfer_rate) >= air_input.temperature || (air_input.temperature - heat_transfer_rate) <= TCRYO)
return
air_input.temperature -= heat_transfer_rate
air_output.temperature += heat_transfer_rate
update_parents()
/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_transfer_rate"] = round(max_heat_transfer_rate)
return data
/obj/machinery/atmospherics/components/binary/temperature_pump/ui_act(action, params)
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] K/s by [key_name(usr)]", INVESTIGATE_ATMOS)
update_icon()
Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

+1
View File
@@ -1609,6 +1609,7 @@
#include "code\modules\atmospherics\machinery\components\binary_devices\passive_gate.dm"
#include "code\modules\atmospherics\machinery\components\binary_devices\pressure_valve.dm"
#include "code\modules\atmospherics\machinery\components\binary_devices\pump.dm"
#include "code\modules\atmospherics\machinery\components\binary_devices\temperature_pump.dm"
#include "code\modules\atmospherics\machinery\components\binary_devices\valve.dm"
#include "code\modules\atmospherics\machinery\components\binary_devices\volume_pump.dm"
#include "code\modules\atmospherics\machinery\components\trinary_devices\filter.dm"
@@ -0,0 +1,47 @@
import { useBackend } from '../backend';
import { Button, LabeledList, NumberInput, Section } from '../components';
import { Window } from '../layouts';
export const AtmosTempPump = (props, context) => {
const { act, data } = useBackend(context);
return (
<Window
width={335}
height={115}>
<Window.Content>
<Section>
<LabeledList>
<LabeledList.Item label="Power">
<Button
icon={data.on ? 'power-off' : 'times'}
content={data.on ? 'On' : 'Off'}
selected={data.on}
onClick={() => act('power')} />
</LabeledList.Item>
<LabeledList.Item label="Heat transfer rate">
<NumberInput
animated
value={parseFloat(data.rate)}
unit="K/s"
width="75px"
minValue={0}
maxValue={4500}
step={1}
onChange={(e, value) => act('rate', {
rate: value,
})} />
<Button
ml={1}
icon="plus"
content="Max"
disabled={data.rate === data.max_heat_transfer_rate}
onClick={() => act('rate', {
rate: 'max',
})} />
</LabeledList.Item>
</LabeledList>
</Section>
</Window.Content>
</Window>
);
};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long