Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions code/game/objects/items/tanks/tank_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/obj/item/tank/internals/oxygen
name = "oxygen tank"
desc = "A tank of oxygen, this one is blue."
icon = 'mod_celadon/_storage_icons/icons/items/misc/tank.dmi'
icon_state = "oxygen"
distribute_pressure = TANK_DEFAULT_RELEASE_PRESSURE
force = 10
Expand Down Expand Up @@ -42,6 +43,7 @@
/obj/item/tank/internals/anesthetic
name = "anesthetic tank"
desc = "A tank with an N2O/O2 gas mix."
icon = 'mod_celadon/_storage_icons/icons/items/misc/tank.dmi'
icon_state = "anesthetic"
item_state = "an_tank"
force = 10
Expand Down Expand Up @@ -78,6 +80,7 @@
/obj/item/tank/internals/plasmaman
name = "plasma internals tank"
desc = "A tank of plasma gas designed specifically for use as internals, particularly for plasma-based lifeforms. If you're not a Plasmaman, you probably shouldn't use this."
icon = 'mod_celadon/_storage_icons/icons/items/misc/tank.dmi'
icon_state = "plasmaman_tank"
item_state = "plasmaman_tank"
force = 10
Expand Down Expand Up @@ -112,6 +115,7 @@
/obj/item/tank/internals/emergency_oxygen
name = "emergency oxygen tank"
desc = "Used for emergencies. Contains very little oxygen, so try to conserve it until you actually need it."
icon = 'mod_celadon/_storage_icons/icons/items/misc/tank.dmi'
icon_state = "emergency"
flags_1 = CONDUCT_1
slot_flags = ITEM_SLOT_BELT
Expand Down Expand Up @@ -151,6 +155,7 @@
/obj/item/tank/internals/generic
name = "gas tank"
desc = "A generic tank used for storing and transporting gasses. Can be used for internals."
icon = 'mod_celadon/_storage_icons/icons/items/misc/tank.dmi'
icon_state = "generic"
distribute_pressure = TANK_DEFAULT_RELEASE_PRESSURE
force = 10
Expand Down
75 changes: 75 additions & 0 deletions code/game/objects/items/tanks/tanks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
var/integrity = 3
var/volume = 70

//Alert variables
var/warning_alert = FALSE
var/critical_warning_alert = FALSE
var/empty_alert = FALSE

supports_variations = VOX_VARIATION

/obj/item/tank/ui_action_click(mob/user)
Expand Down Expand Up @@ -71,8 +76,11 @@

populate_gas()

update_appearance(UPDATE_OVERLAYS)
START_PROCESSING(SSobj, src)

addtimer(CALLBACK(src, PROC_REF(pressure_alerts)), 5 SECONDS, TIMER_STOPPABLE|TIMER_LOOP|TIMER_DELETE_ME)

/obj/item/tank/proc/populate_gas()
return

Expand Down Expand Up @@ -222,6 +230,33 @@
air_contents.react()
check_status()

/obj/item/tank/update_overlays()
. = ..()
var/status_overlay_icon_state
var/pressure = air_contents.return_pressure()

// Switches the pressure status overlay depending on which range the tank pressure lies in
switch(pressure)
if((5 * ONE_ATMOSPHERE) to (29 * ONE_ATMOSPHERE))
status_overlay_icon_state = "status_nominal"
if((2 * ONE_ATMOSPHERE) to (5 * ONE_ATMOSPHERE))
status_overlay_icon_state = "status_warning"
if((0.75 * ONE_ATMOSPHERE) to (2 * ONE_ATMOSPHERE))
status_overlay_icon_state = "status_alert"
if((0.1 * ONE_ATMOSPHERE) to (0.75 * ONE_ATMOSPHERE))
status_overlay_icon_state = "status_critical"
else
status_overlay_icon_state = null

// Actually sets the overlay. As of now, this has only been done for smaller emergency tanks
// The if statement is set as follows due to the coarse search type that the istype proc conducts, as subtypes count as valid types
var/mutable_appearance/status_overlay = mutable_appearance(icon, status_overlay_icon_state)

if(istype(src, /obj/item/tank/internals/emergency_oxygen/double))
status_overlay.pixel_x = 1
status_overlay.pixel_y = 2
. += status_overlay

/obj/item/tank/proc/check_status()
//Handle exploding, leaking, and rupturing of the tank

Expand Down Expand Up @@ -270,3 +305,43 @@

else if(integrity < 3)
integrity++

// adjusts sprites and issues text alerts depending on tank pressure
/obj/item/tank/proc/pressure_alerts()

var/pressure = air_contents.return_pressure()

// Prevents jetpacks from sending any kind of pressure alert
if(istype(src, /obj/item/tank/jetpack))
return 0

// Prevents newly printed tanks from beeping out an alert
if(!air_contents || pressure == 0)
warning_alert = TRUE
critical_warning_alert = TRUE
empty_alert = TRUE
return 0

// Checks the pressure of the tank while it's in use and sends an alert out when the pressure reaches a specific range.
// Binary variables are used here to prevent an alert from repeating more than once
switch(pressure)
if((5 * ONE_ATMOSPHERE) to (20 * ONE_ATMOSPHERE))
warning_alert = FALSE
critical_warning_alert = FALSE
empty_alert = FALSE
if((2 * ONE_ATMOSPHERE) to (5 * ONE_ATMOSPHERE))
if(!warning_alert)
warning_alert = TRUE
if((0.75 * ONE_ATMOSPHERE) to (2 * ONE_ATMOSPHERE))
if(!critical_warning_alert)
critical_warning_alert = TRUE
playsound(src, 'sound/machines/twobeep_high.ogg', 30, FALSE)
say("Tank is at [pressure] kPa! Pressure critically low! -- Estimated time until depletion: [src.volume * 2.5] minutes.")
if(0 to (0.75 * ONE_ATMOSPHERE))
if(!empty_alert)
empty_alert = TRUE
playsound(src, 'sound/machines/twobeep_high.ogg', 30, FALSE)
playsound(src, 'sound/machines/beep.ogg', 30, FALSE)
say("Tank is nearly empty! Replacement recommended!")

update_appearance(UPDATE_OVERLAYS)
Binary file modified mod_celadon/_storage_icons/icons/items/misc/tank.dmi
Binary file not shown.