Make tilt flying/swimming dynamic

This commit is contained in:
jordan4ibanez 2021-04-21 12:56:36 -04:00
parent 20886f54bb
commit 71c34823bc
4 changed files with 23 additions and 6 deletions

View file

@ -349,6 +349,8 @@ function mobs:register_mob(name, def)
eye_height = def.eye_height or 1.5,
defuse_reach = def.defuse_reach or 4,
hostile_cooldown = def.hostile_cooldown or 15,
tilt_fly = def.tilt_fly or true,
tilt_swim = def.tilt_swim or true,
-- End of MCL2 extensions
on_spawn = def.on_spawn,

View file

@ -271,7 +271,9 @@ local swim_state_execution = function(self,dtime)
mobs.set_swim_velocity(self,0)
mobs.set_static_pitch(self)
if self.tilt_swim then
mobs.set_static_pitch(self)
end
elseif self.state == "swim" then
@ -301,7 +303,10 @@ local swim_state_execution = function(self,dtime)
mobs.set_swim_velocity(self,self.walk_velocity)
mobs.set_dynamic_pitch(self)
--only enable tilt swimming if enabled
if self.tilt_swim then
mobs.set_dynamic_pitch(self)
end
end
--flop around if not inside swim node
else
@ -310,7 +315,9 @@ local swim_state_execution = function(self,dtime)
mobs.flop(self)
mobs.set_static_pitch(self)
if self.tilt_swim then
mobs.set_static_pitch(self)
end
end
end
@ -398,7 +405,9 @@ local fly_state_execution = function(self,dtime)
mobs.set_fly_velocity(self,0)
mobs.set_static_pitch(self)
if self.tilt_fly then
mobs.set_static_pitch(self)
end
elseif self.state == "fly" then
@ -426,7 +435,9 @@ local fly_state_execution = function(self,dtime)
quick_rotate(self,dtime)
end
mobs.set_dynamic_pitch(self)
if self.tilt_fly then
mobs.set_dynamic_pitch(self)
end
mobs.set_fly_velocity(self,self.walk_velocity)
end
@ -437,7 +448,9 @@ local fly_state_execution = function(self,dtime)
mobs.float(self)
mobs.set_static_pitch(self)
if self.tilt_fly then
mobs.set_static_pitch(self)
end
end
end
end

View file

@ -195,6 +195,7 @@ mobs.projectile_attack_walk = function(self,dtime)
self.projectile_timer = self.projectile_cooldown
end
--run projectile timer
if self.projectile_timer > 0 then
self.projectile_timer = self.projectile_timer - dtime

View file

@ -17,6 +17,7 @@ mobs:register_mob("mobs_mc:blaze", {
hp_max = 20,
xp_min = 10,
xp_max = 10,
tilt_fly = false,
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.79, 0.3},
rotate = -180,
visual = "mesh",