forked from VoxeLibre/VoxeLibre
Make mobs gravity equal to player's
This commit is contained in:
parent
fb9a55e562
commit
57b293de2b
|
@ -58,6 +58,8 @@ local DEATH_DELAY = 0.5
|
||||||
local DEFAULT_FALL_SPEED = -10
|
local DEFAULT_FALL_SPEED = -10
|
||||||
local FLOP_HEIGHT = 5.0
|
local FLOP_HEIGHT = 5.0
|
||||||
local FLOP_HOR_SPEED = 1.5
|
local FLOP_HOR_SPEED = 1.5
|
||||||
|
local GRAVITY = minetest_settings:get("movement_gravity") + 9.81
|
||||||
|
|
||||||
|
|
||||||
local MOB_CAP = {}
|
local MOB_CAP = {}
|
||||||
MOB_CAP.hostile = 70
|
MOB_CAP.hostile = 70
|
||||||
|
@ -308,6 +310,7 @@ function mobs:register_mob(name, def)
|
||||||
stand_timer = 0,
|
stand_timer = 0,
|
||||||
wandering = true,
|
wandering = true,
|
||||||
current_animation = "",
|
current_animation = "",
|
||||||
|
gravity = GRAVITY,
|
||||||
--set_animation = mobs.set_animation,
|
--set_animation = mobs.set_animation,
|
||||||
--end j4i stuff
|
--end j4i stuff
|
||||||
|
|
||||||
|
@ -349,7 +352,7 @@ function mobs:register_mob(name, def)
|
||||||
--on_detach_child = mob_detach_child,
|
--on_detach_child = mob_detach_child,
|
||||||
|
|
||||||
on_activate = function(self, staticdata, dtime)
|
on_activate = function(self, staticdata, dtime)
|
||||||
self.object:set_acceleration(vector_new(0,-9.81, 0))
|
self.object:set_acceleration(vector_new(0,-GRAVITY, 0))
|
||||||
return mobs.mob_activate(self, staticdata, def, dtime)
|
return mobs.mob_activate(self, staticdata, def, dtime)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue