return actual damage position (created particle py), check for nil damage groups
This commit is contained in:
parent
c06d071220
commit
f6e16a5503
22
api.lua
22
api.lua
@ -8,7 +8,7 @@ local use_cmi = minetest.global_exists("cmi")
|
|||||||
|
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20210407",
|
version = "20210411",
|
||||||
intllib = S,
|
intllib = S,
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {}
|
invis = minetest.global_exists("invisibility") and invisibility or {}
|
||||||
}
|
}
|
||||||
@ -1070,7 +1070,11 @@ function mob_class:do_env_damage()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- particle appears at random mob height
|
-- particle appears at random mob height
|
||||||
pos.y = pos.y + random(self.collisionbox[2], self.collisionbox[5])
|
local py = {
|
||||||
|
x = pos.x,
|
||||||
|
y = pos.y + random(self.collisionbox[2], self.collisionbox[5]),
|
||||||
|
z = pos.z
|
||||||
|
}
|
||||||
|
|
||||||
local nodef = minetest.registered_nodes[self.standing_in]
|
local nodef = minetest.registered_nodes[self.standing_in]
|
||||||
|
|
||||||
@ -1080,7 +1084,7 @@ function mob_class:do_env_damage()
|
|||||||
|
|
||||||
self.health = self.health - self.water_damage
|
self.health = self.health - self.water_damage
|
||||||
|
|
||||||
effect(pos, 5, "bubble.png", nil, nil, 1, nil)
|
effect(py, 5, "bubble.png", nil, nil, 1, nil)
|
||||||
|
|
||||||
if self:check_for_death({type = "environment",
|
if self:check_for_death({type = "environment",
|
||||||
pos = pos, node = self.standing_in}) then
|
pos = pos, node = self.standing_in}) then
|
||||||
@ -1093,7 +1097,7 @@ function mob_class:do_env_damage()
|
|||||||
|
|
||||||
self.health = self.health - self.lava_damage
|
self.health = self.health - self.lava_damage
|
||||||
|
|
||||||
effect(pos, 15, "fire_basic_flame.png", 1, 5, 1, 0.2, 15, true)
|
effect(py, 15, "fire_basic_flame.png", 1, 5, 1, 0.2, 15, true)
|
||||||
|
|
||||||
if self:check_for_death({type = "environment", pos = pos,
|
if self:check_for_death({type = "environment", pos = pos,
|
||||||
node = self.standing_in, hot = true}) then
|
node = self.standing_in, hot = true}) then
|
||||||
@ -1106,7 +1110,7 @@ function mob_class:do_env_damage()
|
|||||||
|
|
||||||
self.health = self.health - self.fire_damage
|
self.health = self.health - self.fire_damage
|
||||||
|
|
||||||
effect(pos, 15, "fire_basic_flame.png", 1, 5, 1, 0.2, 15, true)
|
effect(py, 15, "fire_basic_flame.png", 1, 5, 1, 0.2, 15, true)
|
||||||
|
|
||||||
if self:check_for_death({type = "environment", pos = pos,
|
if self:check_for_death({type = "environment", pos = pos,
|
||||||
node = self.standing_in, hot = true}) then
|
node = self.standing_in, hot = true}) then
|
||||||
@ -1115,11 +1119,11 @@ function mob_class:do_env_damage()
|
|||||||
|
|
||||||
-- damage_per_second node check (not fire and lava)
|
-- damage_per_second node check (not fire and lava)
|
||||||
elseif nodef.damage_per_second ~= 0
|
elseif nodef.damage_per_second ~= 0
|
||||||
and nodef.groups.lava == 0 and nodef.groups.fire == 0 then
|
and nodef.groups.lava == nil and nodef.groups.fire == nil then
|
||||||
|
|
||||||
self.health = self.health - nodef.damage_per_second
|
self.health = self.health - nodef.damage_per_second
|
||||||
|
|
||||||
effect(pos, 5, "tnt_smoke.png")
|
effect(py, 5, "tnt_smoke.png")
|
||||||
|
|
||||||
if self:check_for_death({type = "environment",
|
if self:check_for_death({type = "environment",
|
||||||
pos = pos, node = self.standing_in}) then
|
pos = pos, node = self.standing_in}) then
|
||||||
@ -1132,7 +1136,7 @@ function mob_class:do_env_damage()
|
|||||||
|
|
||||||
self.health = self.health - self.air_damage
|
self.health = self.health - self.air_damage
|
||||||
|
|
||||||
effect(pos, 3, "bubble.png", 1, 1, 1, 0.2)
|
effect(py, 3, "bubble.png", 1, 1, 1, 0.2)
|
||||||
|
|
||||||
if self:check_for_death({type = "environment",
|
if self:check_for_death({type = "environment",
|
||||||
pos = pos, node = self.standing_in}) then
|
pos = pos, node = self.standing_in}) then
|
||||||
@ -1150,7 +1154,7 @@ function mob_class:do_env_damage()
|
|||||||
|
|
||||||
self.health = self.health - self.light_damage
|
self.health = self.health - self.light_damage
|
||||||
|
|
||||||
effect(pos, 5, "tnt_smoke.png")
|
effect(py, 5, "tnt_smoke.png")
|
||||||
|
|
||||||
if self:check_for_death({type = "light"}) then
|
if self:check_for_death({type = "light"}) then
|
||||||
return true
|
return true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user