Skip to content
Merged
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
10 changes: 10 additions & 0 deletions __DEFINES/gases.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@
#define GAS_VOLATILE "volatile_fuel"
#define GAS_OXAGENT "oxygen_agent_b"
#define GAS_RADON "radon"

#define SHOW_PLASMA 1
#define SHOW_SLEEPING 2
#define SHOW_CRYOTHEUM 4

var/static/list/gas2show = list(
GAS_PLASMA = SHOW_PLASMA,
GAS_SLEEPING = SHOW_SLEEPING,
GAS_CRYOTHEUM = SHOW_CRYOTHEUM,
)
35 changes: 22 additions & 13 deletions code/modules/ZAS/Turf.dm
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
/turf/simulated/var/zone/zone
/turf/simulated/var/open_directions

/turf/var/needs_air_update = 0
/turf/var/datum/gas_mixture/air

/turf/var/tmp/list/connection/connections

/turf/simulated/proc/update_graphic(list/graphic_add = null, list/graphic_remove = null)
if(graphic_add && graphic_add.len)
vis_contents += graphic_add
if(graphic_remove && graphic_remove.len)
vis_contents -= graphic_remove
/turf/simulated
var/zone/zone
var/open_directions
var/gases_shown = 0

/turf
var/needs_air_update = 0
var/datum/gas_mixture/air
var/tmp/list/connection/connections

/turf/simulated/proc/update_graphic(graphic_add = 0, graphic_remove = 0)
if(graphic_add || graphic_remove)
if(graphic_add)
gases_shown |= graphic_add
if(graphic_remove)
gases_shown &= ~graphic_remove
for(var/gaslist in XGM.tile_overlay)
for(var/gas_overlay in XGM.tile_overlay[gaslist])
vis_contents -= gas_overlay
for(var/overlay in gas2show)
if(gases_shown & gas2show[overlay])
vis_contents += pick(XGM.tile_overlay[overlay])

/turf/proc/update_air_properties()
var/block = c_airblock(src)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/ZAS/XGM.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
specific_heat[gas.id] = gas.specific_heat
molar_mass[gas.id] = gas.molar_mass
flags[gas.id] = gas.flags
if(gas.tile_overlay)
if(gas.tile_overlay?.len)
tile_overlay[gas.id] = gas.tile_overlay
if(isnum(gas.overlay_limit))
overlay_limit[gas.id] = gas.overlay_limit
Expand Down
50 changes: 46 additions & 4 deletions code/modules/ZAS/XGM_gases.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
var/specific_heat = 20 // J/(mol*K)
var/molar_mass = 0.032 // kg/mol

var/tile_overlay = null //The overlay to draw over tiles containing this gas if it is visible. Can be anything that the overlays list will accept.
var/list/tile_overlay = null //The overlay to draw over tiles containing this gas if it is visible. Can be anything that the overlays list will accept.
var/overlay_limit = null //If the molar_density of this gas in a zone is strictly greater than this number, it is visible.

var/flags = 0
Expand Down Expand Up @@ -70,7 +70,11 @@
//and following a N/Z ratio of 1.5, the molar mass of a monatomic gas is:
molar_mass = 0.405 // kg/mol

tile_overlay = new /obj/effect/overlay/gas_overlay/plasma()
tile_overlay = newlist(
/obj/effect/overlay/gas_overlay/plasma,
/obj/effect/overlay/gas_overlay/plasma/two,
/obj/effect/overlay/gas_overlay/plasma/three
)
overlay_limit = MOLES_PLASMA_VISIBLE / CELL_VOLUME
flags = XGM_GAS_NOTEWORTHY | XGM_GAS_LOGGED

Expand All @@ -81,14 +85,24 @@
name = "plasma"
icon_state = "plasma"

/obj/effect/overlay/gas_overlay/plasma/two
icon_state = "plasma2"

/obj/effect/overlay/gas_overlay/plasma/three
icon_state = "plasma3"

