summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-01 20:19:51 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-01 20:19:51 +0100
commit28ff03fcfe727f827c00078c4fa0319cb3c03421 (patch)
tree79a961e2c3bf9005556cbd7276dd4af2728fd76b
parentVC2008: removed an unneeded file from zlib project (diff)
downloadcuberite-28ff03fcfe727f827c00078c4fa0319cb3c03421.tar
cuberite-28ff03fcfe727f827c00078c4fa0319cb3c03421.tar.gz
cuberite-28ff03fcfe727f827c00078c4fa0319cb3c03421.tar.bz2
cuberite-28ff03fcfe727f827c00078c4fa0319cb3c03421.tar.lz
cuberite-28ff03fcfe727f827c00078c4fa0319cb3c03421.tar.xz
cuberite-28ff03fcfe727f827c00078c4fa0319cb3c03421.tar.zst
cuberite-28ff03fcfe727f827c00078c4fa0319cb3c03421.zip
-rw-r--r--Plugins/MagicCarpet/objects.lua (renamed from Plugins/MagicCarpet.lua)78
-rw-r--r--Plugins/MagicCarpet/plugin.lua65
-rw-r--r--source/Bindings.cpp796
-rw-r--r--source/Bindings.h2
-rw-r--r--source/cPlugin_NewLua.cpp122
-rw-r--r--source/cPlugin_NewLua.h26
6 files changed, 885 insertions, 204 deletions
diff --git a/Plugins/MagicCarpet.lua b/Plugins/MagicCarpet/objects.lua
index 69ccd0d5c..30528cc42 100644
--- a/Plugins/MagicCarpet.lua
+++ b/Plugins/MagicCarpet/objects.lua
@@ -92,78 +92,6 @@ function cCarpet:moveTo( NewPos )
end
end
-
-MagicCarpetPlugin = {}
-MagicCarpetPlugin.__index = MagicCarpetPlugin
-
-function MagicCarpetPlugin:new()
- local t = {}
- setmetatable(t, MagicCarpetPlugin)
- local w = Lua__cPlugin:new()
- tolua.setpeer(w, t)
- w:tolua__set_instance(w)
- return w
-end
-
-function MagicCarpetPlugin:Initialize()
- self:SetName( "MagicCarpet" )
- self:SetVersion( 1 )
-
- PluginManager = cRoot:Get():GetPluginManager()
- PluginManager:AddHook( self, cPluginManager.E_PLUGIN_PLAYER_MOVE)
- PluginManager:AddHook( self, cPluginManager.E_PLUGIN_DISCONNECT)
-
- self:AddCommand("/mc", " - Spawns a magical carpet!", "magiccarpet")
- self:BindCommand( "/mc", "magiccarpet", HandleCarpetCommand )
-
- self.Carpets = {}
-
- Log( "Initialized " .. self:GetName() .. " v." .. self:GetVersion() )
- return true
-end
-
-function MagicCarpetPlugin:OnDisable()
- Log( self:GetName() .. " v." .. self:GetVersion() .. " is shutting down..." )
- for i, Carpet in pairs( self.Carpets ) do
- Carpet:remove()
- end
-end
-
-function HandleCarpetCommand( Split, Player )
- Carpet = self.Carpets[ Player ]
- if( Carpet == nil ) then
- self.Carpets[ Player ] = cCarpet:new()
- Player:SendMessage("You're on a magic carpet!" )
- else
- Carpet:remove()
- self.Carpets[ Player ] = nil
- Player:SendMessage("The carpet vanished!" )
- end
-
- return true
-end
-
-function MagicCarpetPlugin:OnDisconnect( Reason, Player )
- local Carpet = self.Carpets[ Player ]
- if( Carpet ~= nil ) then
- Carpet:remove()
- end
- self.Carpets[ Player ] = nil
-end
-
-function MagicCarpetPlugin:OnPlayerMove( Player )
- local Carpet = self.Carpets[ Player ]
- if( Carpet == nil ) then
- return
- end
-
- if( Player:GetPitch() == 90 ) then
- Carpet:moveTo( cLocation:new( Player:GetPosX(), Player:GetPosY()-1, Player:GetPosZ() ) )
- else
- Carpet:moveTo( cLocation:new( Player:GetPosX(), Player:GetPosY(), Player:GetPosZ() ) )
- end
-end
-
-Plugin = MagicCarpetPlugin:new()
-cRoot:Get():GetPluginManager():AddPlugin( Plugin )
-
+function cCarpet:getY()
+ return self.Location.y
+end \ No newline at end of file
diff --git a/Plugins/MagicCarpet/plugin.lua b/Plugins/MagicCarpet/plugin.lua
new file mode 100644
index 000000000..22604c9d9
--- /dev/null
+++ b/Plugins/MagicCarpet/plugin.lua
@@ -0,0 +1,65 @@
+local PLUGIN = {}
+local Carpets = {}
+
+function Initialize( Plugin )
+ PLUGIN = Plugin
+
+ Plugin:SetName( "MagicCarpet" )
+ Plugin:SetVersion( 1 )
+
+ PluginManager = cRoot:Get():GetPluginManager()
+ PluginManager:AddHook( Plugin, cPluginManager.E_PLUGIN_PLAYER_MOVE)
+ PluginManager:AddHook( Plugin, cPluginManager.E_PLUGIN_DISCONNECT)
+
+ Plugin:AddCommand("/mc", " - Spawns a magical carpet!", "magiccarpet")
+ Plugin:BindCommand( "/mc", "magiccarpet", HandleCarpetCommand )
+
+ Log( "Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() )
+ return true
+end
+
+function OnDisable()
+ Log( PLUGIN:GetName() .. " v." .. PLUGIN:GetVersion() .. " is shutting down..." )
+ for i, Carpet in pairs( Carpets ) do
+ Carpet:remove()
+ end
+end
+
+function HandleCarpetCommand( Split, Player )
+ Carpet = Carpets[ Player ]
+ if( Carpet == nil ) then
+ Carpets[ Player ] = cCarpet:new()
+ Player:SendMessage("You're on a magic carpet!" )
+ else
+ Carpet:remove()
+ Carpets[ Player ] = nil
+ Player:SendMessage("The carpet vanished!" )
+ end
+
+ return true
+end
+
+function OnDisconnect( Reason, Player )
+ local Carpet = Carpets[ Player ]
+ if( Carpet ~= nil ) then
+ Carpet:remove()
+ end
+ Carpets[ Player ] = nil
+end
+
+function OnPlayerMove( Player )
+ local Carpet = Carpets[ Player ]
+ if( Carpet == nil ) then
+ return
+ end
+
+ if( Player:GetPitch() == 90 ) then
+ Carpet:moveTo( cLocation:new( Player:GetPosX(), Player:GetPosY()-1, Player:GetPosZ() ) )
+ else
+ if( Player:GetPosY() < Carpet:getY() ) then
+ LOGINFO("Fell tru mc!")
+ Player:TeleportTo( Player:GetPosX(), Carpet:getY(), Player:GetPosZ() )
+ end
+ Carpet:moveTo( cLocation:new( Player:GetPosX(), Player:GetPosY(), Player:GetPosZ() ) )
+ end
+end \ No newline at end of file
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index c8bcc8123..51bc36108 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 02/01/12 00:50:40.
+** Generated automatically by tolua++-1.0.92 on 02/01/12 20:13:33.
*/
#ifndef __cplusplus
@@ -8082,6 +8082,37 @@ static int tolua_collect_Lua__cPlugin (lua_State* tolua_S)
}
#endif
+/* method: OnDisable of class cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnDisable00
+static int tolua_AllToLua_cPlugin_NewLua_OnDisable00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnDisable'", NULL);
+#endif
+ {
+ self->OnDisable();
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'OnDisable'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: Initialize of class cPlugin_NewLua */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_Initialize00
static int tolua_AllToLua_cPlugin_NewLua_Initialize00(lua_State* tolua_S)
@@ -8147,69 +8178,73 @@ static int tolua_AllToLua_cPlugin_NewLua_Tick00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
-/* method: OnPlayerJoin of class cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnPlayerJoin00
-static int tolua_AllToLua_cPlugin_NewLua_OnPlayerJoin00(lua_State* tolua_S)
+/* method: OnCollectItem of class cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnCollectItem00
+static int tolua_AllToLua_cPlugin_NewLua_OnCollectItem00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,3,&tolua_err)
+ !tolua_isusertype(tolua_S,2,"cPickup",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0));
+ cPickup* a_Pickup = ((cPickup*) tolua_tousertype(tolua_S,2,0));
+ cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnPlayerJoin'", NULL);
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnCollectItem'", NULL);
#endif
{
- bool tolua_ret = (bool) self->OnPlayerJoin(a_Player);
+ bool tolua_ret = (bool) self->OnCollectItem(a_Pickup,a_Player);
tolua_pushboolean(tolua_S,(bool)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'OnPlayerJoin'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'OnCollectItem'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
-/* method: OnLogin of class cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnLogin00
-static int tolua_AllToLua_cPlugin_NewLua_OnLogin00(lua_State* tolua_S)
+/* method: OnDisconnect of class cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnDisconnect00
+static int tolua_AllToLua_cPlugin_NewLua_OnDisconnect00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPacket_Login",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,3,&tolua_err)
+ !tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPacket_Login* a_PacketData = ((cPacket_Login*) tolua_tousertype(tolua_S,2,0));
+ std::string a_Reason = ((std::string) tolua_tocppstring(tolua_S,2,0));
+ cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnLogin'", NULL);
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnDisconnect'", NULL);
#endif
{
- bool tolua_ret = (bool) self->OnLogin(a_PacketData);
+ bool tolua_ret = (bool) self->OnDisconnect(a_Reason,a_Player);
tolua_pushboolean(tolua_S,(bool)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'OnLogin'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'OnDisconnect'.",&tolua_err);
return 0;
#endif
}
@@ -8251,6 +8286,249 @@ static int tolua_AllToLua_cPlugin_NewLua_OnBlockPlace00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
+/* method: OnBlockDig of class cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnBlockDig00
+static int tolua_AllToLua_cPlugin_NewLua_OnBlockDig00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cPacket_BlockDig",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,4,"cItem",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
+ cPacket_BlockDig* a_PacketData = ((cPacket_BlockDig*) tolua_tousertype(tolua_S,2,0));
+ cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
+ cItem* a_PickupItem = ((cItem*) tolua_tousertype(tolua_S,4,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnBlockDig'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->OnBlockDig(a_PacketData,a_Player,a_PickupItem);
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'OnBlockDig'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: OnChat of class cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnChat00
+static int tolua_AllToLua_cPlugin_NewLua_OnChat00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
+ !tolua_isstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
+ const char* a_Chat = ((const char*) tolua_tostring(tolua_S,2,0));
+ cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnChat'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->OnChat(a_Chat,a_Player);
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'OnChat'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: OnLogin of class cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnLogin00
+static int tolua_AllToLua_cPlugin_NewLua_OnLogin00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cPacket_Login",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
+ cPacket_Login* a_PacketData = ((cPacket_Login*) tolua_tousertype(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnLogin'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->OnLogin(a_PacketData);
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'OnLogin'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: OnPlayerSpawn of class cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnPlayerSpawn00
+static int tolua_AllToLua_cPlugin_NewLua_OnPlayerSpawn00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
+ cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnPlayerSpawn'", NULL);
+#endif
+ {
+ self->OnPlayerSpawn(a_Player);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'OnPlayerSpawn'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: OnPlayerJoin of class cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnPlayerJoin00
+static int tolua_AllToLua_cPlugin_NewLua_OnPlayerJoin00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
+ cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnPlayerJoin'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->OnPlayerJoin(a_Player);
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'OnPlayerJoin'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: OnPlayerMove of class cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnPlayerMove00
+static int tolua_AllToLua_cPlugin_NewLua_OnPlayerMove00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
+ cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnPlayerMove'", NULL);
+#endif
+ {
+ self->OnPlayerMove(a_Player);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'OnPlayerMove'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: OnTakeDamage of class cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnTakeDamage00
+static int tolua_AllToLua_cPlugin_NewLua_OnTakeDamage00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cPlugin_NewLua",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cPawn",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,3,"TakeDamageInfo",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
+ cPawn* a_Pawn = ((cPawn*) tolua_tousertype(tolua_S,2,0));
+ TakeDamageInfo* a_TakeDamageInfo = ((TakeDamageInfo*) tolua_tousertype(tolua_S,3,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnTakeDamage'", NULL);
+#endif
+ {
+ self->OnTakeDamage(a_Pawn,a_TakeDamageInfo);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'OnTakeDamage'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: OnKilled of class cPlugin_NewLua */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_NewLua_OnKilled00
static int tolua_AllToLua_cPlugin_NewLua_OnKilled00(lua_State* tolua_S)
@@ -8322,6 +8600,13 @@ static int tolua_AllToLua_cPlugin_NewLua_CreateWebPlugin00(lua_State* tolua_S)
class Lua__cPlugin_NewLua : public cPlugin_NewLua, public ToluaBase {
public:
+ void OnDisable( void ) {
+ if (push_method("OnDisable", tolua_AllToLua_cPlugin_NewLua_OnDisable00)) {
+ ToluaBase::dbcall(lua_state, 1, 0);
+ } else {
+ return ( void ) cPlugin_NewLua:: OnDisable();
+ };
+ };
bool Initialize( void ) {
if (push_method("Initialize", tolua_AllToLua_cPlugin_NewLua_Initialize00)) {
ToluaBase::dbcall(lua_state, 1, 1);
@@ -8340,26 +8625,28 @@ public:
return ( void ) cPlugin_NewLua:: Tick(a_Dt);
};
};
- bool OnPlayerJoin( cPlayer* a_Player) {
- if (push_method("OnPlayerJoin", tolua_AllToLua_cPlugin_NewLua_OnPlayerJoin00)) {
+ bool OnCollectItem( cPickup* a_Pickup, cPlayer* a_Player) {
+ if (push_method("OnCollectItem", tolua_AllToLua_cPlugin_NewLua_OnCollectItem00)) {
+ tolua_pushusertype(lua_state, (void*)a_Pickup, "cPickup");
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
- ToluaBase::dbcall(lua_state, 2, 1);
+ ToluaBase::dbcall(lua_state, 3, 1);
bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0);
lua_pop(lua_state, 1);
return tolua_ret;
} else {
- return ( bool ) cPlugin_NewLua:: OnPlayerJoin(a_Player);
+ return ( bool ) cPlugin_NewLua:: OnCollectItem(a_Pickup,a_Player);
};
};
- bool OnLogin( cPacket_Login* a_PacketData) {
- if (push_method("OnLogin", tolua_AllToLua_cPlugin_NewLua_OnLogin00)) {
- tolua_pushusertype(lua_state, (void*)a_PacketData, "cPacket_Login");
- ToluaBase::dbcall(lua_state, 2, 1);
+ bool OnDisconnect( std::string a_Reason, cPlayer* a_Player) {
+ if (push_method("OnDisconnect", tolua_AllToLua_cPlugin_NewLua_OnDisconnect00)) {
+ tolua_pushcppstring(lua_state, (const char*)a_Reason);
+ tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
+ ToluaBase::dbcall(lua_state, 3, 1);
bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0);
lua_pop(lua_state, 1);
return tolua_ret;
} else {
- return ( bool ) cPlugin_NewLua:: OnLogin(a_PacketData);
+ return ( bool ) cPlugin_NewLua:: OnDisconnect(a_Reason,a_Player);
};
};
bool OnBlockPlace( cPacket_BlockPlace* a_PacketData, cPlayer* a_Player) {
@@ -8374,84 +8661,63 @@ public:
return ( bool ) cPlugin_NewLua:: OnBlockPlace(a_PacketData,a_Player);
};
};
- bool OnKilled( cPawn* a_Killed, cEntity* a_Killer) {
- if (push_method("OnKilled", tolua_AllToLua_cPlugin_NewLua_OnKilled00)) {
- tolua_pushusertype(lua_state, (void*)a_Killed, "cPawn");
- tolua_pushusertype(lua_state, (void*)a_Killer, "cEntity");
- ToluaBase::dbcall(lua_state, 3, 1);
+ bool OnBlockDig( cPacket_BlockDig* a_PacketData, cPlayer* a_Player, cItem* a_PickupItem) {
+ if (push_method("OnBlockDig", tolua_AllToLua_cPlugin_NewLua_OnBlockDig00)) {
+ tolua_pushusertype(lua_state, (void*)a_PacketData, "cPacket_BlockDig");
+ tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
+ tolua_pushusertype(lua_state, (void*)a_PickupItem, "cItem");
+ ToluaBase::dbcall(lua_state, 4, 1);
bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0);
lua_pop(lua_state, 1);
return tolua_ret;
} else {
- return ( bool ) cPlugin_NewLua:: OnKilled(a_Killed,a_Killer);
- };
- };
- void OnDisable( void ) {
- if (push_method("OnDisable", tolua_AllToLua_cPlugin_OnDisable00)) {
- ToluaBase::dbcall(lua_state, 1, 0);
- } else {
- return ( void ) cPlugin_NewLua:: OnDisable();
+ return ( bool ) cPlugin_NewLua:: OnBlockDig(a_PacketData,a_Player,a_PickupItem);
};
};
- bool OnCollectItem( cPickup* a_Pickup, cPlayer* a_Player) {
- if (push_method("OnCollectItem", tolua_AllToLua_cPlugin_OnCollectItem00)) {
- tolua_pushusertype(lua_state, (void*)a_Pickup, "cPickup");
+ bool OnChat( const char* a_Chat, cPlayer* a_Player) {
+ if (push_method("OnChat", tolua_AllToLua_cPlugin_NewLua_OnChat00)) {
+ tolua_pushstring(lua_state, (const char*)a_Chat);
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
ToluaBase::dbcall(lua_state, 3, 1);
bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0);
lua_pop(lua_state, 1);
return tolua_ret;
} else {
- return ( bool ) cPlugin_NewLua:: OnCollectItem(a_Pickup,a_Player);
+ return ( bool ) cPlugin_NewLua:: OnChat(a_Chat,a_Player);
};
};
- bool OnDisconnect( std::string a_Reason, cPlayer* a_Player) {
- if (push_method("OnDisconnect", tolua_AllToLua_cPlugin_OnDisconnect00)) {
- tolua_pushcppstring(lua_state, (const char*)a_Reason);
- tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
- ToluaBase::dbcall(lua_state, 3, 1);
+ bool OnLogin( cPacket_Login* a_PacketData) {
+ if (push_method("OnLogin", tolua_AllToLua_cPlugin_NewLua_OnLogin00)) {
+ tolua_pushusertype(lua_state, (void*)a_PacketData, "cPacket_Login");
+ ToluaBase::dbcall(lua_state, 2, 1);
bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0);
lua_pop(lua_state, 1);
return tolua_ret;
} else {
- return ( bool ) cPlugin_NewLua:: OnDisconnect(a_Reason,a_Player);
+ return ( bool ) cPlugin_NewLua:: OnLogin(a_PacketData);
};
};
- bool OnBlockDig( cPacket_BlockDig* a_PacketData, cPlayer* a_Player, cItem* a_PickupItem) {
- if (push_method("OnBlockDig", tolua_AllToLua_cPlugin_OnBlockDig00)) {
- tolua_pushusertype(lua_state, (void*)a_PacketData, "cPacket_BlockDig");
+ void OnPlayerSpawn( cPlayer* a_Player) {
+ if (push_method("OnPlayerSpawn", tolua_AllToLua_cPlugin_NewLua_OnPlayerSpawn00)) {
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
- tolua_pushusertype(lua_state, (void*)a_PickupItem, "cItem");
- ToluaBase::dbcall(lua_state, 4, 1);
- bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0);
- lua_pop(lua_state, 1);
- return tolua_ret;
+ ToluaBase::dbcall(lua_state, 2, 0);
} else {
- return ( bool ) cPlugin_NewLua:: OnBlockDig(a_PacketData,a_Player,a_PickupItem);
+ return ( void ) cPlugin_NewLua:: OnPlayerSpawn(a_Player);
};
};
- bool OnChat( const char* a_Chat, cPlayer* a_Player) {
- if (push_method("OnChat", tolua_AllToLua_cPlugin_OnChat00)) {
- tolua_pushstring(lua_state, (const char*)a_Chat);
+ bool OnPlayerJoin( cPlayer* a_Player) {
+ if (push_method("OnPlayerJoin", tolua_AllToLua_cPlugin_NewLua_OnPlayerJoin00)) {
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
- ToluaBase::dbcall(lua_state, 3, 1);
+ ToluaBase::dbcall(lua_state, 2, 1);
bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0);
lua_pop(lua_state, 1);
return tolua_ret;
} else {
- return ( bool ) cPlugin_NewLua:: OnChat(a_Chat,a_Player);
- };
- };
- void OnPlayerSpawn( cPlayer* a_Player) {
- if (push_method("OnPlayerSpawn", tolua_AllToLua_cPlugin_OnPlayerSpawn00)) {
- tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
- ToluaBase::dbcall(lua_state, 2, 0);
- } else {
- return ( void ) cPlugin_NewLua:: OnPlayerSpawn(a_Player);
+ return ( bool ) cPlugin_NewLua:: OnPlayerJoin(a_Player);
};
};
void OnPlayerMove( cPlayer* a_Player) {
- if (push_method("OnPlayerMove", tolua_AllToLua_cPlugin_OnPlayerMove00)) {
+ if (push_method("OnPlayerMove", tolua_AllToLua_cPlugin_NewLua_OnPlayerMove00)) {
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
ToluaBase::dbcall(lua_state, 2, 0);
} else {
@@ -8459,7 +8725,7 @@ public:
};
};
void OnTakeDamage( cPawn* a_Pawn, TakeDamageInfo* a_TakeDamageInfo) {
- if (push_method("OnTakeDamage", tolua_AllToLua_cPlugin_OnTakeDamage00)) {
+ if (push_method("OnTakeDamage", tolua_AllToLua_cPlugin_NewLua_OnTakeDamage00)) {
tolua_pushusertype(lua_state, (void*)a_Pawn, "cPawn");
tolua_pushusertype(lua_state, (void*)a_TakeDamageInfo, "TakeDamageInfo");
ToluaBase::dbcall(lua_state, 3, 0);
@@ -8467,49 +8733,61 @@ public:
return ( void ) cPlugin_NewLua:: OnTakeDamage(a_Pawn,a_TakeDamageInfo);
};
};
+ bool OnKilled( cPawn* a_Killed, cEntity* a_Killer) {
+ if (push_method("OnKilled", tolua_AllToLua_cPlugin_NewLua_OnKilled00)) {
+ tolua_pushusertype(lua_state, (void*)a_Killed, "cPawn");
+ tolua_pushusertype(lua_state, (void*)a_Killer, "cEntity");
+ ToluaBase::dbcall(lua_state, 3, 1);
+ bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0);
+ lua_pop(lua_state, 1);
+ return tolua_ret;
+ } else {
+ return ( bool ) cPlugin_NewLua:: OnKilled(a_Killed,a_Killer);
+ };
+ };
+ void cPlugin_NewLua__OnDisable( void ) {
+ return ( void )cPlugin_NewLua::OnDisable();
+ };
bool cPlugin_NewLua__Initialize( void ) {
return ( bool )cPlugin_NewLua::Initialize();
};
void cPlugin_NewLua__Tick( float a_Dt) {
return ( void )cPlugin_NewLua::Tick(a_Dt);
};
- bool cPlugin_NewLua__OnPlayerJoin( cPlayer* a_Player) {
- return ( bool )cPlugin_NewLua::OnPlayerJoin(a_Player);
- };
- bool cPlugin_NewLua__OnLogin( cPacket_Login* a_PacketData) {
- return ( bool )cPlugin_NewLua::OnLogin(a_PacketData);
- };
- bool cPlugin_NewLua__OnBlockPlace( cPacket_BlockPlace* a_PacketData, cPlayer* a_Player) {
- return ( bool )cPlugin_NewLua::OnBlockPlace(a_PacketData,a_Player);
- };
- bool cPlugin_NewLua__OnKilled( cPawn* a_Killed, cEntity* a_Killer) {
- return ( bool )cPlugin_NewLua::OnKilled(a_Killed,a_Killer);
- };
- void cPlugin_NewLua__OnDisable( void ) {
- return ( void )cPlugin_NewLua::OnDisable();
- };
bool cPlugin_NewLua__OnCollectItem( cPickup* a_Pickup, cPlayer* a_Player) {
return ( bool )cPlugin_NewLua::OnCollectItem(a_Pickup,a_Player);
};
bool cPlugin_NewLua__OnDisconnect( std::string a_Reason, cPlayer* a_Player) {
return ( bool )cPlugin_NewLua::OnDisconnect(a_Reason,a_Player);
};
+ bool cPlugin_NewLua__OnBlockPlace( cPacket_BlockPlace* a_PacketData, cPlayer* a_Player) {
+ return ( bool )cPlugin_NewLua::OnBlockPlace(a_PacketData,a_Player);
+ };
bool cPlugin_NewLua__OnBlockDig( cPacket_BlockDig* a_PacketData, cPlayer* a_Player, cItem* a_PickupItem) {
return ( bool )cPlugin_NewLua::OnBlockDig(a_PacketData,a_Player,a_PickupItem);
};
bool cPlugin_NewLua__OnChat( const char* a_Chat, cPlayer* a_Player) {
return ( bool )cPlugin_NewLua::OnChat(a_Chat,a_Player);
};
+ bool cPlugin_NewLua__OnLogin( cPacket_Login* a_PacketData) {
+ return ( bool )cPlugin_NewLua::OnLogin(a_PacketData);
+ };
void cPlugin_NewLua__OnPlayerSpawn( cPlayer* a_Player) {
return ( void )cPlugin_NewLua::OnPlayerSpawn(a_Player);
};
+ bool cPlugin_NewLua__OnPlayerJoin( cPlayer* a_Player) {
+ return ( bool )cPlugin_NewLua::OnPlayerJoin(a_Player);
+ };
void cPlugin_NewLua__OnPlayerMove( cPlayer* a_Player) {
return ( void )cPlugin_NewLua::OnPlayerMove(a_Player);
};
void cPlugin_NewLua__OnTakeDamage( cPawn* a_Pawn, TakeDamageInfo* a_TakeDamageInfo) {
return ( void )cPlugin_NewLua::OnTakeDamage(a_Pawn,a_TakeDamageInfo);
};
+ bool cPlugin_NewLua__OnKilled( cPawn* a_Killed, cEntity* a_Killer) {
+ return ( bool )cPlugin_NewLua::OnKilled(a_Killed,a_Killer);
+ };
};
/* method: tolua__set_instance of class Lua__cPlugin_NewLua */
@@ -8545,6 +8823,37 @@ static int tolua_AllToLua_Lua__cPlugin_NewLua_tolua__set_instance00(lua_State* t
}
#endif //#ifndef TOLUA_DISABLE
+/* method: cPlugin_NewLua__OnDisable of class Lua__cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnDisable00
+static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnDisable00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnDisable'", NULL);
+#endif
+ {
+ self->cPlugin_NewLua__OnDisable();
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnDisable'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: cPlugin_NewLua__Initialize of class Lua__cPlugin_NewLua */
#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__Initialize00
static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__Initialize00(lua_State* tolua_S)
@@ -8610,69 +8919,73 @@ static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__Tick00(lua_State*
}
#endif //#ifndef TOLUA_DISABLE
-/* method: cPlugin_NewLua__OnPlayerJoin of class Lua__cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerJoin00
-static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerJoin00(lua_State* tolua_S)
+/* method: cPlugin_NewLua__OnCollectItem of class Lua__cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnCollectItem00
+static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnCollectItem00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,3,&tolua_err)
+ !tolua_isusertype(tolua_S,2,"cPickup",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0));
+ cPickup* a_Pickup = ((cPickup*) tolua_tousertype(tolua_S,2,0));
+ cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnPlayerJoin'", NULL);
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnCollectItem'", NULL);
#endif
{
- bool tolua_ret = (bool) self->cPlugin_NewLua__OnPlayerJoin(a_Player);
+ bool tolua_ret = (bool) self->cPlugin_NewLua__OnCollectItem(a_Pickup,a_Player);
tolua_pushboolean(tolua_S,(bool)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnPlayerJoin'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnCollectItem'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
-/* method: cPlugin_NewLua__OnLogin of class Lua__cPlugin_NewLua */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnLogin00
-static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnLogin00(lua_State* tolua_S)
+/* method: cPlugin_NewLua__OnDisconnect of class Lua__cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnDisconnect00
+static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnDisconnect00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
- !tolua_isusertype(tolua_S,2,"cPacket_Login",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,3,&tolua_err)
+ !tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
- cPacket_Login* a_PacketData = ((cPacket_Login*) tolua_tousertype(tolua_S,2,0));
+ std::string a_Reason = ((std::string) tolua_tocppstring(tolua_S,2,0));
+ cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnLogin'", NULL);
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnDisconnect'", NULL);
#endif
{
- bool tolua_ret = (bool) self->cPlugin_NewLua__OnLogin(a_PacketData);
+ bool tolua_ret = (bool) self->cPlugin_NewLua__OnDisconnect(a_Reason,a_Player);
tolua_pushboolean(tolua_S,(bool)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnLogin'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnDisconnect'.",&tolua_err);
return 0;
#endif
}
@@ -8714,6 +9027,249 @@ static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnBlockPlace00(lua
}
#endif //#ifndef TOLUA_DISABLE
+/* method: cPlugin_NewLua__OnBlockDig of class Lua__cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnBlockDig00
+static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnBlockDig00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cPacket_BlockDig",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,4,"cItem",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
+ cPacket_BlockDig* a_PacketData = ((cPacket_BlockDig*) tolua_tousertype(tolua_S,2,0));
+ cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
+ cItem* a_PickupItem = ((cItem*) tolua_tousertype(tolua_S,4,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnBlockDig'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->cPlugin_NewLua__OnBlockDig(a_PacketData,a_Player,a_PickupItem);
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnBlockDig'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: cPlugin_NewLua__OnChat of class Lua__cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnChat00
+static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnChat00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
+ !tolua_isstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
+ const char* a_Chat = ((const char*) tolua_tostring(tolua_S,2,0));
+ cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnChat'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->cPlugin_NewLua__OnChat(a_Chat,a_Player);
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnChat'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: cPlugin_NewLua__OnLogin of class Lua__cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnLogin00
+static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnLogin00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cPacket_Login",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
+ cPacket_Login* a_PacketData = ((cPacket_Login*) tolua_tousertype(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnLogin'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->cPlugin_NewLua__OnLogin(a_PacketData);
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnLogin'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: cPlugin_NewLua__OnPlayerSpawn of class Lua__cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerSpawn00
+static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerSpawn00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
+ cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnPlayerSpawn'", NULL);
+#endif
+ {
+ self->cPlugin_NewLua__OnPlayerSpawn(a_Player);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnPlayerSpawn'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: cPlugin_NewLua__OnPlayerJoin of class Lua__cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerJoin00
+static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerJoin00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
+ cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnPlayerJoin'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->cPlugin_NewLua__OnPlayerJoin(a_Player);
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnPlayerJoin'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: cPlugin_NewLua__OnPlayerMove of class Lua__cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerMove00
+static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerMove00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
+ cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnPlayerMove'", NULL);
+#endif
+ {
+ self->cPlugin_NewLua__OnPlayerMove(a_Player);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnPlayerMove'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: cPlugin_NewLua__OnTakeDamage of class Lua__cPlugin_NewLua */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnTakeDamage00
+static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnTakeDamage00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"Lua__cPlugin_NewLua",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cPawn",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,3,"TakeDamageInfo",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ Lua__cPlugin_NewLua* self = (Lua__cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0);
+ cPawn* a_Pawn = ((cPawn*) tolua_tousertype(tolua_S,2,0));
+ TakeDamageInfo* a_TakeDamageInfo = ((TakeDamageInfo*) tolua_tousertype(tolua_S,3,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin_NewLua__OnTakeDamage'", NULL);
+#endif
+ {
+ self->cPlugin_NewLua__OnTakeDamage(a_Pawn,a_TakeDamageInfo);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'cPlugin_NewLua__OnTakeDamage'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: cPlugin_NewLua__OnKilled of class Lua__cPlugin_NewLua */
#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnKilled00
static int tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnKilled00(lua_State* tolua_S)
@@ -17007,22 +17563,38 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_endmodule(tolua_S);
tolua_cclass(tolua_S,"cPlugin_NewLua","cPlugin_NewLua","cPlugin",NULL);
tolua_beginmodule(tolua_S,"cPlugin_NewLua");
+ tolua_function(tolua_S,"OnDisable",tolua_AllToLua_cPlugin_NewLua_OnDisable00);
tolua_function(tolua_S,"Initialize",tolua_AllToLua_cPlugin_NewLua_Initialize00);
tolua_function(tolua_S,"Tick",tolua_AllToLua_cPlugin_NewLua_Tick00);
- tolua_function(tolua_S,"OnPlayerJoin",tolua_AllToLua_cPlugin_NewLua_OnPlayerJoin00);
- tolua_function(tolua_S,"OnLogin",tolua_AllToLua_cPlugin_NewLua_OnLogin00);
+ tolua_function(tolua_S,"OnCollectItem",tolua_AllToLua_cPlugin_NewLua_OnCollectItem00);
+ tolua_function(tolua_S,"OnDisconnect",tolua_AllToLua_cPlugin_NewLua_OnDisconnect00);
tolua_function(tolua_S,"OnBlockPlace",tolua_AllToLua_cPlugin_NewLua_OnBlockPlace00);
+ tolua_function(tolua_S,"OnBlockDig",tolua_AllToLua_cPlugin_NewLua_OnBlockDig00);
+ tolua_function(tolua_S,"OnChat",tolua_AllToLua_cPlugin_NewLua_OnChat00);
+ tolua_function(tolua_S,"OnLogin",tolua_AllToLua_cPlugin_NewLua_OnLogin00);
+ tolua_function(tolua_S,"OnPlayerSpawn",tolua_AllToLua_cPlugin_NewLua_OnPlayerSpawn00);
+ tolua_function(tolua_S,"OnPlayerJoin",tolua_AllToLua_cPlugin_NewLua_OnPlayerJoin00);
+ tolua_function(tolua_S,"OnPlayerMove",tolua_AllToLua_cPlugin_NewLua_OnPlayerMove00);
+ tolua_function(tolua_S,"OnTakeDamage",tolua_AllToLua_cPlugin_NewLua_OnTakeDamage00);
tolua_function(tolua_S,"OnKilled",tolua_AllToLua_cPlugin_NewLua_OnKilled00);
tolua_function(tolua_S,"CreateWebPlugin",tolua_AllToLua_cPlugin_NewLua_CreateWebPlugin00);
tolua_endmodule(tolua_S);
tolua_cclass(tolua_S,"Lua__cPlugin_NewLua","Lua__cPlugin_NewLua","cPlugin_NewLua",NULL);
tolua_beginmodule(tolua_S,"Lua__cPlugin_NewLua");
tolua_function(tolua_S,"tolua__set_instance",tolua_AllToLua_Lua__cPlugin_NewLua_tolua__set_instance00);
+ tolua_function(tolua_S,"cPlugin_NewLua__OnDisable",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnDisable00);
tolua_function(tolua_S,"cPlugin_NewLua__Initialize",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__Initialize00);
tolua_function(tolua_S,"cPlugin_NewLua__Tick",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__Tick00);
- tolua_function(tolua_S,"cPlugin_NewLua__OnPlayerJoin",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerJoin00);
- tolua_function(tolua_S,"cPlugin_NewLua__OnLogin",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnLogin00);
+ tolua_function(tolua_S,"cPlugin_NewLua__OnCollectItem",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnCollectItem00);
+ tolua_function(tolua_S,"cPlugin_NewLua__OnDisconnect",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnDisconnect00);
tolua_function(tolua_S,"cPlugin_NewLua__OnBlockPlace",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnBlockPlace00);
+ tolua_function(tolua_S,"cPlugin_NewLua__OnBlockDig",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnBlockDig00);
+ tolua_function(tolua_S,"cPlugin_NewLua__OnChat",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnChat00);
+ tolua_function(tolua_S,"cPlugin_NewLua__OnLogin",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnLogin00);
+ tolua_function(tolua_S,"cPlugin_NewLua__OnPlayerSpawn",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerSpawn00);
+ tolua_function(tolua_S,"cPlugin_NewLua__OnPlayerJoin",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerJoin00);
+ tolua_function(tolua_S,"cPlugin_NewLua__OnPlayerMove",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnPlayerMove00);
+ tolua_function(tolua_S,"cPlugin_NewLua__OnTakeDamage",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnTakeDamage00);
tolua_function(tolua_S,"cPlugin_NewLua__OnKilled",tolua_AllToLua_Lua__cPlugin_NewLua_cPlugin_NewLua__OnKilled00);
tolua_endmodule(tolua_S);
tolua_cclass(tolua_S,"cPlugin_Lua","cPlugin_Lua","",NULL);
diff --git a/source/Bindings.h b/source/Bindings.h
index 427b7595b..45e35709e 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 02/01/12 00:50:40.
+** Generated automatically by tolua++-1.0.92 on 02/01/12 20:13:33.
*/
/* Exported function */
diff --git a/source/cPlugin_NewLua.cpp b/source/cPlugin_NewLua.cpp
index a5b9bdc48..c96a55fae 100644
--- a/source/cPlugin_NewLua.cpp
+++ b/source/cPlugin_NewLua.cpp
@@ -120,6 +120,14 @@ bool cPlugin_NewLua::Initialize()
return bSuccess;
}
+void cPlugin_NewLua::OnDisable()
+{
+ if( !PushFunction("OnDisable", false) ) // false = don't log error if not found
+ return;
+
+ CallFunction(0, 0, "OnDisable");
+}
+
void cPlugin_NewLua::Tick(float a_Dt)
{
if( !PushFunction("Tick") )
@@ -130,28 +138,30 @@ void cPlugin_NewLua::Tick(float a_Dt)
CallFunction(1, 0, "Tick");
}
-bool cPlugin_NewLua::OnPlayerJoin( cPlayer* a_Player )
+bool cPlugin_NewLua::OnCollectItem( cPickup* a_Pickup, cPlayer* a_Player )
{
- if( !PushFunction("OnPlayerJoin") )
+ if( !PushFunction("OnCollectItem") )
return false;
+ tolua_pushusertype(m_LuaState, a_Pickup, "cPickup");
tolua_pushusertype(m_LuaState, a_Player, "cPlayer");
- if( !CallFunction(1, 1, "OnPlayerJoin") )
+ if( !CallFunction(2, 1, "OnCollectItem") )
return false;
bool bRetVal = (tolua_toboolean( m_LuaState, -1, 0) > 0);
return bRetVal;
}
-bool cPlugin_NewLua::OnLogin( cPacket_Login* a_PacketData )
+bool cPlugin_NewLua::OnDisconnect( std::string a_Reason, cPlayer* a_Player )
{
- if( !PushFunction("OnLogin") )
+ if( !PushFunction("OnDisconnect") )
return false;
- tolua_pushusertype(m_LuaState, a_PacketData, "cPacket_Login");
+ tolua_pushstring( m_LuaState, a_Reason.c_str() );
+ tolua_pushusertype(m_LuaState, a_Player, "cPlayer");
- if( !CallFunction(1, 1, "OnLogin") )
+ if( !CallFunction(2, 1, "OnDisconnect") )
return false;
bool bRetVal = (tolua_toboolean( m_LuaState, -1, 0) > 0);
@@ -173,6 +183,96 @@ bool cPlugin_NewLua::OnBlockPlace( cPacket_BlockPlace* a_PacketData, cPlayer* a_
return bRetVal;
}
+bool cPlugin_NewLua::OnBlockDig( cPacket_BlockDig* a_PacketData, cPlayer* a_Player, cItem* a_PickupItem )
+{
+ if( !PushFunction("OnBlockDig") )
+ return false;
+
+ tolua_pushusertype(m_LuaState, a_PacketData, "cPacket_BlockDig");
+ tolua_pushusertype(m_LuaState, a_Player, "cPlayer");
+ tolua_pushusertype(m_LuaState, a_PickupItem, "cItem");
+
+ if( !CallFunction(3, 1, "OnBlockDig") )
+ return false;
+
+ bool bRetVal = (tolua_toboolean( m_LuaState, -1, 0) > 0);
+ return bRetVal;
+}
+
+bool cPlugin_NewLua::OnChat( const char* a_Chat, cPlayer* a_Player )
+{
+ if( !PushFunction("OnChat") )
+ return false;
+
+ tolua_pushstring( m_LuaState, a_Chat );
+ tolua_pushusertype(m_LuaState, a_Player, "cPlayer");
+
+ if( !CallFunction(2, 1, "OnChat") )
+ return false;
+
+ bool bRetVal = (tolua_toboolean( m_LuaState, -1, 0) > 0);
+ return bRetVal;
+}
+
+bool cPlugin_NewLua::OnLogin( cPacket_Login* a_PacketData )
+{
+ if( !PushFunction("OnLogin") )
+ return false;
+
+ tolua_pushusertype(m_LuaState, a_PacketData, "cPacket_Login");
+
+ if( !CallFunction(1, 1, "OnLogin") )
+ return false;
+
+ bool bRetVal = (tolua_toboolean( m_LuaState, -1, 0) > 0);
+ return bRetVal;
+}
+
+void cPlugin_NewLua::OnPlayerSpawn( cPlayer* a_Player )
+{
+ if( !PushFunction("OnPlayerSpawn") )
+ return;
+
+ tolua_pushusertype(m_LuaState, a_Player, "cPlayer");
+
+ CallFunction(1, 0, "OnPlayerSpawn");
+}
+
+bool cPlugin_NewLua::OnPlayerJoin( cPlayer* a_Player )
+{
+ if( !PushFunction("OnPlayerJoin") )
+ return false;
+
+ tolua_pushusertype(m_LuaState, a_Player, "cPlayer");
+
+ if( !CallFunction(1, 1, "OnPlayerJoin") )
+ return false;
+
+ bool bRetVal = (tolua_toboolean( m_LuaState, -1, 0) > 0);
+ return bRetVal;
+}
+
+void cPlugin_NewLua::OnPlayerMove( cPlayer* a_Player )
+{
+ if( !PushFunction("OnPlayerMove") )
+ return;
+
+ tolua_pushusertype(m_LuaState, a_Player, "cPlayer");
+
+ CallFunction(1, 0, "OnPlayerMove");
+}
+
+void cPlugin_NewLua::OnTakeDamage( cPawn* a_Pawn, TakeDamageInfo* a_TakeDamageInfo )
+{
+ if( !PushFunction("OnTakeDamage") )
+ return;
+
+ tolua_pushusertype(m_LuaState, a_Pawn, "cPawn");
+ tolua_pushusertype(m_LuaState, a_TakeDamageInfo, "TakeDamageInfo");
+
+ CallFunction(2, 0, "OnTakeDamage");
+}
+
bool cPlugin_NewLua::OnKilled( cPawn* a_Killed, cEntity* a_Killer )
{
if( !PushFunction("OnKilled") )
@@ -188,6 +288,7 @@ bool cPlugin_NewLua::OnKilled( cPawn* a_Killed, cEntity* a_Killer )
return bRetVal;
}
+
cWebPlugin_Lua* cPlugin_NewLua::CreateWebPlugin(lua_State* a_LuaState)
{
if( a_LuaState != m_LuaState )
@@ -204,12 +305,15 @@ cWebPlugin_Lua* cPlugin_NewLua::CreateWebPlugin(lua_State* a_LuaState)
// Helper functions
-bool cPlugin_NewLua::PushFunction( const char* a_FunctionName )
+bool cPlugin_NewLua::PushFunction( const char* a_FunctionName, bool a_bLogError /* = true */ )
{
lua_getglobal(m_LuaState, a_FunctionName);
if(!lua_isfunction(m_LuaState,-1))
{
- LOGWARN("Error in plugin %s: Could not find function %s()", m_Directory.c_str(), a_FunctionName );
+ if( a_bLogError )
+ {
+ LOGWARN("Error in plugin %s: Could not find function %s()", m_Directory.c_str(), a_FunctionName );
+ }
lua_pop(m_LuaState,1);
return false;
}
diff --git a/source/cPlugin_NewLua.h b/source/cPlugin_NewLua.h
index 1aa4242ea..d88f7bdf0 100644
--- a/source/cPlugin_NewLua.h
+++ b/source/cPlugin_NewLua.h
@@ -13,18 +13,30 @@ public: //tolua_export
cPlugin_NewLua( const char* a_PluginName );
~cPlugin_NewLua();
- virtual bool Initialize(); //tolua_export
- virtual void Tick(float a_Dt); //tolua_export
- virtual bool OnPlayerJoin( cPlayer* a_Player ); //tolua_export
- virtual bool OnLogin( cPacket_Login* a_PacketData ); //tolua_export
- virtual bool OnBlockPlace( cPacket_BlockPlace* a_PacketData, cPlayer* a_Player ); // tolua_export
- virtual bool OnKilled( cPawn* a_Killed, cEntity* a_Killer ); //tolua_export
+ virtual void OnDisable(); //tolua_export
+ virtual bool Initialize(); //tolua_export
+
+ virtual void Tick(float a_Dt); //tolua_export
+
+ //tolua_begin
+ virtual bool OnCollectItem( cPickup* a_Pickup, cPlayer* a_Player );
+ virtual bool OnDisconnect( std::string a_Reason, cPlayer* a_Player );
+ virtual bool OnBlockPlace( cPacket_BlockPlace* a_PacketData, cPlayer* a_Player );
+ virtual bool OnBlockDig( cPacket_BlockDig* a_PacketData, cPlayer* a_Player, cItem* a_PickupItem );
+ virtual bool OnChat( const char* a_Chat, cPlayer* a_Player );
+ virtual bool OnLogin( cPacket_Login* a_PacketData );
+ virtual void OnPlayerSpawn( cPlayer* a_Player );
+ virtual bool OnPlayerJoin( cPlayer* a_Player );
+ virtual void OnPlayerMove( cPlayer* a_Player );
+ virtual void OnTakeDamage( cPawn* a_Pawn, TakeDamageInfo* a_TakeDamageInfo );
+ virtual bool OnKilled( cPawn* a_Killed, cEntity* a_Killer );
+ //tolua_end
lua_State* GetLuaState() { return m_LuaState; }
cWebPlugin_Lua* CreateWebPlugin(lua_State* a_LuaState); //tolua_export
private:
- bool PushFunction( const char* a_FunctionName );
+ bool PushFunction( const char* a_FunctionName, bool a_bLogError = true );
bool CallFunction( int a_NumArgs, int a_NumResults, const char* a_FunctionName ); // a_FunctionName is only used for error messages, nothing else
typedef std::list< cWebPlugin_Lua* > WebPluginList;