Adds a cache to radiation waves (#30261)

This commit is contained in:
Migratingcocofruit
2025-09-14 20:31:30 +00:00
committed by GitHub
parent 12c3f5afe2
commit 379fa1ad1e
2 changed files with 8 additions and 5 deletions
+6 -5
View File
@@ -1,3 +1,4 @@
GLOBAL_LIST_INIT(turf_rad_item_cache, list("[ALPHA_RAD]" = list(), "[BETA_RAD]" = list(), "[GAMMA_RAD]" = list()))
#define WRAP_INDEX(index, length)((index - 1) % length + 1)
/datum/radiation_wave
@@ -83,11 +84,11 @@
/// Calls rad act on each relevant atom in the turf and returns the resulting weight for that tile after reduction by insulation
/datum/radiation_wave/proc/radiate(atom/source, turf/current_turf, weight, emission_type)
var/list/turf_atoms = list()
if(length(current_turf.contents))
turf_atoms = get_rad_contents(current_turf, emission_type)
else
turf_atoms = list(current_turf)
// populate cache if needed
if(!GLOB.turf_rad_item_cache["[emission_type]"][current_turf])
GLOB.turf_rad_item_cache["[emission_type]"][current_turf] = get_rad_contents(current_turf, emission_type)
var/list/turf_atoms = GLOB.turf_rad_item_cache["[emission_type]"][current_turf]
for(var/k in turf_atoms)
var/atom/thing = k
if(QDELETED(thing))