mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 12:01:06 +01:00
Slow ender dragon regeneration (#4481)
Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4481 Reviewed-by: Mikita Wiśniewski <rudzik8@protonmail.com> Co-authored-by: WillConker <waj01@joanes.net> Co-committed-by: WillConker <waj01@joanes.net>
This commit is contained in:
parent
80a6a6efb0
commit
9d5b46c28a
1 changed files with 15 additions and 8 deletions
|
@ -4,21 +4,17 @@
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
local BEAM_CHECK_FREQUENCY = 2
|
local BEAM_CHECK_FREQUENCY = 1
|
||||||
local POS_CHECK_FREQUENCY = 15
|
local POS_CHECK_FREQUENCY = 15
|
||||||
local HEAL_AMMOUNT = 37
|
local HEAL_INTERVAL = 1
|
||||||
|
local HEAL_AMOUNT = 2
|
||||||
|
|
||||||
local function heal(self)
|
|
||||||
local o = self.object
|
|
||||||
self.health = math.min(self.hp_max,self.health + HEAL_AMMOUNT)
|
|
||||||
end
|
|
||||||
local function check_beam(self)
|
local function check_beam(self)
|
||||||
for _, obj in ipairs(minetest.get_objects_inside_radius(self.object:get_pos(), 80)) do
|
for _, obj in ipairs(minetest.get_objects_inside_radius(self.object:get_pos(), 80)) do
|
||||||
local luaentity = obj:get_luaentity()
|
local luaentity = obj:get_luaentity()
|
||||||
if luaentity and luaentity.name == "mcl_end:crystal" then
|
if luaentity and luaentity.name == "mcl_end:crystal" then
|
||||||
if luaentity.beam then
|
if luaentity.beam then
|
||||||
if luaentity.beam == self.beam then
|
if luaentity.beam == self.beam then
|
||||||
heal(self)
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -106,7 +102,6 @@ mcl_mobs.register_mob("mobs_mc:enderdragon", {
|
||||||
},
|
},
|
||||||
ignores_nametag = true,
|
ignores_nametag = true,
|
||||||
do_custom = function(self,dtime)
|
do_custom = function(self,dtime)
|
||||||
mcl_bossbars.update_boss(self.object, "Ender Dragon", "light_purple")
|
|
||||||
if self._pos_timer == nil or self._pos_timer > POS_CHECK_FREQUENCY then
|
if self._pos_timer == nil or self._pos_timer > POS_CHECK_FREQUENCY then
|
||||||
self._pos_timer = 0
|
self._pos_timer = 0
|
||||||
check_pos(self)
|
check_pos(self)
|
||||||
|
@ -115,8 +110,20 @@ mcl_mobs.register_mob("mobs_mc:enderdragon", {
|
||||||
self._beam_timer = 0
|
self._beam_timer = 0
|
||||||
check_beam(self)
|
check_beam(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
self._beam_timer = self._beam_timer + dtime
|
self._beam_timer = self._beam_timer + dtime
|
||||||
self._pos_timer = self._pos_timer + dtime
|
self._pos_timer = self._pos_timer + dtime
|
||||||
|
|
||||||
|
if self.beam ~= nil then
|
||||||
|
-- heal
|
||||||
|
self._heal_timer = (self._heal_timer or 0) + dtime
|
||||||
|
if self._heal_timer > HEAL_INTERVAL then
|
||||||
|
self.health = math.min(self.hp_max,self.health + HEAL_AMOUNT)
|
||||||
|
self._heal_timer = self._heal_timer - HEAL_INTERVAL
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
mcl_bossbars.update_boss(self.object, "Ender Dragon", "light_purple")
|
||||||
end,
|
end,
|
||||||
on_die = function(self, pos, cmi_cause)
|
on_die = function(self, pos, cmi_cause)
|
||||||
if self._portal_pos then
|
if self._portal_pos then
|
||||||
|
|
Loading…
Reference in a new issue