init; changed chat command and minor things
This commit is contained in:
commit
8175b529b3
12 changed files with 1084 additions and 0 deletions
95
src/formspecs.lua
Normal file
95
src/formspecs.lua
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
local S = minetest.get_translator("mcl_chests")
|
||||
local F = minetest.formspec_escape
|
||||
local C = minetest.colorize
|
||||
|
||||
|
||||
-- Get the formspec for the inventory based on the game
|
||||
function inventory_admin.get_player_inventory_formspec(target_player_name, admin_name)
|
||||
if inventory_admin.utils.is_mineclone2() then
|
||||
-- MineClone2 formspec
|
||||
local formspec = {
|
||||
"formspec_version[4]",
|
||||
"size[11.75,13]", -- Adjust the height to accommodate the spacing
|
||||
|
||||
-- Title for the target player's inventory
|
||||
"label[0.375,0.375;", minetest.formspec_escape(target_player_name .. "'s Inventory"), "]",
|
||||
|
||||
-- Slot backgrounds for the target player's main inventory excluding the hotbar
|
||||
mcl_formspec.get_itemslot_bg_v4(0.375, 1, 9, 3),
|
||||
|
||||
-- Slot list for the target player's main inventory excluding the hotbar
|
||||
"list[detached:" .. target_player_name .. "_inventory;main;0.375,1;9,3;9]",
|
||||
|
||||
-- Slot background for the target player's hotbar, placed at the bottom
|
||||
mcl_formspec.get_itemslot_bg_v4(0.375, 5, 9, 1),
|
||||
|
||||
-- Slot list for the target player's hotbar
|
||||
"list[detached:" .. target_player_name .. "_inventory;main;0.375,5;9,1;0]",
|
||||
|
||||
-- Title for the admin's inventory, moved further down to create space
|
||||
"label[0.375,6.5;Your Inventory]",
|
||||
|
||||
-- Slot backgrounds for the admin player's main inventory excluding the hotbar
|
||||
mcl_formspec.get_itemslot_bg_v4(0.375, 7, 9, 3),
|
||||
|
||||
-- Slot list for the admin player's main inventory excluding the hotbar
|
||||
"list[current_player;main;0.375,7;9,3;9]",
|
||||
|
||||
-- Slot background for the admin player's hotbar, placed further down with spacing similar to the singleplayer's hotbar
|
||||
mcl_formspec.get_itemslot_bg_v4(0.375, 11, 9, 1),
|
||||
|
||||
-- Slot list for the admin player's hotbar, with adjusted Y-coordinate for correct spacing
|
||||
"list[current_player;main;0.375,11;9,1;0]",
|
||||
|
||||
-- Listrings to allow moving items between the target's and admin's inventories
|
||||
"listring[detached:" .. target_player_name .. "_inventory;main]",
|
||||
"listring[current_player;main]",
|
||||
}
|
||||
|
||||
return table.concat(formspec)
|
||||
else
|
||||
-- minetest_game formspec
|
||||
local formspec = {
|
||||
"size[9,11]", -- Width of 8 slots, and enough height to accommodate all slots and labels
|
||||
|
||||
-- Title for the target player's inventory
|
||||
"label[0.5,0;", minetest.formspec_escape(target_player_name .. "s Inventar"), "]",
|
||||
|
||||
-- Singleplayer's complete inventory, including the hotbar in one block
|
||||
"list[detached:" .. target_player_name .. "_inventory;main;0,0.5;9,4;]", -- hotbar, 9 slots per row, 1 rows
|
||||
|
||||
-- Title for the admin's inventory
|
||||
"label[0.5,5.5;Dein Inventar]",
|
||||
|
||||
-- Admin's hotbar visually separated
|
||||
"list[current_player;main;0,6;9,1;0]", -- The hotbar with 9 slots
|
||||
|
||||
-- Admin's main inventory excluding the hotbar
|
||||
"list[current_player;main;0,7;9,3;9]", -- 3 rows of 9 slots each, starting after the hotbar
|
||||
|
||||
-- Listrings for item movement between the inventories
|
||||
"listring[detached:" .. target_player_name .. "_inventory;main]",
|
||||
"listring[current_player;main]",
|
||||
}
|
||||
|
||||
return table.concat(formspec)
|
||||
end
|
||||
end
|
||||
|
||||
function inventory_admin.get_enderchest_inventory_formspec(target_player_name)
|
||||
local formspec_ender_chest = {
|
||||
"formspec_version[4]",
|
||||
"size[11.75,10.425]",
|
||||
"label[0.375,0.375;", F(C(mcl_formspec.label_color, target_player_name.."'s "..S("Ender Chest"))) .. "]",
|
||||
mcl_formspec.get_itemslot_bg_v4(0.375, 0.75, 9, 3),
|
||||
"list[player:" .. target_player_name .. ";enderchest;0.375,0.75;9,3;]", -- Access the target player's enderchest
|
||||
"label[0.375,4.7;", F(C(mcl_formspec.label_color, S("Inventar"))) .. "]",
|
||||
mcl_formspec.get_itemslot_bg_v4(0.375, 5.1, 9, 3),
|
||||
"list[current_player;main;0.375,5.1;9,3;9]",
|
||||
mcl_formspec.get_itemslot_bg_v4(0.375, 9.05, 9, 1),
|
||||
"list[current_player;main;0.375,9.05;9,1;]",
|
||||
"listring[player:" .. target_player_name .. ";enderchest]",
|
||||
"listring[current_player;main]",
|
||||
}
|
||||
return table.concat(formspec_ender_chest)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue