1
0

Added cItemGrid to represent an XY grid of items; converted chests to use cItemGrid.

http://forum.mc-server.org/showthread.php?tid=831

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1380 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2013-04-10 19:52:03 +00:00
parent c603180470
commit cc26f16463
15 changed files with 1321 additions and 115 deletions

View File

@@ -968,6 +968,10 @@ static int copy_lua_values(lua_State * a_Source, lua_State * a_Destination, int
return 1;
}
static int tolua_cPlugin_Call(lua_State* tolua_S)
{
cPlugin_NewLua * self = (cPlugin_NewLua *) tolua_tousertype(tolua_S, 1, 0);
@@ -1095,6 +1099,40 @@ static int tolua_get_HTTPRequest_FormData(lua_State* tolua_S)
static int Lua_ItemGrid_GetSlotCoords(lua_State * L)
{
tolua_Error tolua_err;
if (
!tolua_isusertype(L, 1, "const cItemGrid", 0, &tolua_err) ||
!tolua_isnumber (L, 2, 0, &tolua_err) ||
!tolua_isnoobj (L, 3, &tolua_err)
)
{
goto tolua_lerror;
}
const cItemGrid * self = (const cItemGrid *)tolua_tousertype(L, 1, 0);
int SlotNum = (int)tolua_tonumber(L, 2, 0);
if (self == NULL)
{
tolua_error(L, "invalid 'self' in function 'cItemGrid:GetSlotCoords'", NULL);
return 0;
}
int X, Y;
self->GetSlotCoords(SlotNum, X, Y);
tolua_pushnumber(L, (lua_Number)X);
tolua_pushnumber(L, (lua_Number)Y);
return 2;
tolua_lerror:
tolua_error(L, "#ferror in function 'FindKey'.", &tolua_err);
return 0;
}
void ManualBindings::Bind( lua_State* tolua_S )
{
tolua_beginmodule(tolua_S,NULL);
@@ -1158,6 +1196,10 @@ void ManualBindings::Bind( lua_State* tolua_S )
tolua_constant(tolua_S, "MAX_VIEW_DISTANCE", cClientHandle::MAX_VIEW_DISTANCE);
tolua_endmodule(tolua_S);
tolua_beginmodule(tolua_S, "cItemGrid");
tolua_function(tolua_S, "GetSlotCoords", Lua_ItemGrid_GetSlotCoords);
tolua_endmodule(tolua_S);
tolua_function(tolua_S, "md5", tolua_md5);
tolua_endmodule(tolua_S);