mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 20:41:11 +01:00
use dtime
This commit is contained in:
parent
5c085bd28f
commit
32a57133ac
1 changed files with 7 additions and 3 deletions
|
@ -314,8 +314,8 @@ minetest.register_globalstep(function(dtime)
|
||||||
speed_mult = speed_mult - slowdown_mult * dtime -- slow down
|
speed_mult = speed_mult - slowdown_mult * dtime -- slow down
|
||||||
speed_mult = math.max(speed_mult, -1)
|
speed_mult = math.max(speed_mult, -1)
|
||||||
speed_mult = math.min(speed_mult, max_speed)
|
speed_mult = math.min(speed_mult, max_speed)
|
||||||
if turn_amount > 0.1 then
|
if turn_amount > 0.3 then
|
||||||
speed_mult = speed_mult - (speed_mult * turn_amount / (math.pi*3))
|
speed_mult = speed_mult - (speed_mult * (turn_amount / (math.pi*3)))
|
||||||
end
|
end
|
||||||
|
|
||||||
elytra.speed = speed_mult -- set the speed so you can keep track of it and add to it
|
elytra.speed = speed_mult -- set the speed so you can keep track of it and add to it
|
||||||
|
@ -342,11 +342,12 @@ minetest.register_globalstep(function(dtime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
new_vel = vector.multiply(new_vel, speed_mult * dtime * 30)
|
new_vel = vector.multiply(new_vel, speed_mult)
|
||||||
new_vel = {
|
new_vel = {
|
||||||
x = clamp(new_vel.x, -max_speed, max_speed),
|
x = clamp(new_vel.x, -max_speed, max_speed),
|
||||||
y = clamp(new_vel.y, -max_speed, max_speed),
|
y = clamp(new_vel.y, -max_speed, max_speed),
|
||||||
z = clamp(new_vel.z, -max_speed, max_speed)}
|
z = clamp(new_vel.z, -max_speed, max_speed)}
|
||||||
|
new_vel = vector.multiply(new_vel, dtime * 30)
|
||||||
|
|
||||||
-- slow the player down so less spongy movement by applying half the inverse vel
|
-- slow the player down so less spongy movement by applying half the inverse vel
|
||||||
-- NOTE: do not set this higher than about 0.7 or the game will get the wrong vel and it will be broken
|
-- NOTE: do not set this higher than about 0.7 or the game will get the wrong vel and it will be broken
|
||||||
|
@ -697,6 +698,9 @@ end)
|
||||||
-- Don't change HP if the player falls in the water or through End Portal:
|
-- Don't change HP if the player falls in the water or through End Portal:
|
||||||
mcl_damage.register_modifier(function(obj, damage, reason)
|
mcl_damage.register_modifier(function(obj, damage, reason)
|
||||||
if reason.type == "fall" then
|
if reason.type == "fall" then
|
||||||
|
if minetest.is_creative_enabled(obj:get_player_name()) then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
local pos = obj:get_pos()
|
local pos = obj:get_pos()
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local velocity = obj:get_velocity() or obj:get_player_velocity() or {x=0,y=-10,z=0}
|
local velocity = obj:get_velocity() or obj:get_player_velocity() or {x=0,y=-10,z=0}
|
||||||
|
|
Loading…
Reference in a new issue