From 30f870e88c92585e2978dbbced449f08bb8be2d0 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Fri, 15 May 2020 19:02:38 +0200 Subject: [PATCH 1/4] Reset player view and attachment table on death --- cart_entity.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cart_entity.lua b/cart_entity.lua index 07fe911..73ae7d4 100644 --- a/cart_entity.lua +++ b/cart_entity.lua @@ -94,7 +94,7 @@ end -- 0.5.x and later: When the driver leaves function cart_entity:on_detach_child(child) if child and child:get_player_name() == self.driver then - self.driver = nil + boost_cart:manage_attachment(child, nil) end end From c8f7cae2c8a4e495cc69bc0351240123da53ddf6 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sat, 16 May 2020 19:13:26 +0200 Subject: [PATCH 2/4] Set driver to nil (like before) The driver variable is not handled by boost_cart:manage_attachment --- cart_entity.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/cart_entity.lua b/cart_entity.lua index 73ae7d4..6f23613 100644 --- a/cart_entity.lua +++ b/cart_entity.lua @@ -94,6 +94,7 @@ end -- 0.5.x and later: When the driver leaves function cart_entity:on_detach_child(child) if child and child:get_player_name() == self.driver then + self.driver = nil boost_cart:manage_attachment(child, nil) end end From 56f5b18dae1e4f54046c52c620c9e4e9a093e7a9 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 29 May 2020 19:14:06 +0200 Subject: [PATCH 3/4] Fix item collection Broken since 5.3.0-dev Co-authored-by: SmallJoker --- cart_entity.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cart_entity.lua b/cart_entity.lua index 6f23613..9cc5324 100644 --- a/cart_entity.lua +++ b/cart_entity.lua @@ -340,10 +340,13 @@ function cart_entity:on_step(dtime) if self.punched then -- Collect dropped items for _, obj_ in pairs(minetest.get_objects_inside_radius(pos, 1)) do - if not obj_:is_player() and - obj_:get_luaentity() and - not obj_:get_luaentity().physical_state and - obj_:get_luaentity().name == "__builtin:item" then + local ent = obj_:get_luaentity() + -- Careful here: physical_state and disable_physics are item-internal APIs + if ent and ent.name == "__builtin:item" and ent.physical_state then + -- Check API to support 5.2.0 and older + if ent.disable_physics then + ent:disable_physics() + end obj_:set_attach(self.object, "", {x=0, y=0, z=0}, {x=0, y=0, z=0}) self.attached_items[#self.attached_items + 1] = obj_ From 5b5318338153ece8846ed6089c9ee49d11283213 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sat, 30 May 2020 09:08:54 +0200 Subject: [PATCH 4/4] Descend from cart using sneak (#31) --- README.md | 1 + cart_entity.lua | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 8b7324f..765d505 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Target: Run smoothly as possible, even on laggy servers. - Rail junction switching with the 'right/left' walking keys - Handbrake with the 'back' key - Support for non-minetest_game subgames +- Descend from cart using the `sneak` key ## Settings This mod can be adjusted to fit the preference of a player or server. Use the `Settings -> All Settings` dialog in the main menu or tune your diff --git a/cart_entity.lua b/cart_entity.lua index 9cc5324..a30885c 100644 --- a/cart_entity.lua +++ b/cart_entity.lua @@ -304,6 +304,12 @@ function cart_entity:on_step(dtime) acc = -0.4 end end + if ctrl and ctrl.sneak then + -- Descend when sneak is pressed + boost_cart:manage_attachment(player, nil) + player = nil + ctrl = nil + end if acc then -- Slow down or speed up, depending on Y direction