/datum/gas/sleeping_agent
id = GAS_SLEEPING
name = "Sleeping Agent"
short_name = "N<sub>2</sub>O"
specific_heat = 40 // J/(mol*K)
molar_mass = 0.044 // kg/mol. N鈧侽

tile_overlay = new /obj/effect/overlay/gas_overlay/sleeping_agent()
tile_overlay = newlist(
/obj/effect/overlay/gas_overlay/sleeping_agent,
/obj/effect/overlay/gas_overlay/sleeping_agent/two,
/obj/effect/overlay/gas_overlay/sleeping_agent/three
)
overlay_limit = 1 / CELL_VOLUME
flags = XGM_GAS_NOTEWORTHY | XGM_GAS_LOGGED

Expand All @@ -99,6 +113,12 @@
name = "sleeping agent"
icon_state = "sleeping_agent"

/obj/effect/overlay/gas_overlay/sleeping_agent/two
icon_state = "sleeping_agent2"

/obj/effect/overlay/gas_overlay/sleeping_agent/three
icon_state = "sleeping_agent3"

/datum/gas/volatile_fuel
id = GAS_VOLATILE
name = "Volatile Fuel"
Expand Down Expand Up @@ -133,7 +153,14 @@

molar_mass = 0.032

tile_overlay = new /obj/effect/overlay/gas_overlay/cryotheum()
tile_overlay = newlist(
/obj/effect/overlay/gas_overlay/cryotheum,
/obj/effect/overlay/gas_overlay/cryotheum/two,
/obj/effect/overlay/gas_overlay/cryotheum/three,
/obj/effect/overlay/gas_overlay/cryotheum/four,
/obj/effect/overlay/gas_overlay/cryotheum/five,
/obj/effect/overlay/gas_overlay/cryotheum/six
)
overlay_limit = MOLES_CRYOTHEUM_VISIBLE / CELL_VOLUME
flags = XGM_GAS_NOTEWORTHY | XGM_GAS_LOGGED

Expand All @@ -144,6 +171,21 @@
name = "cryotheum"
icon_state = "cryotheum"

/obj/effect/overlay/gas_overlay/cryotheum/two
icon_state = "cryotheum2"

/obj/effect/overlay/gas_overlay/cryotheum/three
icon_state = "cryotheum3"

/obj/effect/overlay/gas_overlay/cryotheum/four
icon_state = "cryotheum4"

/obj/effect/overlay/gas_overlay/cryotheum/five
icon_state = "cryotheum5"

/obj/effect/overlay/gas_overlay/cryotheum/six
icon_state = "cryotheum6"

/datum/gas/radon
id = GAS_RADON
name = "Radon"
Expand Down
43 changes: 34 additions & 9 deletions code/modules/ZAS/Zone.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ Class Procs:
var/list/edges = list()
var/datum/gas_mixture/air = new

var/list/graphic_add = list()
var/list/graphic_remove = list()
//Flags of active tile overlays for this zone. Updated by check_tile_graphic()
var/graphic = 0

var/graphic_add = 0
var/graphic_remove = 0

