aboutsummaryrefslogtreecommitdiff
path: root/init.lua
blob: c7253faa8a9fcf908e663ce64835f6b534bc664f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
dofile(minetest.get_modpath("billboard") .. "/nodes.lua")

for i,n in ipairs(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"
    elseif n.item2 == nil then
        n.item2 = "white"
    elseif 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
    elseif n.scale < 0 then  -- scale has a negative value?
        n.scale = n.scale * -1
    end
    
    -- Filename isn't given?
    if n.filename == nil then
        n.filename = "bb_" .. n.item1 .. "_" .. n.item2 .. "_" .. n.item3
    elseif n.imgtyp == nil then -- no Imagetyp is given?
        n.imgtyp = "png"
    end
    
    if not n.name then
		n.name=n.item1 .. "_" .. n.item2 .. "_" .. n.item3
    end
    
    -- Register the Node
    minetest.register_node("billboard:bb_"..n.name, {
                    description = n.title,
                    drawtype = "signlike",
                    visual_scale = n.scale,
                    tiles = {
                                    n.filename .. "." ..n.imgtyp
                                },
                    inventory_image = n.filename .."."..n.imgtyp,
                    wield_image = n.filename .. "." ..n.imgtyp,
                    paramtype = "light",
                    paramtype2 = "wallmounted",
                    sunlight_propagates = true,
                    walkable = false,
                    light_source = 1, -- reflecting a bit of light might be expected
                    selection_box = {
                                                    type = "wallmounted"
                                            },
                    groups = {choppy=2,dig_immediate=3,attached_node=1, picture=1},
                    legacy_wallmounted = true,
        
    })
    
    if not n.norecipe then
		-- Register the Recipe for the Node
		minetest.register_craft({
							output = "billboard:bb_"..n.name,
							recipe = {
												{"group:stick", "group:stick", "group:stick"},
												{"default:"..n.item1, "wool:"..n.item2, "wool:"..n.item3},
												{"group:stick", "group:stick", "group:stick"}
										}
		})
	end

end