forked from MineClone5/MineClone5
Update method for harming by heal to mob attributes
This commit is contained in:
parent
10f2dcb53a
commit
ad5759a5ad
|
@ -2042,7 +2042,7 @@ local do_states = function(self, dtime)
|
||||||
|
|
||||||
local is_in_danger = false
|
local is_in_danger = false
|
||||||
if lp then
|
if lp then
|
||||||
|
|
||||||
local is_in_danger = false
|
local is_in_danger = false
|
||||||
|
|
||||||
-- if mob is flying, only check for node it is currently in (no contact with node below)
|
-- if mob is flying, only check for node it is currently in (no contact with node below)
|
||||||
|
@ -3438,6 +3438,8 @@ minetest.register_entity(name, {
|
||||||
get_staticdata = function(self)
|
get_staticdata = function(self)
|
||||||
return mob_staticdata(self)
|
return mob_staticdata(self)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
harmed_by_heal = def.harmed_by_heal,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -363,6 +363,7 @@ skeleton_horse.sounds = {
|
||||||
damage = "mobs_mc_skeleton_hurt",
|
damage = "mobs_mc_skeleton_hurt",
|
||||||
distance = 16,
|
distance = 16,
|
||||||
}
|
}
|
||||||
|
skeleton_horse.harmed_by_heal = true
|
||||||
mobs:register_mob("mobs_mc:skeleton_horse", skeleton_horse)
|
mobs:register_mob("mobs_mc:skeleton_horse", skeleton_horse)
|
||||||
|
|
||||||
-- Zombie horse
|
-- Zombie horse
|
||||||
|
@ -381,6 +382,7 @@ zombie_horse.sounds = {
|
||||||
damage = "mobs_mc_zombie_hurt",
|
damage = "mobs_mc_zombie_hurt",
|
||||||
distance = 16,
|
distance = 16,
|
||||||
}
|
}
|
||||||
|
zombie_horse.harmed_by_heal = true
|
||||||
mobs:register_mob("mobs_mc:zombie_horse", zombie_horse)
|
mobs:register_mob("mobs_mc:zombie_horse", zombie_horse)
|
||||||
|
|
||||||
-- Donkey
|
-- Donkey
|
||||||
|
|
|
@ -91,6 +91,7 @@ local skeleton = {
|
||||||
shoot_offset = 1.5,
|
shoot_offset = 1.5,
|
||||||
dogshoot_switch = 1,
|
dogshoot_switch = 1,
|
||||||
dogshoot_count_max =1.8,
|
dogshoot_count_max =1.8,
|
||||||
|
harmed_by_heal = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:skeleton", skeleton)
|
mobs:register_mob("mobs_mc:skeleton", skeleton)
|
||||||
|
|
|
@ -83,6 +83,7 @@ mobs:register_mob("mobs_mc:witherskeleton", {
|
||||||
dogshoot_switch = 1,
|
dogshoot_switch = 1,
|
||||||
dogshoot_count_max =0.5,
|
dogshoot_count_max =0.5,
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
|
harmed_by_heal = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
--spawn
|
--spawn
|
||||||
|
|
|
@ -76,6 +76,7 @@ mobs:register_mob("mobs_mc:villager_zombie", {
|
||||||
sunlight_damage = 1,
|
sunlight_damage = 1,
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
|
harmed_by_heal = true,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ mobs:register_mob("mobs_mc:wither", {
|
||||||
walk_start = 0, walk_end = 20,
|
walk_start = 0, walk_end = 20,
|
||||||
run_start = 0, run_end = 20,
|
run_start = 0, run_end = 20,
|
||||||
},
|
},
|
||||||
|
harmed_by_heal = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
||||||
|
@ -98,4 +99,3 @@ mobs:register_arrow("mobs_mc:wither_skull", {
|
||||||
|
|
||||||
--Spawn egg
|
--Spawn egg
|
||||||
mobs:register_egg("mobs_mc:wither", S("Wither"), "mobs_mc_spawn_icon_wither.png", 0, true)
|
mobs:register_egg("mobs_mc:wither", S("Wither"), "mobs_mc_spawn_icon_wither.png", 0, true)
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,7 @@ local zombie = {
|
||||||
sunlight_damage = 2,
|
sunlight_damage = 2,
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
|
harmed_by_heal = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:zombie", zombie)
|
mobs:register_mob("mobs_mc:zombie", zombie)
|
||||||
|
|
|
@ -79,6 +79,7 @@ local pigman = {
|
||||||
fire_damage = 0,
|
fire_damage = 0,
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
|
harmed_by_heal = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:pigman", pigman)
|
mobs:register_mob("mobs_mc:pigman", pigman)
|
||||||
|
|
|
@ -437,29 +437,12 @@ function mcl_potions._add_spawner(obj, color)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local is_zombie = {}
|
|
||||||
|
|
||||||
for i, zombie in ipairs({"husk","zombie","pigman"}) do
|
|
||||||
is_zombie["mobs_mc:"..zombie] = true
|
|
||||||
is_zombie["mobs_mc:baby_"..zombie] = true
|
|
||||||
end
|
|
||||||
|
|
||||||
is_zombie["mobs_mc:witherskeleton"] = true
|
|
||||||
is_zombie["mobs_mc:skeleton"] = true
|
|
||||||
is_zombie["mobs_mc:stray"] = true
|
|
||||||
is_zombie["mobs_mc:villager_zombie"] = true
|
|
||||||
is_zombie["mobs_mc:wither"] = true
|
|
||||||
is_zombie["mobs_mc:skeleton_horse"] = true
|
|
||||||
is_zombie["mobs_mc:zombie_horse"] = true
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function mcl_potions.healing_func(player, hp)
|
function mcl_potions.healing_func(player, hp)
|
||||||
|
|
||||||
local obj = player:get_luaentity()
|
local obj = player:get_luaentity()
|
||||||
|
|
||||||
if is_zombie[player:get_entity_name()] then hp = -hp end
|
if obj and obj.harmed_by_heal then hp = -hp end
|
||||||
|
|
||||||
if hp > 0 then
|
if hp > 0 then
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue