0
0
Fork 0

Mobs: Separate fire damage from lava damage

This commit is contained in:
Wuzzy 2019-10-02 18:43:48 +02:00
parent b71c9204ec
commit f9e46b914d
11 changed files with 28 additions and 13 deletions

View File

@ -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)

View File

@ -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).

View File

@ -53,6 +53,7 @@ mobs:register_mob("mobs_mc:blaze", {
-- MC Wiki: takes 1 damage every half second while in water
water_damage = 2,
lava_damage = 0,
fire_damage = 0,
fall_damage = 0,
fall_speed = -2.25,
light_damage = 0,

View File

@ -114,8 +114,6 @@ mobs:register_mob("mobs_mc:creeper", {
},
floats = 1,
fear_height = 4,
lava_damage = 4,
light_damage = 0,
view_range = 16,
blood_amount = 0,
})

View File

@ -48,6 +48,7 @@ mobs:register_mob("mobs_mc:enderdragon", {
max = 1},
},
lava_damage = 0,
fire_damage = 0,
on_rightclick = nil,
attack_type = "dogshoot",
arrow = "mobs_mc:fireball2",

View File

@ -75,6 +75,7 @@ mobs:register_mob("mobs_mc:witherskeleton", {
},
water_damage = 0,
lava_damage = 0,
fire_damage = 0,
light_damage = 0,
view_range = 16,
attack_type = "dogfight",

View File

@ -201,6 +201,7 @@ local magma_cube_big = {
},
water_damage = 0,
lava_damage = 0,
fire_damage = 0,
light_damage = 0,
fall_damage = 0,
view_range = 16,

View File

@ -28,7 +28,7 @@ mobs:register_mob("mobs_mc:snowman", {
view_range = 10,
fall_damage = 0,
water_damage = 4,
lava_damage = 20,
rain_damage = 4,
attacks_monsters = true,
collisionbox = {-0.35, -0.01, -0.35, 0.35, 1.89, 0.35},
visual = "mesh",
@ -119,8 +119,6 @@ mobs:register_mob("mobs_mc:snowman", {
end
end
end,
rain_damage = 4,
})
-- This is to be called when a pumpkin or jack'o lantern has been placed. Recommended: In the on_construct function

View File

@ -49,6 +49,7 @@ mobs:register_mob("mobs_mc:wither", {
max = 1},
},
lava_damage = 0,
fire_damage = 0,
attack_type = "dogshoot",
explosion_radius = 3,
explosion_fire = false,

View File

@ -75,7 +75,6 @@ local zombie = {
walk_start = 0, walk_end = 40,
run_start = 0, run_end = 40,
},
lava_damage = 4,
sunlight_damage = 2,
view_range = 16,
attack_type = "dogfight",

View File

@ -75,6 +75,7 @@ local pigman = {
punch_end = 130,
},
lava_damage = 0,
fire_damage = 0,
fear_height = 4,
view_range = 16,
}