From 550f8712aebf12758d6b38587ee56001040115b5 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Fri, 3 Jan 2020 11:54:49 +0100 Subject: [PATCH] dying player bugfix (when fly mode is disabled) --- README.md | 6 +++--- config.lua | 12 ++++++++++++ control.lua | 12 +++++++++++- init.lua | 2 +- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3252707..c921ea8 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The size of the crane (which is the construction area) and the rope length can b If there is not enough free space for the crane mast/arm or the potential construction area of the crane intersects a protected area from another player, the crane will not be build. -* Right-click the crane switch block to switch to fly privs. The player will be placed in front of the crane. +* Right-click the crane switch block to start the crane (get fly privs). The player will be placed in front of the crane. * To remove the crane, destroy the base block. @@ -31,7 +31,7 @@ default # License -Copyright (C) 2017-2019 Joachim Stolberg +Copyright (C) 2017-2020 Joachim Stolberg Code: Licensed under the GNU LGPL version 2.1 or later. See LICENSE.txt and http://www.gnu.org/licenses/lgpl-2.1.txt Textures: CC0 @@ -57,4 +57,4 @@ Textures: CC0 * 2018-05-28 v1.0 Mod released * 2019-09-08 v2.0 Completely restructured, protection areas removed * 2019-12-03 v2.1 Bugfix issue #2 (Some players still have "fly" after detaching) - +* 2020-01-03 V2.2 dying player bugfix (when fly mode is disabled) diff --git a/config.lua b/config.lua index ee460b9..0ee5296 100644 --- a/config.lua +++ b/config.lua @@ -1,3 +1,15 @@ +--[[ + + Tower Crane Mod + =============== + + Copyright (C) 2017-2020 Joachim Stolberg + LGPLv2.1+ + See LICENSE.txt for more information + +]]-- + + -- Maximum crane height in blocks (8..n) towercrane.max_height = tonumber(minetest.setting_get("towercrane_max_height")) or 32 diff --git a/control.lua b/control.lua index b120073..1a5394a 100644 --- a/control.lua +++ b/control.lua @@ -3,7 +3,7 @@ Tower Crane Mod =============== - Copyright (C) 2017-2019 Joachim Stolberg + Copyright (C) 2017-2020 Joachim Stolberg LGPLv2.1+ See LICENSE.txt for more information @@ -309,6 +309,16 @@ minetest.register_on_leaveplayer(function(player) end end) +minetest.register_on_dieplayer(function(player, reason) + if is_operator(player) then + local pos = get_my_crane_pos(player) + if pos then + reset_operator_privs(player) + stop_crane(pos, player) + end + end +end) + minetest.register_lbm({ label = "[towercrane] break down", name = "towercrane:break_down", diff --git a/init.lua b/init.lua index c39a32f..83f18b9 100644 --- a/init.lua +++ b/init.lua @@ -3,7 +3,7 @@ Tower Crane Mod =============== - Copyright (C) 2017-2019 Joachim Stolberg + Copyright (C) 2017-2020 Joachim Stolberg LGPLv2.1+ See LICENSE.txt for more information