Update radiation.lua

Shouldn't the resistance cache be initialized before the node_radiation_resistance function?
This commit is contained in:
DustyDave961 2024-11-20 13:08:00 -06:00 committed by GitHub
parent feb853c715
commit 28a906863d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -185,6 +185,7 @@ technic.register_group_resistance("tree", 3.4)
technic.register_group_resistance("uranium_block", 500) technic.register_group_resistance("uranium_block", 500)
technic.register_group_resistance("wood", 1.7) technic.register_group_resistance("wood", 1.7)
--Radiation resistances cache
technic.resistance_cache = {} technic.resistance_cache = {}
function technic.cache_resistances() function technic.cache_resistances()
@ -197,6 +198,8 @@ function technic.cache_resistances()
end end
end end
technic.cache_resistances()
local function node_radiation_resistance(node_name) local function node_radiation_resistance(node_name)
local cached_resistance = technic.resistance_cache[node_name] local cached_resistance = technic.resistance_cache[node_name]
if cached_resistance then if cached_resistance then
@ -206,9 +209,6 @@ local function node_radiation_resistance(node_name)
end end
end end
-- Initialize cache
technic.cache_resistances()
--[[ --[[
Radioactive nodes cause damage to nearby players. The damage Radioactive nodes cause damage to nearby players. The damage
effect depends on the intrinsic strength of the radiation source, effect depends on the intrinsic strength of the radiation source,