mirror of
https://github.com/Poikilos/mobs.git
synced 2023-10-03 07:28:50 -07:00
Add an option to disable jumping.
This commit is contained in:
parent
b254ecd9fc
commit
9afa2ec1fd
3
api.lua
3
api.lua
@ -28,6 +28,7 @@ function mobs:register_mob(name, def)
|
||||
sounds = def.sounds,
|
||||
animation = def.animation,
|
||||
follow = def.follow,
|
||||
jump = def.jump or true,
|
||||
|
||||
timer = 0,
|
||||
env_damage_timer = 0, -- only if state = "attack"
|
||||
@ -305,7 +306,7 @@ function mobs:register_mob(name, def)
|
||||
if math.random(1, 100) <= 30 then
|
||||
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/180*math.pi))
|
||||
end
|
||||
if self.get_velocity(self) <= 0.5 and self.object:getvelocity().y == 0 then
|
||||
if self.jump == true and self.get_velocity(self) <= 0.5 and self.object:getvelocity().y == 0 then
|
||||
local v = self.object:getvelocity()
|
||||
v.y = 5
|
||||
self.object:setvelocity(v)
|
||||
|
Loading…
x
Reference in New Issue
Block a user