add grass, flowers, bonemeal

This commit is contained in:
wsor 2021-08-01 22:36:44 -04:00
parent eed9ec104e
commit 87a78267bf
36 changed files with 115 additions and 3 deletions

View File

@ -69,6 +69,6 @@ for i = 1, 4 do
end end
end, end,
drop = drop, drop = drop,
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1}, groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1, plant =1},
}) })
end end

View File

@ -69,6 +69,6 @@ for i = 1, 4 do
end end
end, end,
drop = drop, drop = drop,
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1}, groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1, plant = 1},
}) })
end end

26
mods/fl_bones/init.lua Normal file
View File

@ -0,0 +1,26 @@
minetest.register_craftitem("fl_bones:bonemeal", {
description = "bonemeal",
inventory_image = "farlands_bonemeal.png",
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then return end
local node = minetest.get_node_or_nil(pointed_thing.under)
if not node then return end
if minetest.get_item_group(node.name, "plant") ~= 1 then return end
local node_def = minetest.registered_nodes[node.name]
if node_def._on_bonemeal then
node_def._on_bonemeal(pointed_thing.under, user)
itemstack:take_item()
return itemstack
end
if minetest.get_node_timer(pointed_thing.under):is_started() then
if math.random(10) > 8 then
minetest.get_node_timer(pointed_thing.under):stop()
node_def.on_timer(pointed_thing.under, 0)
end
itemstack:take_item()
return itemstack
end
return
end
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

View File

@ -0,0 +1,51 @@
local modpath = minetest.get_modpath("fl_plantlife")
local dir = minetest.get_dir_list(modpath .. "/textures", false)
for _, name in ipairs(dir) do
if string.find(name, "ground") then
local _, i = string.find(name, "farlands_flower_")
local hold = string.sub(name, i+1, -1)
local j, _ = string.find(hold, ".png")
local fname = string.sub(hold, 1, j-1)
local split = string.split(fname, "_")
minetest.register_node("fl_plantlife:" .. fname, {
description = table.concat(split, " "),
drawtype = "nodebox",
paramtype = "light",
tiles = {name, name},
inventory_image = name,
wield_image = name,
walkable = false,
node_box = {
type = "fixed",
fixed = {-0.5, -0.48, -0.5, 0.5, -0.47, 0.5}
},
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.45, 0.5}
},
groups = {oddly_breakable_by_hand = 3, plant = 1, flower = 1}
})
elseif string.find(name, "farlands_flower") then
local _, i = string.find(name, "farlands_flower_")
local hold = string.sub(name, i+1, -1)
local j, _ = string.find(hold, ".png")
local fname = string.sub(hold, 1, j-1)
local split = string.split(fname, "_")
minetest.register_node("fl_plantlife:" .. fname, {
description = table.concat(split, " "),
drawtype = "plantlike",
paramtype = "light",
inventory_image = name,
walkable = false,
tiles = {name},
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
},
groups = {oddly_breakable_by_hand = 3, plant = 1, flower = 1}
})
end
end
--foxglove_pink/purple

View File

@ -0,0 +1,31 @@
local function reg_grass(name)
local desc = string.split(name, "_")
local groups = {oddly_breakable_by_hand = 3, plant = 1, not_in_creative_inventory = 1}
for i=1, 5 do
minetest.register_node("fl_plantlife:" .. name .. "_" .. i, {
description = table.concat(desc, " "),
drawtype = "plantlike",
paramtype = "light",
paramtype2 = "degrotate",
tiles = {"[combine:16x16:0," .. 10 - 2*i .. "=farlands_" .. name .. "_plant.png"},
floodable = true,
on_flood = function(pos, oldnode, newnode)
minetest.dig_node(pos)
end,
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,-0.45,0.5},
},
walkable = false,
frop = "fl_plantlife:" .. name .. "_5",
groups = groups,
})
end
minetest.override_item("fl_plantlife:" .. name .. "_5", {
inventory_image = "[combine:16x16:0,4=farlands_" .. name .. "_plant.png",
groups = {oddly_breakable_by_hand = 3, plant = 1, not_in_creative_inventory = 0}
})
end
reg_grass("grass")
reg_grass("savannah_grass")

View File

@ -0,0 +1,4 @@
local modpath = minetest.get_modpath("fl_plantlife")
dofile(modpath .. "/grass.lua")
dofile(modpath .. "/flowers.lua")

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

View File

@ -8,7 +8,7 @@ local function register_sapling(name, offset)
sunlight_propagates = true, sunlight_propagates = true,
walkable = true, walkable = true,
tiles = {"farlands_" .. name .. "_sapling.png"}, tiles = {"farlands_" .. name .. "_sapling.png"},
groups = {oddly_breakable_by_hand = 3}, groups = {oddly_breakable_by_hand = 3, plant = 1},
on_timer = function(pos) on_timer = function(pos)
minetest.remove_node(pos) minetest.remove_node(pos)
minetest.place_schematic( minetest.place_schematic(