Fix rad damage blocking

Instead of trying to skip everything (and not
updating stats), just set rate to 0.
This commit is contained in:
Aaron Suen 2022-01-22 22:17:35 -05:00
parent 10a447799b
commit d9d33d1a4f

View File

@ -151,11 +151,6 @@ local logbase = math_log(base)
nodecore.register_playerstep({
label = "lux rad scan",
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 rate, setrate = radrate(player)
@ -174,6 +169,8 @@ nodecore.register_playerstep({
data.unradtime = data.unradtime - use
end
if nodecore.player_can_take_damage(player)
and nodecore.player_visible(player) then
data.radtime = (data.radtime or 0) + dtime
if data.radtime > 1 then data.radtime = 1 end
while data.radtime > 1/16 do
@ -184,6 +181,9 @@ nodecore.register_playerstep({
rad = 1 - (1 - rad) * 31/32
end
end
else
rate = 0
end
setrate(rate)
data.radhudtime = (data.radhudtime or 0) + dtime * 2