Patch motorbike to add setting to place directly in inventory when punched

master
Jordan Irwin 2021-05-22 00:51:54 -07:00
parent d7c06abc07
commit 6c7a8abeaf
6 changed files with 38 additions and 4 deletions

View File

@ -653,7 +653,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[patch.minetest_game]: https://github.com/AntumMT/mtgame-minetest/tree/355a756
[patch.moreblocks]: https://github.com/AntumMT/mod-moreblocks/tree/6dda839
[patch.moreores]: https://github.com/AntumMT/mod-moreores/tree/ae59578
[patch.motorbike]: https://github.com/AntumMT/mod-motorbike/tree/e9bcce2
[patch.motorbike]: https://github.com/AntumMT/mod-motorbike/tree/3bb0c6a
[patch.mysheetmetal]: https://github.com/AntumMT/mod-mysheetmetal/tree/2ffb3a2
[patch.nether]: https://github.com/AntumMT/mod-nether/tree/7a84ddd
[patch.pipeworks]: https://gitlab.com/AntumMT/mod-pipeworks/tree/48b082e

View File

@ -2417,6 +2417,15 @@ torches_enable_ceiling = false
#helicopter.mouse_default = true
# *** motorbike ***
## If enabled, bike is placed in inventory when punched.
# type: bool
# default: false
#motorbike.punch_inv = false
########
## UI ##

View File

@ -27,6 +27,7 @@ for setting, default in pairs(settings) do
biker[setting] = value
end
biker.path = minetest.get_modpath"motorbike"
dofile(biker.path .. "/settings.lua")
dofile(biker.path .. "/functions.lua")
local bikelist = {
"black",
@ -96,9 +97,21 @@ for _, colour in pairs(bikelist) do
end
if not self.driver then
if biker.breakable then
local pos = self.object:get_pos()
local item = minetest.add_item(pos, self.drop)
if item then
if not biker.punch_inv then
local pos = self.object:get_pos()
local item = minetest.add_item(pos, self.drop)
if item then
self.object:remove()
if self.plate then self.plate:remove() end
end
else
local stack = ItemStack(self.drop)
local pinv = puncher:get_inventory()
if not pinv:room_for_item("main", stack) then
core.chat_send_player(puncher:get_player_name(), "You do not have room in your inventory")
return
end
pinv:add_item("main", stack)
self.object:remove()
if self.plate then self.plate:remove() end
end

View File

@ -0,0 +1,3 @@
-- If enabled, bike is be placed in inventory when punched.
biker.punch_inv = core.settings:get_bool("motorbike.punch_inv", false)

View File

@ -0,0 +1,3 @@
# If enabled, bike is placed in inventory when punched.
motorbike.punch_inv (Punch places in inventory) bool false

View File

@ -693,6 +693,12 @@ listitems.enable_singleword (Enable singleword commands) bool true
moreblocks.stairsplus_in_creative_inventory (Display Stairs+ nodes in creative inventory) bool true
[*motorbike]
# If enabled, bike is placed in inventory when punched.
motorbike.punch_inv (Punch places in inventory) bool false
[*pipeworks]
#Enable pipes.