#ifdef ZAS_COLOR
var/turf_color
Expand Down Expand Up @@ -80,7 +83,7 @@ Class Procs:
air.merge(turf_air)
T.zone = src
contents += T
T.update_graphic(air.graphic)
T.update_graphic(graphic)
#ifdef ZAS_COLOR
T.color = turf_color
#endif
Expand All @@ -100,7 +103,7 @@ Class Procs:
air.volume -= turf_air.volume
air.update_values()
contents -= T
T.update_graphic(graphic_remove = air.graphic)
T.update_graphic(graphic_remove = graphic)
#ifdef ZAS_COLOR
T.color = null
#endif
Expand All @@ -117,7 +120,7 @@ Class Procs:
#endif
c_invalidate()
for(var/turf/simulated/T in contents)
T.update_graphic(graphic_remove = air.graphic)
T.update_graphic(graphic_remove = graphic)
into.add(T)
#ifdef ZASDBG
T.dbg(merged)
Expand Down Expand Up @@ -145,7 +148,7 @@ Class Procs:
return //Short circuit for explosions where rebuild is called many times over.
c_invalidate()
for(var/turf/simulated/T in contents)
T.update_graphic(graphic_remove = air.graphic) //we need to remove the overlays so they're not doubled when the zone is rebuilt
T.update_graphic(graphic_remove = graphic) //we need to remove the overlays so they're not doubled when the zone is rebuilt
#ifdef ZAS_COLOR
T.color = null
#endif
Expand All @@ -171,16 +174,38 @@ Class Procs:
/zone/proc/tick()
check_for_events()
air.reaction_tick()
if(air.check_tile_graphic(graphic_add, graphic_remove))
if(check_tile_graphic())
for(var/turf/simulated/T in contents)
T.update_graphic(graphic_add, graphic_remove)
graphic_add.len = 0
graphic_remove.len = 0
graphic_add = 0
graphic_remove = 0

for(var/connection_edge/E in edges)
if(E.sleeping)
E.recheck()

//Rechecks the gas_mixture and adjusts the graphic list if needed.
/zone/proc/check_tile_graphic()
for(var/g in XGM.overlay_limit)
if(g in gas2show)
if(graphic & gas2show[g])
//Overlay is already applied for this gas, check if it's still valid.
if(air.molar_density(g) <= XGM.overlay_limit[g])
graphic_remove |= gas2show[g]
else
//Overlay isn't applied for this gas, check if it's valid and needs to be added.
if(air.molar_density(g) > XGM.overlay_limit[g])
graphic_add |= gas2show[g]

. = 0
//Apply changes
if(graphic_add)
graphic |= graphic_add
. = 1
if(graphic_remove)
graphic &= ~graphic_remove
. = 1

/zone/proc/dbg_data(mob/M)
to_chat(M, name)
to_chat(M, "O2: [air[GAS_OXYGEN]] N2: [air[GAS_NITROGEN]] CO2: [air[GAS_CARBON]] P: [air[GAS_PLASMA]]")
Expand Down
29 changes: 0 additions & 29 deletions code/modules/ZAS/_gas_mixture.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

var/temperature = 0 //in Kelvin

//List of active tile overlays for this gas_mixture. Updated by check_tile_graphic()
var/list/graphic = list()

var/pressure = 0

var/tmp/fuel_burnt = 0
Expand Down Expand Up @@ -307,32 +304,6 @@
//Procedures used for very specific events//
////////////////////////////////////////////

//Rechecks the gas_mixture and adjusts the graphic list if needed.
//Two lists can be passed by reference if you need know specifically which graphics were added and removed.
/datum/gas_mixture/proc/check_tile_graphic(list/graphic_add = null, list/graphic_remove = null)
for(var/g in XGM.overlay_limit)
if(graphic.Find(XGM.tile_overlay[g]))
//Overlay is already applied for this gas, check if it's still valid.
if(molar_density(g) <= XGM.overlay_limit[g])
if(!graphic_remove)
graphic_remove = list()
graphic_remove += XGM.tile_overlay[g]
else
//Overlay isn't applied for this gas, check if it's valid and needs to be added.
if(molar_density(g) > XGM.overlay_limit[g])
if(!graphic_add)
graphic_add = list()
graphic_add += XGM.tile_overlay[g]

. = 0
//Apply changes
if(graphic_add && graphic_add.len)
graphic += graphic_add
. = 1
if(graphic_remove && graphic_remove.len)
graphic -= graphic_remove
. = 1

/datum/gas_mixture/proc/react(atom/dump_location)
//Purpose: Calculating if it is possible for a fire to occur in the airmix
//Called by: Air mixes updating?
Expand Down
Binary file modified icons/effects/tile_effects.dmi
Binary file not shown.
Loading