Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

150 bones inventory slots and register_transfer_inventory_to_bones_on_player_death callback #3030

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b0545dc
bones: bones are now holding 150 item slots and register_transfer_inv…
imre84 May 5, 2023
3dad8a5
fixes as per code review completed
imre84 May 5, 2023
eeec7d6
fixes as per code review completed (2)
imre84 May 6, 2023
5141c96
fixes as per code review completed (3)
imre84 May 12, 2023
4b22280
fixes as per code review completed (4)
imre84 May 29, 2023
224ae80
Use Minetest's `table.insert_all`
appgurueu May 29, 2023
bd60bfb
Fix `table.insert` usage
appgurueu May 29, 2023
738e0d7
Refactor
appgurueu May 30, 2023
9e52fc1
Make Luacheck happy
appgurueu May 30, 2023
b62713f
PR #3030 fix
imre84 Feb 24, 2024
5b35ea5
as per https://github.com/minetest/minetest_game/pull/3030#pullreques…
imre84 Feb 24, 2024
da3c36d
NS routine as per code review
imre84 Feb 27, 2024
25ff385
fix for https://github.com/minetest/minetest_game/pull/3030#pullreque…
imre84 Mar 23, 2024
062fc46
doc clarification
imre84 Mar 23, 2024
e27ad58
as per https://github.com/minetest/minetest_game/pull/3030#discussion…
imre84 Mar 28, 2024
7c119fe
scrollbar vs bones formspec
imre84 Mar 28, 2024
9d41427
debug code removed
imre84 Mar 28, 2024
704f11d
testing/debug code to make the bones go full, needs to be reverted
imre84 Mar 30, 2024
e7d483b
scroll fix
imre84 Mar 30, 2024
dfd0805
whitespace fix
imre84 Mar 30, 2024
5879783
bones inventory reordering
imre84 Mar 30, 2024
48099eb
luacheck fix
imre84 Mar 30, 2024
e62cfaa
whitespace fix
imre84 Mar 31, 2024
cd8cb78
coding style fix
imre84 Mar 31, 2024
cc6b859
coding style fix
imre84 Mar 31, 2024
5cc2b46
coding style fix
imre84 Mar 31, 2024
c2cfa87
to make bones_mode = keep work
imre84 Mar 31, 2024
357f87a
minetest.conf.example updated with bones_max_slots
imre84 Mar 31, 2024
dbfaad4
cb renamed to callback
imre84 Mar 31, 2024
c29990b
debug code reverted
imre84 Mar 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 31 additions & 12 deletions mods/bones/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,38 @@ local function is_owner(pos, name)
return false
end

local function appendmulti(tbl,...)
for _, v in pairs({...}) do
table.insert(tbl, v)
end
end

local function get_bones_formspec_for_size(numitems)
local cols, rows
local scroll=false
SmallJoker marked this conversation as resolved.
Show resolved Hide resolved
if numitems <= min_inv_size then
cols, rows = 8, 4
elseif numitems <= 4 * 15 then
cols, rows = math.ceil(numitems / 4), 4
else
cols, rows = 15, math.ceil(numitems / 15)
cols, rows = 8, math.ceil(numitems / 8)
scroll=true
end
local output={}
appendmulti(output, "size[", 8.5, ",", 9, "]")
if scroll then
appendmulti(output, "scrollbaroptions[max=",rows*9.3,"]")
SmallJoker marked this conversation as resolved.
Show resolved Hide resolved
appendmulti(output, "scrollbar[8,0;0.3,4.5;vertical;bones_scroll;0]")
appendmulti(output, "scroll_container[0,0.3;10.3,4.95;bones_scroll;vertical;0.1]")
end
return table.concat{
"size[", cols, ",", rows + 5, "]",
"list[current_name;main;0,0.3;", cols, ",", rows, ";]",
"list[current_player;main;", (cols - 8) / 2, ",", rows + 0.85, ";8,1;]",
"list[current_player;main;", (cols - 8) / 2, ",", rows + 2.08, ";8,3;8]",
"listring[current_name;main]",
"listring[current_player;main]",
default.get_hotbar_bg(0, 4.85)
}
appendmulti(output, "list[current_name;main;0,0;", cols, ",", rows, ";]")
if scroll then
appendmulti(output, "scroll_container_end[]")
end
appendmulti(output, "list[current_player;main;", 0, ",", 4.75, ";8,1;]")
appendmulti(output, "list[current_player;main;", 0, ",", 5.98, ";8,3;8]")
appendmulti(output, "listring[current_name;main]")
appendmulti(output, "listring[current_player;main]")
appendmulti(output, default.get_hotbar_bg(0, 4.85))
return table.concat(output)
end

local share_bones_time = tonumber(minetest.settings:get("share_bones_time")) or 1200
Expand Down Expand Up @@ -221,6 +235,11 @@ bones.register_collect_items(function(player)

player_inv:set_list(list_name, {})
end
while(#items<bones_max_slots) -- some testcode so that I can easily test how would it look like if it's actually full
do
local inv_slot
table.insert(items, ItemStack("bucket:bucket_lava"))
end
return items
end)

Expand Down