Support negative damage_per_second values

This commit is contained in:
Wuzzy 2024-11-27 20:57:38 +01:00
parent d9acd10977
commit cba746e669

View File

@ -625,11 +625,18 @@ doc.add_category("nodes", {
--- Direct interaction with the player
---- Damage (very important)
if not forbidden_core_factoids.node_damage then
if data.def.damage_per_second ~= nil and data.def.damage_per_second > 1 then
if data.def.damage_per_second ~= nil then
if data.def.damage_per_second > 1 then
datastring = datastring .. S("This block causes a damage of @1 hit points per second.", data.def.damage_per_second) .. "\n"
elseif data.def.damage_per_second == 1 then
datastring = datastring .. S("This block causes a damage of @1 hit point per second.", data.def.damage_per_second) .. "\n"
elseif data.def.damage_per_second == -1 then
datastring = datastring .. S("This block heals @1 hit point per second.", math.abs(data.def.damage_per_second)) .. "\n"
elseif data.def.damage_per_second < -1 then
datastring = datastring .. S("This block heals @1 hit points per second.", math.abs(data.def.damage_per_second)) .. "\n"
end
end
if data.def.drowning then
if data.def.drowning > 1 then
datastring = datastring .. S("This block decreases your breath and causes a drowning damage of @1 hit points every 2 seconds.", data.def.drowning) .. "\n"