GAGS coloring for Atmos that displays changes in temperature (#59924)

This PR adds temperature based coloring for atmos gas meters and freezers.

These values are based on the BODYTEMP icon warnings that you get when a room is too hot or too cold. There is also some minor code improvements where some of the icon heat and cold warnings were hardcoded values. I made this a constant in the __DEFINES.atmospherics.dm file that you can see below. These values have been applied to air alarms, thermomachines, gas meters, and species code.

This is a QoL update for atmos tech nerds. Instead of having to manually examine a gas meter or use an analyzer to determine what temperature is in the pipes you can rely on the colored icons to communicate that information rapidly. This should also help prevent harmful gas leaks where a person unwrenches a pipe without realizing there is hot gas inside it. And you should be able to troubleshoot a delaming SM faster and easier with these colors.
This commit is contained in:
Tim
2021-07-21 14:40:33 -07:00
committed by GitHub
parent 726d141c91
commit a455259b3f
10 changed files with 533 additions and 46 deletions
+14
View File
@@ -212,6 +212,20 @@
/// The modifier on cold damage hulks get.
#define HULK_COLD_DAMAGE_MOD 2
// Body temperature warning icons
/// The temperature the red icon is displayed.
#define BODYTEMP_HEAT_WARNING_3 (BODYTEMP_HEAT_DAMAGE_LIMIT + 360) //+700k
/// The temperature the orange icon is displayed.
#define BODYTEMP_HEAT_WARNING_2 (BODYTEMP_HEAT_DAMAGE_LIMIT + 120) //460K
/// The temperature the yellow icon is displayed.
#define BODYTEMP_HEAT_WARNING_1 (BODYTEMP_HEAT_DAMAGE_LIMIT) //340K
/// The temperature the light green icon is displayed.
#define BODYTEMP_COLD_WARNING_1 (BODYTEMP_COLD_DAMAGE_LIMIT) //270k
/// The temperature the cyan icon is displayed.
#define BODYTEMP_COLD_WARNING_2 (BODYTEMP_COLD_DAMAGE_LIMIT - 70) //200k
/// The temperature the blue icon is displayed.
#define BODYTEMP_COLD_WARNING_3 (BODYTEMP_COLD_DAMAGE_LIMIT - 150) //120k
/// what min_cold_protection_temperature is set to for space-helmet quality headwear. MUST NOT BE 0.
#define SPACE_HELM_MIN_TEMP_PROTECT 2.0
/// Thermal insulation works both ways /Malkevin
@@ -338,6 +338,16 @@
icon_file = 'icons/obj/stack_objects.dmi'
json_config = 'code/datums/greyscale/json_configs/wrap_paper.json'
/datum/greyscale_config/meter
name = "Meter"
icon_file = 'icons/obj/atmospherics/pipes/meter.dmi'
json_config = 'code/datums/greyscale/json_configs/meter.json'
/datum/greyscale_config/thermomachine
name = "Thermomachine"
icon_file = 'icons/obj/atmospherics/components/thermomachine.dmi'
json_config = 'code/datums/greyscale/json_configs/thermomachine.json'
/datum/greyscale_config/janicart_upgrade
name = "Janicart Upgrade"
icon_file = 'icons/obj/janicart_upgrade.dmi'
@@ -0,0 +1,375 @@
{
"meter": [
{
"type": "icon_state",
"icon_state": "pressure0",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
}
],
"meter0": [
{
"type": "icon_state",
"icon_state": "pressure0",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons0",
"blend_mode": "overlay"
}
],
"meter1_1": [
{
"type": "icon_state",
"icon_state": "pressure1_1",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons1",
"blend_mode": "overlay"
}
],
"meter1_2": [
{
"type": "icon_state",
"icon_state": "pressure1_2",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons1",
"blend_mode": "overlay"
}
],
"meter1_3": [
{
"type": "icon_state",
"icon_state": "pressure1_3",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons1",
"blend_mode": "overlay"
}
],
"meter1_4": [
{
"type": "icon_state",
"icon_state": "pressure1_4",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons1",
"blend_mode": "overlay"
}
],
"meter1_5": [
{
"type": "icon_state",
"icon_state": "pressure1_5",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons1",
"blend_mode": "overlay"
}
],
"meter1_6": [
{
"type": "icon_state",
"icon_state": "pressure1_6",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons1",
"blend_mode": "overlay"
}
],
"meter2_1": [
{
"type": "icon_state",
"icon_state": "pressure2_1",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons2",
"blend_mode": "overlay"
}
],
"meter2_2": [
{
"type": "icon_state",
"icon_state": "pressure2_2",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons2",
"blend_mode": "overlay"
}
],
"meter2_3": [
{
"type": "icon_state",
"icon_state": "pressure2_3",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons2",
"blend_mode": "overlay"
}
],
"meter2_4": [
{
"type": "icon_state",
"icon_state": "pressure2_4",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons2",
"blend_mode": "overlay"
}
],
"meter2_5": [
{
"type": "icon_state",
"icon_state": "pressure2_5",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons2",
"blend_mode": "overlay"
}
],
"meter2_6": [
{
"type": "icon_state",
"icon_state": "pressure2_6",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons2",
"blend_mode": "overlay"
}
],
"meter3_1": [
{
"type": "icon_state",
"icon_state": "pressure3_1",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons3",
"blend_mode": "overlay"
}
],
"meter3_2": [
{
"type": "icon_state",
"icon_state": "pressure3_2",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons3",
"blend_mode": "overlay"
}
],
"meter3_3": [
{
"type": "icon_state",
"icon_state": "pressure3_3",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons3",
"blend_mode": "overlay"
}
],
"meter3_4": [
{
"type": "icon_state",
"icon_state": "pressure3_4",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons3",
"blend_mode": "overlay"
}
],
"meter3_5": [
{
"type": "icon_state",
"icon_state": "pressure3_5",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons3",
"blend_mode": "overlay"
}
],
"meter3_6": [
{
"type": "icon_state",
"icon_state": "pressure3_6",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons3",
"blend_mode": "overlay"
}
],
"meter4": [
{
"type": "icon_state",
"icon_state": "pressure4",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "meter_base",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "buttons4",
"blend_mode": "overlay"
}
]
}
@@ -0,0 +1,59 @@
{
"thermo_0": [
{
"type": "icon_state",
"icon_state": "temp_meter",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "thermo_base",
"blend_mode": "overlay"
}
],
"thermo_1": [
{
"type": "icon_state",
"icon_state": "temp_meter_1",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "thermo_base_1",
"blend_mode": "overlay"
}
],
"thermo_1_blinking": [
{
"type": "icon_state",
"icon_state": "temp_meter_1",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "blinking",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "thermo_base_1",
"blend_mode": "overlay"
}
],
"thermo-open": [
{
"type": "icon_state",
"icon_state": "temp_meter-o",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "thermo_base-o",
"blend_mode": "overlay"
}
]
}
@@ -85,7 +85,7 @@
var/list/TLV = list( // Breathable air.
"pressure" = new/datum/tlv(HAZARD_LOW_PRESSURE, WARNING_LOW_PRESSURE, WARNING_HIGH_PRESSURE, HAZARD_HIGH_PRESSURE), // kPa. Values are min2, min1, max1, max2
"temperature" = new/datum/tlv(T0C, T0C+10, T0C+40, T0C+66),
"temperature" = new/datum/tlv(BODYTEMP_COLD_WARNING_1, BODYTEMP_COLD_WARNING_1+10, BODYTEMP_HEAT_WARNING_1-27, BODYTEMP_HEAT_WARNING_1),
/datum/gas/oxygen = new/datum/tlv(16, 19, 135, 140), // Partial pressure, kpa
/datum/gas/nitrogen = new/datum/tlv(-1, -1, 1000, 1000),
/datum/gas/carbon_dioxide = new/datum/tlv(-1, -1, 5, 10),
@@ -2,7 +2,7 @@
/obj/machinery/atmospherics/components/binary/thermomachine
icon = 'icons/obj/atmospherics/components/thermomachine.dmi'
icon_state = "freezer"
icon_state = "thermo_base"
name = "Temperature control unit"
desc = "Heats or cools gas in connected pipes."
@@ -19,11 +19,10 @@
vent_movement = NONE
pipe_flags = PIPING_ONE_PER_TURF
set_dir_on_move = FALSE
greyscale_config = /datum/greyscale_config/thermomachine
greyscale_colors = COLOR_VIBRANT_LIME
var/icon_state_off = "freezer"
var/icon_state_on = "freezer_1"
var/icon_state_open = "freezer-o"
set_dir_on_move = FALSE
var/min_temperature = T20C //actual temperature will be defined by RefreshParts() and by the cooling var
var/max_temperature = T20C //actual temperature will be defined by RefreshParts() and by the cooling var
@@ -81,35 +80,43 @@
/obj/machinery/atmospherics/components/binary/thermomachine/update_icon_state()
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"
switch(target_temperature)
if(BODYTEMP_HEAT_WARNING_3 to INFINITY)
greyscale_colors = COLOR_RED
if(BODYTEMP_HEAT_WARNING_2 to BODYTEMP_HEAT_WARNING_3)
greyscale_colors = COLOR_ORANGE
if(BODYTEMP_HEAT_WARNING_1 to BODYTEMP_HEAT_WARNING_2)
greyscale_colors = COLOR_YELLOW
if(BODYTEMP_COLD_WARNING_1 to BODYTEMP_HEAT_WARNING_1)
greyscale_colors = COLOR_VIBRANT_LIME
if(BODYTEMP_COLD_WARNING_2 to BODYTEMP_COLD_WARNING_1)
greyscale_colors = COLOR_CYAN
if(BODYTEMP_COLD_WARNING_3 to BODYTEMP_COLD_WARNING_2)
greyscale_colors = COLOR_BLUE
else
greyscale_colors = COLOR_VIOLET
set_greyscale(colors=greyscale_colors)
if(panel_open)
icon_state = icon_state_open
icon_state = "thermo-open"
return ..()
if(on && is_operational)
icon_state = icon_state_on
if(skipping_work)
icon_state = "thermo_1_blinking"
else
icon_state = "thermo_1"
return ..()
icon_state = icon_state_off
icon_state = "thermo_0"
return ..()
/obj/machinery/atmospherics/components/binary/thermomachine/update_overlays()
. = ..()
//Doesn't check if the pipes are intact
var/mutable_appearance/pipe_appearance1 = mutable_appearance('icons/obj/atmospherics/pipes/pipe_underlays.dmi', "intact_[dir]_[piping_layer]", layer = GAS_SCRUBBER_LAYER)
pipe_appearance1.color = COLOR_LIME
var/mutable_appearance/pipe_appearance2 = mutable_appearance('icons/obj/atmospherics/pipes/pipe_underlays.dmi', "intact_[turn(dir, 180)]_[piping_layer]", layer = GAS_SCRUBBER_LAYER)
pipe_appearance2.color = COLOR_MOSTLY_PURE_RED
. += pipe_appearance1
. += pipe_appearance2
if(skipping_work && on)
var/mutable_appearance/skipping = mutable_appearance(icon, "blinking")
. += skipping
if(!initial(icon))
return
var/mutable_appearance/thermo_overlay = new(initial(icon))
. += getpipeimage(thermo_overlay, "pipe", dir, COLOR_LIME, piping_layer)
. += getpipeimage(thermo_overlay, "pipe", turn(dir, 180), COLOR_MOSTLY_PURE_RED, piping_layer)
/obj/machinery/atmospherics/components/binary/thermomachine/examine(mob/user)
. = ..()
@@ -237,7 +244,7 @@
if(!anchored)
to_chat(user, span_notice("Anchor [src] first!"))
return
if(default_deconstruction_screwdriver(user, icon_state_open, icon_state_off, item))
if(default_deconstruction_screwdriver(user, "thermo-open", "thermo-0", item))
change_pipe_connection(panel_open)
return
if(default_change_direction_wrench(user, item))
@@ -451,15 +458,11 @@
. = ..()
/obj/machinery/atmospherics/components/binary/thermomachine/freezer
icon_state = "freezer"
icon_state_off = "freezer"
icon_state_on = "freezer_1"
icon_state_open = "freezer-o"
cooling = TRUE
/obj/machinery/atmospherics/components/binary/thermomachine/freezer/on
on = TRUE
icon_state = "freezer_1"
icon_state = "thermo_base_1"
/obj/machinery/atmospherics/components/binary/thermomachine/freezer/on/Initialize()
. = ..()
@@ -468,20 +471,19 @@
/obj/machinery/atmospherics/components/binary/thermomachine/freezer/on/coldroom
name = "Cold room temperature control unit"
icon_state = "thermo_base_1"
greyscale_colors = COLOR_CYAN
cooling = TRUE
/obj/machinery/atmospherics/components/binary/thermomachine/freezer/on/coldroom/Initialize()
. = ..()
target_temperature = COLD_ROOM_TEMP
/obj/machinery/atmospherics/components/binary/thermomachine/heater
icon_state = "heater"
icon_state_off = "heater"
icon_state_on = "heater_1"
icon_state_open = "heater-o"
cooling = FALSE
/obj/machinery/atmospherics/components/binary/thermomachine/heater/on
on = TRUE
icon_state = "heater_1"
icon_state = "thermo_base_1"
#undef THERMOMACHINE_SAFE_TEMPERATURE
@@ -2,7 +2,7 @@
name = "gas flow meter"
desc = "It measures something."
icon = 'icons/obj/atmospherics/pipes/meter.dmi'
icon_state = "meterX"
icon_state = "meter_base"
layer = HIGH_PIPE_LAYER
power_channel = AREA_USAGE_ENVIRON
use_power = IDLE_POWER_USE
@@ -13,6 +13,8 @@
var/frequency = 0
var/atom/target
var/target_layer = PIPING_LAYER_DEFAULT
greyscale_config = /datum/greyscale_config/meter
greyscale_colors = COLOR_GRAY
/obj/machinery/meter/atmos
frequency = FREQ_ATMOS_STORAGE
@@ -59,18 +61,22 @@
/obj/machinery/meter/process_atmos()
if(!(target?.flags_1 & INITIALIZED_1))
icon_state = "meterX"
icon_state = "meter0"
greyscale_colors = COLOR_GRAY
set_greyscale(colors=greyscale_colors)
return FALSE
if(machine_stat & (BROKEN|NOPOWER))
icon_state = "meter0"
icon_state = "meter"
greyscale_colors = COLOR_GRAY
set_greyscale(colors=greyscale_colors)
return FALSE
use_power(5)
var/datum/gas_mixture/environment = target.return_air()
if(!environment)
icon_state = "meterX"
icon_state = "meter0"
return FALSE
var/env_pressure = environment.return_pressure()
@@ -88,6 +94,27 @@
else
icon_state = "meter4"
var/env_temperature = environment.temperature
if(env_pressure == 0 || env_temperature == 0)
greyscale_colors = COLOR_GRAY
else
switch(env_temperature)
if(BODYTEMP_HEAT_WARNING_3 to INFINITY)
greyscale_colors = COLOR_RED
if(BODYTEMP_HEAT_WARNING_2 to BODYTEMP_HEAT_WARNING_3)
greyscale_colors = COLOR_ORANGE
if(BODYTEMP_HEAT_WARNING_1 to BODYTEMP_HEAT_WARNING_2)
greyscale_colors = COLOR_YELLOW
if(BODYTEMP_COLD_WARNING_1 to BODYTEMP_HEAT_WARNING_1)
greyscale_colors = COLOR_VIBRANT_LIME
if(BODYTEMP_COLD_WARNING_2 to BODYTEMP_COLD_WARNING_1)
greyscale_colors = COLOR_CYAN
if(BODYTEMP_COLD_WARNING_3 to BODYTEMP_COLD_WARNING_2)
greyscale_colors = COLOR_BLUE
else
greyscale_colors = COLOR_VIOLET
set_greyscale(colors=greyscale_colors)
if(frequency)
var/datum/radio_frequency/radio_connection = SSradio.return_frequency(frequency)
@@ -1683,9 +1683,9 @@ GLOBAL_LIST_EMPTY(roundstart_races)
humi.remove_movespeed_modifier(/datum/movespeed_modifier/cold)
// display alerts based on how hot it is
switch(humi.bodytemperature)
if(0 to 460)
if(bodytemp_heat_damage_limit to BODYTEMP_HEAT_WARNING_2)
humi.throw_alert("temp", /atom/movable/screen/alert/hot, 1)
if(461 to 700)
if(BODYTEMP_HEAT_WARNING_2 to BODYTEMP_HEAT_WARNING_3)
humi.throw_alert("temp", /atom/movable/screen/alert/hot, 2)
else
humi.throw_alert("temp", /atom/movable/screen/alert/hot, 3)
@@ -1699,9 +1699,9 @@ GLOBAL_LIST_EMPTY(roundstart_races)
humi.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/cold, multiplicative_slowdown = ((bodytemp_cold_damage_limit - humi.bodytemperature) / COLD_SLOWDOWN_FACTOR))
// Display alerts based how cold it is
switch(humi.bodytemperature)
if(201 to bodytemp_cold_damage_limit)
if(BODYTEMP_COLD_WARNING_2 to bodytemp_cold_damage_limit)
humi.throw_alert("temp", /atom/movable/screen/alert/cold, 1)
if(120 to 200)
if(BODYTEMP_COLD_WARNING_3 to BODYTEMP_COLD_WARNING_2)
humi.throw_alert("temp", /atom/movable/screen/alert/cold, 2)
else
humi.throw_alert("temp", /atom/movable/screen/alert/cold, 3)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 716 B

After

Width:  |  Height:  |  Size: 1.4 KiB