1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2024-11-13 05:50:17 +01:00

tweak damage

This commit is contained in:
tenplus1 2024-08-23 15:07:08 +01:00
parent dce2abfcfe
commit 29314186b3

13
api.lua
View File

@ -18,7 +18,7 @@ end
mobs = {
mod = "redo",
version = "20240810",
version = "20240823",
spawning_mobs = {},
translate = S,
invis = minetest.global_exists("invisibility") and invisibility or {},
@ -1011,7 +1011,7 @@ function mob_class:do_env_damage()
local py = {x = pos.x, y = pos.y + prop.collisionbox[5], z = pos.z}
local nodef = minetest.registered_nodes[self.standing_in]
-- water
-- water damage
if self.water_damage ~= 0 and nodef.groups.water then
self.health = self.health - self.water_damage
@ -1020,9 +1020,10 @@ function mob_class:do_env_damage()
if self:check_for_death({type = "environment",
pos = pos, node = self.standing_in}) then return true end
end
-- lava damage
elseif self.lava_damage ~= 0 and self:is_inside("group:lava") then
if self.lava_damage ~= 0 and nodef.groups.lava then
self.health = self.health - self.lava_damage
@ -1030,9 +1031,10 @@ function mob_class:do_env_damage()
if self:check_for_death({type = "environment", pos = pos,
node = self.standing_in, hot = true}) then return true end
end
-- fire damage
elseif self.fire_damage ~= 0 and self:is_inside("group:fire") then
if self.fire_damage ~= 0 and nodef.groups.fire then
self.health = self.health - self.fire_damage
@ -1040,9 +1042,10 @@ function mob_class:do_env_damage()
if self:check_for_death({type = "environment", pos = pos,
node = self.standing_in, hot = true}) then return true end
end
-- damage_per_second node check (not fire and lava)
elseif self.node_damage and nodef.damage_per_second and nodef.damage_per_second ~= 0
if self.node_damage and nodef.damage_per_second and nodef.damage_per_second ~= 0
and nodef.groups.lava == nil and nodef.groups.fire == nil then
self.health = self.health - nodef.damage_per_second