plants: update plants mod: add new, save & remove debug

This commit is contained in:
Van
2026-10-02 21:27:45 +03:00
parent 934a8a8e83
commit c7d2b94603
3 changed files with 32 additions and 11 deletions

View File

@@ -1,16 +1,40 @@
local Plant, TileSheet = Smc.requirePlant(), Smc.requireTileSheet() 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({ Plant:new({
settings = { settings = {
name = 'plants', name = 'bog_grass_'..tostring(i),
tiles = { "test_plant.png" }, tiles = { BogPlantsTileSheet:t(i-1, 0) },
place_param2 = 3, place_param2 = 8,
}, },
callbacks = {
after_place_node = afterPlaceNode,
}
}) })
end
-- DEBUG
local PlantsTileSheet = TileSheet:new('plants_test_sheet.png', 16, 16) local PlantsTileSheet = TileSheet:new('plants_test_sheet.png', 16, 16)
for i=0, 3 do for i=0, 3 do
Plant:new({ Plant:new({
settings = { settings = {
@@ -53,6 +77,3 @@ Plant:new({
place_param2 = 3, place_param2 = 3,
} }
}) })

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB