From 932a5ec9a8fbb910b847ffc27fbadaff33ffe5c1 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Mon, 19 Apr 2021 19:33:46 -0700 Subject: [PATCH] Patch helicopter mod to add some settings --- README.md | 3 ++- minetest.conf.example | 19 +++++++++++++++++++ mods/transport/helicopter/depends.txt | 4 ---- mods/transport/helicopter/heli_entities.lua | 10 +++++++--- mods/transport/helicopter/init.lua | 1 + mods/transport/helicopter/settings.lua | 12 ++++++++++++ mods/transport/helicopter/settingtypes.txt | 7 +++++++ settingtypes.txt | 10 ++++++++++ 8 files changed, 58 insertions(+), 8 deletions(-) delete mode 100644 mods/transport/helicopter/depends.txt create mode 100644 mods/transport/helicopter/settings.lua create mode 100644 mods/transport/helicopter/settingtypes.txt diff --git a/README.md b/README.md index 18d9c9b7..cebb4d9d 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m * transport/ * [bike][] ([MIT][lic.bike]) -- version: [1.2][ver.bike] *2021-04-12* * [boats][boats2] ([LGPL][lic.lgpl3.0] / [CC BY-SA][lic.ccbysa3.0]) -- version: [b83231e Git][ver.boats2] *2016-10-14* ([patched][patch.boats2]) ***UPSTREAM MOVED*** - * [helicopter][] ([GPL][lic.gpl2.0] / [CC0][lic.cc0] / CC BY-NC) -- version: [1955cdd Git][ver.helicopter] *2021-03-28* + * [helicopter][] ([GPL][lic.gpl2.0] / [CC0][lic.cc0] / CC BY-NC) -- version: [1955cdd Git][ver.helicopter] *2021-03-28* ([patched][patch.helicopter]) * [hovercraft][] ([LGPL / CC BY-SA / CC0][lic.hovercraft]) -- version: [4d50e68 Git][ver.hovercraft] *2017-05-14* ([patched][patch.hovercraft]) * ui/ * [bookmarks_gui][] ([BSD 3-Clause][lic.bookmarks_gui]) -- version: [f7ae10a Git][ver.bookmarks_gui] *2017-08-29* @@ -554,6 +554,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m [patch.gems_tools]: https://github.com/AntumMT/mod-gems_tools/tree/7f89843 [patch.hbarmor]: https://github.com/AntumMT/mod-hbarmor/tree/12a7dea [patch.hbsprint]: https://github.com/AntumMT/mod-hbsprint/tree/03aef67 +[patch.helicopter]: https://github.com/AntumMT/mod-helicopter/tree/dc7066b [patch.homedecor]: https://github.com/AntumMT/mp-homedecor/tree/e1ede67 [patch.hovercraft]: https://github.com/AntumMT/mod-hovercraft/tree/73a6223 [patch.hud]: https://github.com/AntumMT/mod-hud/tree/6846e20 diff --git a/minetest.conf.example b/minetest.conf.example index ae8128dc..774fc661 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -2261,6 +2261,25 @@ torches_enable_ceiling = false +############### +## TRANSPORT ## +############### + +# *** helicopter *** + +## If enabled, places helicopter in inventory instead of destroying it +# when punched. +# type: bool +# default: false +#helicopter.pick_up = true + +## If enabled, helicopter will be controlled via mouse by default. +# type: bool +# default: false +#helicopter.mouse_default = true + + + ######## ## UI ## ######## diff --git a/mods/transport/helicopter/depends.txt b/mods/transport/helicopter/depends.txt deleted file mode 100644 index e7a04f5a..00000000 --- a/mods/transport/helicopter/depends.txt +++ /dev/null @@ -1,4 +0,0 @@ -player_api -biofuel -default? -creative? diff --git a/mods/transport/helicopter/heli_entities.lua b/mods/transport/helicopter/heli_entities.lua index 9ac68c32..8bb7e4e5 100644 --- a/mods/transport/helicopter/heli_entities.lua +++ b/mods/transport/helicopter/heli_entities.lua @@ -50,7 +50,7 @@ minetest.register_entity("helicopter:heli", { hp_max = 50, color = "#0063b0", _passenger = nil, - _by_mouse = true, + _by_mouse = helicopter.mouse_default, get_staticdata = function(self) -- unloaded/unloads ... is now saved return minetest.serialize({ @@ -273,8 +273,12 @@ minetest.register_entity("helicopter:heli", { end if self.hp_max <= 0 then - self.object:remove() - puncher:get_inventory():add_item("main", "helicopter:heli") + if helicopter.pick_up then + self.object:remove() + puncher:get_inventory():add_item("main", "helicopter:heli") + else + helicopter.destroy(self) + end end end diff --git a/mods/transport/helicopter/init.lua b/mods/transport/helicopter/init.lua index a91f508d..087761c4 100644 --- a/mods/transport/helicopter/init.lua +++ b/mods/transport/helicopter/init.lua @@ -29,6 +29,7 @@ helicopter.colors ={ yellow='#ffe400', } +dofile(minetest.get_modpath("helicopter") .. DIR_DELIM .. "settings.lua") --dofile(minetest.get_modpath(minetest.get_current_modname()) .. DIR_DELIM .. "heli_hud.lua") dofile(minetest.get_modpath("helicopter") .. DIR_DELIM .. "heli_hud.lua") dofile(minetest.get_modpath("helicopter") .. DIR_DELIM .. "heli_utilities.lua") diff --git a/mods/transport/helicopter/settings.lua b/mods/transport/helicopter/settings.lua new file mode 100644 index 00000000..dc9c5b36 --- /dev/null +++ b/mods/transport/helicopter/settings.lua @@ -0,0 +1,12 @@ + +--- Determines handling of punched helicopter. +-- +-- If `false`, helicopter is destroyed. Otherwise, it is added to inventory. +-- - Default: false +helicopter.pick_up = minetest.settings:get_bool("helicopter.pick_up", false) + +--- Determines default control of helicopter. +-- +-- If enabled, helicopter will be controlled via mouse by default. +-- - Default: false +helicopter.mouse_default = minetest.settings:get_bool("helicopter.mouse_default", false) diff --git a/mods/transport/helicopter/settingtypes.txt b/mods/transport/helicopter/settingtypes.txt new file mode 100644 index 00000000..764ff495 --- /dev/null +++ b/mods/transport/helicopter/settingtypes.txt @@ -0,0 +1,7 @@ + +# If enabled, places helicopter in inventory instead of destroying it +# when punched. +helicopter.pick_up (Place in inventory) bool false + +# If enabled, helicopter will be controlled via mouse by default. +helicopter.mouse_default (Mouse control default) bool false diff --git a/settingtypes.txt b/settingtypes.txt index df5988df..f27c5772 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -264,6 +264,16 @@ sprint_breath (Breath) bool true sprint_breath_drain (Breath drain) float 1 +[*helicopter] + +# If enabled, places helicopter in inventory instead of destroying it +# when punched. +helicopter.pick_up (Place in inventory) bool false + +# If enabled, helicopter will be controlled via mouse by default. +helicopter.mouse_default (Mouse control default) bool false + + [*hidename] # Use alpha color level to hide nametag instead of clearing text.