Code tweak and tidy

This commit is contained in:
TenPlus1 2016-06-05 11:39:20 +01:00
parent a3a3934227
commit 306c025713
5 changed files with 18 additions and 15 deletions

View File

@ -170,14 +170,14 @@ local function growth(pointed_thing)
local stage = "" local stage = ""
-- grow registered crops -- 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 = 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 return

View File

@ -108,13 +108,13 @@ minetest.register_abm({
"group:ethereal_grass") "group:ethereal_grass")
-- count new grass nodes -- 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 if num > curr_max then
curr_max = num curr_max = num
curr_type = p curr_type = dirts[n]
end end
end end

View File

@ -41,20 +41,22 @@ minetest.register_craft({
}) })
-- X pattern craft recipes (5x 'a' in X pattern gives 5 of 'b') -- X pattern craft recipes (5x 'a' in X pattern gives 5 of 'b')
for _,items in pairs({ local cheat = {
{"default:cobble", "default:gravel"}, {"default:cobble", "default:gravel"},
{"default:gravel", "default:dirt"}, {"default:gravel", "default:dirt"},
{"default:dirt", "default:sand"}, {"default:dirt", "default:sand"},
{"default:ice", "default:snow"}, {"default:ice", "default:snow"},
{"ethereal:dry_dirt", "default:desert_sand"}, {"ethereal:dry_dirt", "default:desert_sand"},
}) do }
local a, b = unpack(items)
for n = 1, #cheat do
minetest.register_craft({ minetest.register_craft({
output = b.." 5", output = cheat[n][2] .. " 5",
recipe = { recipe = {
{a, "", a}, {cheat[n][1], "", cheat[n][1]},
{"", a, ""}, {"", cheat[n][1], ""},
{a, "", a}, {cheat[n][1], "", cheat[n][1]},
} }
}) })
end end

View File

@ -1,3 +1,4 @@
-- Flowers spread over all types of soil -- Flowers spread over all types of soil
minetest.register_abm({ minetest.register_abm({
nodenames = {"group:flora"}, nodenames = {"group:flora"},

View File

@ -1,6 +1,6 @@
--[[ --[[
Minetest Ethereal Mod (17th May 2016) Minetest Ethereal Mod (5th June 2016)
Created by ChinChow Created by ChinChow