mirror of
https://github.com/minetest-mods/technic.git
synced 2025-02-23 15:20: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.quarry.maxdepth** max depth of the quarry (default: 100)
|
||||||
* **technic.switch_max_range** max cable length (default: 256)
|
* **technic.switch_max_range** max cable length (default: 256)
|
||||||
* **technic.switch.off_delay_seconds** switching station off delay (default: 300 seconds)
|
* **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
|
# Chat commands
|
||||||
|
|
||||||
|
@ -347,8 +347,12 @@ local function dmg_object(pos, object, strength)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local enable_radiation_throttling = minetest.settings:get_bool("technic.radiation.enable_throttling")
|
||||||
|
|
||||||
-- max lag tracker
|
-- max lag tracker
|
||||||
local last_max_lag = 0
|
local last_max_lag = 0
|
||||||
|
|
||||||
|
if enable_radiation_throttling then
|
||||||
local function trackMaxLag()
|
local function trackMaxLag()
|
||||||
last_max_lag = technic.get_max_lag()
|
last_max_lag = technic.get_max_lag()
|
||||||
minetest.after(5, trackMaxLag)
|
minetest.after(5, trackMaxLag)
|
||||||
@ -356,10 +360,11 @@ end
|
|||||||
|
|
||||||
-- kick off lag tracking function
|
-- kick off lag tracking function
|
||||||
trackMaxLag()
|
trackMaxLag()
|
||||||
|
end
|
||||||
|
|
||||||
local rad_dmg_mult_sqrt = math.sqrt(1 / rad_dmg_cutoff)
|
local rad_dmg_mult_sqrt = math.sqrt(1 / rad_dmg_cutoff)
|
||||||
local function dmg_abm(pos, node)
|
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
|
-- too much lag, skip radiation check entirely
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -375,12 +380,16 @@ local function dmg_abm(pos, node)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if minetest.settings:get_bool("enable_damage") then
|
if minetest.settings:get_bool("enable_damage") then
|
||||||
|
if enable_radiation_throttling then
|
||||||
|
dmg_abm = throttle(100, dmg_abm)
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Radiation damage",
|
label = "Radiation damage",
|
||||||
nodenames = {"group:radioactive"},
|
nodenames = {"group:radioactive"},
|
||||||
interval = 1,
|
interval = 1,
|
||||||
chance = 2,
|
chance = 2,
|
||||||
action = throttle(100, dmg_abm),
|
action = dmg_abm,
|
||||||
})
|
})
|
||||||
|
|
||||||
if longterm_damage then
|
if longterm_damage then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user