This commit is contained in:
HybridDog 2015-11-06 14:27:25 +01:00
parent 381e4a5322
commit aaae93ac61
2 changed files with 93 additions and 81 deletions

171
init.lua
View File

@ -2,11 +2,12 @@ local load_time_start = os.clock()
local MAX_SIZE = 3 local MAX_SIZE = 3
riesenpilz = {} riesenpilz = {}
dofile(minetest.get_modpath("riesenpilz").."/settings.lua") local modpath = minetest.get_modpath("riesenpilz").."/"
dofile(minetest.get_modpath("riesenpilz").."/functions.lua") dofile(modpath.."settings.lua")
dofile(modpath.."functions.lua")
--Growing Functions -- Growing Functions
local function r_area(manip, width, height, pos) local function r_area(manip, width, height, pos)
local emerged_pos1, emerged_pos2 = manip:read_from_map( local emerged_pos1, emerged_pos2 = manip:read_from_map(
@ -19,13 +20,14 @@ end
local function set_vm_data(manip, nodes, pos, t1, name) local function set_vm_data(manip, nodes, pos, t1, name)
manip:set_data(nodes) manip:set_data(nodes)
manip:write_to_map() manip:write_to_map()
riesenpilz.inform("a "..name.." mushroom grew at ("..pos.x.."|"..pos.y.."|"..pos.z..")", 3, t1) riesenpilz.inform("a giant "..name.." mushroom grew at "..vector.pos_to_string(pos), 3, t1)
local t1 = os.clock() local t1 = os.clock()
manip:update_map() manip:update_map()
riesenpilz.inform("map updated", 3, t1) riesenpilz.inform("map updated", 3, t1)
end end
-- contents become added later
local c local c
function riesenpilz.red(pos, nodes, area, w) function riesenpilz.red(pos, nodes, area, w)
@ -143,7 +145,7 @@ local function riesenpilz_minecraft_fliegenpilz(pos)
manip:set_param2_data(param2s) manip:set_param2_data(param2s)
manip:write_to_map() manip:write_to_map()
manip:update_map() manip:update_map()
riesenpilz.inform("a fly agaric grew at ("..pos.x.."|"..pos.y.."|"..pos.z..")", 3, t1) riesenpilz.inform("a fly agaric grew at "..vector.pos_to_string(pos), 3, t1)
end end
@ -451,39 +453,44 @@ local function riesenpilz_apple(pos)
manip:set_data(nodes) manip:set_data(nodes)
manip:write_to_map() manip:write_to_map()
riesenpilz.inform("an apple grew at ("..pos.x.."|"..pos.y.."|"..pos.z..")", 3, t1) riesenpilz.inform("an apple grew at "..vector.pos_to_string(pos), 3, t1)
manip:update_map() manip:update_map()
end end
--3D apple [3apple] -- 3D apple [3apple]
minetest.override_item("default:apple", { if riesenpilz.change_apple then
drawtype = "nodebox", minetest.override_item("default:apple", {
tiles = {"3apple_apple_top.png","3apple_apple_bottom.png","3apple_apple.png"}, drawtype = "nodebox",
node_box = { tiles = {"3apple_apple_top.png", "3apple_apple_bottom.png", "3apple_apple.png"},
type = "fixed", node_box = {
fixed = { type = "fixed",
{-3/16, -7/16, -3/16, 3/16, 1/16, 3/16}, fixed = {
{-4/16, -6/16, -3/16, 4/16, 0, 3/16}, {-3/16, -7/16, -3/16, 3/16, 1/16, 3/16},
{-3/16, -6/16, -4/16, 3/16, 0, 4/16}, {-4/16, -6/16, -3/16, 4/16, 0, 3/16},
{-1/32, 1/16, -1/32, 1/32, 4/16, 1/32}, {-3/16, -6/16, -4/16, 3/16, 0, 4/16},
{-1/16, 1.6/16, 0, 1/16, 1.8/16, 1/16}, {-1/32, 1/16, -1/32, 1/32, 4/16, 1/32},
{-2/16, 1.4/16, 1/16, 1/16, 1.6/16, 2/16}, {-1/16, 1.6/16, 0, 1/16, 1.8/16, 1/16},
{-2/16, 1.2/16, 2/16, 0, 1.4/16, 3/16}, {-2/16, 1.4/16, 1/16, 1/16, 1.6/16, 2/16},
{-1.5/16, 1/16, .5/16, 0.5/16, 1.2/16, 2.5/16}, {-2/16, 1.2/16, 2/16, 0, 1.4/16, 3/16},
} {-1.5/16, 1/16, .5/16, 0.5/16, 1.2/16, 2.5/16},
}, }
}) },
})
end
--Mushroom Nodes -- Mushroom Nodes
local mushrooms_list = { local abm_allowed = true
local disallowed_ps = {}
for name,i in pairs({
brown = { brown = {
description = "brown mushroom", description = "brown mushroom",
box = { box = {
@ -639,11 +646,7 @@ local mushrooms_list = {
chance = 20, chance = 20,
}, },
}, },
} }) do
local abm_allowed = true
local disallowed_ps = {}
for name,i in pairs(mushrooms_list) do
local burntime = i.burntime or 1 local burntime = i.burntime or 1
local box = { local box = {
type = "fixed", type = "fixed",
@ -815,26 +818,19 @@ minetest.register_globalstep(function(dtime)
end end
end) end)
minetest.register_craftitem("riesenpilz:mush45_meal", {
description = "Mushroom Meal",
inventory_image = "riesenpilz_mush45_meal.png", -- Big Mushroom Nodes
on_use = minetest.item_eat(6),
local head_sounds = default.node_sound_wood_defaults({
footstep = {name="riesenpilz_head", gain=0.1},
place = {name="default_place_node", gain=0.5},
dig = {name="riesenpilz_head", gain=0.2},
dug = {name="riesenpilz_stem", gain=0.1}
}) })
minetest.register_craft({ for _,i in pairs({
output = "riesenpilz:mush45_meal 4",
recipe = {
{"riesenpilz:brown45", "riesenpilz:red45"},
{"riesenpilz:red45", "riesenpilz:brown45"},
}
})
--Big Mushroom Nodes
local pilznode_list = {
{ {
typ = "stem", typ = "stem",
description = "white", description = "white",
@ -924,16 +920,7 @@ local pilznode_list = {
textures = {"head_brown_bright.png", "head_white.png", "head_brown_bright.png"}, textures = {"head_brown_bright.png", "head_white.png", "head_brown_bright.png"},
sapling = "parasol" sapling = "parasol"
}, },
} }) do
local head_sounds = default.node_sound_wood_defaults({
footstep = {name="riesenpilz_head", gain=0.1},
place = {name="default_place_node", gain=0.5},
dig = {name="riesenpilz_head", gain=0.2},
dug = {name="riesenpilz_stem", gain=0.1}
})
for _,i in pairs(pilznode_list) do
-- fill missing stuff -- fill missing stuff
local textures = i.textures local textures = i.textures
i.description = i.description or i.name i.description = i.description or i.name
@ -1033,7 +1020,7 @@ c = {
--Growing -- Growing
minetest.register_tool("riesenpilz:growingtool", { minetest.register_tool("riesenpilz:growingtool", {
@ -1041,33 +1028,55 @@ minetest.register_tool("riesenpilz:growingtool", {
inventory_image = "riesenpilz_growingtool.png", inventory_image = "riesenpilz_growingtool.png",
}) })
minetest.register_on_punchnode(function(pos, node, puncher) minetest.register_on_punchnode(function(pos, node, player)
if puncher:get_wielded_item():get_name() == "riesenpilz:growingtool" then if player:get_wielded_item():get_name() ~= "riesenpilz:growingtool"
local name = node.name or minetest.is_protected(pos, player:get_player_name()) then
if name == "riesenpilz:red" then return
riesenpilz_hybridpilz(pos) end
elseif name == "riesenpilz:fly_agaric" then
riesenpilz_minecraft_fliegenpilz(pos) local name = node.name
elseif name == "riesenpilz:brown" then if name == "riesenpilz:red" then
riesenpilz_brauner_minecraftpilz(pos) riesenpilz_hybridpilz(pos)
elseif name == "riesenpilz:lavashroom" then elseif name == "riesenpilz:fly_agaric" then
riesenpilz_lavashroom(pos) riesenpilz_minecraft_fliegenpilz(pos)
elseif name == "riesenpilz:glowshroom" then elseif name == "riesenpilz:brown" then
riesenpilz_glowshroom(pos) riesenpilz_brauner_minecraftpilz(pos)
elseif name == "riesenpilz:parasol" then elseif name == "riesenpilz:lavashroom" then
riesenpilz_parasol(pos) riesenpilz_lavashroom(pos)
elseif name == "riesenpilz:red45" then elseif name == "riesenpilz:glowshroom" then
riesenpilz_red45(pos) riesenpilz_glowshroom(pos)
elseif name == "default:apple" then elseif name == "riesenpilz:parasol" then
riesenpilz_apple(pos) riesenpilz_parasol(pos)
end elseif name == "riesenpilz:red45" then
riesenpilz_red45(pos)
elseif name == "default:apple" then
riesenpilz_apple(pos)
end end
end) end)
-- Food
minetest.register_craftitem("riesenpilz:mush45_meal", {
description = "Mushroom Meal",
inventory_image = "riesenpilz_mush45_meal.png",
on_use = minetest.item_eat(6),
})
minetest.register_craft({
output = "riesenpilz:mush45_meal 4",
recipe = {
{"riesenpilz:brown45", "riesenpilz:red45"},
{"riesenpilz:red45", "riesenpilz:brown45"},
}
})
if riesenpilz.enable_mapgen then if riesenpilz.enable_mapgen then
dofile(minetest.get_modpath("riesenpilz") .. "/mapgen.lua") dofile(modpath.."mapgen.lua")
end end
local time = math.floor(tonumber(os.clock()-load_time_start)*100+0.5)/100 local time = math.floor(tonumber(os.clock()-load_time_start)*100+0.5)/100

View File

@ -25,3 +25,6 @@ riesenpilz.inform_all = false--minetest.is_singleplayer()
--1:<a bit of information> 2:<acceptable amount of information> 3:<lots of text> --1:<a bit of information> 2:<acceptable amount of information> 3:<lots of text>
riesenpilz.max_spam = 2 riesenpilz.max_spam = 2
--3d apple
riesenpilz.change_apple = true