mirror of
https://github.com/minetest-mods/technic.git
synced 2025-02-23 07:10:19 +01:00
parent
690b514277
commit
3a326899d9
@ -32,6 +32,7 @@ Recommended mods that build on the `technic mod`:
|
||||
* **technic.quarry.maxdepth** max depth of the quarry (default: 100)
|
||||
* **technic.switch_max_range** max cable length (default: 256)
|
||||
* **technic.switch.off_delay_seconds** switching station off delay (default: 300 seconds)
|
||||
* **technic.radiation.enable_throttling** enable lag- and per-second-trottling of radiation damage
|
||||
|
||||
# Chat commands
|
||||
|
||||
|
@ -347,19 +347,24 @@ local function dmg_object(pos, object, strength)
|
||||
end
|
||||
end
|
||||
|
||||
local enable_radiation_throttling = minetest.settings:get_bool("technic.radiation.enable_throttling")
|
||||
|
||||
-- max lag tracker
|
||||
local last_max_lag = 0
|
||||
local function trackMaxLag()
|
||||
|
||||
if enable_radiation_throttling then
|
||||
local function trackMaxLag()
|
||||
last_max_lag = technic.get_max_lag()
|
||||
minetest.after(5, trackMaxLag)
|
||||
end
|
||||
end
|
||||
|
||||
-- kick off lag tracking function
|
||||
trackMaxLag()
|
||||
-- kick off lag tracking function
|
||||
trackMaxLag()
|
||||
end
|
||||
|
||||
local rad_dmg_mult_sqrt = math.sqrt(1 / rad_dmg_cutoff)
|
||||
local function dmg_abm(pos, node)
|
||||
if last_max_lag > 1.5 then
|
||||
if enable_radiation_throttling and last_max_lag > 1.5 then
|
||||
-- too much lag, skip radiation check entirely
|
||||
return
|
||||
end
|
||||
@ -375,12 +380,16 @@ local function dmg_abm(pos, node)
|
||||
end
|
||||
|
||||
if minetest.settings:get_bool("enable_damage") then
|
||||
if enable_radiation_throttling then
|
||||
dmg_abm = throttle(100, dmg_abm)
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Radiation damage",
|
||||
nodenames = {"group:radioactive"},
|
||||
interval = 1,
|
||||
chance = 2,
|
||||
action = throttle(100, dmg_abm),
|
||||
action = dmg_abm,
|
||||
})
|
||||
|
||||
if longterm_damage then
|
||||
|
Loading…
x
Reference in New Issue
Block a user