summaryrefslogtreecommitdiff
path: root/mods/leko_pan/init.lua
blob: d8c28a7e7c316f3c80008198d7b6a6605f8cd97f (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
_G.leko_pan = {}
leko_pan.colors     = {"loje",       "loje2",      "jelo",        "laso",     "laso2",      "laso3",      "unu",        "pimeja"}
leko_pan.colors_rgb = {{255, 64, 64},{255, 128, 0},{192, 192, 64},{0, 192, 0},{0, 192, 192},{64, 64, 255},{192, 0, 192},{128, 128, 128}}
leko_pan.colors_map = {}
for i, v in ipairs(leko_pan.colors) do
    leko_pan.colors_map[v] = leko_pan.colors_rgb[i]
end

minetest.register_node(":alasa_pan:leko", {
    description = "leko",
    tiles = {"leko.png"},
    groups = {}
})
minetest.register_node(":alasa_pan:anpa", {
    description = "anpa",
    tiles = {"leko_anpa.png"},
    groups = {}
})

for _, v in pairs(leko_pan.colors) do
    local name = v
    if v:sub(#v, #v) == "2" or v:sub(#v, #v) == "3" then name = name:sub(1, #v-1) end
    minetest.register_node(":alasa_pan:leko_"..v, {
        description = "leko "..v,
        tiles = {"leko_"..v..".png"},
        groups = {oddly_breakable_by_hand = 2}
    })    
end

local function hex_string(r, g, b)
    return ("%02X%02X%02X"):format(r, g, b)
end
for i, v in ipairs(leko_pan.colors) do
    local r, g, b = 255-leko_pan.colors_rgb[i][1], 255-leko_pan.colors_rgb[i][2], 255-leko_pan.colors_rgb[i][3]
    minetest.register_node(":alasa_pan:nasin_"..v, {
        description = "nasin "..v,
        tiles = {"anpa_nasin.png^[invert:rgb^[multiply:#"..hex_string(r, g, b).."^[invert:rgb"},
        groups = {}
    })
end

local ingredient_box = {type="fixed", fixed={-0.375, -0.375, -0.375, 0.375, 0.375, 0.375}}
minetest.register_node(":alasa_pan:ko_pan", {
    description = "ko pan",
    tiles = {"ko_pan.png"},
    groups = {oddly_breakable_by_hand = 1},
    drawtype = "nodebox",
    walkable = false,
    node_box = ingredient_box,
    paramtype = "light",
    sunlight_propagates = true,
    use_texture_alpha = "clip"
})
minetest.register_node(":alasa_pan:ko_suli", {
    description = "ko suli",
    tiles = {"ko_suli.png"},
    groups = {oddly_breakable_by_hand = 1},
    drawtype = "nodebox",
    walkable = false,
    node_box = ingredient_box,
    paramtype = "light",
    sunlight_propagates = true,
    use_texture_alpha = "clip"
})
minetest.register_node(":alasa_pan:telo", {
    description = "telo",
    tiles = {"telo.png"},
    groups = {oddly_breakable_by_hand = 1},
    drawtype = "nodebox",
    walkable = false,
    node_box = ingredient_box,
    paramtype = "light",
    sunlight_propagates = true,
    use_texture_alpha = "clip"
})
minetest.register_node(":alasa_pan:pan", {
    description = "pan",
    tiles = {
        "pan_t.png", -- +Y
        "pan_s2.png", -- -Y
        "pan_s.png", -- +X
        "pan_s.png", -- -X
        "pan_s2.png", -- +Z
        "pan_s2.png", -- -Z
    },
    groups = {oddly_breakable_by_hand = 1},
    drawtype = "nodebox",
    walkable = false,
    node_box = {
        type="fixed",
        fixed={
            {-0.375, -0.5, -0.25, 0.375, 0, 0.25},
            {-0.375, 0, -0.375, 0.375, 0.25, 0.375},
        }
    },
    paramtype = "light",
    sunlight_propagates = true,
    use_texture_alpha = "clip"
})

minetest.register_node(":alasa_pan:ilo_pona", {
    description = "ilo pona",
    tiles = {"ilo_pona.png"},
    groups = {}
})
minetest.register_node(":alasa_pan:ilo_seli", {
    description = "ilo seli",
    tiles = {"ilo_seli.png"},
    groups = {}
})
minetest.register_node(":alasa_pan:monsuta", {
    description = "monsuta",
    tiles = {"monsuta.png"},
    drawtype = "glasslike",
    groups = {},
    walkable = false,
    use_texture_alpha = "clip"
})