mobs:shulker:use on_attack to set shoot interval

to between 1 and 6 seconds
This commit is contained in:
bakawun 2023-12-11 09:36:03 +01:00 committed by the-real-herowl
parent 69903aa4ec
commit bc101314df

View file

@ -35,7 +35,7 @@ mcl_mobs.register_mob("mobs_mc:shulker", {
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
attack_type = "shoot", attack_type = "shoot",
shoot_interval = 5.5, shoot_interval = 6,
arrow = "mobs_mc:shulkerbullet", arrow = "mobs_mc:shulkerbullet",
shoot_offset = 0.5, shoot_offset = 0.5,
passive = false, passive = false,
@ -81,7 +81,6 @@ mcl_mobs.register_mob("mobs_mc:shulker", {
noyaw = true, noyaw = true,
do_custom = function(self,dtime) do_custom = function(self,dtime)
local pos = self.object:get_pos() local pos = self.object:get_pos()
self.shoot_interval = math.random(1, 5.5)
if math.floor(self.object:get_yaw()) ~=0 then if math.floor(self.object:get_yaw()) ~=0 then
self.object:set_yaw(0) self.object:set_yaw(0)
mcl_mobs:yaw(self, 0, 0, dtime) mcl_mobs:yaw(self, 0, 0, dtime)
@ -155,6 +154,9 @@ mcl_mobs.register_mob("mobs_mc:shulker", {
end end
end end
end, end,
on_attack = function(self, dtime)
self.shoot_interval = math.random(1, 6)
end,
}) })
-- bullet arrow (weapon) -- bullet arrow (weapon)