Added white trees (sorry, the texture is terrible), added furnace support (finally), and added cloning support (somewhat)
This commit is contained in:
parent
e75d6a2f84
commit
4bbfe0032f
@ -22,6 +22,9 @@ minetest.registered_craftitems = {}
|
|||||||
minetest.registered_tools = {}
|
minetest.registered_tools = {}
|
||||||
minetest.registered_aliases = {}
|
minetest.registered_aliases = {}
|
||||||
minetest.registered_crafts = {}
|
minetest.registered_crafts = {}
|
||||||
|
minetest.registered_fuels = {}
|
||||||
|
minetest.registered_smeltables = {}
|
||||||
|
minetest.registered_clones = {}
|
||||||
|
|
||||||
-- For tables that are indexed by item name:
|
-- For tables that are indexed by item name:
|
||||||
-- If table[X] does not exist, default to table[minetest.registered_aliases[X]]
|
-- If table[X] does not exist, default to table[minetest.registered_aliases[X]]
|
||||||
@ -152,6 +155,8 @@ end
|
|||||||
|
|
||||||
function minetest.register_node(name, nodedef)
|
function minetest.register_node(name, nodedef)
|
||||||
nodedef.type = "node"
|
nodedef.type = "node"
|
||||||
|
minetest.registered_clones[name] = {}
|
||||||
|
minetest.registered_clones[name][0] = name
|
||||||
minetest.register_item(name, nodedef)
|
minetest.register_item(name, nodedef)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -167,6 +172,50 @@ function minetest.register_craftitem(name, craftitemdef)
|
|||||||
minetest.register_item(name, craftitemdef)
|
minetest.register_item(name, craftitemdef)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function minetest.register_craft(craftdef)
|
||||||
|
local tempcraftdef = craftdef
|
||||||
|
if craftdef.recipe ~= nil and craftdef.output ~= nil then
|
||||||
|
if craftdef.type == "cooking" then
|
||||||
|
if minetest.registered_clones[craftdef.recipe] ~= nil then
|
||||||
|
for i,v in ipairs(minetest.registered_clones[craftdef.recipe]) do
|
||||||
|
tempcraftdef.recipe = v
|
||||||
|
minetest.registered_smeltables[v] = craftdef.output
|
||||||
|
minetest.register_craft_raw(tempcraftdef)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
minetest.registered_smeltables[craftdef.recipe] = craftdef.burntime
|
||||||
|
minetest.register_craft_raw(craftdef)
|
||||||
|
end
|
||||||
|
elseif craftdef.type == "fuel" then
|
||||||
|
if minetest.registered_clones[craftdef.recipe] ~= nil then
|
||||||
|
for i,v in ipairs(minetest.registered_clones[craftdef.recipe]) do
|
||||||
|
tempcraftdef.recipe = v
|
||||||
|
minetest.registered_fuels[v] = craftdef.burntime
|
||||||
|
minetest.register_craft_raw(tempcraftdef)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
minetest.registered_fuels[craftdef.recipe] = craftdef.burntime
|
||||||
|
minetest.register_craft_raw(craftdef)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for i,v in ipairs(craftdef.recipe) do
|
||||||
|
for x,y in ipairs(v) do
|
||||||
|
if minetest.registered_clones[y] ~= nil then
|
||||||
|
for z,a in ipairs(minetest.registered_clones[y]) do
|
||||||
|
tempcraftdef.recipe[v][y] = a
|
||||||
|
minetest.registered_crafts[tempcraftdef.recipe] = craftdef.output
|
||||||
|
minetest.register_craft_raw(tempcraftdef)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
minetest.registered_crafts[craftdef.recipe] = craftdef.output
|
||||||
|
minetest.register_craft_raw(craftdef)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function minetest.register_tool(name, tooldef)
|
function minetest.register_tool(name, tooldef)
|
||||||
tooldef.type = "tool"
|
tooldef.type = "tool"
|
||||||
tooldef.stack_max = 1
|
tooldef.stack_max = 1
|
||||||
@ -228,6 +277,16 @@ for name in pairs(forbidden_item_names) do
|
|||||||
register_alias_raw(name, "")
|
register_alias_raw(name, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Clone a node, changing something
|
||||||
|
function minetest.register_node_clone(name, original_name, nodedefs)
|
||||||
|
local newnodedef = minetest.registered_nodes[original_name]
|
||||||
|
for ndn, nd in pairs(nodedefs) do
|
||||||
|
newnodedef[ndn] = nd;
|
||||||
|
end
|
||||||
|
minetest.registered_clones[original_name][table.getn(minetest.registered_clones[original_name])+1] = name
|
||||||
|
minetest.register_node(name, newnodedef)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Deprecated:
|
-- Deprecated:
|
||||||
-- Aliases for minetest.register_alias (how ironic...)
|
-- Aliases for minetest.register_alias (how ironic...)
|
||||||
|
@ -850,6 +850,10 @@ minetest.register_node("default:tree", {
|
|||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_node_clone("default:tree_white", "default:tree", {
|
||||||
|
tile_images = {"default_tree_top_white.png", "default_tree_top_white.png", "default_tree_white.png"},
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_node("default:jungletree", {
|
minetest.register_node("default:jungletree", {
|
||||||
description = "Jungle Tree",
|
description = "Jungle Tree",
|
||||||
tile_images = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"},
|
tile_images = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"},
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
minetest.register_alias("mapgen_air", "air")
|
minetest.register_alias("mapgen_air", "air")
|
||||||
minetest.register_alias("mapgen_stone", "default:stone")
|
minetest.register_alias("mapgen_stone", "default:stone")
|
||||||
minetest.register_alias("mapgen_tree", "default:tree")
|
minetest.register_alias("mapgen_tree", "default:tree")
|
||||||
|
minetest.register_alias("mapgen_tree_white", "default:tree_white")
|
||||||
minetest.register_alias("mapgen_jungletree", "default:jungletree")
|
minetest.register_alias("mapgen_jungletree", "default:jungletree")
|
||||||
minetest.register_alias("mapgen_leaves", "default:leaves")
|
minetest.register_alias("mapgen_leaves", "default:leaves")
|
||||||
minetest.register_alias("mapgen_apple", "default:apple")
|
minetest.register_alias("mapgen_apple", "default:apple")
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 341 B After Width: | Height: | Size: 428 B |
BIN
games/minetest/mods/default/textures/default_tree_top_white.png
Normal file
BIN
games/minetest/mods/default/textures/default_tree_top_white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 410 B |
BIN
games/minetest/mods/default/textures/default_tree_white.png
Normal file
BIN
games/minetest/mods/default/textures/default_tree_white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 431 B |
@ -1750,7 +1750,7 @@ void the_game(
|
|||||||
guienv->setFocus(gui_chat_console);
|
guienv->setFocus(gui_chat_console);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(input->wasKeyDown(getKeySetting("keymap_freemove")))
|
/*if(input->wasKeyDown(getKeySetting("keymap_freemove")))
|
||||||
{
|
{
|
||||||
if(g_settings->getBool("free_move"))
|
if(g_settings->getBool("free_move"))
|
||||||
{
|
{
|
||||||
@ -1766,7 +1766,7 @@ void the_game(
|
|||||||
if(!client.checkPrivilege("fly"))
|
if(!client.checkPrivilege("fly"))
|
||||||
statustext += L" (note: no 'fly' privilege)";
|
statustext += L" (note: no 'fly' privilege)";
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
if(input->wasKeyDown(getKeySetting("keymap_fastmove")))
|
if(input->wasKeyDown(getKeySetting("keymap_fastmove")))
|
||||||
{
|
{
|
||||||
if(g_settings->getBool("fast_move"))
|
if(g_settings->getBool("fast_move"))
|
||||||
@ -2586,7 +2586,7 @@ void the_game(
|
|||||||
(daynight_ratio * LIGHT_SUN) / 1000) / 255.0;
|
(daynight_ratio * LIGHT_SUN) / 1000) / 255.0;
|
||||||
float direct_brightness = 0;
|
float direct_brightness = 0;
|
||||||
bool sunlight_seen = false;
|
bool sunlight_seen = false;
|
||||||
if(g_settings->getBool("free_move")){
|
if(player->is_flying){
|
||||||
direct_brightness = time_brightness;
|
direct_brightness = time_brightness;
|
||||||
sunlight_seen = true;
|
sunlight_seen = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -230,7 +230,16 @@ void make_custom_tree(ManualMapVoxelManipulator &vmanip, v3s16 p0,
|
|||||||
void make_tree(ManualMapVoxelManipulator &vmanip, v3s16 p0,
|
void make_tree(ManualMapVoxelManipulator &vmanip, v3s16 p0,
|
||||||
bool is_apple_tree, INodeDefManager *ndef)
|
bool is_apple_tree, INodeDefManager *ndef)
|
||||||
{
|
{
|
||||||
MapNode treenode(ndef->getId("mapgen_tree"));
|
bool white_tree = myrand_range(0, 5) == 1;
|
||||||
|
MapNode treenode;
|
||||||
|
if (white_tree)
|
||||||
|
{
|
||||||
|
treenode = ndef->getId("mapgen_tree_white");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
treenode = ndef->getId("mapgen_tree");
|
||||||
|
}
|
||||||
MapNode leavesnode(ndef->getId("mapgen_leaves"));
|
MapNode leavesnode(ndef->getId("mapgen_leaves"));
|
||||||
MapNode applenode(ndef->getId("mapgen_apple"));
|
MapNode applenode(ndef->getId("mapgen_apple"));
|
||||||
mapnoderandom applestruct;
|
mapnoderandom applestruct;
|
||||||
|
@ -4296,7 +4296,7 @@ static const struct luaL_Reg minetest_f [] = {
|
|||||||
{"log", l_log},
|
{"log", l_log},
|
||||||
{"register_item_raw", l_register_item_raw},
|
{"register_item_raw", l_register_item_raw},
|
||||||
{"register_alias_raw", l_register_alias_raw},
|
{"register_alias_raw", l_register_alias_raw},
|
||||||
{"register_craft", l_register_craft},
|
{"register_craft_raw", l_register_craft},
|
||||||
{"setting_set", l_setting_set},
|
{"setting_set", l_setting_set},
|
||||||
{"setting_get", l_setting_get},
|
{"setting_get", l_setting_get},
|
||||||
{"setting_getbool", l_setting_getbool},
|
{"setting_getbool", l_setting_getbool},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user