forked from VoxeLibre/VoxeLibre
Migrated mobs to the new effects API
This commit is contained in:
parent
55ce6f0f4b
commit
747bf16a94
|
@ -21,8 +21,6 @@ local function atan(x)
|
|||
end
|
||||
end
|
||||
|
||||
mcl_mobs.effect_functions = {}
|
||||
|
||||
|
||||
-- check if daytime and also if mob is docile during daylight hours
|
||||
function mob_class:day_docile()
|
||||
|
@ -1153,9 +1151,8 @@ function mob_class:do_states_attack (dtime)
|
|||
damage_groups = {fleshy = self.damage}
|
||||
}, nil)
|
||||
if self.dealt_effect then
|
||||
mcl_mobs.effect_functions[self.dealt_effect.name](
|
||||
self.attack, self.dealt_effect.factor, self.dealt_effect.dur
|
||||
)
|
||||
mcl_potions.give_effect_by_level(self.dealt_effect.name, self.attack,
|
||||
self.dealt_effect.level, self.dealt_effect.dur)
|
||||
end
|
||||
end
|
||||
else
|
||||
|
|
|
@ -98,7 +98,7 @@ mcl_mobs.register_mob("mobs_mc:witherskeleton", {
|
|||
fire_resistant = true,
|
||||
dealt_effect = {
|
||||
name = "withering",
|
||||
factor = 1,
|
||||
level = 1,
|
||||
dur = 10,
|
||||
},
|
||||
})
|
||||
|
|
|
@ -138,7 +138,7 @@ cave_spider.sounds = table.copy(spider.sounds)
|
|||
cave_spider.sounds.base_pitch = 1.25
|
||||
cave_spider.dealt_effect = {
|
||||
name = "poison",
|
||||
factor = 2.5,
|
||||
level = 2,
|
||||
dur = 7,
|
||||
}
|
||||
mcl_mobs.register_mob("mobs_mc:cave_spider", cave_spider)
|
||||
|
|
|
@ -349,7 +349,7 @@ mcl_mobs.register_mob("mobs_mc:wither", {
|
|||
mcl_util.deal_damage(objs[n], 8, {type = "magic"})
|
||||
hit_some = true
|
||||
end
|
||||
mcl_mobs.effect_functions["withering"](objs[n], 0.5, 10)
|
||||
mcl_potions.give_effect("withering", objs[n], 2, 10)
|
||||
end
|
||||
if hit_some then
|
||||
mcl_mobs.effect(pos, 32, "mcl_particles_soul_fire_flame.png", 5, 10, self.reach, 1, 0)
|
||||
|
@ -469,7 +469,7 @@ mcl_mobs.register_arrow("mobs_mc:wither_skull", {
|
|||
-- direct hit
|
||||
hit_player = function(self, player)
|
||||
local pos = vector.new(self.object:get_pos())
|
||||
mcl_mobs.effect_functions["withering"](player, 0.5, 10)
|
||||
mcl_potions.give_effect("withering", player, 2, 10)
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 0.5,
|
||||
damage_groups = {fleshy = 8},
|
||||
|
@ -484,7 +484,7 @@ mcl_mobs.register_arrow("mobs_mc:wither_skull", {
|
|||
|
||||
hit_mob = function(self, mob)
|
||||
local pos = vector.new(self.object:get_pos())
|
||||
mcl_mobs.effect_functions["withering"](mob, 0.5, 10)
|
||||
mcl_potions.give_effect("withering", mob, 2, 10)
|
||||
mob:punch(self.object, 1.0, {
|
||||
full_punch_interval = 0.5,
|
||||
damage_groups = {fleshy = 8},
|
||||
|
@ -522,7 +522,7 @@ mcl_mobs.register_arrow("mobs_mc:wither_skull_strong", {
|
|||
-- direct hit
|
||||
hit_player = function(self, player)
|
||||
local pos = vector.new(self.object:get_pos())
|
||||
mcl_mobs.effect_functions["withering"](player, 0.5, 10)
|
||||
mcl_potions.give_effect("withering", player, 2, 10)
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 0.5,
|
||||
damage_groups = {fleshy = 12},
|
||||
|
@ -541,7 +541,7 @@ mcl_mobs.register_arrow("mobs_mc:wither_skull_strong", {
|
|||
|
||||
hit_mob = function(self, mob)
|
||||
local pos = vector.new(self.object:get_pos())
|
||||
mcl_mobs.effect_functions["withering"](mob, 0.5, 10)
|
||||
mcl_potions.give_effect("withering", mob, 2, 10)
|
||||
mob:punch(self.object, 1.0, {
|
||||
full_punch_interval = 0.5,
|
||||
damage_groups = {fleshy = 12},
|
||||
|
|
|
@ -633,19 +633,6 @@ function mcl_potions.get_alchemy(ingr, pot)
|
|||
return false
|
||||
end
|
||||
|
||||
-- TODO replace all calls to the old API with new API calls in other mods
|
||||
-- mcl_mobs.effect_functions["poison"] = mcl_potions.poison_func
|
||||
-- mcl_mobs.effect_functions["regeneration"] = mcl_potions.regeneration_func
|
||||
-- mcl_mobs.effect_functions["invisibility"] = mcl_potions.invisiblility_func
|
||||
-- mcl_mobs.effect_functions["fire_resistance"] = mcl_potions.fire_resistance_func
|
||||
-- mcl_mobs.effect_functions["night_vision"] = mcl_potions.night_vision_func
|
||||
-- mcl_mobs.effect_functions["water_breathing"] = mcl_potions.water_breathing_func
|
||||
-- mcl_mobs.effect_functions["leaping"] = mcl_potions.leaping_func
|
||||
-- mcl_mobs.effect_functions["swiftness"] = mcl_potions.swiftness_func
|
||||
-- mcl_mobs.effect_functions["heal"] = mcl_potions.healing_func
|
||||
-- mcl_mobs.effect_functions["bad_omen"] = mcl_potions.bad_omen_func
|
||||
-- mcl_mobs.effect_functions["withering"] = mcl_potions.withering_func
|
||||
|
||||
-- give withering to players in a wither rose
|
||||
local etime = 0
|
||||
minetest.register_globalstep(function(dtime)
|
||||
|
|
Loading…
Reference in New Issue