Files

80 lines
1.3 KiB
Lua

local Plant, TileSheet = Smc.requirePlant(), Smc.requireTileSheet()
local placeParam2 = {
2,
3,
4,
34,
35,
36
}
local function afterPlaceNode(pos, placer, itemstack, pointed_thing)
local node = core.get_node(pos)
node.param2 = 8 + placeParam2[math.random(#placeParam2)]
core.set_node(pos, node)
end
-- --- Bog plants ---
local BogPlantsTileSheet = TileSheet:new('plants_bog_sheet.png', 16, 16)
for i=1, 3 do
Plant:new({
settings = {
name = 'bog_grass_'..tostring(i),
tiles = { BogPlantsTileSheet:t(i-1, 0) },
place_param2 = 8,
},
callbacks = {
after_place_node = afterPlaceNode,
}
})
end
-- DEBUG
local PlantsTileSheet = TileSheet:new('plants_test_sheet.png', 16, 16)
for i=0, 3 do
Plant:new({
settings = {
name = 'plant'..tostring(i),
_title = 'Plant',
tiles = { PlantsTileSheet:t(i,0) },
place_param2 = 3,
},
})
end
Plant:new({
settings = {
name = 'rye',
tiles = {PlantsTileSheet:t(0,1)},
place_param2 = 3,
}
})
Plant:new({
settings = {
name = 'rye_small',
tiles = {PlantsTileSheet:t(0,2)},
place_param2 = 3,
}
})
Plant:new({
settings = {
name = 'meadow_grass_1',
tiles = {PlantsTileSheet:t(4,0)},
place_param2 = 3,
}
})
Plant:new({
settings = {
name = 'meadow_grass_2',
tiles = {PlantsTileSheet:t(5,0)},
place_param2 = 3,
}
})