Compare commits
2 Commits
441fbb8323
...
6eac20e4f5
| Author | SHA1 | Date | |
|---|---|---|---|
| 6eac20e4f5 | |||
| 4210248343 |
67
mods/GAME/ITEMS/ores/init.lua
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
local Item, Node, TileSheet = Smc.requireItem(), Smc.requireNode(), Smc.requireTileSheet()
|
||||||
|
local CraftSystem = Smc.requireCraftSystem()
|
||||||
|
|
||||||
|
-- local InventoryCraftHandler = CraftSystem:getPrimitiveCraftHandler('inside_player_inventory')
|
||||||
|
|
||||||
|
---@type TileSheet
|
||||||
|
local oreTileSheet = TileSheet:new('ores_sheet.png', 16, 16)
|
||||||
|
|
||||||
|
---@class OreDef
|
||||||
|
---@field rarity Item.Rarity?
|
||||||
|
|
||||||
|
---@param name string
|
||||||
|
---@param y integer
|
||||||
|
---@param def OreDef?
|
||||||
|
local function registerOre(name, y, def)
|
||||||
|
if def == nil then
|
||||||
|
def = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
Item:new({
|
||||||
|
settings = {
|
||||||
|
name = name,
|
||||||
|
rarity = def.rarity,
|
||||||
|
inventory_image = oreTileSheet:t(0, y),
|
||||||
|
groups = { ore = 1 }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Ores Items --
|
||||||
|
-- Slag
|
||||||
|
registerOre('slag', 0, {})
|
||||||
|
|
||||||
|
-- Copper ores
|
||||||
|
registerOre('chalcopyrite', 1, {})
|
||||||
|
registerOre('malachite', 2, {})
|
||||||
|
registerOre('cuprite', 3, {})
|
||||||
|
registerOre('native_copper', 4, {})
|
||||||
|
|
||||||
|
-- Tin ores
|
||||||
|
registerOre('cassiterite', 5, {})
|
||||||
|
registerOre('stannite', 6, {})
|
||||||
|
|
||||||
|
-- Iron oresLimonite
|
||||||
|
registerOre('limonite', 7, {})
|
||||||
|
registerOre('hematite', 8, {})
|
||||||
|
registerOre('magnetite', 9, {})
|
||||||
|
registerOre('meteoric_iron', 10, {})
|
||||||
|
|
||||||
|
-- Ores blocks --
|
||||||
|
-- Slag
|
||||||
|
Node:new({
|
||||||
|
settings = {
|
||||||
|
name = 'slag_block',
|
||||||
|
tiles = { oreTileSheet:t(1, 0) },
|
||||||
|
groups = { ore = 1, dig_immediate = 2 }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Malachite
|
||||||
|
Node:new({
|
||||||
|
settings = {
|
||||||
|
name = 'malachite_block',
|
||||||
|
tiles = { oreTileSheet:t(1, 2) },
|
||||||
|
groups = { ore = 1, dig_immediate = 2 }
|
||||||
|
}
|
||||||
|
})
|
||||||
2
mods/GAME/ITEMS/ores/mod.conf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
name = smc__game__items__ores
|
||||||
|
depends = smc__core__node, smc__core__tilesheet
|
||||||
BIN
mods/GAME/ITEMS/ores/textures/sheets/ores_sheet.png
Normal file
|
After Width: | Height: | Size: 66 KiB |
@@ -105,23 +105,23 @@ local function getCompactForm(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, 0.5, 14, 12.5, 'player_inventory_compact_middle_background.png', false)
|
:background(0, 9.5, 14, 3, 'player_inventory_middle_background.png', false)
|
||||||
:listColors('#00000000', '#e1b69150')
|
:listColors('#00000000', '#e1b69150')
|
||||||
:list('current_player', 'main', 1.5, 9.75, 9,1)
|
:list('current_player', 'main', 1.5, 9.75, 9,1)
|
||||||
:list('current_player', 'main', 1.5, 11.25, 9,1, 9)
|
:list('current_player', 'main', 1.5, 11.25, 9,1, 9)
|
||||||
-- Inventory mode switch button (compact/full):
|
-- Inventory mode switch button (compact/full):
|
||||||
:imageButton(12.75, 10, 1, 0.5, 'player_inventory_compact_mode_button_on.png', 'change_compact_mode')
|
:imageButton(12.75, 10, 1, 0.5, 'player_inventory_compact_mode_button_on.png', 'change_compact_mode')
|
||||||
-- Tab:
|
-- Tab:
|
||||||
:container(leftTab(self, playerName, 'left'), 1.5, 0.5)
|
:container(leftTab(self, playerName, 'left'), 0, 0.5)
|
||||||
-- Selection buttons for the (left) panel:
|
-- Selection buttons for the (left) panel:
|
||||||
:imageButton(1.5,0,2,0.5, leftTabButtonTextures[1],'select_left_craft_tab', core.colorize('#e1b691','craft'))
|
:imageButton(0,0,2,0.5, leftTabButtonTextures[1],'select_left_craft_tab', core.colorize('#e1b691','craft'))
|
||||||
:imageButton(3.5,0,2,0.5, leftTabButtonTextures[2], 'select_left_equip_tab', core.colorize('#e1b691','equip'))
|
:imageButton(2,0,2,0.5, leftTabButtonTextures[2], 'select_left_equip_tab', core.colorize('#e1b691','equip'))
|
||||||
:imageButton(5.5,0,2,0.5, leftTabButtonTextures[3], 'select_left_bag_tab', core.colorize('#e1b691','bags'))
|
:imageButton(4,0,2,0.5, leftTabButtonTextures[3], 'select_left_bag_tab', core.colorize('#e1b691','bags'))
|
||||||
:imageButton(7.5,0,2,0.5, leftTabButtonTextures[4], 'select_left_ref_tab', core.colorize('#e1b691','refs'))
|
:imageButton(6,0,2,0.5, leftTabButtonTextures[4], 'select_left_ref_tab', core.colorize('#e1b691','refs'))
|
||||||
|
|
||||||
if self:getContex(playerName, 'node_tab') ~= nil then
|
if self:getContex(playerName, 'node_tab') ~= nil then
|
||||||
InventoryForm
|
InventoryForm
|
||||||
:imageButton(9.5,0,2,0.5, leftTabButtonTextures[5], 'select_left_node_tab', core.colorize('#e1b691','node'))
|
:imageButton(8,0,2,0.5, leftTabButtonTextures[5], 'select_left_node_tab', core.colorize('#e1b691','node'))
|
||||||
end
|
end
|
||||||
|
|
||||||
return InventoryForm:toString()
|
return InventoryForm:toString()
|
||||||
@@ -160,7 +160,7 @@ local function getFullForm(self, playerName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local InventoryForm = Formspec:new({
|
local InventoryForm = Formspec:new({
|
||||||
size = {x=22, y=12.5},
|
size = {x=28, y=12.5},
|
||||||
position = {x=0.5, y=0.55},
|
position = {x=0.5, y=0.55},
|
||||||
noPrepend = true,
|
noPrepend = true,
|
||||||
})
|
})
|
||||||
@@ -175,30 +175,31 @@ 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_background.png', false)
|
:background(0, 9.5, 28, 1.5, 'player_inventory_middle_margin_background.png', false)
|
||||||
|
:background(7, 9.5, 14, 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', 8.5, 9.75, 9,1)
|
||||||
:list('current_player', 'main', 5.5,11.25, 9,1, 9)
|
:list('current_player', 'main', 8.5, 11.25, 9,1, 9)
|
||||||
-- Inventory mode switch button (compact/full):
|
-- Inventory mode switch button (compact/full):
|
||||||
:imageButton(16.75, 10, 1, 0.5, 'player_inventory_compact_mode_button_off.png', 'change_compact_mode')
|
:imageButton(19.75, 10, 1, 0.5, 'player_inventory_compact_mode_button_off.png', 'change_compact_mode')
|
||||||
-- Tabs:
|
-- Tabs:
|
||||||
:container(leftTab(self, playerName, 'left'), 0, 0.5)
|
:container(leftTab(self, playerName, 'left'), 0, 0.5)
|
||||||
:container(rightTab(self, playerName, 'right'), 11, 0.5)
|
:container(rightTab(self, playerName, 'right'), 14, 0.5)
|
||||||
-- Selection buttons for the left panel:
|
-- Selection buttons for the left panel:
|
||||||
:imageButton(0,0,2,0.5, leftTabButtonTextures[1],'select_left_craft_tab', core.colorize('#e1b691','craft'))
|
:imageButton(0,0,2,0.5, leftTabButtonTextures[1],'select_left_craft_tab', core.colorize('#e1b691','craft'))
|
||||||
:imageButton(2,0,2,0.5, leftTabButtonTextures[2], 'select_left_equip_tab', core.colorize('#e1b691','equip'))
|
:imageButton(2,0,2,0.5, leftTabButtonTextures[2], 'select_left_equip_tab', core.colorize('#e1b691','equip'))
|
||||||
:imageButton(4,0,2,0.5, leftTabButtonTextures[3], 'select_left_bag_tab', core.colorize('#e1b691','bags'))
|
:imageButton(4,0,2,0.5, leftTabButtonTextures[3], 'select_left_bag_tab', core.colorize('#e1b691','bags'))
|
||||||
:imageButton(6,0,2,0.5, leftTabButtonTextures[4], 'select_left_ref_tab', core.colorize('#e1b691','refs'))
|
:imageButton(6,0,2,0.5, leftTabButtonTextures[4], 'select_left_ref_tab', core.colorize('#e1b691','refs'))
|
||||||
-- Selection buttons for the right panel:
|
-- Selection buttons for the right panel:
|
||||||
:imageButton(11,0,2,0.5, rightTabButtonTextures[1],'select_right_craft_tab', core.colorize('#e1b691','craft'))
|
:imageButton(14,0,2,0.5, rightTabButtonTextures[1],'select_right_craft_tab', core.colorize('#e1b691','craft'))
|
||||||
:imageButton(13,0,2,0.5, rightTabButtonTextures[2], 'select_right_equip_tab', core.colorize('#e1b691','equip'))
|
:imageButton(16,0,2,0.5, rightTabButtonTextures[2], 'select_right_equip_tab', core.colorize('#e1b691','equip'))
|
||||||
:imageButton(15,0,2,0.5, rightTabButtonTextures[3], 'select_right_bag_tab', core.colorize('#e1b691','bags'))
|
:imageButton(18,0,2,0.5, rightTabButtonTextures[3], 'select_right_bag_tab', core.colorize('#e1b691','bags'))
|
||||||
:imageButton(17,0,2,0.5, rightTabButtonTextures[4], 'select_right_ref_tab', core.colorize('#e1b691','refs'))
|
:imageButton(20,0,2,0.5, rightTabButtonTextures[4], 'select_right_ref_tab', core.colorize('#e1b691','refs'))
|
||||||
|
|
||||||
if self:getContex(playerName, 'node_tab') ~= nil then
|
if self:getContex(playerName, 'node_tab') ~= nil then
|
||||||
InventoryForm
|
InventoryForm
|
||||||
:imageButton(8,0,2,0.5, leftTabButtonTextures[5], 'select_left_node_tab', core.colorize('#e1b691','node'))
|
:imageButton(8,0,2,0.5, leftTabButtonTextures[5], 'select_left_node_tab', core.colorize('#e1b691','node'))
|
||||||
:imageButton(19,0,2,0.5, rightTabButtonTextures[5], 'select_right_node_tab', core.colorize('#e1b691','node'))
|
:imageButton(22,0,2,0.5, rightTabButtonTextures[5], 'select_right_node_tab', core.colorize('#e1b691','node'))
|
||||||
end
|
end
|
||||||
|
|
||||||
return InventoryForm:toString()
|
return InventoryForm:toString()
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ local function getCraftTabTemplate(self, playerName, tabType, tabName, handler)
|
|||||||
end
|
end
|
||||||
|
|
||||||
CraftTab
|
CraftTab
|
||||||
:background(0, 0, 11, 9, 'player_inventory_craft_tab_background.png')
|
:background(0, 0, 14, 9, 'player_inventory_craft_tab_background.png')
|
||||||
:field(0.25, 0.5, 5, 0.75, tabType..'::'..tabName..'::craft_search_field', nil, searchFieldValue)
|
:field(0.25, 0.5, 5, 0.75, tabType..'::'..tabName..'::craft_search_field', nil, searchFieldValue)
|
||||||
:fieldCloseOnEnter(tabType..'::'..tabName..'::craft_search_field', false)
|
:fieldCloseOnEnter(tabType..'::'..tabName..'::craft_search_field', false)
|
||||||
:container(craftsListForm, 0.5, 1.5)
|
:container(craftsListForm, 0.5, 1.5)
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ local function getBagTab(self, playerName, tabType)
|
|||||||
end
|
end
|
||||||
|
|
||||||
BagTab
|
BagTab
|
||||||
:image(0, 0, 11, 9, 'player_inventory_tab_background.png')
|
:image(0, 0, 14, 9, 'player_inventory_tab_background.png')
|
||||||
:scrollContainer(BagLists, 0, 0.5, 10.5, 8, 'bag_tab_scrollbar', 'vertical')
|
:scrollContainer(BagLists, 0, 0.5, 10.5, 8, 'bag_tab_scrollbar', 'vertical')
|
||||||
|
|
||||||
if containerHeight > 8 then
|
if containerHeight > 8 then
|
||||||
|
|||||||
@@ -13,19 +13,22 @@ local function getEquipTab(self, playerName, tabType)
|
|||||||
local equipListsX = 4.5
|
local equipListsX = 4.5
|
||||||
|
|
||||||
EquipTab
|
EquipTab
|
||||||
:image(0, 0, 11, 9, 'player_inventory_equip_tab_background.png')
|
:image(0, 0, 14, 9, 'player_inventory_equip_tab_background.png')
|
||||||
-- Equipment slots:
|
-- Equipment slots:
|
||||||
:list('current_player', 'equip_head', 56/16, 45/16, 1, 1)
|
:list('current_player', 'equip_head', 80/16, 45/16, 1, 1)
|
||||||
:list('current_player', 'equip_head', 44/16, 33/16, 1, 1, 1)
|
:list('current_player', 'equip_head', 68/16, 33/16, 1, 1, 1)
|
||||||
:list('current_player', 'equip_torso', 104/16, 45/16, 1, 1)
|
:list('current_player', 'equip_torso', 128/16, 45/16, 1, 1)
|
||||||
:list('current_player', 'equip_torso', 116/16, 33/16, 1, 1, 1)
|
:list('current_player', 'equip_torso', 140/16, 33/16, 1, 1, 1)
|
||||||
:list('current_player', 'equip_legs', 56/16, 65/16, 1, 1)
|
:list('current_player', 'equip_legs', 80/16, 65/16, 1, 1)
|
||||||
:list('current_player', 'equip_legs', 44/16, 77/16, 1, 1, 1)
|
:list('current_player', 'equip_legs', 68/16, 77/16, 1, 1, 1)
|
||||||
:list('current_player', 'equip_feet', 104/16, 65/16, 1, 1)
|
:list('current_player', 'equip_feet', 128/16, 65/16, 1, 1)
|
||||||
:list('current_player', 'equip_feet', 116/16, 77/16, 1, 1, 1)
|
:list('current_player', 'equip_feet', 140/16, 77/16, 1, 1, 1)
|
||||||
:list('current_player', 'equip_left_thigh', 60/16, 97/16, 1, 1)
|
:list('current_player', 'equip_left_thigh', 84/16, 97/16, 1, 1)
|
||||||
:list('current_player', 'equip_back', 80/16, 97/16, 1, 1)
|
:list('current_player', 'equip_back', 104/16, 97/16, 1, 1)
|
||||||
:list('current_player', 'equip_right_thigh', 100/16, 97/16, 1, 1)
|
:list('current_player', 'equip_right_thigh', 124/16, 97/16, 1, 1)
|
||||||
|
-- TODO: слот для щита
|
||||||
|
-- TODO: слоты для аксессуаров?
|
||||||
|
|
||||||
-- Hidden equipment slot for correct listing
|
-- Hidden equipment slot for correct listing
|
||||||
-- (distribute equipment across its slots while holding shift):
|
-- (distribute equipment across its slots while holding shift):
|
||||||
:list('current_player', 'listring_equip', 0, 0, 1, 1)
|
:list('current_player', 'listring_equip', 0, 0, 1, 1)
|
||||||
@@ -50,37 +53,37 @@ local function getEquipTab(self, playerName, tabType)
|
|||||||
|
|
||||||
-- If the equipment slots are empty, then we apply an overlay.
|
-- If the equipment slots are empty, then we apply an overlay.
|
||||||
if inv:get_stack('equip_head', 1):is_empty() then
|
if inv:get_stack('equip_head', 1):is_empty() then
|
||||||
EquipTab:image(56/16, 45/16, 1, 1, slotsOverlayTileSheet:t(0,0))
|
EquipTab:image(80/16, 45/16, 1, 1, slotsOverlayTileSheet:t(0,0))
|
||||||
end
|
end
|
||||||
if inv:get_stack('equip_torso', 1):is_empty() then
|
if inv:get_stack('equip_torso', 1):is_empty() then
|
||||||
EquipTab:image(104/16, 45/16, 1, 1, slotsOverlayTileSheet:t(0,1))
|
EquipTab:image(128/16, 45/16, 1, 1, slotsOverlayTileSheet:t(0,1))
|
||||||
end
|
end
|
||||||
if inv:get_stack('equip_legs', 1):is_empty() then
|
if inv:get_stack('equip_legs', 1):is_empty() then
|
||||||
EquipTab:image(56/16, 65/16, 1, 1, slotsOverlayTileSheet:t(0,2))
|
EquipTab:image(80/16, 65/16, 1, 1, slotsOverlayTileSheet:t(0,2))
|
||||||
end
|
end
|
||||||
if inv:get_stack('equip_feet', 1):is_empty() then
|
if inv:get_stack('equip_feet', 1):is_empty() then
|
||||||
EquipTab:image(104/16, 65/16, 1, 1, slotsOverlayTileSheet:t(0,3))
|
EquipTab:image(128/16, 65/16, 1, 1, slotsOverlayTileSheet:t(0,3))
|
||||||
end
|
end
|
||||||
if inv:get_stack('equip_head', 2):is_empty() then
|
if inv:get_stack('equip_head', 2):is_empty() then
|
||||||
EquipTab:image(44/16, 33/16, 1, 1, slotsOverlayTileSheet:t(1,0))
|
EquipTab:image(68/16, 33/16, 1, 1, slotsOverlayTileSheet:t(1,0))
|
||||||
end
|
end
|
||||||
if inv:get_stack('equip_torso', 2):is_empty() then
|
if inv:get_stack('equip_torso', 2):is_empty() then
|
||||||
EquipTab:image(116/16, 33/16, 1, 1, slotsOverlayTileSheet:t(1,1))
|
EquipTab:image(140/16, 33/16, 1, 1, slotsOverlayTileSheet:t(1,1))
|
||||||
end
|
end
|
||||||
if inv:get_stack('equip_legs', 2):is_empty() then
|
if inv:get_stack('equip_legs', 2):is_empty() then
|
||||||
EquipTab:image(44/16, 77/16, 1, 1, slotsOverlayTileSheet:t(1,2))
|
EquipTab:image(68/16, 77/16, 1, 1, slotsOverlayTileSheet:t(1,2))
|
||||||
end
|
end
|
||||||
if inv:get_stack('equip_feet', 2):is_empty() then
|
if inv:get_stack('equip_feet', 2):is_empty() then
|
||||||
EquipTab:image(116/16, 77/16, 1, 1, slotsOverlayTileSheet:t(1,3))
|
EquipTab:image(140/16, 77/16, 1, 1, slotsOverlayTileSheet:t(1,3))
|
||||||
end
|
end
|
||||||
if inv:get_stack('equip_back', 1):is_empty() then
|
if inv:get_stack('equip_back', 1):is_empty() then
|
||||||
EquipTab:image(80/16, 97/16, 1, 1, slotsOverlayTileSheet:t(0,4))
|
EquipTab:image(104/16, 97/16, 1, 1, slotsOverlayTileSheet:t(0,4))
|
||||||
end
|
end
|
||||||
if inv:get_stack('equip_left_thigh', 1):is_empty() then
|
if inv:get_stack('equip_left_thigh', 1):is_empty() then
|
||||||
EquipTab:image(60/16, 97/16, 1, 1, slotsOverlayTileSheet:t(1,4))
|
EquipTab:image(84/16, 97/16, 1, 1, slotsOverlayTileSheet:t(1,4))
|
||||||
end
|
end
|
||||||
if inv:get_stack('equip_right_thigh', 1):is_empty() then
|
if inv:get_stack('equip_right_thigh', 1):is_empty() then
|
||||||
EquipTab:image(100/16, 97/16, 1, 1, slotsOverlayTileSheet:t(1,4))
|
EquipTab:image(124/16, 97/16, 1, 1, slotsOverlayTileSheet:t(1,4))
|
||||||
end
|
end
|
||||||
|
|
||||||
return EquipTab
|
return EquipTab
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ local function getRefTab(self, playerName, tabType)
|
|||||||
local RefTab = Formspec:new()
|
local RefTab = Formspec:new()
|
||||||
|
|
||||||
RefTab
|
RefTab
|
||||||
:image(0, 0, 11, 9, 'player_inventory_tab_background.png')
|
:image(0, 0, 14, 9, 'player_inventory_tab_background.png')
|
||||||
:label(2,2, 'REFERENCE PANE')
|
:label(2,2, 'REFERENCE PANE')
|
||||||
|
|
||||||
return RefTab
|
return RefTab
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 266 KiB |
|
Before Width: | Height: | Size: 199 B |
|
Before Width: | Height: | Size: 176 KiB |
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 631 B |
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 859 B |
|
After Width: | Height: | Size: 345 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |