aboutsummaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authoracmgit <undertakers_help@yahoo.com>2016-08-02 20:12:31 +0200
committeracmgit <undertakers_help@yahoo.com>2016-08-02 20:12:31 +0200
commit48dc7b4c929c0596bc710bebafc4ca53cacb1748 (patch)
tree77022a5218375fe3e2952e9522e3c26b1782cd38 /init.lua
parentba25a050f3f36d2531536d94bca07baf5d0c5719 (diff)
downloadbillboard-48dc7b4c929c0596bc710bebafc4ca53cacb1748.tar.gz
billboard-48dc7b4c929c0596bc710bebafc4ca53cacb1748.tar.bz2
billboard-48dc7b4c929c0596bc710bebafc4ca53cacb1748.zip
Named Parameter added, Default-Values for Parameter inserted.
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua46
1 files changed, 38 insertions, 8 deletions
diff --git a/init.lua b/init.lua
index 76f466f..b05303b 100644
--- a/init.lua
+++ b/init.lua
@@ -2,16 +2,46 @@ dofile(minetest.get_modpath("billboard") .. "/nodes.lua")
for i,n in ipairs(bb_boardlist) do
+ -- No Title there?
+ if n.title == nil then
+ n.title = "Billboard ".. n.item1 .. "_" .. n.item2 .. "_" .. n.item3
+ end
+
+ -- For Recipe: Item isn't given?
+ if n.item1 == nil then
+ n.item1 = "sign_wall_wood"
+ end
+ if n.item2 == nil then
+ n.item2 = "white"
+ end
+ if n.item3 == nil then
+ n.item3 = "white"
+ end
+
+ -- scale isn't given or 0 (invalid)?
+ if n.scale == nil or n.scale == 0 then
+ n.scale = 1
+ end
+ -- scale has a negative value?
+ if n.scale < 0 then
+ n.scale = n.scale * -1
+ end
+
+ -- no Imagetyp is given?
+ if n.imgtyp == nil then
+ n.imgtyp = "png"
+ end
+
-- Register the Node
- minetest.register_node("billboard:bb_".. n[1].."_"..n[2].."_"..n[3], {
- description = "Billboard " ..n[1].."_"..n[2].."_"..n[3],
+ minetest.register_node("billboard:bb_".. n.item1 .."_"..n.item2 .."_"..n.item3, {
+ description = n.title,
drawtype = "signlike",
- visual_scale = n[4],
+ visual_scale = n.scale,
tiles = {
- "bb_"..n[1].."_"..n[2].."_"..n[3].."."..n[5]
+ "bb_"..n.item1.."_"..n.item2.."_"..n.item3.."."..n.imgtyp
},
- inventory_image = "bb_"..n[1].."_"..n[2].."_"..n[3].."."..n[5],
- wield_image = "bb_"..n[1].."_"..n[2].."_"..n[3].."."..n[5],
+ inventory_image = "bb_"..n.item1.."_"..n.item2.."_"..n.item3.."."..n.imgtyp,
+ wield_image = "bb_"..n.item1.."_"..n.item2.."_"..n.item3.."."..n.imgtyp,
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
@@ -27,10 +57,10 @@ for i,n in ipairs(bb_boardlist) do
-- Register the Recipe for the Node
minetest.register_craft({
- output = "billboard:bb_"..n[1].."_"..n[2].."_"..n[3],
+ output = "billboard:bb_"..n.item1.."_"..n.item2.."_"..n.item3,
recipe = {
{"group:stick", "group:stick", "group:stick"},
- {"default:"..n[1], "wool:"..n[2], "wool:"..n[3]},
+ {"default:"..n.item1, "wool:"..n.item2, "wool:"..n.item3},
{"group:stick", "group:stick", "group:stick"}
}
})