2012-05-25 03:18:52 -04:00
|
|
|
|
2012-01-26 15:39:46 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "cPlugin.h"
|
2012-05-25 03:18:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-01-26 15:39:46 -05:00
|
|
|
|
|
|
|
typedef struct lua_State lua_State;
|
2012-01-27 18:47:32 -05:00
|
|
|
class cWebPlugin_Lua;
|
2012-01-26 15:39:46 -05:00
|
|
|
|
2012-05-25 03:18:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-01-26 18:10:49 -05:00
|
|
|
class cPlugin_NewLua : public cPlugin //tolua_export
|
|
|
|
{ //tolua_export
|
|
|
|
public: //tolua_export
|
2012-01-26 15:39:46 -05:00
|
|
|
cPlugin_NewLua( const char* a_PluginName );
|
|
|
|
~cPlugin_NewLua();
|
|
|
|
|
2012-02-01 14:19:51 -05:00
|
|
|
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
|
2012-01-26 15:39:46 -05:00
|
|
|
|
2012-01-27 18:47:32 -05:00
|
|
|
lua_State* GetLuaState() { return m_LuaState; }
|
|
|
|
|
|
|
|
cWebPlugin_Lua* CreateWebPlugin(lua_State* a_LuaState); //tolua_export
|
2012-01-26 15:39:46 -05:00
|
|
|
private:
|
2012-02-01 14:19:51 -05:00
|
|
|
bool PushFunction( const char* a_FunctionName, bool a_bLogError = true );
|
2012-01-26 18:10:49 -05:00
|
|
|
bool CallFunction( int a_NumArgs, int a_NumResults, const char* a_FunctionName ); // a_FunctionName is only used for error messages, nothing else
|
|
|
|
|
2012-01-27 18:47:32 -05:00
|
|
|
typedef std::list< cWebPlugin_Lua* > WebPluginList;
|
|
|
|
WebPluginList m_WebPlugins;
|
|
|
|
|
2012-02-22 10:15:44 -05:00
|
|
|
cCriticalSection m_CriticalSection;
|
|
|
|
|
2012-01-26 15:39:46 -05:00
|
|
|
std::string m_Directory;
|
|
|
|
lua_State* m_LuaState;
|
|
|
|
};//tolua_export
|