aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2016-07-30 12:50:22 +0200
committerparamat <mat.gregory@virginmedia.com>2016-08-18 20:43:49 +0100
commit5c0e659516857733d968707490b16bcf62f33c92 (patch)
tree925acebd2637b75aacfc1d379a97277c3ac0485e /src
parent986d70ccecb09fcbd247758643a4d623c9c4e1b8 (diff)
downloadminetest-5c0e659516857733d968707490b16bcf62f33c92.tar.gz
minetest-5c0e659516857733d968707490b16bcf62f33c92.tar.bz2
minetest-5c0e659516857733d968707490b16bcf62f33c92.zip
Script API: Make the craft recipe field 'method' consistent
Diffstat (limited to 'src')
-rw-r--r--src/script/lua_api/l_craft.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/script/lua_api/l_craft.cpp b/src/script/lua_api/l_craft.cpp
index d135c689f..2236566de 100644
--- a/src/script/lua_api/l_craft.cpp
+++ b/src/script/lua_api/l_craft.cpp
@@ -422,20 +422,28 @@ static void push_craft_recipe(lua_State *L, IGameDef *gdef,
}
lua_setfield(L, -2, "items");
setintfield(L, -1, "width", input.width);
+
+ std::string method_s;
switch (input.method) {
case CRAFT_METHOD_NORMAL:
- lua_pushstring(L, "normal");
+ method_s = "normal";
break;
case CRAFT_METHOD_COOKING:
- lua_pushstring(L, "cooking");
+ method_s = "cooking";
break;
case CRAFT_METHOD_FUEL:
- lua_pushstring(L, "fuel");
+ method_s = "fuel";
break;
default:
- lua_pushstring(L, "unknown");
+ method_s = "unknown";
}
+ lua_pushstring(L, method_s.c_str());
+ lua_setfield(L, -2, "method");
+
+ // Deprecated, only for compatibility's sake
+ lua_pushstring(L, method_s.c_str());
lua_setfield(L, -2, "type");
+
lua_pushstring(L, output.item.c_str());
lua_setfield(L, -2, "output");
}