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
riesenpilz = {}
dofile(minetest.get_modpath("riesenpilz").."/settings.lua")
dofile(minetest.get_modpath("riesenpilz").."/functions.lua")
local modpath = minetest.get_modpath("riesenpilz").."/"
dofile(modpath.."settings.lua")
dofile(modpath.."functions.lua")
--Growing Functions
-- Growing Functions
local function r_area(manip, width, height, pos)
local emerged_pos1, emerged_pos2 = manip:read_from_map(
@ -19,13 +20,14 @@ end
local function set_vm_data(manip, nodes, pos, t1, name)
manip:set_data(nodes)
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()
manip:update_map()
riesenpilz.inform("map updated", 3, t1)
end
-- contents become added later
local c
function riesenpilz.red(pos, nodes, area, w)
@ -143,7 +145,7 @@ local function riesenpilz_minecraft_fliegenpilz(pos)
manip:set_param2_data(param2s)
manip:write_to_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
@ -451,39 +453,44 @@ local function riesenpilz_apple(pos)
manip:set_data(nodes)
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()
end
--3D apple [3apple]
-- 3D apple [3apple]
minetest.override_item("default:apple", {
drawtype = "nodebox",
tiles = {"3apple_apple_top.png","3apple_apple_bottom.png","3apple_apple.png"},
node_box = {
type = "fixed",
fixed = {
{-3/16, -7/16, -3/16, 3/16, 1/16, 3/16},
{-4/16, -6/16, -3/16, 4/16, 0, 3/16},
{-3/16, -6/16, -4/16, 3/16, 0, 4/16},
{-1/32, 1/16, -1/32, 1/32, 4/16, 1/32},
{-1/16, 1.6/16, 0, 1/16, 1.8/16, 1/16},
{-2/16, 1.4/16, 1/16, 1/16, 1.6/16, 2/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},
}
},
})
if riesenpilz.change_apple then
minetest.override_item("default:apple", {
drawtype = "nodebox",
tiles = {"3apple_apple_top.png", "3apple_apple_bottom.png", "3apple_apple.png"},
node_box = {
type = "fixed",
fixed = {
{-3/16, -7/16, -3/16, 3/16, 1/16, 3/16},
{-4/16, -6/16, -3/16, 4/16, 0, 3/16},
{-3/16, -6/16, -4/16, 3/16, 0, 4/16},
{-1/32, 1/16, -1/32, 1/32, 4/16, 1/32},
{-1/16, 1.6/16, 0, 1/16, 1.8/16, 1/16},
{-2/16, 1.4/16, 1/16, 1/16, 1.6/16, 2/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 = {
description = "brown mushroom",
box = {
@ -639,11 +646,7 @@ local mushrooms_list = {
chance = 20,
},
},
}
local abm_allowed = true
local disallowed_ps = {}
for name,i in pairs(mushrooms_list) do
}) do
local burntime = i.burntime or 1
local box = {
type = "fixed",
@ -815,26 +818,19 @@ minetest.register_globalstep(function(dtime)
end
end)
minetest.register_craftitem("riesenpilz:mush45_meal", {
description = "Mushroom Meal",
inventory_image = "riesenpilz_mush45_meal.png",
on_use = minetest.item_eat(6),
-- Big Mushroom Nodes
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({
output = "riesenpilz:mush45_meal 4",
recipe = {
{"riesenpilz:brown45", "riesenpilz:red45"},
{"riesenpilz:red45", "riesenpilz:brown45"},
}
})
--Big Mushroom Nodes
local pilznode_list = {
for _,i in pairs({
{
typ = "stem",
description = "white",
@ -924,16 +920,7 @@ local pilznode_list = {
textures = {"head_brown_bright.png", "head_white.png", "head_brown_bright.png"},
sapling = "parasol"
},
}
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
}) do
-- fill missing stuff
local textures = i.textures
i.description = i.description or i.name
@ -1033,7 +1020,7 @@ c = {
--Growing
-- Growing
minetest.register_tool("riesenpilz:growingtool", {
@ -1041,33 +1028,55 @@ minetest.register_tool("riesenpilz:growingtool", {
inventory_image = "riesenpilz_growingtool.png",
})
minetest.register_on_punchnode(function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == "riesenpilz:growingtool" then
local name = node.name
if name == "riesenpilz:red" then
riesenpilz_hybridpilz(pos)
elseif name == "riesenpilz:fly_agaric" then
riesenpilz_minecraft_fliegenpilz(pos)
elseif name == "riesenpilz:brown" then
riesenpilz_brauner_minecraftpilz(pos)
elseif name == "riesenpilz:lavashroom" then
riesenpilz_lavashroom(pos)
elseif name == "riesenpilz:glowshroom" then
riesenpilz_glowshroom(pos)
elseif name == "riesenpilz:parasol" then
riesenpilz_parasol(pos)
elseif name == "riesenpilz:red45" then
riesenpilz_red45(pos)
elseif name == "default:apple" then
riesenpilz_apple(pos)
end
minetest.register_on_punchnode(function(pos, node, player)
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
if name == "riesenpilz:red" then
riesenpilz_hybridpilz(pos)
elseif name == "riesenpilz:fly_agaric" then
riesenpilz_minecraft_fliegenpilz(pos)
elseif name == "riesenpilz:brown" then
riesenpilz_brauner_minecraftpilz(pos)
elseif name == "riesenpilz:lavashroom" then
riesenpilz_lavashroom(pos)
elseif name == "riesenpilz:glowshroom" then
riesenpilz_glowshroom(pos)
elseif name == "riesenpilz:parasol" then
riesenpilz_parasol(pos)
elseif name == "riesenpilz:red45" then
riesenpilz_red45(pos)
elseif name == "default:apple" then
riesenpilz_apple(pos)
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
dofile(minetest.get_modpath("riesenpilz") .. "/mapgen.lua")
dofile(modpath.."mapgen.lua")
end
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>
riesenpilz.max_spam = 2
--3d apple
riesenpilz.change_apple = true