mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-01-11 10:20:21 +01:00
added failsafe for suffocation value (true, false) instead of value
This commit is contained in:
parent
f98d769e15
commit
00e8ac0850
13
api.lua
13
api.lua
@ -6,7 +6,7 @@ local use_cmi = minetest.global_exists("cmi")
|
|||||||
|
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20200501",
|
version = "20200502",
|
||||||
intllib = S,
|
intllib = S,
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {}
|
invis = minetest.global_exists("invisibility") and invisibility or {}
|
||||||
}
|
}
|
||||||
@ -1018,13 +1018,20 @@ function mob_class:do_env_damage()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- suffocation inside solid node
|
--- suffocation inside solid node
|
||||||
if (self.suffocation ~= 0)
|
if (self.suffocation and self.suffocation ~= 0)
|
||||||
and (nodef.walkable == nil or nodef.walkable == true)
|
and (nodef.walkable == nil or nodef.walkable == true)
|
||||||
and (nodef.collision_box == nil or nodef.collision_box.type == "regular")
|
and (nodef.collision_box == nil or nodef.collision_box.type == "regular")
|
||||||
and (nodef.node_box == nil or nodef.node_box.type == "regular")
|
and (nodef.node_box == nil or nodef.node_box.type == "regular")
|
||||||
and (nodef.groups.disable_suffocation ~= 1) then
|
and (nodef.groups.disable_suffocation ~= 1) then
|
||||||
|
|
||||||
self.health = self.health - self.suffocation
|
local damage
|
||||||
|
if self.suffocation == true then
|
||||||
|
damage = 2
|
||||||
|
else
|
||||||
|
damage = (self.suffocation or 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.health = self.health - damage
|
||||||
|
|
||||||
if self:check_for_death({type = "suffocation",
|
if self:check_for_death({type = "suffocation",
|
||||||
pos = pos, node = self.standing_in}) then return true end
|
pos = pos, node = self.standing_in}) then return true end
|
||||||
|
Loading…
Reference in New Issue
Block a user