mirror of
https://github.com/minetest/minetest_game.git
synced 2024-11-05 23:33:51 +01:00
Improved flowers' registration system - Specific nodeboxes, - Color groups - All datas were put into a table then unpacked for add_simple_flower
This commit is contained in:
parent
638add603f
commit
01ad09036b
@ -1,6 +1,9 @@
|
|||||||
-- Minetest 0.4 mod: default
|
-- Minetest 0.4 mod: default
|
||||||
-- See README.txt for licensing and other information.
|
-- See README.txt for licensing and other information.
|
||||||
|
|
||||||
|
-- Namespace for functions
|
||||||
|
flowers = {}
|
||||||
|
|
||||||
-- Map Generation
|
-- Map Generation
|
||||||
dofile(minetest.get_modpath("flowers").."/mapgen.lua")
|
dofile(minetest.get_modpath("flowers").."/mapgen.lua")
|
||||||
|
|
||||||
@ -13,13 +16,20 @@ minetest.register_alias("flowers:flower_tulip", "flowers:tulip")
|
|||||||
minetest.register_alias("flowers:flower_viola", "flowers:viola")
|
minetest.register_alias("flowers:flower_viola", "flowers:viola")
|
||||||
|
|
||||||
-- Flower registration function
|
-- Flower registration function
|
||||||
local function add_simple_flower(name, desc, image, f_groups)
|
local function add_simple_flower(name, desc, box, f_groups)
|
||||||
|
-- Common flowers' groups
|
||||||
|
f_groups.snappy = 3
|
||||||
|
f_groups.flammable = 2
|
||||||
|
f_groups.flower = 1
|
||||||
|
f_groups.flora = 1
|
||||||
|
f_groups.attached_node = 1
|
||||||
|
|
||||||
minetest.register_node("flowers:"..name.."", {
|
minetest.register_node("flowers:"..name.."", {
|
||||||
description = desc,
|
description = desc,
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
tiles = { image..".png" },
|
tiles = { "flowers_" .. name .. ".png" },
|
||||||
inventory_image = image..".png",
|
inventory_image = "flowers_" .. name .. ".png",
|
||||||
wield_image = image..".png",
|
wield_image = "flowers_" .. name .. ".png",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
@ -28,19 +38,24 @@ local function add_simple_flower(name, desc, image, f_groups)
|
|||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 },
|
fixed = box
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Registrations using the function above
|
-- Registrations using the function above
|
||||||
add_simple_flower("dandelion_yellow", "Yellow Dandelion", "flowers_dandelion_yellow", {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,dig_by_water=1,color_yellow=1})
|
flowers.datas = {
|
||||||
add_simple_flower("geranium", "Blue Geranium", "flowers_geranium", {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,dig_by_water=1,color_blue=1})
|
{"dandelion_yellow", "Yellow Dandelion", { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 }, {color_yellow=1}},
|
||||||
add_simple_flower("rose", "Rose", "flowers_rose", {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,dig_by_water=1,color_red=1})
|
{"geranium", "Blue Geranium", { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 }, {color_blue=1}},
|
||||||
add_simple_flower("tulip", "Orange Tulip", "flowers_tulip", {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,dig_by_water=1,color_orange=1})
|
{"rose", "Rose", { -0.15, -0.5, -0.15, 0.15, 0.3, 0.15 }, {color_red=1}},
|
||||||
add_simple_flower("dandelion_white", "White dandelion", "flowers_dandelion_white",{snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_white=1})
|
{"tulip", "Orange Tulip", { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 }, {color_orange=1}},
|
||||||
add_simple_flower("viola", "Viola", "flowers_viola", {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_violet=1})
|
{"dandelion_white", "White dandelion", { -0.5, -0.5, -0.5, 0.5, -0.2, 0.5 }, {color_white=1}},
|
||||||
|
{"viola", "Viola", { -0.5, -0.5, -0.5, 0.5, -0.2, 0.5 }, {color_violet=1}}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _,item in pairs(flowers.datas) do
|
||||||
|
add_simple_flower(unpack(item))
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"group:flora"},
|
nodenames = {"group:flora"},
|
||||||
|
Loading…
Reference in New Issue
Block a user