From 832b0afdd63ffc090ada94dcba67a8c4e41647eb Mon Sep 17 00:00:00 2001 From: Sumyjkl Date: Mon, 1 Aug 2022 20:51:08 +1000 Subject: [PATCH] more reasonable values --- mods/PLAYER/mcl_playerplus/init.lua | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 8a9771e460..f786d696d8 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -282,26 +282,29 @@ minetest.register_globalstep(function(dtime) if elytra.active then mcl_player.player_set_animation(player, "fly") - local slowdown_mult = 0.7 -- amount of vel to take - local max_speed = 1000 + local slowdown_mult = 0.2 -- amount of vel to take + local speedup_mult = 10 -- amount of speed to add based on look dir + local max_speed = 60 local direction = player:get_look_dir() local v = player:get_velocity() - local speed_mult = clamp(elytra.speed - direction.y * 30 * dtime, -max_speed, max_speed) + local direction_mult = clamp(direction.y*2, -0.5, 0.5) + local speed_mult = clamp(elytra.speed - direction_mult * speedup_mult * dtime, -max_speed, max_speed) speed_mult = speed_mult - slowdown_mult * speed_mult * dtime -- slow down speed_mult = math.max(speed_mult, -1) + speed_mult = math.min(speed_mult, max_speed) elytra.speed = speed_mult vel = direction vel = vector.multiply(vel, speed_mult) - -- vel = { - -- x = clamp(vel.x, -max_speed, max_speed), - -- y = clamp(vel.y, -max_speed, max_speed), - -- z = clamp(vel.z, -max_speed, max_speed)} + vel = { + x = clamp(vel.x, -max_speed, max_speed), + y = clamp(vel.y, -max_speed, max_speed), + z = clamp(vel.z, -max_speed, max_speed)} -- 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 v = vector.multiply(v, -0.3) player:add_velocity(v) - vel.y = vel.y - (100 / math.max(speed_mult, 1)) * dtime + vel.y = vel.y - (100 / math.max(speed_mult, 2)) * dtime player:add_velocity(vel) playerphysics.add_physics_factor(player, "gravity", "mcl_playerplus:elytra", 0.1)