rocks: Change of registration of rocks
This commit is contained in:
@@ -18,13 +18,13 @@ local MapGen = mapGenRequire('MapGen')
|
|||||||
sylite = 'rocks:sylite',
|
sylite = 'rocks:sylite',
|
||||||
syliteGray = 'rocks:sylite_gray',
|
syliteGray = 'rocks:sylite_gray',
|
||||||
syliteBlack = 'rocks:sylite_black',
|
syliteBlack = 'rocks:sylite_black',
|
||||||
tauitite = 'rocks:tauitite',
|
--tauitite = 'rocks:tauitite',
|
||||||
iyellite = 'rocks:iyellite',
|
--iyellite = 'rocks:iyellite',
|
||||||
falmyte = 'rocks:falmyte',
|
--falmyte = 'rocks:falmyte',
|
||||||
hapcoryte = 'rocks:hapcoryte',
|
--hapcoryte = 'rocks:hapcoryte',
|
||||||
burcite = 'rocks:burcite',
|
--burcite = 'rocks:burcite',
|
||||||
felhor = 'rocks:felhor',
|
--felhor = 'rocks:felhor',
|
||||||
malachite = 'rocks:malachite',
|
--malachite = 'rocks:malachite',
|
||||||
|
|
||||||
-- Liquids
|
-- Liquids
|
||||||
water = 'liquids:water_source',
|
water = 'liquids:water_source',
|
||||||
|
|||||||
@@ -2,88 +2,173 @@ local Node, TileSheet = Smc.requireNode(), Smc.requireTileSheet()
|
|||||||
|
|
||||||
local PrimitiveCraftHandler = Smc.requireCraftSystemPrimitiveCraftHandler()
|
local PrimitiveCraftHandler = Smc.requireCraftSystemPrimitiveCraftHandler()
|
||||||
|
|
||||||
---@type Node.NodeDefinition
|
---@type TileSheet
|
||||||
local defaultRockDef = {
|
local rocksTileSheet = TileSheet:new("rocks_sheet.png", 16, 16)
|
||||||
|
|
||||||
|
---@class RockDef
|
||||||
|
---@field rarity Item.Rarity?
|
||||||
|
|
||||||
|
local function registerSegmentsCrafts(name, craftGroup)
|
||||||
|
PrimitiveCraftHandler:registerCraft(name..'_slab', {
|
||||||
|
recipe = {name},
|
||||||
|
output = name..'_slab',
|
||||||
|
group = craftGroup
|
||||||
|
})
|
||||||
|
|
||||||
|
PrimitiveCraftHandler:registerCraft(name..'_stair', {
|
||||||
|
recipe = {name},
|
||||||
|
output = name..'_stair',
|
||||||
|
group = craftGroup
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param name string
|
||||||
|
---@param y number
|
||||||
|
---@param def RockDef?
|
||||||
|
---@param staff {block:boolean?,bricks:boolean?,pillar:boolean?}
|
||||||
|
local function registerRock(name, y, def, staff)
|
||||||
|
if def == nil then
|
||||||
|
def = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
local modPrefix = Mod.getInfo().shortName..':'
|
||||||
|
local craftGroup = 'rocks_'..name..'_staff'
|
||||||
|
|
||||||
|
-- Default rock
|
||||||
|
local defaultRock = Node:getExtended({
|
||||||
settings = {
|
settings = {
|
||||||
name = '',
|
name = '',
|
||||||
tiles = {},
|
_rarity = def.rarity,
|
||||||
groups = {
|
groups = {
|
||||||
|
rocks = 1,
|
||||||
dig_immediate = 2,
|
dig_immediate = 2,
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
|
||||||
|
|
||||||
---@type Node
|
|
||||||
local defaultRock = Node:getExtended(defaultRockDef)
|
|
||||||
|
|
||||||
local rockFactory = defaultRock:getFactory()
|
|
||||||
|
|
||||||
---@type TileSheet
|
|
||||||
local ts = TileSheet:new("rocks_sheet.png", 16, 16)
|
|
||||||
|
|
||||||
local function registerRocksTypes(postfix, x)
|
|
||||||
rockFactory:registerNodesByShortDef({
|
|
||||||
{"sylite"..postfix, {ts:t(x, 0)}},
|
|
||||||
{"sylite_gray"..postfix, {ts:t(x, 1)}},
|
|
||||||
{"sylite_black"..postfix, {ts:t(x, 2)}},
|
|
||||||
{"tauitite_light"..postfix, {ts:t(x, 3)}},
|
|
||||||
{"tauitite_pink"..postfix, {ts:t(x, 4)}},
|
|
||||||
{"tauitite"..postfix, {ts:t(x, 5)}},
|
|
||||||
{"falmyte_light"..postfix, {ts:t(x, 6)}},
|
|
||||||
{"falmyte_yellow"..postfix, {ts:t(x, 7)}},
|
|
||||||
{"falmyte_red"..postfix, {ts:t(x, 8)}},
|
|
||||||
{"falmyte_dark"..postfix, {ts:t(x, 9)}},
|
|
||||||
{"iyellite"..postfix, {ts:t(x, 14)}},
|
|
||||||
{"falmyte"..postfix, {ts:t(x, 14)}},
|
|
||||||
{"hapcoryte"..postfix, {ts:t(x, 14)}},
|
|
||||||
{"burcite"..postfix, {ts:t(x, 14)}},
|
|
||||||
{"felhor"..postfix, {ts:t(x, 14)}},
|
|
||||||
{"malachite"..postfix, {ts:t(x, 14)}}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Solid rock
|
||||||
|
defaultRock:new({
|
||||||
|
settings = {
|
||||||
|
name = name,
|
||||||
|
tiles = { rocksTileSheet:t(0, y) },
|
||||||
|
groups = {
|
||||||
|
segments = 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
registerSegmentsCrafts(modPrefix..name, craftGroup)
|
||||||
|
|
||||||
|
-- Chipped rock
|
||||||
|
local chippedRockName = name..'_chipped'
|
||||||
|
defaultRock:new({
|
||||||
|
settings = {
|
||||||
|
name = chippedRockName,
|
||||||
|
tiles = { rocksTileSheet:t(1, y) },
|
||||||
|
groups = {
|
||||||
|
segments = 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
registerSegmentsCrafts(modPrefix..chippedRockName, craftGroup)
|
||||||
|
|
||||||
|
if staff.block == true then
|
||||||
|
-- Solid rock block
|
||||||
|
local blockName = name..'_block'
|
||||||
|
defaultRock:new({
|
||||||
|
settings = {
|
||||||
|
name = name..'_block',
|
||||||
|
tiles = { rocksTileSheet:t(3, y) },
|
||||||
|
groups = {
|
||||||
|
segments = 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
registerSegmentsCrafts(modPrefix..blockName, craftGroup)
|
||||||
|
|
||||||
|
PrimitiveCraftHandler:registerCraft(blockName, {
|
||||||
|
recipe = {modPrefix..name},
|
||||||
|
output = modPrefix..blockName,
|
||||||
|
group = craftGroup,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
if staff.bricks == true then
|
||||||
|
-- Solid rock bricks
|
||||||
|
local bricksName = name..'_bricks'
|
||||||
|
defaultRock:new({
|
||||||
|
settings = {
|
||||||
|
name = bricksName,
|
||||||
|
tiles = { rocksTileSheet:t(4, y) },
|
||||||
|
groups = {
|
||||||
|
segments = 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
registerSegmentsCrafts(modPrefix..bricksName, craftGroup)
|
||||||
|
|
||||||
|
PrimitiveCraftHandler:registerCraft(bricksName, {
|
||||||
|
recipe = {modPrefix..name},
|
||||||
|
output = modPrefix..bricksName,
|
||||||
|
group = craftGroup,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
if staff.pillar == true then
|
||||||
|
local columnTopTexture = rocksTileSheet:t(9, y)
|
||||||
|
|
||||||
|
-- Fluted column
|
||||||
|
defaultRock:new({
|
||||||
|
settings = {
|
||||||
|
name = name..'_fluted_column',
|
||||||
|
tiles = {
|
||||||
|
columnTopTexture,
|
||||||
|
columnTopTexture,
|
||||||
|
rocksTileSheet:t(6, y)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Ionic chapiter
|
||||||
|
defaultRock:new({
|
||||||
|
settings = {
|
||||||
|
name = name..'_ionic_chapiter',
|
||||||
|
tiles = {
|
||||||
|
rocksTileSheet:t(3, y),
|
||||||
|
columnTopTexture,
|
||||||
|
rocksTileSheet:t(7, y),
|
||||||
|
rocksTileSheet:t(7, y),
|
||||||
|
rocksTileSheet:t(8, y),
|
||||||
|
rocksTileSheet:t(8, y)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function registerPilarStaff(rock, y)
|
-- Sylite group
|
||||||
local columnTop = ts:t(9, y)
|
registerRock('sylite', 0, {}, {block = true, bricks = true, pillar = true})
|
||||||
|
registerRock('sylite_gray', 1, {}, {block = true, bricks = true, pillar = true})
|
||||||
|
registerRock('sylite_black', 2, {}, {block = true, bricks = true, pillar = true})
|
||||||
|
|
||||||
rockFactory:registerNodesByShortDef({
|
-- Tauitite group
|
||||||
{rock..'_fluted_column', {columnTop, columnTop, ts:t(6, y)}},
|
registerRock('tauitite_light', 3, {}, {block = true, bricks = true})
|
||||||
{rock..'_ionic_chapiter', {
|
registerRock('tauitite_pink', 4, {}, {block = true, bricks = true})
|
||||||
ts:t(3, y),
|
registerRock('tauitite_black', 5, {}, {block = true, bricks = true})
|
||||||
columnTop,
|
|
||||||
ts:t(7, y),
|
|
||||||
ts:t(7, y),
|
|
||||||
ts:t(8, y),
|
|
||||||
ts:t(8, y)}},
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
registerPilarStaff('sylite', 0)
|
-- Falmyte group
|
||||||
registerPilarStaff('sylite_gray', 1)
|
registerRock('falmyte_light', 6, {}, {block = true, bricks = true})
|
||||||
registerPilarStaff('sylite_black', 2)
|
registerRock('falmyte_yellow', 7, {}, {block = true, bricks = true})
|
||||||
|
registerRock('falmyte_red', 8, {}, {block = true, bricks = true})
|
||||||
|
registerRock('falmyte_dark', 9, {}, {block = true, bricks = true})
|
||||||
|
|
||||||
registerRocksTypes('', 0)
|
-- TODO:
|
||||||
registerRocksTypes('_chipped', 1)
|
-- iyellite
|
||||||
registerRocksTypes('_block', 3)
|
-- falmyte
|
||||||
registerRocksTypes('_bricks', 4)
|
-- hapcoryte
|
||||||
registerRocksTypes('_bricks_2', 5)
|
-- burcite
|
||||||
|
-- felhor
|
||||||
PrimitiveCraftHandler:registerCraft('rocks:sylite_fluted_column', {
|
-- malachite
|
||||||
recipe = {
|
|
||||||
'rocks:sylite'
|
|
||||||
},
|
|
||||||
output = 'rocks:sylite_fluted_column',
|
|
||||||
})
|
|
||||||
|
|
||||||
PrimitiveCraftHandler:registerCraft('rocks:sylite_ionic_chapiter', {
|
|
||||||
recipe = {
|
|
||||||
'rocks:sylite'
|
|
||||||
},
|
|
||||||
output = 'rocks:sylite_ionic_chapiter',
|
|
||||||
})
|
|
||||||
|
|
||||||
PrimitiveCraftHandler:registerCraft('rocks:sylite_bricks_2', {
|
|
||||||
recipe = {
|
|
||||||
'rocks:sylite'
|
|
||||||
},
|
|
||||||
output = 'rocks:sylite_bricks_2',
|
|
||||||
})
|
|
||||||
|
|||||||
Reference in New Issue
Block a user