0.0.1
This commit is contained in:
commit
b8fc46244e
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 monk
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
36
README.md
Normal file
36
README.md
Normal file
@ -0,0 +1,36 @@
|
||||
Inventory Overflow
|
||||
==================
|
||||
|
||||
Places digged items into the next available inventory
|
||||
|
||||
MIT © 2024 monk
|
||||
|
||||
___
|
||||
|
||||
## Summary
|
||||
|
||||
When you dig a node, and your main inventory is full, this mod will attempt to put that node into the next available inventory provided by:
|
||||
|
||||
- [sfinv_bags](https://codeberg.org/tenplus1/sfinv_bags) or [unified_inventory bags](https://github.com/minetest-mods/unified_inventory)
|
||||
- Support for up to all four bag inventories!
|
||||
- Only works if a bag is equipped!
|
||||
|
||||
- [Enderchest](https://codeberg.org/Wuzzy/xdecor-libre)
|
||||
- [Void Chest](https://github.com/MeseCraft/void_chest)
|
||||
- Both chests can be used simultaneously!
|
||||
- Only works if a chest is in the main inventory, or a bag inventory!
|
||||
|
||||
|
||||
Dig a node, try to put it in:
|
||||
- Main inventory
|
||||
- Enderchest if carried in main inventory
|
||||
- Void Chest if carried in main inventory
|
||||
- Equipped bags 1 through 4
|
||||
- Enderchest if carried in the equipped bag
|
||||
- Void Chest if carried in the equipped bag
|
||||
- The ground if everything is full
|
||||
|
||||
|
||||
This mod should work as-is without configuration, provided there is at least one of the above mentionned mods already installed.
|
||||
|
||||
I guess that's it
|
104
init.lua
Normal file
104
init.lua
Normal file
@ -0,0 +1,104 @@
|
||||
--==[[ Inventory Overflow - 0.0.1 ]]==--
|
||||
--==[[ MIT © 2024 monk ]]==--
|
||||
|
||||
local bags_enabled = minetest.get_modpath("unified_inventory")
|
||||
and minetest.settings:get_bool("unified_inventory_bags") ~= false
|
||||
or minetest.get_modpath("sfinv_bags") and true
|
||||
|
||||
local void_chest_item = minetest.get_modpath("void_chest") and "void_chest:void_chest"
|
||||
local void_chest_inv = void_chest_item and "void_chest:void_chest"
|
||||
|
||||
local enderchest_item = minetest.get_modpath("xdecor") and "xdecor:enderchest"
|
||||
local enderchest_inv = enderchest_item and "enderchest"
|
||||
|
||||
local function get_bags(player)
|
||||
return minetest.get_inventory({
|
||||
type = "detached",
|
||||
name = player:get_player_name().."_bags"
|
||||
})
|
||||
end
|
||||
|
||||
local old_handle_node_drops = minetest.handle_node_drops
|
||||
function minetest.handle_node_drops(pos, drops, digger)
|
||||
|
||||
if not digger or not digger:is_player() then
|
||||
return old_handle_node_drops(pos, drops, digger)
|
||||
end
|
||||
|
||||
local inv = digger:get_inventory()
|
||||
|
||||
if inv then
|
||||
for _, item in ipairs(drops) do
|
||||
|
||||
if inv:room_for_item("main", item) then
|
||||
inv:add_item("main", item)
|
||||
|
||||
elseif enderchest_item
|
||||
and inv:contains_item("main", enderchest_item)
|
||||
and inv:room_for_item(enderchest_inv, item) then
|
||||
inv:add_item(enderchest_inv, item)
|
||||
|
||||
elseif void_chest_item
|
||||
and inv:contains_item("main", void_chest_item)
|
||||
and inv:room_for_item(void_chest_inv, item) then
|
||||
inv:add_item(void_chest_inv, item)
|
||||
|
||||
elseif bags_enabled and (function()
|
||||
local bag_inv = get_bags(digger)
|
||||
for i = 1, 4 do
|
||||
if bag_inv:get_stack("bag" .. i, 1):get_definition().groups.bagslots then
|
||||
local bagcontents = "bag"..i.."contents"
|
||||
|
||||
if inv:room_for_item(bagcontents, item) then
|
||||
inv:add_item(bagcontents, item)
|
||||
return true
|
||||
|
||||
elseif enderchest_item
|
||||
and inv:contains_item(bagcontents, enderchest_item)
|
||||
and inv:room_for_item(enderchest_inv, item) then
|
||||
inv:add_item(enderchest_inv, item)
|
||||
return true
|
||||
|
||||
elseif void_chest_item
|
||||
and inv:contains_item(bagcontents, void_chest_item)
|
||||
and inv:room_for_item(void_chest_inv, item) then
|
||||
inv:add_item(void_chest_inv, item)
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end)() then
|
||||
|
||||
else
|
||||
minetest.add_item(pos, item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------------------------
|
||||
-- MIT License --
|
||||
-- --
|
||||
-- Copyright © 2024 monk --
|
||||
-- --
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy --
|
||||
-- of this software and associated documentation files (the "Software"), to deal --
|
||||
-- in the Software without restriction, including without limitation the rights --
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --
|
||||
-- copies of the Software, and to permit persons to whom the Software is --
|
||||
-- furnished to do so, subject to the following conditions: --
|
||||
-- --
|
||||
-- The above copyright notice and this permission notice shall be included in all --
|
||||
-- copies or substantial portions of the Software. --
|
||||
-- --
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --
|
||||
-- SOFTWARE. --
|
||||
------------------------------------------------------------------------------------
|
8
mod.conf
Normal file
8
mod.conf
Normal file
@ -0,0 +1,8 @@
|
||||
name = inventory_overflow
|
||||
author = monk
|
||||
optional_depends = sfinv, unified_inventory, xdecor, void_chest
|
||||
|
||||
description = For when your inventory is full, digged items are placed into the next inventory
|
||||
license = MIT
|
||||
title = Inventory Overflow
|
||||
forum = https://github.com/monk-afk/inventory-overflow
|
BIN
screenshot.png
Normal file
BIN
screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 156 KiB |
Loading…
x
Reference in New Issue
Block a user