diff --git a/mods/GAME/ITEMS/plants/init.lua b/mods/GAME/ITEMS/plants/init.lua index e65a62c..b05e16d 100644 --- a/mods/GAME/ITEMS/plants/init.lua +++ b/mods/GAME/ITEMS/plants/init.lua @@ -1,16 +1,40 @@ local Plant, TileSheet = Smc.requirePlant(), Smc.requireTileSheet() -Plant:new({ - settings = { - name = 'plants', - tiles = { "test_plant.png" }, - place_param2 = 3, - }, -}) +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 = { @@ -53,6 +77,3 @@ Plant:new({ place_param2 = 3, } }) - - - diff --git a/mods/GAME/ITEMS/plants/textures/sheets/plants_bog_sheet.png b/mods/GAME/ITEMS/plants/textures/sheets/plants_bog_sheet.png new file mode 100644 index 0000000..bbf4666 Binary files /dev/null and b/mods/GAME/ITEMS/plants/textures/sheets/plants_bog_sheet.png differ diff --git a/mods/GAME/ITEMS/plants/textures/test_plant.png b/mods/GAME/ITEMS/plants/textures/test_plant.png deleted file mode 100644 index f3d1100..0000000 Binary files a/mods/GAME/ITEMS/plants/textures/test_plant.png and /dev/null differ