Mobs: Separate fire damage from lava damage
This commit is contained in:
parent
b71c9204ec
commit
f9e46b914d
11 changed files with 28 additions and 13 deletions
|
@ -712,7 +712,7 @@ local do_env_damage = function(self)
|
|||
|
||||
pos.y = pos.y + 1 -- for particle effect position
|
||||
|
||||
-- water
|
||||
-- water damage
|
||||
if self.water_damage
|
||||
and nodef.groups.water then
|
||||
|
||||
|
@ -720,14 +720,13 @@ local do_env_damage = function(self)
|
|||
|
||||
self.health = self.health - self.water_damage
|
||||
|
||||
-- TODO: Damage particle
|
||||
effect(pos, 5, "bubble.png", nil, nil, 1, nil)
|
||||
effect(pos, 5, "tnt_smoke.png", nil, nil, 1, nil)
|
||||
|
||||
if check_for_death(self, "water", {type = "environment",
|
||||
pos = pos, node = self.standing_in}) then return end
|
||||
end
|
||||
|
||||
-- lava
|
||||
-- lava damage
|
||||
elseif self.lava_damage
|
||||
and (nodef.groups.lava) then
|
||||
|
||||
|
@ -735,19 +734,31 @@ local do_env_damage = function(self)
|
|||
|
||||
self.health = self.health - self.lava_damage
|
||||
|
||||
-- TODO: Damage particle
|
||||
effect(pos, 5, "fire_basic_flame.png", nil, nil, 1, nil)
|
||||
|
||||
if check_for_death(self, "lava", {type = "environment",
|
||||
pos = pos, node = self.standing_in}) then return end
|
||||
end
|
||||
|
||||
-- fire damage
|
||||
elseif self.fire_damage
|
||||
and (nodef.groups.fire) then
|
||||
|
||||
if self.fire_damage ~= 0 then
|
||||
|
||||
self.health = self.health - self.fire_damage
|
||||
|
||||
effect(pos, 5, "fire_basic_flame.png", nil, nil, 1, nil)
|
||||
|
||||
if check_for_death(self, "fire", {type = "environment",
|
||||
pos = pos, node = self.standing_in}) then return end
|
||||
end
|
||||
|
||||
-- damage_per_second node check
|
||||
elseif nodef.damage_per_second ~= 0 then
|
||||
|
||||
self.health = self.health - nodef.damage_per_second
|
||||
|
||||
-- TODO: Damage particle
|
||||
effect(pos, 5, "tnt_smoke.png")
|
||||
|
||||
if check_for_death(self, "dps", {type = "environment",
|
||||
|
@ -3132,6 +3143,7 @@ minetest.register_entity(name, {
|
|||
sunlight_damage = def.sunlight_damage or 0,
|
||||
water_damage = def.water_damage or 0,
|
||||
lava_damage = def.lava_damage or 8,
|
||||
fire_damage = def.fire_damage or 1,
|
||||
suffocation = def.suffocation or true,
|
||||
fall_damage = def.fall_damage or 1,
|
||||
fall_speed = def.fall_speed or -10, -- must be lower than -2 (default: -10)
|
||||
|
|
|
@ -61,9 +61,11 @@ functions needed for the mob to work properly which contains the following:
|
|||
'fall_speed' has the maximum speed the mob can fall at, default is -10.
|
||||
'fall_damage' when true causes falling to inflict damage.
|
||||
'water_damage' holds the damage per second infliced to mobs when standing in
|
||||
water.
|
||||
water (default: 0).
|
||||
'lava_damage' holds the damage per second inflicted to mobs when standing
|
||||
in lava (default: 8).
|
||||
'fire_damage' holds the damage per second inflicted to mobs when standing
|
||||
in fire (default: 1).
|
||||
'light_damage' holds the damage per second inflicted to mobs when it's too
|
||||
bright (above 13 light).
|
||||
'suffocation' when true causes mobs to suffocate inside solid blocks (2 damage per second).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue