Files
simple-makes-complex/mods/GAME/ITEMS/storages/init.lua

99 lines
1.7 KiB
Lua

local Node, TileSheet = Smc.requireNode(), Smc.requireTileSheet()
local defaultStorage = Node:getExtended({
settings = {
name = '',
groups = {
dig_immediate = 2,
storage = 1
},
paramtype = 'light',
paramtype2 = 'facedir',
}
})
local storageFactory = defaultStorage:getFactory()
---@type TileSheet
local caseTileSheet = TileSheet:new('cases_sheet.png', 16, 16)
local function getCaseTiles(x, y)
return {
caseTileSheet:t(x, y),
caseTileSheet:t(x, y),
caseTileSheet:t(x, y+1),
}
end
local t = getCaseTiles
storageFactory:registerItems({
---@type Node.NodeDefinition
{
settings = {
name = 'case_closed',
_title = 'Case',
--description = '',
tiles = t(0,0)
},
},
---@type Node.NodeDefinition
{
settings = {
name = 'case_open',
_title = 'Case',
--description = '',
tiles = t(1,0);
drawtype = 'nodebox';
node_box = {
type = 'fixed',
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5 - 1/16*2, 0.5},
}
}
},
},
---@type Node.NodeDefinition
{
settings = {
drawtype = 'mesh',
name = 'chest_close',
tiles = {'storage_chest.png'},
mesh = 'storage_chest_close.obj',
node_box = {
type = 'fixed',
fixed = {
{-7/16, -0.5, -7/16, 23/16, 6/16, 7/16},
}
},
selection_box = {
type = 'fixed',
fixed = {
{-7/16, -0.5, -7/16, 23/16, 6/16, 7/16},
}
}
},
},
---@type Node.NodeDefinition
{
settings = {
drawtype = 'mesh',
name = 'chest_open',
tiles = {'storage_chest.png'},
mesh = 'storage_chest_open.obj',
node_box = {
type = 'fixed',
fixed = {
{-7/16, -0.5, -7/16, 23/16, 6/16, 7/16},
}
},
selection_box = {
type = 'fixed',
fixed = {
{-7/16, -0.5, -7/16, 23/16, 6/16, 7/16},
}
}
},
},
})