mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 03:27:05 +01:00
Adds a cache to radiation waves (#30261)
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user