PlayerInventory & PlayerInventoryUI: create equip slots & draft equip tab. #34
This commit is contained in:
@@ -9,6 +9,11 @@ core.register_on_joinplayer(function(player)
|
|||||||
player:hud_set_hotbar_itemcount(9)
|
player:hud_set_hotbar_itemcount(9)
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
inv:set_size('main', 18)
|
inv:set_size('main', 18)
|
||||||
|
-- Player equipment slots:
|
||||||
|
inv:set_size('equip_head', 2)
|
||||||
|
inv:set_size('equip_torso', 2)
|
||||||
|
inv:set_size('equip_legs', 2)
|
||||||
|
inv:set_size('equip_feet', 2)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
core.register_chatcommand('show_inv',
|
core.register_chatcommand('show_inv',
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ local function getFullForm(self, playerName)
|
|||||||
-- * left tab - equipment;
|
-- * left tab - equipment;
|
||||||
-- * right tab - crafting menu.
|
-- * right tab - crafting menu.
|
||||||
---@type PlayerInventoryUI.TabName
|
---@type PlayerInventoryUI.TabName
|
||||||
local leftTabName = self:getContex(playerName, 'left_tab_name') or 'craft_tab'
|
local leftTabName = self:getContex(playerName, 'left_tab_name') or 'equip_tab'
|
||||||
---@type PlayerInventoryUI.TabName
|
---@type PlayerInventoryUI.TabName
|
||||||
local rightTabName = self:getContex(playerName, 'right_tab_name') or 'craft_tab'
|
local rightTabName = self:getContex(playerName, 'right_tab_name') or 'craft_tab'
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ local function getFullForm(self, playerName)
|
|||||||
-- Removing the inventory background color:
|
-- Removing the inventory background color:
|
||||||
:bgcolor('#00000000', 'neither')
|
:bgcolor('#00000000', 'neither')
|
||||||
-- A permanent part of the inventory:
|
-- A permanent part of the inventory:
|
||||||
:background(0, 9.5, 22, 3, 'player_inventory_middle_backgound.png', false)
|
:background(0, 9.5, 22, 3, 'player_inventory_middle_background.png', false)
|
||||||
:listColors('#00000000', '#e1b69150')
|
:listColors('#00000000', '#e1b69150')
|
||||||
:list('current_player', 'main', 5.5,9.75, 9,1)
|
:list('current_player', 'main', 5.5,9.75, 9,1)
|
||||||
:list('current_player', 'main', 5.5,11.25, 9,1, 9)
|
:list('current_player', 'main', 5.5,11.25, 9,1, 9)
|
||||||
|
|||||||
@@ -7,9 +7,18 @@ local Formspec = Smc.requireFormspec()
|
|||||||
local function getEquipTab(self, playerName, tabType)
|
local function getEquipTab(self, playerName, tabType)
|
||||||
local EquipTab = Formspec:new()
|
local EquipTab = Formspec:new()
|
||||||
|
|
||||||
|
---The x coordinate for the equipment slot position
|
||||||
|
local equipListsX = 4.5
|
||||||
|
|
||||||
EquipTab
|
EquipTab
|
||||||
:image(0, 0, 11, 9, 'player_inventory_tab_background.png')
|
:image(0, 0, 11, 9, 'player_inventory_equip_tab_background.png')
|
||||||
:label(2,2, 'EQUIPMENT PANE')
|
-- Equipment slots:
|
||||||
|
:label(equipListsX, 0.75, 'cloth')
|
||||||
|
:label(equipListsX+1.25, 0.75, 'armor')
|
||||||
|
:list('current_player', 'equip_head', equipListsX, 1, 2, 1)
|
||||||
|
:list('current_player', 'equip_torso', equipListsX, 2.25, 2, 1)
|
||||||
|
:list('current_player', 'equip_legs', equipListsX, 3.5, 2, 1)
|
||||||
|
:list('current_player', 'equip_feet', equipListsX, 4.75, 2, 1)
|
||||||
|
|
||||||
return EquipTab
|
return EquipTab
|
||||||
end
|
end
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 100 KiB |
Reference in New Issue
Block a user