equipment & PlayerInventoryUI: Added test clothing, autolistring for clothing slots, and clothing slot overlay

This commit is contained in:
Van
2026-04-28 19:52:02 +03:00
parent b314f7adf8
commit 95bba1b02d
5 changed files with 103 additions and 6 deletions

View File

@@ -62,6 +62,47 @@ Item:new({
}
})
Item:new({
settings = {
name = 'shapka',
inventory_image = EquipTileSheet:t(6, 0),
groups = {
equip_head = 1
}
}
})
Item:new({
settings = {
name = 'rubashka',
inventory_image = EquipTileSheet:t(6, 1),
groups = {
equip_torso = 1
}
}
})
Item:new({
settings = {
name = 'trusy',
inventory_image = EquipTileSheet:t(6, 2),
groups = {
equip_legs = 1
}
}
})
Item:new({
settings = {
name = 'noski',
inventory_image = EquipTileSheet:t(6, 3),
groups = {
equip_feet = 1
}
}
})
Item:new({
settings = {
name = 'bag',

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -466,7 +466,43 @@ local function equipListring(player, inventory, fromList, fromIndex)
-- If it's already occupied, we prevent items from being moved.
--
-- TODO: дописать автолистринг для одежды
if core.get_item_group(itemStack:get_name(), 'equip_head') == 2 then
if core.get_item_group(itemStack:get_name(), 'equip_head') == 1 then
if not inventory:get_stack('equip_head', 1):is_empty() then
return 0
end
inventory:set_stack('equip_head', 1, itemStack)
inventory:set_stack(fromList, fromIndex, nil)
PlayerInventoryUI:showForm(playerName)
return
elseif core.get_item_group(itemStack:get_name(), 'equip_torso') == 1 then
if not inventory:get_stack('equip_torso', 1):is_empty() then
return 0
end
inventory:set_stack('equip_torso', 1, itemStack)
inventory:set_stack(fromList, fromIndex, nil)
PlayerInventoryUI:showForm(playerName)
return
elseif core.get_item_group(itemStack:get_name(), 'equip_legs') == 1 then
if not inventory:get_stack('equip_legs', 1):is_empty() then
return 0
end
inventory:set_stack('equip_legs', 1, itemStack)
inventory:set_stack(fromList, fromIndex, nil)
PlayerInventoryUI:showForm(playerName)
return
elseif core.get_item_group(itemStack:get_name(), 'equip_feet') == 1 then
if not inventory:get_stack('equip_feet', 1):is_empty() then
return 0
end
inventory:set_stack('equip_feet', 1, itemStack)
inventory:set_stack(fromList, fromIndex, nil)
PlayerInventoryUI:showForm(playerName)
return
elseif core.get_item_group(itemStack:get_name(), 'equip_head') == 2 then
if not inventory:get_stack('equip_head', 2):is_empty() then
return 0
end

View File

@@ -49,18 +49,38 @@ local function getEquipTab(self, playerName, tabType)
local inv = player:get_inventory()
-- If the equipment slots are empty, then we apply an overlay.
-- TODO: оверлей одежды
if inv:get_stack('equip_head', 1):is_empty() then
EquipTab:image(56/16, 45/16, 1, 1, slotsOverlayTileSheet:t(0,0))
end
if inv:get_stack('equip_torso', 1):is_empty() then
EquipTab:image(104/16, 45/16, 1, 1, slotsOverlayTileSheet:t(0,1))
end
if inv:get_stack('equip_legs', 1):is_empty() then
EquipTab:image(56/16, 65/16, 1, 1, slotsOverlayTileSheet:t(0,2))
end
if inv:get_stack('equip_feet', 1):is_empty() then
EquipTab:image(104/16, 65/16, 1, 1, slotsOverlayTileSheet:t(0,3))
end
if inv:get_stack('equip_head', 2):is_empty() then
EquipTab:image(44/16, 33/16, 1, 1, slotsOverlayTileSheet:t(0,0))
EquipTab:image(44/16, 33/16, 1, 1, slotsOverlayTileSheet:t(1,0))
end
if inv:get_stack('equip_torso', 2):is_empty() then
EquipTab:image(116/16, 33/16, 1, 1, slotsOverlayTileSheet:t(0,1))
EquipTab:image(116/16, 33/16, 1, 1, slotsOverlayTileSheet:t(1,1))
end
if inv:get_stack('equip_legs', 2):is_empty() then
EquipTab:image(44/16, 77/16, 1, 1, slotsOverlayTileSheet:t(0,2))
EquipTab:image(44/16, 77/16, 1, 1, slotsOverlayTileSheet:t(1,2))
end
if inv:get_stack('equip_feet', 2):is_empty() then
EquipTab:image(116/16, 77/16, 1, 1, slotsOverlayTileSheet:t(0,3))
EquipTab:image(116/16, 77/16, 1, 1, slotsOverlayTileSheet:t(1,3))
end
if inv:get_stack('equip_back', 1):is_empty() then
EquipTab:image(80/16, 97/16, 1, 1, slotsOverlayTileSheet:t(0,4))
end
if inv:get_stack('equip_left_thigh', 1):is_empty() then
EquipTab:image(60/16, 97/16, 1, 1, slotsOverlayTileSheet:t(1,4))
end
if inv:get_stack('equip_right_thigh', 1):is_empty() then
EquipTab:image(100/16, 97/16, 1, 1, slotsOverlayTileSheet:t(1,4))
end
return EquipTab

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 10 KiB