1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Allow replacements in cooking and fuel recipes

This commit is contained in:
Kahrl 2012-02-11 18:10:13 +01:00 committed by Perttu Ahola
parent 430d6e1cca
commit e070f1e525
3 changed files with 69 additions and 38 deletions

View file

@ -4129,8 +4129,17 @@ static int l_register_craft(lua_State *L)
float cooktime = getfloatfield_default(L, table, "cooktime", 3.0);
CraftReplacements replacements;
lua_getfield(L, table, "replacements");
if(!lua_isnil(L, -1))
{
if(!read_craft_replacements(L, -1, replacements))
throw LuaError(L, "Invalid replacements"
" (cooking output=\"" + output + "\")");
}
CraftDefinition *def = new CraftDefinitionCooking(
output, recipe, cooktime);
output, recipe, cooktime, replacements);
craftdef->registerCraft(def);
}
/*
@ -4144,8 +4153,17 @@ static int l_register_craft(lua_State *L)
float burntime = getfloatfield_default(L, table, "burntime", 1.0);
CraftReplacements replacements;
lua_getfield(L, table, "replacements");
if(!lua_isnil(L, -1))
{
if(!read_craft_replacements(L, -1, replacements))
throw LuaError(L, "Invalid replacements"
" (fuel recipe=\"" + recipe + "\")");
}
CraftDefinition *def = new CraftDefinitionFuel(
recipe, burntime);
recipe, burntime, replacements);
craftdef->registerCraft(def);
}
else