103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
local function regStage(n, st)
local base = {
description = b.name;
drawtype = "plantlike";
tiles = { tostring(st.tex) };
paramtype = "light";
paramtype2 = "meshoptions";
walkable = false;
buildable_to = true;
groups = {
plant = 1;
plant_grow = stageCt ~= n and 1 or 0;
};
drop = st.drop;
_starlit = {
plant = {
id = id, stage = n;
};
};
}
if st.swap then
base.node_dig_prediction = stageID(st.swap)
function base.on_dig(pos, node, digger)
node.name = stageID(st.swap)
minetest.swap_node(pos, node)
return true
end
end
return base
end
for i, v in ipairs(b.stages) do
local n = regStage(i, v)
b.stageNodes[i] = n
minetest.register_node(stageID(i), n)
end
b.fullyGrown = stageID(stageCt)
local dec = {
deco_type = 'simple';
decoration = b.fullyGrown;
height = 1;
param2 = 0;
}
for k,v in pairs(b.decoration) do dec[k] = v end
b.decoration = minetest.register_decoration(dec)
end)
local toward = lib.math.toward
local hfinterval = 1.5
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
|
|
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
local function regStage(n, st)
local base = {
description = b.name;
drawtype = "plantlike";
tiles = { tostring(st.tex) };
paramtype = "light";
paramtype2 = "meshoptions";
place_param2 = b.meshOpt;
walkable = false;
buildable_to = true;
groups = {
plant = 1;
plant_grow = stageCt ~= n and 1 or 0;
};
drop = st.drop;
_starlit = {
plant = {
id = id, stage = n;
};
recover = starlit.type.fab {
time = { shred = .3; };
cost = { shredPower = 1; };
};
recover_vary = function(rng, ctx)
return starlit.type.fab {
element = {
carbon = rng:int(0,1);
potassium = rng:int(0,1);
}
};
end;
};
}
if st.swap then
base.node_dig_prediction = stageID(st.swap)
function base.after_dig_node(pos, node, digger)
node.name = stageID(st.swap)
minetest.swap_node(pos, node)
return true
end
end
if st.biolum then
base.light_source = math.floor(st.biolum * (n/stageCt))
end
return base
end
for i, v in ipairs(b.stages) do
local n = regStage(i, v)
b.stageNodes[i] = n
minetest.register_node(stageID(i), n)
end
b.fullyGrown = stageID(stageCt)
local dec = {
deco_type = 'simple';
decoration = b.fullyGrown;
height = 1;
param2 = b.meshOpt or 0;
}
for k,v in pairs(b.decoration) do dec[k] = v end
b.decoration = minetest.register_decoration(dec)
end)
local toward = lib.math.toward
local hfinterval = 1.5
|