Fix rad damage blocking
Instead of trying to skip everything (and not updating stats), just set rate to 0.
This commit is contained in:
parent
10a447799b
commit
d9d33d1a4f
@ -151,11 +151,6 @@ local logbase = math_log(base)
|
|||||||
nodecore.register_playerstep({
|
nodecore.register_playerstep({
|
||||||
label = "lux rad scan",
|
label = "lux rad scan",
|
||||||
action = function(player, data, dtime)
|
action = function(player, data, dtime)
|
||||||
if not (nodecore.player_visible(player)
|
|
||||||
and nodecore.player_can_take_damage(player)) then
|
|
||||||
return nodecore.hud_set(player, {label = "radiation", ttl = 0})
|
|
||||||
end
|
|
||||||
|
|
||||||
local rad, setrad = radlevel(player)
|
local rad, setrad = radlevel(player)
|
||||||
local rate, setrate = radrate(player)
|
local rate, setrate = radrate(player)
|
||||||
|
|
||||||
@ -174,15 +169,20 @@ nodecore.register_playerstep({
|
|||||||
data.unradtime = data.unradtime - use
|
data.unradtime = data.unradtime - use
|
||||||
end
|
end
|
||||||
|
|
||||||
data.radtime = (data.radtime or 0) + dtime
|
if nodecore.player_can_take_damage(player)
|
||||||
if data.radtime > 1 then data.radtime = 1 end
|
and nodecore.player_visible(player) then
|
||||||
while data.radtime > 1/16 do
|
data.radtime = (data.radtime or 0) + dtime
|
||||||
data.radtime = data.radtime - 1/16
|
if data.radtime > 1 then data.radtime = 1 end
|
||||||
local inrate = (nodescan(player) + itemscan(player)) / 256
|
while data.radtime > 1/16 do
|
||||||
rate = (rate or 0) * 0.99 + inrate * 0.01
|
data.radtime = data.radtime - 1/16
|
||||||
if inrate > 0 and math_random() < inrate then
|
local inrate = (nodescan(player) + itemscan(player)) / 256
|
||||||
rad = 1 - (1 - rad) * 31/32
|
rate = (rate or 0) * 0.99 + inrate * 0.01
|
||||||
|
if inrate > 0 and math_random() < inrate then
|
||||||
|
rad = 1 - (1 - rad) * 31/32
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
rate = 0
|
||||||
end
|
end
|
||||||
setrate(rate)
|
setrate(rate)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user