diff options
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/AllToLua.pkg | 1 | ||||
-rw-r--r-- | src/Bindings/Bindings.cpp | 120 | ||||
-rw-r--r-- | src/Bindings/Bindings.h | 2 | ||||
-rw-r--r-- | src/Bindings/Plugin.h | 1 | ||||
-rw-r--r-- | src/Bindings/PluginLua.cpp | 15 | ||||
-rw-r--r-- | src/Bindings/PluginLua.h | 1 | ||||
-rw-r--r-- | src/Bindings/PluginManager.cpp | 21 | ||||
-rw-r--r-- | src/Bindings/PluginManager.h | 2 |
8 files changed, 156 insertions, 7 deletions
diff --git a/src/Bindings/AllToLua.pkg b/src/Bindings/AllToLua.pkg index 2a70efedf..6db7b2b0e 100644 --- a/src/Bindings/AllToLua.pkg +++ b/src/Bindings/AllToLua.pkg @@ -36,6 +36,7 @@ $cfile "../Entities/Pawn.h" $cfile "../Entities/Player.h" $cfile "../Entities/Pickup.h" $cfile "../Entities/ProjectileEntity.h" +$cfile "../Entities/TNTEntity.h" $cfile "../Server.h" $cfile "../World.h" $cfile "../Inventory.h" diff --git a/src/Bindings/Bindings.cpp b/src/Bindings/Bindings.cpp index c3607af5d..090d8047a 100644 --- a/src/Bindings/Bindings.cpp +++ b/src/Bindings/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/08/13 18:11:12. +** Generated automatically by tolua++-1.0.92 on 12/14/13 16:22:45. */ #ifndef __cplusplus @@ -34,6 +34,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S); #include "../Entities/Player.h" #include "../Entities/Pickup.h" #include "../Entities/ProjectileEntity.h" +#include "../Entities/TNTEntity.h" #include "../Server.h" #include "../World.h" #include "../Inventory.h" @@ -218,7 +219,7 @@ static void tolua_reg_types (lua_State* tolua_S) tolua_usertype(tolua_S,"cItemGrid"); tolua_usertype(tolua_S,"cHTTPServer::cCallbacks"); tolua_usertype(tolua_S,"cLuaWindow"); - tolua_usertype(tolua_S,"cServer"); + tolua_usertype(tolua_S,"cInventory"); tolua_usertype(tolua_S,"cHopperEntity"); tolua_usertype(tolua_S,"std::vector<AString>"); tolua_usertype(tolua_S,"cBlockEntityWithItems"); @@ -226,15 +227,16 @@ static void tolua_reg_types (lua_State* tolua_S) tolua_usertype(tolua_S,"cCraftingGrid"); tolua_usertype(tolua_S,"cBlockArea"); tolua_usertype(tolua_S,"cGroup"); - tolua_usertype(tolua_S,"cItem"); tolua_usertype(tolua_S,"cTracer"); + tolua_usertype(tolua_S,"cItem"); + tolua_usertype(tolua_S,"cBoundingBox"); tolua_usertype(tolua_S,"cArrowEntity"); tolua_usertype(tolua_S,"cDropSpenserEntity"); - tolua_usertype(tolua_S,"cBoundingBox"); tolua_usertype(tolua_S,"cCuboid"); tolua_usertype(tolua_S,"Vector3i"); - tolua_usertype(tolua_S,"cNoteEntity"); tolua_usertype(tolua_S,"Vector3d"); + tolua_usertype(tolua_S,"cNoteEntity"); + tolua_usertype(tolua_S,"cServer"); tolua_usertype(tolua_S,"cBlockEntity"); tolua_usertype(tolua_S,"cCriticalSection"); tolua_usertype(tolua_S,"HTTPTemplateRequest"); @@ -254,8 +256,8 @@ static void tolua_reg_types (lua_State* tolua_S) tolua_usertype(tolua_S,"cDropperEntity"); tolua_usertype(tolua_S,"cProjectileEntity"); tolua_usertype(tolua_S,"cItemGrid::cListener"); - tolua_usertype(tolua_S,"cInventory"); tolua_usertype(tolua_S,"cPlayer"); + tolua_usertype(tolua_S,"cTNTEntity"); } /* method: new of class cIniFile */ @@ -11518,6 +11520,70 @@ static int tolua_AllToLua_cArrowEntity_SetIsCritical00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: GetCounterTime of class cTNTEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cTNTEntity_GetCounterTime00 +static int tolua_AllToLua_cTNTEntity_GetCounterTime00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cTNTEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cTNTEntity* self = (const cTNTEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetCounterTime'", NULL); +#endif + { + double tolua_ret = (double) self->GetCounterTime(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetCounterTime'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetMaxFuseTime of class cTNTEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cTNTEntity_GetMaxFuseTime00 +static int tolua_AllToLua_cTNTEntity_GetMaxFuseTime00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cTNTEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cTNTEntity* self = (const cTNTEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxFuseTime'", NULL); +#endif + { + double tolua_ret = (double) self->GetMaxFuseTime(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetMaxFuseTime'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: GetDescription of class cServer */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cServer_GetDescription00 static int tolua_AllToLua_cServer_GetDescription00(lua_State* tolua_S) @@ -19926,6 +19992,41 @@ static int tolua_AllToLua_cRoot_GetWorld00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: CreateAndInitializeWorld of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_CreateAndInitializeWorld00 +static int tolua_AllToLua_cRoot_CreateAndInitializeWorld00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); + const AString a_WorldName = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CreateAndInitializeWorld'", NULL); +#endif + { + cWorld* tolua_ret = (cWorld*) self->CreateAndInitializeWorld(a_WorldName); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cWorld"); + tolua_pushcppstring(tolua_S,(const char*)a_WorldName); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CreateAndInitializeWorld'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: GetPrimaryServerVersion of class cRoot */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetPrimaryServerVersion00 static int tolua_AllToLua_cRoot_GetPrimaryServerVersion00(lua_State* tolua_S) @@ -29797,6 +29898,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_constant(tolua_S,"HOOK_UPDATING_SIGN",cPluginManager::HOOK_UPDATING_SIGN); tolua_constant(tolua_S,"HOOK_WEATHER_CHANGED",cPluginManager::HOOK_WEATHER_CHANGED); tolua_constant(tolua_S,"HOOK_WEATHER_CHANGING",cPluginManager::HOOK_WEATHER_CHANGING); + tolua_constant(tolua_S,"HOOK_WORLD_STARTED",cPluginManager::HOOK_WORLD_STARTED); tolua_constant(tolua_S,"HOOK_WORLD_TICK",cPluginManager::HOOK_WORLD_TICK); tolua_constant(tolua_S,"HOOK_NUM_HOOKS",cPluginManager::HOOK_NUM_HOOKS); tolua_constant(tolua_S,"HOOK_MAX",cPluginManager::HOOK_MAX); @@ -30957,6 +31059,11 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_cclass(tolua_S,"cFireChargeEntity","cFireChargeEntity","cProjectileEntity",NULL); tolua_beginmodule(tolua_S,"cFireChargeEntity"); tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cTNTEntity","cTNTEntity","cEntity",NULL); + tolua_beginmodule(tolua_S,"cTNTEntity"); + tolua_function(tolua_S,"GetCounterTime",tolua_AllToLua_cTNTEntity_GetCounterTime00); + tolua_function(tolua_S,"GetMaxFuseTime",tolua_AllToLua_cTNTEntity_GetMaxFuseTime00); + tolua_endmodule(tolua_S); tolua_cclass(tolua_S,"cServer","cServer","",NULL); tolua_beginmodule(tolua_S,"cServer"); tolua_function(tolua_S,"GetDescription",tolua_AllToLua_cServer_GetDescription00); @@ -31348,6 +31455,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"GetServer",tolua_AllToLua_cRoot_GetServer00); tolua_function(tolua_S,"GetDefaultWorld",tolua_AllToLua_cRoot_GetDefaultWorld00); tolua_function(tolua_S,"GetWorld",tolua_AllToLua_cRoot_GetWorld00); + tolua_function(tolua_S,"CreateAndInitializeWorld",tolua_AllToLua_cRoot_CreateAndInitializeWorld00); tolua_function(tolua_S,"GetPrimaryServerVersion",tolua_AllToLua_cRoot_GetPrimaryServerVersion00); tolua_function(tolua_S,"SetPrimaryServerVersion",tolua_AllToLua_cRoot_SetPrimaryServerVersion00); tolua_function(tolua_S,"GetGroupManager",tolua_AllToLua_cRoot_GetGroupManager00); diff --git a/src/Bindings/Bindings.h b/src/Bindings/Bindings.h index 88367e71f..73cf3c7d8 100644 --- a/src/Bindings/Bindings.h +++ b/src/Bindings/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/08/13 18:11:13. +** Generated automatically by tolua++-1.0.92 on 12/14/13 16:22:46. */ /* Exported function */ diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h index 50a89018d..5cb35ac5a 100644 --- a/src/Bindings/Plugin.h +++ b/src/Bindings/Plugin.h @@ -93,6 +93,7 @@ public: virtual bool OnUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player) = 0; virtual bool OnWeatherChanged (cWorld & a_World) = 0; virtual bool OnWeatherChanging (cWorld & a_World, eWeather & a_NewWeather) = 0; + virtual bool OnWorldStarted (cWorld & a_World) = 0; virtual bool OnWorldTick (cWorld & a_World, float a_Dt, int a_LastTickDurationMSec) = 0; /** Handles the command split into a_Split, issued by player a_Player. diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index d714f2112..f27cee76e 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -1143,6 +1143,21 @@ bool cPluginLua::OnWeatherChanging(cWorld & a_World, eWeather & a_NewWeather) +bool cPluginLua::OnWorldStarted(cWorld & a_World) +{ + cCSLock Lock(m_CriticalSection); + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_WORLD_STARTED]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_World); + } + return false; +} + + + + + bool cPluginLua::OnWorldTick(cWorld & a_World, float a_Dt, int a_LastTickDurationMSec) { cCSLock Lock(m_CriticalSection); diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h index 95e7e789f..188d202e0 100644 --- a/src/Bindings/PluginLua.h +++ b/src/Bindings/PluginLua.h @@ -90,6 +90,7 @@ public: virtual bool OnUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player) override; virtual bool OnWeatherChanged (cWorld & a_World) override; virtual bool OnWeatherChanging (cWorld & a_World, eWeather & a_NewWeather) override; + virtual bool OnWorldStarted (cWorld & a_World) override; virtual bool OnWorldTick (cWorld & a_World, float a_Dt, int a_LastTickDurationMSec) override; virtual bool HandleCommand(const AStringVector & a_Split, cPlayer * a_Player) override; diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index 29ea26577..12263605f 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -1209,6 +1209,27 @@ bool cPluginManager::CallHookWeatherChanging(cWorld & a_World, eWeather & a_NewW +bool cPluginManager::CallHookWorldStarted(cWorld & a_World) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_WORLD_STARTED); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnWorldStarted(a_World)) + { + return true; + } + } + return false; +} + + + + + bool cPluginManager::CallHookWorldTick(cWorld & a_World, float a_Dt, int a_LastTickDurationMSec) { HookMap::iterator Plugins = m_Hooks.find(HOOK_WORLD_TICK); diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h index 8282b061c..09f230475 100644 --- a/src/Bindings/PluginManager.h +++ b/src/Bindings/PluginManager.h @@ -106,6 +106,7 @@ public: // tolua_export HOOK_UPDATING_SIGN, HOOK_WEATHER_CHANGED, HOOK_WEATHER_CHANGING, + HOOK_WORLD_STARTED, HOOK_WORLD_TICK, // Note that if a hook type is added, it may need processing in cPlugin::CanAddHook() descendants, @@ -191,6 +192,7 @@ public: // tolua_export bool CallHookUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player); bool CallHookWeatherChanged (cWorld & a_World); bool CallHookWeatherChanging (cWorld & a_World, eWeather & a_NewWeather); + bool CallHookWorldStarted (cWorld & a_World); bool CallHookWorldTick (cWorld & a_World, float a_Dt, int a_LastTickDurationMSec); bool DisablePlugin(const AString & a_PluginName); // tolua_export |