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

View File

@ -2,8 +2,9 @@ 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
@ -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,7 +453,7 @@ 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
@ -460,6 +462,7 @@ end
-- 3D apple [3apple] -- 3D apple [3apple]
if riesenpilz.change_apple then
minetest.override_item("default:apple", { minetest.override_item("default:apple", {
drawtype = "nodebox", drawtype = "nodebox",
tiles = {"3apple_apple_top.png", "3apple_apple_bottom.png", "3apple_apple.png"}, tiles = {"3apple_apple_top.png", "3apple_apple_bottom.png", "3apple_apple.png"},
@ -477,13 +480,17 @@ minetest.override_item("default:apple", {
} }
}, },
}) })
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",
on_use = minetest.item_eat(6),
})
minetest.register_craft({
output = "riesenpilz:mush45_meal 4",
recipe = {
{"riesenpilz:brown45", "riesenpilz:red45"},
{"riesenpilz:red45", "riesenpilz:brown45"},
}
})
-- Big Mushroom Nodes -- Big Mushroom Nodes
local pilznode_list = { 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({
{ {
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
@ -1041,8 +1028,12 @@ 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"
or minetest.is_protected(pos, player:get_player_name()) then
return
end
local name = node.name local name = node.name
if name == "riesenpilz:red" then if name == "riesenpilz:red" then
riesenpilz_hybridpilz(pos) riesenpilz_hybridpilz(pos)
@ -1061,13 +1052,31 @@ minetest.register_on_punchnode(function(pos, node, puncher)
elseif name == "default:apple" then elseif name == "default:apple" then
riesenpilz_apple(pos) riesenpilz_apple(pos)
end 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