mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 13:53:45 +01:00
Optimisation and cleanup
-optimised and cleaned up wither rose withering effect code -removed unused code
This commit is contained in:
parent
e4102e6124
commit
966712f4ff
@ -681,6 +681,9 @@ function mob_class:do_env_damage()
|
|||||||
-- don't fall when on ignore, just stand still
|
-- don't fall when on ignore, just stand still
|
||||||
if self.standing_in == "ignore" then
|
if self.standing_in == "ignore" then
|
||||||
self.object:set_velocity({x = 0, y = 0, z = 0})
|
self.object:set_velocity({x = 0, y = 0, z = 0})
|
||||||
|
-- wither rose effect
|
||||||
|
elseif self.standing_in == "mcl_flowers:wither_rose" then
|
||||||
|
mcl_potions.withering_func(self.object, 1, 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
local nodef = minetest.registered_nodes[self.standing_in]
|
local nodef = minetest.registered_nodes[self.standing_in]
|
||||||
|
@ -161,7 +161,6 @@ mcl_mobs.register_mob("mobs_mc:wither", {
|
|||||||
if self._custom_timer > 1 then
|
if self._custom_timer > 1 then
|
||||||
self.health = math.min(self.health + 1, self.hp_max)
|
self.health = math.min(self.health + 1, self.hp_max)
|
||||||
self._custom_timer = self._custom_timer - 1
|
self._custom_timer = self._custom_timer - 1
|
||||||
self._xplded_lately = false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if anti_troll and self._spawner then
|
if anti_troll and self._spawner then
|
||||||
|
@ -734,10 +734,6 @@ function mcl_potions.healing_func(player, hp)
|
|||||||
|
|
||||||
local obj = player:get_luaentity()
|
local obj = player:get_luaentity()
|
||||||
|
|
||||||
if player:get_hp() == 0 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if obj and obj.harmed_by_heal then hp = -hp end
|
if obj and obj.harmed_by_heal then hp = -hp end
|
||||||
|
|
||||||
if hp > 0 then
|
if hp > 0 then
|
||||||
|
@ -474,21 +474,16 @@ mcl_mobs.effect_functions["heal"] = mcl_potions.healing_func
|
|||||||
mcl_mobs.effect_functions["bad_omen"] = mcl_potions.bad_omen_func
|
mcl_mobs.effect_functions["bad_omen"] = mcl_potions.bad_omen_func
|
||||||
mcl_mobs.effect_functions["withering"] = mcl_potions.withering_func
|
mcl_mobs.effect_functions["withering"] = mcl_potions.withering_func
|
||||||
|
|
||||||
-- give withering when standing in wither rose
|
-- give withering to players in a wither rose
|
||||||
local etime = 0
|
local etime = 0
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
etime = dtime + etime
|
etime = dtime + etime
|
||||||
if etime < 0.5 then return end
|
if etime < 0.5 then return end
|
||||||
etime = 0
|
etime = 0
|
||||||
for _,pl in pairs(minetest.get_connected_players()) do
|
for _,pl in pairs(minetest.get_connected_players()) do
|
||||||
local n = minetest.find_node_near(pl:get_pos(),0.4,"mcl_flowers:wither_rose",true)
|
local npos = vector.offset(pl:get_pos(), 0, 0.2, 0)
|
||||||
if n then mcl_potions.withering_func(pl, 1, 2) end
|
local n = minetest.get_node(npos)
|
||||||
end
|
if n.name == "mcl_flowers:wither_rose" then mcl_potions.withering_func(pl, 1, 2) end
|
||||||
for _,ent in pairs(minetest.luaentities) do
|
|
||||||
if ent.object:get_pos() and ent.is_mob then
|
|
||||||
local n = minetest.find_node_near(ent.object:get_pos(),0.4,"mcl_flowers:wither_rose",true)
|
|
||||||
if n then mcl_potions.withering_func(ent.object, 1, 2) end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user