semi-working on 0.3 server step
This commit is contained in:
parent
32a57133ac
commit
12af0e7de8
|
@ -300,15 +300,15 @@ minetest.register_globalstep(function(dtime)
|
||||||
player:set_pos(vector.offset(player:get_pos(), 0, 0.8, 0))
|
player:set_pos(vector.offset(player:get_pos(), 0, 0.8, 0))
|
||||||
end
|
end
|
||||||
mcl_player.player_set_animation(player, "fly")
|
mcl_player.player_set_animation(player, "fly")
|
||||||
local slowdown_mult = 1 -- amount of vel to take per sec
|
local slowdown_mult = 0.2 -- amount of vel to take per sec
|
||||||
local fall_speed = 10 -- amount to fall down per sec in nodes
|
local fall_speed = 20 -- amount to fall down per sec in nodes
|
||||||
local speedup_mult = 10 -- amount of speed to add based on look dir
|
local speedup_mult = 10 -- amount of speed to add based on look dir
|
||||||
local max_speed = 300
|
local max_speed = 100
|
||||||
local direction = player:get_look_dir()
|
local direction = player:get_look_dir()
|
||||||
local player_vel = player:get_velocity()
|
local player_vel = player:get_velocity()
|
||||||
local turn_amount = anglediff(minetest.dir_to_yaw(direction), minetest.dir_to_yaw(player_vel))
|
local turn_amount = anglediff(minetest.dir_to_yaw(direction), minetest.dir_to_yaw(player_vel))
|
||||||
local direction_mult = clamp(-direction.y + 0, -1, 1)
|
local direction_mult = clamp(-direction.y + 0, -0.8, 1)
|
||||||
if direction_mult < 0 then direction_mult = -(direction_mult^2) end
|
if direction_mult < 0 then direction_mult = -(direction_mult^2) / 2 end
|
||||||
|
|
||||||
local speed_mult = elytra.speed + direction_mult * speedup_mult * dtime
|
local speed_mult = elytra.speed + direction_mult * speedup_mult * dtime
|
||||||
speed_mult = speed_mult - slowdown_mult * dtime -- slow down
|
speed_mult = speed_mult - slowdown_mult * dtime -- slow down
|
||||||
|
@ -326,7 +326,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
elytra.rocketing = elytra.rocketing - dtime
|
elytra.rocketing = elytra.rocketing - dtime
|
||||||
if vector.length(player_velocity) < 40 then
|
if vector.length(player_velocity) < 40 then
|
||||||
-- player:add_velocity(vector.multiply(player:get_look_dir(), 4))
|
-- player:add_velocity(vector.multiply(player:get_look_dir(), 4))
|
||||||
speed_mult = 30
|
speed_mult = 10
|
||||||
elytra.speed = speed_mult
|
elytra.speed = speed_mult
|
||||||
add_particle({
|
add_particle({
|
||||||
pos = fly_pos,
|
pos = fly_pos,
|
||||||
|
@ -347,15 +347,15 @@ minetest.register_globalstep(function(dtime)
|
||||||
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)
|
-- 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
|
||||||
-- this is far from ideal, but there's no good way to set_velocity on the player
|
-- this is far from ideal, but there's no good way to set_velocity on the player
|
||||||
player_vel = vector.multiply(player_vel, -0.4 * dtime * 30)
|
player_vel = vector.multiply(player_vel, -0.1)
|
||||||
new_vel = vector.add(new_vel, player_vel)
|
new_vel = vector.add(new_vel, player_vel)
|
||||||
|
|
||||||
new_vel.y = new_vel.y - (200 / math.max(speed_mult, 2)) * dtime
|
new_vel.y = new_vel.y - (100 / math.max(speed_mult, 1)) * dtime
|
||||||
new_vel.y = new_vel.y - fall_speed * dtime
|
new_vel.y = new_vel.y - fall_speed * dtime
|
||||||
player:add_velocity(new_vel)
|
player:add_velocity(new_vel)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue