From 61b870b9af4daa1c900d7bb936de5121ab8d005a Mon Sep 17 00:00:00 2001 From: Piezo_ Date: Sun, 9 Dec 2018 16:19:10 -0800 Subject: [PATCH 1/4] Removed airstopper until minetest devs are smart enough to implement serverside players --- init.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index b246906..41a1bc2 100644 --- a/init.lua +++ b/init.lua @@ -52,7 +52,7 @@ hangglider.id = {} -- hud id for displaying overlay with struts end if debug then hangglider.debug = {} end -- hud id for debug data --hangglider.airbreak = {} -- true if falling fast when equip - +--[[ minetest.register_entity("hangglider:airstopper", { --A one-instant entity that catches the player and stops them. is_visible = false, physical = false, @@ -85,7 +85,7 @@ minetest.register_entity("hangglider:airstopper", { --A one-instant entity that self.object:remove() end end -}) +})]] if minetestd and minetestd.services.gravityctl.enabled then minetestd.gravityctl.register_gravity_effect("hangglider", @@ -123,8 +123,10 @@ minetest.register_entity("hangglider:glider", { if not (mrn_name.walkable or (mrn_name.drowning and mrn_name.drowning == 1)) then canExist = true step_v = player:get_player_velocity().y - if step_v < 0 then + if step_v < 0 and step_v > -3 then player:set_physics_override({speed=math.abs(step_v/2) + 0.75}) + elseif step_v <= -3 then --Cap our fall speed. + player:set_physics_override({speed=2.25}) else player:set_physics_override({speed=1}) end @@ -221,7 +223,7 @@ minetest.register_tool("hangglider:hangglider", { if HUD_Overlay then player:hud_change(hangglider.id[pname], "text", "glider_struts.png") end local airbreak = false local vel = player:get_player_velocity().y - if vel < -1.5 then -- engage mid-air, falling fast, so stop but ramp velocity more quickly + --[[if vel < -1.5 then -- engage mid-air, falling fast, so stop but ramp velocity more quickly --hangglider.airbreak[pname] = true airbreak = true local stopper = minetest.add_entity(pos, "hangglider:airstopper") @@ -230,7 +232,7 @@ minetest.register_tool("hangglider:hangglider", { stopper:get_luaentity().attach = player player:set_attach( stopper, "", {x=0,y=0,z=0}, {x=0,y=0,z=0}) end, stopper, player) - end + end]] if not airbreak then if moveModelUp then minetest.add_entity(pos, "hangglider:glider"):set_attach(player, "", {x=0,y=10,z=0}, {x=0,y=0,z=0}) From 62b8366905b314af5442de99896d94e1eb41b9e8 Mon Sep 17 00:00:00 2001 From: Piezo_ Date: Sun, 9 Dec 2018 17:52:41 -0800 Subject: [PATCH 2/4] simplified liquid check --- init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 41a1bc2..0030185 100644 --- a/init.lua +++ b/init.lua @@ -37,7 +37,8 @@ -- Improved gravity adjustment function. -- Changed airbreaking process -- Removed airbreak penalty, as any 'advantage' seems minimal after new adjustments - +-- Removed airbreak until minetest devs are smart enough to implement better serverside players. +-- Simplified liquid check. local HUD_Overlay = true --show glider struts as overlay on HUD local debug = false --show debug info in top-center of hud @@ -120,7 +121,7 @@ minetest.register_entity("hangglider:glider", { if hangglider.use[pname] then local mrn_name = minetest.registered_nodes[minetest.get_node(vector.new(pos.x, pos.y-0.5, pos.z)).name] if mrn_name then - if not (mrn_name.walkable or (mrn_name.drowning and mrn_name.drowning == 1)) then + if not (mrn_name.walkable or mrn_name.liquidtype) then canExist = true step_v = player:get_player_velocity().y if step_v < 0 and step_v > -3 then From 1153c08213b05a704f5990250bbb974829e35c8d Mon Sep 17 00:00:00 2001 From: Piezo_ Date: Sun, 9 Dec 2018 17:58:20 -0800 Subject: [PATCH 3/4] That didn't work, how about now? --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 0030185..3fed91e 100644 --- a/init.lua +++ b/init.lua @@ -121,7 +121,7 @@ minetest.register_entity("hangglider:glider", { if hangglider.use[pname] then local mrn_name = minetest.registered_nodes[minetest.get_node(vector.new(pos.x, pos.y-0.5, pos.z)).name] if mrn_name then - if not (mrn_name.walkable or mrn_name.liquidtype) then + if not (mrn_name.walkable or mrn_name.liquidtype ~= "none") then canExist = true step_v = player:get_player_velocity().y if step_v < 0 and step_v > -3 then From 43a734a57b0d2149e874de9c3d23331d8978b648 Mon Sep 17 00:00:00 2001 From: Piezo_ Date: Sun, 9 Dec 2018 17:59:23 -0800 Subject: [PATCH 4/4] An entire commit just for one comment --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 3fed91e..aa92f17 100644 --- a/init.lua +++ b/init.lua @@ -126,7 +126,7 @@ minetest.register_entity("hangglider:glider", { step_v = player:get_player_velocity().y if step_v < 0 and step_v > -3 then player:set_physics_override({speed=math.abs(step_v/2) + 0.75}) - elseif step_v <= -3 then --Cap our fall speed. + elseif step_v <= -3 then --Cap our gliding movement speed. player:set_physics_override({speed=2.25}) else player:set_physics_override({speed=1})