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,
|
eye_height = def.eye_height or 1.5,
|
||||||
defuse_reach = def.defuse_reach or 4,
|
defuse_reach = def.defuse_reach or 4,
|
||||||
hostile_cooldown = def.hostile_cooldown or 15,
|
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
|
-- End of MCL2 extensions
|
||||||
|
|
||||||
on_spawn = def.on_spawn,
|
on_spawn = def.on_spawn,
|
||||||
|
|
|
@ -271,7 +271,9 @@ local swim_state_execution = function(self,dtime)
|
||||||
|
|
||||||
mobs.set_swim_velocity(self,0)
|
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
|
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_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
|
end
|
||||||
--flop around if not inside swim node
|
--flop around if not inside swim node
|
||||||
else
|
else
|
||||||
|
@ -310,7 +315,9 @@ local swim_state_execution = function(self,dtime)
|
||||||
|
|
||||||
mobs.flop(self)
|
mobs.flop(self)
|
||||||
|
|
||||||
mobs.set_static_pitch(self)
|
if self.tilt_swim then
|
||||||
|
mobs.set_static_pitch(self)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -398,7 +405,9 @@ local fly_state_execution = function(self,dtime)
|
||||||
|
|
||||||
mobs.set_fly_velocity(self,0)
|
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
|
elseif self.state == "fly" then
|
||||||
|
|
||||||
|
@ -426,7 +435,9 @@ local fly_state_execution = function(self,dtime)
|
||||||
quick_rotate(self,dtime)
|
quick_rotate(self,dtime)
|
||||||
end
|
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)
|
mobs.set_fly_velocity(self,self.walk_velocity)
|
||||||
end
|
end
|
||||||
|
@ -437,7 +448,9 @@ local fly_state_execution = function(self,dtime)
|
||||||
|
|
||||||
mobs.float(self)
|
mobs.float(self)
|
||||||
|
|
||||||
mobs.set_static_pitch(self)
|
if self.tilt_fly then
|
||||||
|
mobs.set_static_pitch(self)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -195,6 +195,7 @@ mobs.projectile_attack_walk = function(self,dtime)
|
||||||
self.projectile_timer = self.projectile_cooldown
|
self.projectile_timer = self.projectile_cooldown
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--run projectile timer
|
||||||
if self.projectile_timer > 0 then
|
if self.projectile_timer > 0 then
|
||||||
self.projectile_timer = self.projectile_timer - dtime
|
self.projectile_timer = self.projectile_timer - dtime
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ mobs:register_mob("mobs_mc:blaze", {
|
||||||
hp_max = 20,
|
hp_max = 20,
|
||||||
xp_min = 10,
|
xp_min = 10,
|
||||||
xp_max = 10,
|
xp_max = 10,
|
||||||
|
tilt_fly = false,
|
||||||
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.79, 0.3},
|
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.79, 0.3},
|
||||||
rotate = -180,
|
rotate = -180,
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
|
Loading…
Reference in New Issue