Update method for harming by heal to mob attributes

This commit is contained in:
Brandon 2020-07-12 16:56:41 -04:00
parent 10f2dcb53a
commit ad5759a5ad
9 changed files with 12 additions and 20 deletions

View File

@ -2042,7 +2042,7 @@ local do_states = function(self, dtime)
local is_in_danger = false
if lp then
local is_in_danger = false
-- 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)
return mob_staticdata(self)
end,
harmed_by_heal = def.harmed_by_heal,
})

View File

@ -363,6 +363,7 @@ skeleton_horse.sounds = {
damage = "mobs_mc_skeleton_hurt",
distance = 16,
}
skeleton_horse.harmed_by_heal = true
mobs:register_mob("mobs_mc:skeleton_horse", skeleton_horse)
-- Zombie horse
@ -381,6 +382,7 @@ zombie_horse.sounds = {
damage = "mobs_mc_zombie_hurt",
distance = 16,
}
zombie_horse.harmed_by_heal = true
mobs:register_mob("mobs_mc:zombie_horse", zombie_horse)
-- Donkey

View File

@ -91,6 +91,7 @@ local skeleton = {
shoot_offset = 1.5,
dogshoot_switch = 1,
dogshoot_count_max =1.8,
harmed_by_heal = true,
}
mobs:register_mob("mobs_mc:skeleton", skeleton)

View File

@ -83,6 +83,7 @@ mobs:register_mob("mobs_mc:witherskeleton", {
dogshoot_switch = 1,
dogshoot_count_max =0.5,
fear_height = 4,
harmed_by_heal = true,
})
--spawn

View File

@ -76,6 +76,7 @@ mobs:register_mob("mobs_mc:villager_zombie", {
sunlight_damage = 1,
view_range = 16,
fear_height = 4,
harmed_by_heal = true,
})

View File

@ -61,6 +61,7 @@ mobs:register_mob("mobs_mc:wither", {
walk_start = 0, walk_end = 20,
run_start = 0, run_end = 20,
},
harmed_by_heal = true,
})
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
@ -98,4 +99,3 @@ mobs:register_arrow("mobs_mc:wither_skull", {
--Spawn egg
mobs:register_egg("mobs_mc:wither", S("Wither"), "mobs_mc_spawn_icon_wither.png", 0, true)

View File

@ -79,6 +79,7 @@ local zombie = {
sunlight_damage = 2,
view_range = 16,
attack_type = "dogfight",
harmed_by_heal = true,
}
mobs:register_mob("mobs_mc:zombie", zombie)

View File

@ -79,6 +79,7 @@ local pigman = {
fire_damage = 0,
fear_height = 4,
view_range = 16,
harmed_by_heal = true,
}
mobs:register_mob("mobs_mc:pigman", pigman)

View File

@ -437,29 +437,12 @@ function mcl_potions._add_spawner(obj, color)
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)
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