Code tweak and tidy
This commit is contained in:
parent
a3a3934227
commit
306c025713
@ -170,14 +170,14 @@ local function growth(pointed_thing)
|
||||
local stage = ""
|
||||
|
||||
-- grow registered crops
|
||||
for _, row in pairs(crops) do
|
||||
for n = 1, #crops do
|
||||
|
||||
if string.find(node.name, row[1]) then
|
||||
if string.find(node.name, crops[n][1]) then
|
||||
|
||||
stage = tonumber( node.name:split("_")[2] )
|
||||
stage = math.min(stage + math.random(1, 4), row[2])
|
||||
stage = math.min(stage + math.random(1, 4), crops[n][2])
|
||||
|
||||
minetest.set_node(pos, {name = row[1] .. stage})
|
||||
minetest.set_node(pos, {name = crops[n][1] .. stage})
|
||||
|
||||
return
|
||||
|
||||
|
6
dirt.lua
6
dirt.lua
@ -108,13 +108,13 @@ minetest.register_abm({
|
||||
"group:ethereal_grass")
|
||||
|
||||
-- count new grass nodes
|
||||
for _,p in pairs(dirts) do
|
||||
for n = 1, #dirts do
|
||||
|
||||
num = grasses[p] or 0
|
||||
num = grasses[dirts[n]] or 0
|
||||
|
||||
if num > curr_max then
|
||||
curr_max = num
|
||||
curr_type = p
|
||||
curr_type = dirts[n]
|
||||
end
|
||||
end
|
||||
|
||||
|
16
extra.lua
16
extra.lua
@ -41,20 +41,22 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
-- X pattern craft recipes (5x 'a' in X pattern gives 5 of 'b')
|
||||
for _,items in pairs({
|
||||
local cheat = {
|
||||
{"default:cobble", "default:gravel"},
|
||||
{"default:gravel", "default:dirt"},
|
||||
{"default:dirt", "default:sand"},
|
||||
{"default:ice", "default:snow"},
|
||||
{"ethereal:dry_dirt", "default:desert_sand"},
|
||||
}) do
|
||||
local a, b = unpack(items)
|
||||
}
|
||||
|
||||
for n = 1, #cheat do
|
||||
|
||||
minetest.register_craft({
|
||||
output = b.." 5",
|
||||
output = cheat[n][2] .. " 5",
|
||||
recipe = {
|
||||
{a, "", a},
|
||||
{"", a, ""},
|
||||
{a, "", a},
|
||||
{cheat[n][1], "", cheat[n][1]},
|
||||
{"", cheat[n][1], ""},
|
||||
{cheat[n][1], "", cheat[n][1]},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
-- Flowers spread over all types of soil
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:flora"},
|
||||
|
Loading…
Reference in New Issue
Block a user