Skip to content
Permalink
Browse files

Script API: Make the craft recipe field 'method' consistent

  • Loading branch information...
SmallJoker authored and paramat committed Jul 30, 2016
1 parent 986d70c commit 5c0e659516857733d968707490b16bcf62f33c92
Showing with 12 additions and 4 deletions.
  1. +12 −4 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");
}

0 comments on commit 5c0e659

Please sign in to comment.
You can’t perform that action at this time.