From f56ccc47477615ba020702e425a89b7477adf13d Mon Sep 17 00:00:00 2001 From: HybridDog Date: Fri, 5 Dec 2014 22:50:57 +0100 Subject: [PATCH] change code --- init.lua | 93 +++++++++++++++++++++++++++++++++++------------------- mapgen.lua | 4 +-- 2 files changed, 62 insertions(+), 35 deletions(-) diff --git a/init.lua b/init.lua index 3146130..3d44786 100644 --- a/init.lua +++ b/init.lua @@ -371,28 +371,6 @@ minetest.register_node(":default:apple", { --Mushroom Nodes -local function pilz(name, desc, b, burntime) - burntime = burntime or 1 - local box = { - type = "fixed", - fixed = b - } - minetest.register_node("riesenpilz:"..name, { - description = desc, - tiles = {"riesenpilz_"..name.."_top.png", "riesenpilz_"..name.."_bottom.png", "riesenpilz_"..name.."_side.png"}, - inventory_image = "riesenpilz_"..name.."_side.png", - walkable = false, - buildable_to = true, - drawtype = "nodebox", - paramtype = "light", - groups = {snappy=3,flammable=2,attached_node=1}, - sounds = default.node_sound_leaves_defaults(), - node_box = box, - selection_box = box, - furnace_burntime = burntime - }) -end - local BOX = { RED = { {-1/16, -8/16, -1/16, 1/16, -6/16, 1/16}, @@ -461,19 +439,68 @@ local BOX = { local mushrooms_list = { - {"brown", "brown mushroom", BOX.BROWN}, - {"red", "red mushroom", BOX.RED}, - {"fly_agaric", "fly agaric", BOX.FLY_AGARIC}, - {"lavashroom", "Lavashroom", BOX.LAVASHROOM}, - {"glowshroom", "Glowshroom", BOX.GLOWSHROOM}, - {"nether_shroom", "Nether mushroom", BOX.NETHER_SHROOM, 6}, - {"parasol", "white parasol mushroom", BOX.PARASOL}, - {"red45", "45 red mushroom", BOX.RED45}, - {"brown45", "45 brown mushroom", BOX.BROWN45}, + ["brown"] = { + description = "brown mushroom", + box = BOX.BROWN, + growing = { + + } + }, + ["red"] = { + description = "red mushroom", + box = BOX.RED + }, + ["fly_agaric"] = { + description = "fly agaric", + box = BOX.FLY_AGARIC + }, + ["lavashroom"] = { + description = "Lavashroom", + box = BOX.LAVASHROOM + }, + ["glowshroom"] = { + description = "Glowshroom", + box = BOX.GLOWSHROOM + }, + ["nether_shroom"] = { + description = "Nether mushroom", + box = BOX.NETHER_SHROOM, + burntime = 6 + }, + ["parasol"] = { + description = "white parasol mushroom", + box = BOX.PARASOL + }, + ["red45"] = { + description = "45 red mushroom", + box = BOX.RED45 + }, + ["brown45"] = { + description = "45 brown mushroom", + box = BOX.BROWN45 + }, } -for _,i in ipairs(mushrooms_list) do - pilz(i[1], i[2], i[3], i[4]) +for name,i in pairs(mushrooms_list) do + local burntime = i.burntime or 1 + local box = { + type = "fixed", + fixed = i.box + } + minetest.register_node("riesenpilz:"..name, { + description = i.description, + tiles = {"riesenpilz_"..name.."_top.png", "riesenpilz_"..name.."_bottom.png", "riesenpilz_"..name.."_side.png"}, + inventory_image = "riesenpilz_"..name.."_side.png", + walkable = false, + buildable_to = true, + drawtype = "nodebox", + paramtype = "light", + groups = {snappy=3,flammable=2,attached_node=1}, + sounds = default.node_sound_leaves_defaults(), + node_box = box, + selection_box = box, + furnace_burntime = burntime + }) end diff --git a/mapgen.lua b/mapgen.lua index b82bf5f..5ce6b45 100644 --- a/mapgen.lua +++ b/mapgen.lua @@ -53,8 +53,8 @@ end function riesenpilz_circle(nam, pos, radius, chance) - for i = -radius, radius, 1 do - for j = -radius, radius, 1 do + for i = -radius, radius do + for j = -radius, radius do if math.floor( math.sqrt(i^2+j^2) +0.5) == radius and data[area:index(pos.x+i, pos.y, pos.z+j)] == c.air and pr:next(1,chance) == 1