mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 10:31:06 +01:00
Make tilt flying/swimming dynamic
This commit is contained in:
parent
20886f54bb
commit
71c34823bc
4 changed files with 23 additions and 6 deletions
|
@ -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)
|
||||
|
||||
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
|
||||
|
|
|
@ -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 a new issue