mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 11:37:40 +01:00
Fixes radiation hud (#18703)
This commit is contained in:
@@ -8,6 +8,8 @@ PROCESSING_SUBSYSTEM_DEF(radiation)
|
||||
// turf_rad_cache is the state in the current loop, and may not be 100% representative
|
||||
// until processing is complete.
|
||||
// prev_rad_cache is the fully evaluated radiation state cache from the previous tick.
|
||||
var/last_rad_cache_update = 0
|
||||
var/rad_cache_update_interval = 5 SECONDS
|
||||
var/list/turf_rad_cache = list()
|
||||
var/list/prev_rad_cache = list()
|
||||
|
||||
@@ -25,7 +27,9 @@ PROCESSING_SUBSYSTEM_DEF(radiation)
|
||||
master.investigate_log(msg, "radiation")
|
||||
|
||||
/datum/controller/subsystem/processing/radiation/fire(resumed)
|
||||
refresh_rad_cache()
|
||||
if(world.time > last_rad_cache_update + rad_cache_update_interval)
|
||||
refresh_rad_cache()
|
||||
last_rad_cache_update = world.time
|
||||
. = ..()
|
||||
|
||||
/datum/controller/subsystem/processing/radiation/proc/get_turf_radiation(turf/place)
|
||||
@@ -37,12 +41,13 @@ PROCESSING_SUBSYSTEM_DEF(radiation)
|
||||
/datum/controller/subsystem/processing/radiation/proc/update_rad_cache(datum/component/radioactive/thing)
|
||||
var/atom/owner = thing.parent
|
||||
var/turf/place = get_turf(owner)
|
||||
if (turf_rad_cache[place])
|
||||
if(turf_rad_cache[place])
|
||||
turf_rad_cache[place] += thing.strength
|
||||
else
|
||||
turf_rad_cache[place] = thing.strength
|
||||
|
||||
|
||||
/datum/controller/subsystem/processing/radiation/proc/refresh_rad_cache()
|
||||
prev_rad_cache = turf_rad_cache.Copy()
|
||||
prev_rad_cache.Cut()
|
||||
prev_rad_cache = turf_rad_cache
|
||||
turf_rad_cache = list()
|
||||
|
||||
Reference in New Issue
Block a user