forked from VoxeLibre/VoxeLibre
Make tilt flying/swimming dynamic
This commit is contained in:
parent
20886f54bb
commit
71c34823bc
|
@ -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,
|
||||
|
|
|
@ -271,7 +271,9 @@ local swim_state_execution = function(self,dtime)
|
|||
|
||||
mobs.set_swim_velocity(self,0)
|
||||
|
||||
if self.tilt_swim then
|
||||
mobs.set_static_pitch(self)
|
||||
end
|
||||
|
||||
elseif self.state == "swim" then
|
||||
|
||||
|
@ -301,8 +303,11 @@ local swim_state_execution = function(self,dtime)
|
|||
|
||||
mobs.set_swim_velocity(self,self.walk_velocity)
|
||||
|
||||
--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
|
||||
--do animation
|
||||
|
@ -310,8 +315,10 @@ local swim_state_execution = function(self,dtime)
|
|||
|
||||
mobs.flop(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)
|
||||
|
||||
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
|
||||
|
||||
if self.tilt_fly then
|
||||
mobs.set_dynamic_pitch(self)
|
||||
end
|
||||
|
||||
mobs.set_fly_velocity(self,self.walk_velocity)
|
||||
end
|
||||
|
@ -437,10 +448,12 @@ local fly_state_execution = function(self,dtime)
|
|||
|
||||
mobs.float(self)
|
||||
|
||||
if self.tilt_fly then
|
||||
mobs.set_static_pitch(self)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue