Refactors Heaters and Coolers (#15376)

* Refactors Heaters and Coolers

* Update tgui.bundle.js

* flail

* tweaks

* Update tgui.bundle.js

* Update tgui.bundle.js
This commit is contained in:
Fox McCloud
2021-01-28 16:18:24 -05:00
committed by GitHub
parent 003a1f7cba
commit 8a461a4e53
20 changed files with 396 additions and 616 deletions
+18 -27
View File
@@ -9598,9 +9598,8 @@
/area/space/nearstation)
"aAf" = (
/obj/machinery/atmospherics/pipe/simple/hidden/supply,
/obj/machinery/atmospherics/unary/heat_reservoir/heater{
dir = 4;
on = 1
/obj/machinery/atmospherics/unary/thermomachine/heater/on{
dir = 4
},
/obj/machinery/camera{
c_tag = "Supermatter West";
@@ -10088,7 +10087,7 @@
/area/maintenance/fsmaint)
"aBh" = (
/obj/machinery/atmospherics/pipe/simple/hidden/supply,
/obj/machinery/atmospherics/unary/cold_sink/freezer{
/obj/machinery/atmospherics/unary/thermomachine/freezer{
dir = 4
},
/obj/effect/decal/warning_stripes/yellow/hollow,
@@ -22428,9 +22427,8 @@
/turf/simulated/floor/plasteel,
/area/atmos)
"aXj" = (
/obj/machinery/atmospherics/unary/heat_reservoir/heater{
dir = 8;
on = 0
/obj/machinery/atmospherics/unary/thermomachine/heater{
dir = 8
},
/obj/effect/decal/warning_stripes/yellow,
/turf/simulated/floor/plasteel{
@@ -23122,9 +23120,8 @@
/turf/simulated/floor/plasteel,
/area/atmos)
"aYz" = (
/obj/machinery/atmospherics/unary/heat_reservoir/heater{
dir = 4;
on = 1
/obj/machinery/atmospherics/unary/thermomachine/heater/on{
dir = 4
},
/obj/effect/decal/warning_stripes/yellow,
/turf/simulated/floor/plasteel{
@@ -35230,7 +35227,7 @@
},
/area/atmos)
"bur" = (
/obj/machinery/atmospherics/unary/heat_reservoir/heater,
/obj/machinery/atmospherics/unary/thermomachine/heater,
/obj/effect/decal/warning_stripes/yellow,
/turf/simulated/floor/plasteel{
dir = 8;
@@ -35239,7 +35236,7 @@
/area/atmos)
"bus" = (
/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers,
/obj/machinery/atmospherics/unary/cold_sink/freezer{
/obj/machinery/atmospherics/unary/thermomachine/freezer{
dir = 4
},
/obj/effect/decal/warning_stripes/yellow,
@@ -35857,9 +35854,8 @@
},
/area/turret_protected/ai)
"bvD" = (
/obj/machinery/atmospherics/unary/heat_reservoir/heater{
dir = 1;
on = 1
/obj/machinery/atmospherics/unary/thermomachine/heater/on{
dir = 1
},
/turf/simulated/floor/plasteel{
dir = 10;
@@ -76544,11 +76540,8 @@
/turf/simulated/floor/plasteel,
/area/toxins/xenobiology)
"cOV" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer{
current_temperature = 80;
dir = 1;
min_temperature = 80;
on = 1
/obj/machinery/atmospherics/unary/thermomachine/freezer/on/server{
dir = 1
},
/obj/structure/extinguisher_cabinet{
pixel_x = -26;
@@ -88980,7 +88973,7 @@
},
/area/medical/medbay)
"dls" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer{
/obj/machinery/atmospherics/unary/thermomachine/freezer{
dir = 1
},
/obj/effect/decal/warning_stripes/south,
@@ -90776,9 +90769,8 @@
},
/area/crew_quarters/hor)
"doO" = (
/obj/machinery/atmospherics/unary/heat_reservoir/heater{
dir = 8;
on = 0
/obj/machinery/atmospherics/unary/thermomachine/heater{
dir = 8
},
/obj/effect/decal/warning_stripes/northwest,
/turf/simulated/floor/plasteel,
@@ -94950,7 +94942,7 @@
},
/area/toxins/mixing)
"dwc" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer{
/obj/machinery/atmospherics/unary/thermomachine/freezer{
dir = 8
},
/obj/effect/decal/warning_stripes/northwest,
@@ -95039,8 +95031,7 @@
/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers{
dir = 4
},
/obj/machinery/atmospherics/unary/cold_sink/freezer{
current_temperature = 80;
/obj/machinery/atmospherics/unary/thermomachine/freezer/on/server{
on = 1
},
/turf/simulated/floor/plasteel{
+8 -11
View File
@@ -45821,9 +45821,8 @@
name = "Port Maintenance"
})
"bHe" = (
/obj/machinery/atmospherics/unary/heat_reservoir/heater{
dir = 2;
on = 1
/obj/machinery/atmospherics/unary/thermomachine/heater/on{
dir = 2
},
/turf/simulated/floor/plasteel{
dir = 1;
@@ -56003,7 +56002,7 @@
/turf/simulated/floor/plasteel,
/area/atmos)
"cag" = (
/obj/machinery/atmospherics/unary/heat_reservoir/heater{
/obj/machinery/atmospherics/unary/thermomachine/heater{
dir = 8
},
/turf/simulated/floor/plasteel,
@@ -56888,7 +56887,7 @@
},
/area/hydroponics)
"cbT" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer{
/obj/machinery/atmospherics/unary/thermomachine/freezer{
dir = 8
},
/turf/simulated/floor/plasteel,
@@ -74002,7 +74001,7 @@
})
"cFF" = (
/obj/machinery/light,
/obj/machinery/atmospherics/unary/cold_sink/freezer{
/obj/machinery/atmospherics/unary/thermomachine/freezer{
dir = 1
},
/obj/effect/decal/warning_stripes/south,
@@ -74537,7 +74536,7 @@
dir = 2;
pixel_y = 24
},
/obj/machinery/atmospherics/unary/cold_sink/freezer,
/obj/machinery/atmospherics/unary/thermomachine/freezer,
/obj/effect/decal/warning_stripes/south,
/turf/simulated/floor/plasteel,
/area/toxins/mixing{
@@ -79203,10 +79202,8 @@
name = "\improper Research Division Server Room"
})
"cOl" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer{
current_temperature = 80;
dir = 2;
on = 1
/obj/machinery/atmospherics/unary/thermomachine/freezer/on/server{
dir = 2
},
/obj/effect/decal/cleanable/cobweb2,
/turf/simulated/floor/plasteel{
@@ -1522,9 +1522,7 @@
},
/area/awaymission/research)
"el" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer{
current_temperature = 80
},
/obj/machinery/atmospherics/unary/thermomachine/freezer,
/turf/simulated/floor/plasteel{
icon_state = "showroomfloor"
},
@@ -7822,10 +7822,8 @@
},
/area/awaymission/UO71/science)
"qC" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer{
current_temperature = 80;
dir = 2;
on = 1
/obj/machinery/atmospherics/unary/thermomachine/freezer/on/server{
dir = 2
},
/turf/simulated/floor/plasteel{
icon_state = "dark"
@@ -10936,7 +10934,7 @@
/turf/simulated/wall,
/area/awaymission/UO71/mining)
"ww" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer{
/obj/machinery/atmospherics/unary/thermomachine/freezer{
dir = 4
},
/turf/simulated/floor/plasteel{
@@ -10849,10 +10849,8 @@
name = "UO45 Engineering"
})
"qg" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer{
current_temperature = 80;
dir = 2;
on = 1
/obj/machinery/atmospherics/unary/thermomachine/freezer/on/server{
dir = 2
},
/turf/simulated/floor/plasteel{
icon_state = "dark"
+10 -20
View File
@@ -47901,7 +47901,7 @@
},
/area/medical/genetics_cloning)
"bSC" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer,
/obj/machinery/atmospherics/unary/thermomachine/freezer,
/obj/machinery/alarm{
pixel_y = 25
},
@@ -53878,7 +53878,7 @@
},
/area/medical/cryo)
"ccy" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer{
/obj/machinery/atmospherics/unary/thermomachine/freezer{
dir = 1
},
/obj/machinery/camera{
@@ -54287,11 +54287,7 @@
},
/area/engine/gravitygenerator)
"cdb" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer{
current_temperature = 80;
dir = 2;
on = 1
},
/obj/machinery/atmospherics/unary/thermomachine/freezer/on/server,
/obj/item/radio/intercom{
broadcasting = 0;
name = "station intercom (General)";
@@ -61596,7 +61592,7 @@
dir = 1;
in_use = 1
},
/obj/machinery/atmospherics/unary/cold_sink/freezer,
/obj/machinery/atmospherics/unary/thermomachine/freezer,
/obj/effect/decal/warning_stripes/northwestcorner,
/turf/simulated/floor/plasteel{
icon_state = "white"
@@ -77913,10 +77909,8 @@
/turf/simulated/floor/engine,
/area/engine/engineering)
"cTA" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer{
dir = 8;
icon_state = "freezer_0";
tag = ""
/obj/machinery/atmospherics/unary/thermomachine/freezer{
dir = 8
},
/turf/simulated/floor/plasteel{
icon_state = "dark"
@@ -81358,10 +81352,8 @@
/turf/simulated/floor/plating,
/area/maintenance/asmaint)
"daV" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer{
dir = 8;
icon_state = "freezer_0";
tag = ""
/obj/machinery/atmospherics/unary/thermomachine/freezer{
dir = 8
},
/turf/simulated/floor/plasteel,
/area/atmos)
@@ -82797,10 +82789,8 @@
/turf/simulated/floor/plasteel,
/area/atmos)
"dei" = (
/obj/machinery/atmospherics/unary/heat_reservoir/heater{
dir = 8;
icon_state = "freezer_0";
tag = ""
/obj/machinery/atmospherics/unary/thermomachine/heater{
dir = 8
},
/turf/simulated/floor/plasteel,
/area/atmos)
+1 -1
View File
@@ -7863,7 +7863,7 @@
},
/area/centcom/evac)
"tz" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer{
/obj/machinery/atmospherics/unary/thermomachine/freezer{
dir = 1
},
/turf/simulated/floor/plasteel{
+2 -2
View File
@@ -575,7 +575,7 @@
},
/area/shuttle/administration)
"bi" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer{
/obj/machinery/atmospherics/unary/thermomachine/freezer{
dir = 1
},
/turf/simulated/shuttle/floor{
@@ -1101,7 +1101,7 @@
},
/area/shuttle/administration)
"cj" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer,
/obj/machinery/atmospherics/unary/thermomachine/freezer,
/turf/simulated/shuttle/floor{
icon_state = "floor3"
},
+1 -1
View File
@@ -311,7 +311,7 @@
/turf/simulated/shuttle/floor4,
/area/shuttle/escape)
"aY" = (
/obj/machinery/atmospherics/unary/cold_sink/freezer{
/obj/machinery/atmospherics/unary/thermomachine/freezer{
dir = 1
},
/turf/simulated/floor/plasteel{
@@ -1,42 +0,0 @@
/obj/machinery/atmospherics/unary/cold_sink
icon = 'icons/obj/atmospherics/cold_sink.dmi'
icon_state = "on_cool"
density = 1
use_power = IDLE_POWER_USE
name = "cold sink"
desc = "Cools gas when connected to pipe network"
var/on = 0
var/current_temperature = T20C
var/current_heat_capacity = 50000 //totally random
/obj/machinery/atmospherics/unary/cold_sink/update_icon()
..()
if(node)
icon_state = "intact_[on?("on"):("off")]"
else
icon_state = "exposed"
on = 0
/obj/machinery/atmospherics/unary/cold_sink/process_atmos()
..()
if(!on)
return 0
var/air_heat_capacity = air_contents.heat_capacity()
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
var/old_temperature = air_contents.temperature
if(combined_heat_capacity > 0)
var/combined_energy = current_temperature*current_heat_capacity + air_heat_capacity*air_contents.temperature
air_contents.temperature = combined_energy/combined_heat_capacity
//todo: have current temperature affected. require power to bring down current temperature again
if(abs(old_temperature-air_contents.temperature) > 1)
parent.update = 1
return 1
@@ -1,41 +0,0 @@
/obj/machinery/atmospherics/unary/heat_reservoir
icon = 'icons/obj/atmospherics/cold_sink.dmi'
icon_state = "intact_off"
density = 1
use_power = IDLE_POWER_USE
name = "heat reservoir"
desc = "Heats gas when connected to pipe network"
var/on = 0
var/current_temperature = T20C
var/current_heat_capacity = 50000 //totally random
/obj/machinery/atmospherics/unary/heat_reservoir/update_icon()
..()
if(node)
icon_state = "intact_[on?("on"):("off")]"
else
icon_state = "exposed"
on = 0
/obj/machinery/atmospherics/unary/heat_reservoir/process_atmos()
..()
if(!on)
return 0
var/air_heat_capacity = air_contents.heat_capacity()
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
var/old_temperature = air_contents.temperature
if(combined_heat_capacity > 0)
var/combined_energy = current_temperature*current_heat_capacity + air_heat_capacity*air_contents.temperature
air_contents.temperature = combined_energy/combined_heat_capacity
//todo: have current temperature affected. require power to bring up current temperature again
if(abs(old_temperature-air_contents.temperature) > 1)
parent.update = 1
return 1
@@ -0,0 +1,251 @@
/obj/machinery/atmospherics/unary/thermomachine
icon = 'icons/obj/cryogenic2.dmi'
icon_state = "freezer"
name = "Temperature control unit"
desc = "Heats or cools gas in connected pipes."
density = TRUE
max_integrity = 300
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 100, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 80, "acid" = 30)
layer = OBJ_LAYER
///Check if the device should be on or off
var/on = FALSE
var/icon_state_off = "freezer"
var/icon_state_on = "freezer_1"
var/icon_state_open = "freezer-o"
///actual temperature will be defined by RefreshParts() and by the cooling var
var/min_temperature = T20C
//actual temperature will be defined by RefreshParts() and by the cooling var
var/max_temperature = T20C
var/target_temperature = T20C
var/heat_capacity = 0
var/cooling = TRUE
var/base_heating = 140
var/base_cooling = 170
/obj/machinery/atmospherics/unary/thermomachine/New()
..()
initialize_directions = dir
component_parts = list()
component_parts += new /obj/item/circuitboard/thermomachine(null)
component_parts += new /obj/item/stock_parts/matter_bin(src)
component_parts += new /obj/item/stock_parts/matter_bin(src)
component_parts += new /obj/item/stock_parts/micro_laser(src)
component_parts += new /obj/item/stock_parts/micro_laser(src)
component_parts += new /obj/item/stack/sheet/glass(src)
component_parts += new /obj/item/stack/cable_coil(src, 1)
RefreshParts()
update_icon()
/obj/machinery/atmospherics/unary/thermomachine/proc/swap_function()
cooling = !cooling
if(cooling)
icon_state_off = "freezer"
icon_state_on = "freezer_1"
icon_state_open = "freezer-o"
else
icon_state_off = "heater"
icon_state_on = "heater_1"
icon_state_open = "heater-o"
target_temperature = T20C
RefreshParts()
update_icon()
/obj/machinery/atmospherics/unary/thermomachine/RefreshParts()
var/calculated_bin_rating
for(var/obj/item/stock_parts/matter_bin/bin in component_parts)
calculated_bin_rating += bin.rating
heat_capacity = 5000 * ((calculated_bin_rating - 1) ** 2)
min_temperature = T20C
max_temperature = T20C
if(cooling)
var/calculated_laser_rating
for(var/obj/item/stock_parts/micro_laser/laser in component_parts)
calculated_laser_rating += laser.rating
min_temperature = max(T0C - (base_cooling + calculated_laser_rating * 15), TCMB) //73.15K with T1 stock parts
else
var/calculated_laser_rating
for(var/obj/item/stock_parts/micro_laser/laser in component_parts)
calculated_laser_rating += laser.rating
max_temperature = T20C + (base_heating * calculated_laser_rating) //573.15K with T1 stock parts
/obj/machinery/atmospherics/unary/thermomachine/update_icon()
if(panel_open)
icon_state = icon_state_open
else if(on)
icon_state = icon_state_on
else
icon_state = icon_state_off
/obj/machinery/atmospherics/unary/thermomachine/examine(mob/user)
. = ..()
. += "<span class='notice'>The thermostat is set to [target_temperature]K ([(T0C - target_temperature) * -1]C).</span>"
if(in_range(user, src) || isobserver(user))
. += "<span class='notice'>The status display reads: Efficiency <b>[(heat_capacity / 5000) * 100]%</b>.</span>"
. += "<span class='notice'>Temperature range <b>[min_temperature]K - [max_temperature]K ([(T0C - min_temperature) * -1]C - [(T0C-max_temperature) * -1]C)</b>.</span>"
/obj/machinery/atmospherics/unary/thermomachine/process_atmos()
..()
if(!on)
return 0
var/air_heat_capacity = air_contents.heat_capacity()
var/combined_heat_capacity = heat_capacity + air_heat_capacity
var/old_temperature = air_contents.temperature
if(combined_heat_capacity > 0)
var/combined_energy = heat_capacity * target_temperature + air_heat_capacity * air_contents.temperature
air_contents.temperature = combined_energy / combined_heat_capacity
//todo: have current temperature affected. require power to bring down current temperature again
var/temperature_delta= abs(old_temperature - air_contents.temperature)
if(temperature_delta > 1)
active_power_usage = (heat_capacity * temperature_delta) / 10 + idle_power_usage
parent.update = 1
else
active_power_usage = idle_power_usage
return 1
/obj/machinery/atmospherics/unary/thermomachine/attackby(obj/item/I, mob/user, params)
if(exchange_parts(user, I))
return
return ..()
/obj/machinery/atmospherics/unary/thermomachine/crowbar_act(mob/user, obj/item/I)
if(default_deconstruction_crowbar(user, I))
return TRUE
/obj/machinery/atmospherics/unary/thermomachine/screwdriver_act(mob/user, obj/item/I)
if(default_deconstruction_screwdriver(user, icon_state_open, icon_state_off, I))
on = FALSE
update_icon()
return TRUE
/obj/machinery/atmospherics/unary/thermomachine/wrench_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(!panel_open)
to_chat(user, "<span class='notice'>Open the maintenance panel first.</span>")
return
var/list/choices = list("West" = WEST, "East" = EAST, "South" = SOUTH, "North" = NORTH)
var/selected = input(user,"Select a direction for the connector.", "Connector Direction") in choices
dir = choices[selected]
var/node_connect = dir
initialize_directions = dir
for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
if(target.initialize_directions & get_dir(target,src))
node = target
break
build_network()
update_icon()
/obj/machinery/atmospherics/unary/thermomachine/attack_ai(mob/user)
attack_hand(user)
/obj/machinery/atmospherics/unary/thermomachine/attack_ghost(mob/user)
attack_hand(user)
/obj/machinery/atmospherics/unary/thermomachine/attack_hand(mob/user)
if(panel_open)
to_chat(user, "<span class='notice'>Close the maintenance panel first.</span>")
return
ui_interact(user)
/obj/machinery/atmospherics/unary/thermomachine/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = TRUE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "ThermoMachine", name, 300, 250)
ui.open()
/obj/machinery/atmospherics/unary/thermomachine/ui_data(mob/user)
var/list/data = list()
data["on"] = on
data["cooling"] = cooling
data["min"] = min_temperature
data["max"] = max_temperature
data["target"] = target_temperature
data["initial"] = initial(target_temperature)
data["temperature"] = air_contents.temperature
data["pressure"] = air_contents.return_pressure()
return data
/obj/machinery/atmospherics/unary/thermomachine/ui_act(action, params)
if(..())
return
add_fingerprint(usr)
switch(action)
if("power")
on = !on
use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
update_icon()
. = TRUE
if("cooling")
swap_function()
investigate_log("was changed to [cooling ? "cooling" : "heating"] by [key_name(usr)]", "atmos")
. = TRUE
if("target")
var/target = params["target"]
var/adjust = text2num(params["adjust"])
if(target == "input")
target = input("Set new target ([min_temperature] - [max_temperature] K):", name, target_temperature) as num|null
if(!isnull(target))
. = TRUE
else if(adjust)
target = target_temperature + adjust
. = TRUE
else if(text2num(target) != null)
target = text2num(target)
. = TRUE
if(.)
target_temperature = clamp(target, min_temperature, max_temperature)
investigate_log("was set to [target_temperature] K by [key_name(usr)]", "atmos")
/obj/machinery/atmospherics/unary/thermomachine/freezer
icon_state = "freezer"
icon_state_off = "freezer"
icon_state_on = "freezer_1"
icon_state_open = "freezer-o"
cooling = TRUE
/obj/machinery/atmospherics/unary/thermomachine/freezer/on
on = TRUE
icon_state = "freezer_1"
/obj/machinery/atmospherics/unary/thermomachine/freezer/on/New()
..()
if(target_temperature == initial(target_temperature))
target_temperature = min_temperature
/obj/machinery/atmospherics/unary/thermomachine/freezer/on/coldroom
name = "Cold room temperature control unit"
/obj/machinery/atmospherics/unary/thermomachine/freezer/on/coldroom/New()
..()
target_temperature = COLD_ROOM_TEMP
/obj/machinery/atmospherics/unary/thermomachine/freezer/on/server
name = "Server room temperature control unit"
/obj/machinery/atmospherics/unary/thermomachine/freezer/on/server/New()
..()
target_temperature = SERVER_ROOM_TEMP
/obj/machinery/atmospherics/unary/thermomachine/heater
icon_state = "heater"
icon_state_off = "heater"
icon_state_on = "heater_1"
icon_state_open = "heater-o"
cooling = FALSE
/obj/machinery/atmospherics/unary/thermomachine/heater/on
on = TRUE
icon_state = "heater_1"
+5
View File
@@ -13,6 +13,11 @@
#define TCRYO 265 // -48.15degC
#define T0C 273.15 // 0degC
#define T20C 293.15 // 20degC
/// -14C - Temperature used for kitchen cold room, medical freezer, etc.
#define COLD_ROOM_TEMP 259.15
/// -193C - Temperature used for server rooms
#define SERVER_ROOM_TEMP 80
#define MOLES_CELLSTANDARD (ONE_ATMOSPHERE*CELL_VOLUME/(T20C*R_IDEAL_GAS_EQUATION)) //moles in a 2.5 m^3 cell at 101.325 Pa and 20 degC
#define M_CELL_WITH_RATIO (MOLES_CELLSTANDARD * 0.005) //compared against for superconductivity
-330
View File
@@ -1,330 +0,0 @@
/obj/machinery/atmospherics/unary/cold_sink/freezer
name = "freezer"
icon = 'icons/obj/cryogenic2.dmi'
icon_state = "freezer"
density = 1
var/min_temperature = 0
anchored = 1.0
use_power = IDLE_POWER_USE
active_power_usage = 5000 //cooling down massive amounts of air's not cheap. This is still very low considering everything
power_channel = EQUIP
current_heat_capacity = 1000
layer = 3
plane = GAME_PLANE
max_integrity = 300
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 100, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 80, "acid" = 30)
/obj/machinery/atmospherics/unary/cold_sink/freezer/New()
..()
initialize_directions = dir
component_parts = list()
component_parts += new /obj/item/circuitboard/thermomachine(null)
component_parts += new /obj/item/stock_parts/matter_bin(null)
component_parts += new /obj/item/stock_parts/matter_bin(null)
component_parts += new /obj/item/stock_parts/micro_laser(null)
component_parts += new /obj/item/stock_parts/micro_laser(null)
component_parts += new /obj/item/stack/sheet/glass(null)
component_parts += new /obj/item/stack/cable_coil(null, 1)
RefreshParts()
/obj/machinery/atmospherics/unary/cold_sink/freezer/upgraded/New()
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/thermomachine(null)
component_parts += new /obj/item/stock_parts/matter_bin/super(null)
component_parts += new /obj/item/stock_parts/matter_bin/super(null)
component_parts += new /obj/item/stock_parts/micro_laser/ultra(null)
component_parts += new /obj/item/stock_parts/micro_laser/ultra(null)
component_parts += new /obj/item/stack/sheet/glass(null)
component_parts += new /obj/item/stack/cable_coil(null, 1)
RefreshParts()
/obj/machinery/atmospherics/unary/cold_sink/freezer/RefreshParts()
var/H
var/T
for(var/obj/item/stock_parts/matter_bin/M in component_parts)
H += M.rating
for(var/obj/item/stock_parts/micro_laser/M in component_parts)
T += M.rating
min_temperature = max(0,T0C - (170 + (T*15)))
current_heat_capacity = 1000 * ((H - 1) ** 2)
/obj/machinery/atmospherics/unary/cold_sink/freezer/on_construction()
..(dir,dir)
/obj/machinery/atmospherics/unary/cold_sink/freezer/process()
return // need to overwrite the parent or it returns PROCESS_KILL and it stops processing/using power
/obj/machinery/atmospherics/unary/cold_sink/freezer/attackby(obj/item/I, mob/user, params)
if(exchange_parts(user, I))
return
return ..()
/obj/machinery/atmospherics/unary/cold_sink/freezer/crowbar_act(mob/user, obj/item/I)
if(default_deconstruction_crowbar(user, I))
return TRUE
/obj/machinery/atmospherics/unary/cold_sink/freezer/screwdriver_act(mob/user, obj/item/I)
if(default_deconstruction_screwdriver(user, "freezer-o", "freezer", I))
on = FALSE
use_power = IDLE_POWER_USE
update_icon()
return TRUE
/obj/machinery/atmospherics/unary/cold_sink/freezer/wrench_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(!panel_open)
to_chat(user, "<span class='notice'>Open the maintenance panel first.</span>")
return
var/list/choices = list("West" = WEST, "East" = EAST, "South" = SOUTH, "North" = NORTH)
var/selected = input(user,"Select a direction for the connector.", "Connector Direction") in choices
dir = choices[selected]
var/node_connect = dir
initialize_directions = dir
for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
if(target.initialize_directions & get_dir(target,src))
node = target
break
build_network()
update_icon()
/obj/machinery/atmospherics/unary/cold_sink/freezer/update_icon()
if(panel_open)
icon_state = "freezer-o"
else if(src.on)
icon_state = "freezer_1"
else
icon_state = "freezer"
return
/obj/machinery/atmospherics/unary/cold_sink/freezer/attack_ai(mob/user as mob)
attack_hand(user)
/obj/machinery/atmospherics/unary/cold_sink/freezer/attack_ghost(mob/user as mob)
attack_hand(user)
/obj/machinery/atmospherics/unary/cold_sink/freezer/attack_hand(mob/user as mob)
if(panel_open)
to_chat(user, "<span class='notice'>Close the maintenance panel first.</span>")
return
ui_interact(user)
/obj/machinery/atmospherics/unary/cold_sink/freezer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = TRUE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "GasFreezer", "Gas Cooling System", 540, 200)
ui.open()
/obj/machinery/atmospherics/unary/cold_sink/freezer/ui_data(mob/user)
var/list/data = list()
data["on"] = on
data["pressure"] = round(air_contents.return_pressure())
data["temperature"] = round(air_contents.temperature)
data["temperatureCelsius"] = round(air_contents.temperature - T0C, 1)
if(air_contents.total_moles() == 0 && air_contents.temperature == 0)
data["temperatureCelsius"] = 0
data["min"] = round(min_temperature)
data["max"] = round(T20C)
data["target"] = round(current_temperature)
data["targetCelsius"] = round(current_temperature - T0C, 1)
return data
/obj/machinery/atmospherics/unary/cold_sink/freezer/ui_act(action, params)
if(..())
return
add_fingerprint(usr)
. = TRUE
switch(action)
if("power")
on = !on
if(on)
use_power = ACTIVE_POWER_USE
else
use_power = IDLE_POWER_USE
update_icon()
if("minimum")
current_temperature = min_temperature
if("maximum")
current_temperature = T20C
if("temp")
var/amount = params["temp"]
amount = text2num(amount)
current_temperature = clamp(amount, T20C, min_temperature)
/obj/machinery/atmospherics/unary/cold_sink/freezer/power_change()
..()
if(stat & NOPOWER)
on = 0
use_power = IDLE_POWER_USE
update_icon()
/obj/machinery/atmospherics/unary/heat_reservoir/heater/
name = "heater"
icon = 'icons/obj/cryogenic2.dmi'
icon_state = "heater"
density = 1
var/max_temperature = 0
anchored = 1.0
layer = 3
current_heat_capacity = 1000
active_power_usage = 5000
power_channel = EQUIP
max_integrity = 300
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 100, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 80, "acid" = 30)
/obj/machinery/atmospherics/unary/heat_reservoir/heater/New()
..()
initialize_directions = dir
var/obj/item/circuitboard/thermomachine/H = new /obj/item/circuitboard/thermomachine(null)
H.build_path = /obj/machinery/atmospherics/unary/heat_reservoir/heater
H.name = "circuit board (Heater)"
component_parts = list()
component_parts += H
component_parts += new /obj/item/stock_parts/matter_bin(src)
component_parts += new /obj/item/stock_parts/matter_bin(src)
component_parts += new /obj/item/stock_parts/micro_laser(src)
component_parts += new /obj/item/stock_parts/micro_laser(src)
component_parts += new /obj/item/stack/sheet/glass(src)
component_parts += new /obj/item/stack/cable_coil(src, 1)
RefreshParts()
/obj/machinery/atmospherics/unary/heat_reservoir/heater/upgraded/New()
..()
var/obj/item/circuitboard/thermomachine/H = new /obj/item/circuitboard/thermomachine(null)
H.build_path = /obj/machinery/atmospherics/unary/heat_reservoir/heater
H.name = "circuit board (Heater)"
component_parts = list()
component_parts += H
component_parts += new /obj/item/stock_parts/matter_bin/super(src)
component_parts += new /obj/item/stock_parts/matter_bin/super(src)
component_parts += new /obj/item/stock_parts/micro_laser/ultra(src)
component_parts += new /obj/item/stock_parts/micro_laser/ultra(src)
component_parts += new /obj/item/stack/sheet/glass(src)
component_parts += new /obj/item/stack/cable_coil(src, 1)
RefreshParts()
/obj/machinery/atmospherics/unary/heat_reservoir/heater/on_construction()
..(dir,dir)
/obj/machinery/atmospherics/unary/heat_reservoir/heater/process()
return // need to override the parent or it stops processing, meaning it stops using power.
/obj/machinery/atmospherics/unary/heat_reservoir/heater/RefreshParts()
var/H
var/T
for(var/obj/item/stock_parts/matter_bin/M in component_parts)
H += M.rating
for(var/obj/item/stock_parts/micro_laser/M in component_parts)
T += M.rating
max_temperature = T20C + (140 * T)
current_heat_capacity = 1000 * ((H - 1) ** 2)
/obj/machinery/atmospherics/unary/heat_reservoir/heater/attackby(obj/item/I, mob/user, params)
if(exchange_parts(user, I))
return
return ..()
/obj/machinery/atmospherics/unary/heat_reservoir/heater/crowbar_act(mob/user, obj/item/I)
if(default_deconstruction_crowbar(user, I))
return TRUE
/obj/machinery/atmospherics/unary/heat_reservoir/heater/screwdriver_act(mob/user, obj/item/I)
if(default_deconstruction_screwdriver(user, "heater-o", "heater", I))
on = 0
use_power = IDLE_POWER_USE
update_icon()
return TRUE
/obj/machinery/atmospherics/unary/heat_reservoir/heater/wrench_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(!panel_open)
to_chat(user, "<span class='notice'>Open the maintenance panel first.</span>")
return
var/list/choices = list("West" = WEST, "East" = EAST, "South" = SOUTH, "North" = NORTH)
var/selected = input(user,"Select a direction for the connector.", "Connector Direction") in choices
dir = choices[selected]
var/node_connect = dir
initialize_directions = dir
for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
if(target.initialize_directions & get_dir(target,src))
node = target
break
build_network()
update_icon()
/obj/machinery/atmospherics/unary/heat_reservoir/heater/update_icon()
if(panel_open)
icon_state = "heater-o"
else if(src.on)
icon_state = "heater_1"
else
icon_state = "heater"
return
/obj/machinery/atmospherics/unary/heat_reservoir/heater/attack_ai(mob/user as mob)
attack_hand(user)
/obj/machinery/atmospherics/unary/heat_reservoir/heater/attack_ghost(mob/user as mob)
src.attack_hand(user)
/obj/machinery/atmospherics/unary/heat_reservoir/heater/attack_hand(mob/user as mob)
if(panel_open)
to_chat(user, "<span class='notice'>Close the maintenance panel first.</span>")
return
ui_interact(user)
/obj/machinery/atmospherics/unary/heat_reservoir/heater/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = TRUE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "GasFreezer", "Gas Heating System", 540, 200)
ui.open()
/obj/machinery/atmospherics/unary/heat_reservoir/heater/ui_data(mob/user)
var/list/data = list()
data["on"] = on
data["pressure"] = round(air_contents.return_pressure())
data["temperature"] = round(air_contents.temperature)
data["temperatureCelsius"] = round(air_contents.temperature - T0C, 1)
if(air_contents.total_moles() == 0 && air_contents.temperature == 0)
data["temperatureCelsius"] = 0
data["min"] = round(T20C)
data["max"] = round(T20C + max_temperature)
data["target"] = round(current_temperature)
data["targetCelsius"] = round(current_temperature - T0C, 1)
return data
/obj/machinery/atmospherics/unary/heat_reservoir/heater/ui_act(action, params)
if(..())
return
add_fingerprint(usr)
. = TRUE
switch(action)
if("power")
on = !on
if(on)
use_power = ACTIVE_POWER_USE
else
use_power = IDLE_POWER_USE
update_icon()
if("minimum")
current_temperature = T20C
if("maximum")
current_temperature = max_temperature + T20C
if("temp")
var/amount = params["temp"]
amount = text2num(amount)
current_temperature = clamp(amount, T20C, T20C + max_temperature)
/obj/machinery/atmospherics/unary/heat_reservoir/heater/power_change()
..()
if(stat & NOPOWER)
on = 0
use_power = IDLE_POWER_USE
update_icon()
+2 -16
View File
@@ -314,9 +314,8 @@ to destroy them and players will be able to make replacements.
/obj/item/stock_parts/capacitor = 6)
/obj/item/circuitboard/thermomachine
name = "circuit board (Freezer)"
desc = "Use screwdriver to switch between heating and cooling modes."
build_path = /obj/machinery/atmospherics/unary/cold_sink/freezer
name = "Thermomachine (Machine Board)"
build_path = /obj/machinery/atmospherics/unary/thermomachine
board_type = "machine"
origin_tech = "programming=3;plasmatech=3"
req_components = list(
@@ -325,19 +324,6 @@ to destroy them and players will be able to make replacements.
/obj/item/stack/cable_coil = 1,
/obj/item/stack/sheet/glass = 1)
/obj/item/circuitboard/thermomachine/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/screwdriver))
if(build_path == /obj/machinery/atmospherics/unary/cold_sink/freezer)
build_path = /obj/machinery/atmospherics/unary/heat_reservoir/heater
name = "circuit board (Heater)"
to_chat(user, "<span class='notice'>You set the board to heating.</span>")
else
build_path = /obj/machinery/atmospherics/unary/cold_sink/freezer
name = "circuit board (Freezer)"
to_chat(user, "<span class='notice'>You set the board to cooling.</span>")
return
return ..()
/obj/item/circuitboard/recharger
name = "circuit board (Recharger)"
build_path = /obj/machinery/recharger
@@ -105,15 +105,9 @@
/obj/machinery/atmospherics/unary/vent_pump
description_info = "This pumps the contents of the attached pipe out into the atmosphere, if needed. It can be controlled from an Air Alarm."
//Freezers
/obj/machinery/atmospherics/unary/cold_sink/freezer
description_info = "Cools down the gas of the pipe it is connected to. It uses massive amounts of electricity while on. \
It can be upgraded by replacing the capacitors, manipulators, and matter bins. It can be deconstructed by screwing the maintenance panel open with a \
screwdriver, and then using a crowbar."
//Heaters
/obj/machinery/atmospherics/unary/heat_reservoir/heater
description_info = "Heats up the gas of the pipe it is connected to. It uses massive amounts of electricity while on. \
//Freezer and Heater
/obj/machinery/atmospherics/unary/thermomachine
description_info = "Cools or heats the gas of the pipe it is connected to. It uses massive amounts of electricity while on. \
It can be upgraded by replacing the capacitors, manipulators, and matter bins. It can be deconstructed by screwing the maintenance panel open with a \
screwdriver, and then using a crowbar."
+1 -3
View File
@@ -191,16 +191,15 @@
#include "code\ATMOSPHERICS\components\trinary_devices\mixer.dm"
#include "code\ATMOSPHERICS\components\trinary_devices\trinary_base.dm"
#include "code\ATMOSPHERICS\components\trinary_devices\tvalve.dm"
#include "code\ATMOSPHERICS\components\unary_devices\cold_sink.dm"
#include "code\ATMOSPHERICS\components\unary_devices\generator_input.dm"
#include "code\ATMOSPHERICS\components\unary_devices\heat_exchanger.dm"
#include "code\ATMOSPHERICS\components\unary_devices\heat_source.dm"
#include "code\ATMOSPHERICS\components\unary_devices\outlet_injector.dm"
#include "code\ATMOSPHERICS\components\unary_devices\oxygen_generator.dm"
#include "code\ATMOSPHERICS\components\unary_devices\passive_vent.dm"
#include "code\ATMOSPHERICS\components\unary_devices\portables_connector.dm"
#include "code\ATMOSPHERICS\components\unary_devices\tank.dm"
#include "code\ATMOSPHERICS\components\unary_devices\thermal_plate.dm"
#include "code\ATMOSPHERICS\components\unary_devices\thermomachine.dm"
#include "code\ATMOSPHERICS\components\unary_devices\unary_base.dm"
#include "code\ATMOSPHERICS\components\unary_devices\vent_pump.dm"
#include "code\ATMOSPHERICS\components\unary_devices\vent_scrubber.dm"
@@ -676,7 +675,6 @@
#include "code\game\machinery\firealarm.dm"
#include "code\game\machinery\flasher.dm"
#include "code\game\machinery\floodlight.dm"
#include "code\game\machinery\Freezer.dm"
#include "code\game\machinery\gameboard.dm"
#include "code\game\machinery\guestpass.dm"
#include "code\game\machinery\hologram.dm"
@@ -1,99 +0,0 @@
import { useBackend } from '../backend';
import { Box, Section, ProgressBar, Button, LabeledList, NumberInput, Flex } from '../components';
import { Window } from '../layouts';
export const GasFreezer = (props, context) => {
const { act, data } = useBackend(context);
const {
on,
pressure,
temperature,
temperatureCelsius,
min,
max,
target,
targetCelsius,
} = data;
const ratio = (temperature - min) / (max - min);
return (
<Window>
<Window.Content>
<Section title="Status" buttons={(
<Button
icon={on ? 'power-off' : 'times'}
content={on ? 'On' : 'Off'}
selected={on}
onClick={() => act('power')} />
)}>
<LabeledList>
<LabeledList.Item label="Pressure">
{pressure} kpA
</LabeledList.Item>
<LabeledList.Item label="Temperature">
<Flex direction="row" justify="space-between">
<Flex.Item width="70%">
<ProgressBar
value={ratio}
ranges={{
blue: [-Infinity, 0.5],
red: [0.5, Infinity],
}}>
&nbsp;
</ProgressBar>
</Flex.Item>
<Flex.Item width="30%">
{ratio < 0.5 && (
<Box inline color="blue" ml={1}>
{temperature} K ({temperatureCelsius}&deg;C)
</Box>
)}
{ratio >= 0.5 && (
<Box inline color="red" ml={1}>
{temperature} K ({temperatureCelsius}&deg;C)
</Box>
)}
</Flex.Item>
</Flex>
</LabeledList.Item>
<LabeledList.Item label="Target temperature">
<Flex direction="row">
<Flex.Item width="70%" justify="end">
<ProgressBar value={(target - min) / (max - min)}>
&nbsp;
</ProgressBar>
</Flex.Item>
<Flex.Item width="30%">
<Box inline ml={1}>{target} K ({targetCelsius}&deg;C)</Box>
</Flex.Item>
</Flex>
</LabeledList.Item>
<LabeledList.Item label="Set target temperature">
<Button
icon="fast-backward"
title="Minimum temperature"
onClick={() => act('temp', {
temp: min,
})} />
<NumberInput
value={Math.round(target)}
unit="K"
minValue={Math.round(min)}
maxValue={Math.round(max)}
step={5}
stepPixelSize={3}
onDrag={(e, value) => act('temp', {
temp: value,
})} />
<Button
icon="fast-forward"
title="Maximum Temperature"
onClick={() => act('temp', {
temp: max,
})} />
</LabeledList.Item>
</LabeledList>
</Section>
</Window.Content>
</Window>
);
};
@@ -0,0 +1,86 @@
import { toFixed } from 'common/math';
import { useBackend } from '../backend';
import { AnimatedNumber, Button, LabeledList, NumberInput, Section } from '../components';
import { Window } from '../layouts';
export const ThermoMachine = (props, context) => {
const { act, data } = useBackend(context);
return (
<Window>
<Window.Content>
<Section title="Status">
<LabeledList>
<LabeledList.Item label="Temperature">
<AnimatedNumber
value={data.temperature}
format={value => toFixed(value, 2)} />
{' K'}
</LabeledList.Item>
<LabeledList.Item label="Pressure">
<AnimatedNumber
value={data.pressure}
format={value => toFixed(value, 2)} />
{' kPa'}
</LabeledList.Item>
</LabeledList>
</Section>
<Section
title="Controls"
buttons={(
<Button
icon={data.on ? 'power-off' : 'times'}
content={data.on ? 'On' : 'Off'}
selected={data.on}
onClick={() => act('power')} />
)}>
<LabeledList>
<LabeledList.Item label="Setting">
<Button
icon={data.cooling ? 'temperature-low' : 'temperature-high'}
content={data.cooling ? 'Cooling' : 'Heating'}
selected={data.cooling}
onClick={() => act('cooling')} />
</LabeledList.Item>
<LabeledList.Item label="Target Temperature">
<NumberInput
animated
value={Math.round(data.target)}
unit="K"
width="62px"
minValue={Math.round(data.min)}
maxValue={Math.round(data.max)}
step={5}
stepPixelSize={3}
onDrag={(e, value) => act('target', {
target: value,
})} />
</LabeledList.Item>
<LabeledList.Item label="Presets">
<Button
icon="fast-backward"
disabled={data.target === data.min}
title="Minimum temperature"
onClick={() => act('target', {
target: data.min,
})} />
<Button
icon="sync"
disabled={data.target === data.initial}
title="Room Temperature"
onClick={() => act('target', {
target: data.initial,
})} />
<Button
icon="fast-forward"
disabled={data.target === data.max}
title="Maximum Temperature"
onClick={() => act('target', {
target: data.max,
})} />
</LabeledList.Item>
</LabeledList>
</Section>
</Window.Content>
</Window>
);
};
File diff suppressed because one or more lines are too long