cPickup doesn't use cPackets.
Also, Lua API change, OnCollectItem -> OnCollectPickup; first param is cPlayer to match other callbacks. git-svn-id: http://mc-server.googlecode.com/svn/trunk@786 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
0c5910c4fb
commit
f0fc0edd21
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
** Lua binding: AllToLua
|
** Lua binding: AllToLua
|
||||||
** Generated automatically by tolua++-1.0.92 on 08/24/12 09:56:22.
|
** Generated automatically by tolua++-1.0.92 on 08/24/12 10:55:13.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
@ -7879,16 +7879,16 @@ static int tolua_AllToLua_cPlugin_OnChunkGenerating00(lua_State* tolua_S)
|
|||||||
}
|
}
|
||||||
#endif //#ifndef TOLUA_DISABLE
|
#endif //#ifndef TOLUA_DISABLE
|
||||||
|
|
||||||
/* method: OnCollectItem of class cPlugin */
|
/* method: OnCollectPickup of class cPlugin */
|
||||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_OnCollectItem00
|
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_OnCollectPickup00
|
||||||
static int tolua_AllToLua_cPlugin_OnCollectItem00(lua_State* tolua_S)
|
static int tolua_AllToLua_cPlugin_OnCollectPickup00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
if (
|
if (
|
||||||
!tolua_isusertype(tolua_S,1,"cPlugin",0,&tolua_err) ||
|
!tolua_isusertype(tolua_S,1,"cPlugin",0,&tolua_err) ||
|
||||||
!tolua_isusertype(tolua_S,2,"cPickup",0,&tolua_err) ||
|
!tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) ||
|
||||||
!tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
|
!tolua_isusertype(tolua_S,3,"cPickup",0,&tolua_err) ||
|
||||||
!tolua_isnoobj(tolua_S,4,&tolua_err)
|
!tolua_isnoobj(tolua_S,4,&tolua_err)
|
||||||
)
|
)
|
||||||
goto tolua_lerror;
|
goto tolua_lerror;
|
||||||
@ -7896,20 +7896,20 @@ static int tolua_AllToLua_cPlugin_OnCollectItem00(lua_State* tolua_S)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
cPlugin* self = (cPlugin*) tolua_tousertype(tolua_S,1,0);
|
cPlugin* self = (cPlugin*) tolua_tousertype(tolua_S,1,0);
|
||||||
cPickup* a_Pickup = ((cPickup*) tolua_tousertype(tolua_S,2,0));
|
cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0));
|
||||||
cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
|
cPickup* a_Pickup = ((cPickup*) tolua_tousertype(tolua_S,3,0));
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnCollectItem'", NULL);
|
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnCollectPickup'", NULL);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
bool tolua_ret = (bool) self->OnCollectItem(a_Pickup,a_Player);
|
bool tolua_ret = (bool) self->OnCollectPickup(a_Player,a_Pickup);
|
||||||
tolua_pushboolean(tolua_S,(bool)tolua_ret);
|
tolua_pushboolean(tolua_S,(bool)tolua_ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_lerror:
|
tolua_lerror:
|
||||||
tolua_error(tolua_S,"#ferror in function 'OnCollectItem'.",&tolua_err);
|
tolua_error(tolua_S,"#ferror in function 'OnCollectPickup'.",&tolua_err);
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -8793,16 +8793,16 @@ public:
|
|||||||
return ( bool ) cPlugin:: OnChunkGenerating(a_World,a_ChunkX,a_ChunkZ,a_pLuaChunk);
|
return ( bool ) cPlugin:: OnChunkGenerating(a_World,a_ChunkX,a_ChunkZ,a_pLuaChunk);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
bool OnCollectItem( cPickup* a_Pickup, cPlayer* a_Player) {
|
bool OnCollectPickup( cPlayer* a_Player, cPickup* a_Pickup) {
|
||||||
if (push_method("OnCollectItem", tolua_AllToLua_cPlugin_OnCollectItem00)) {
|
if (push_method("OnCollectPickup", tolua_AllToLua_cPlugin_OnCollectPickup00)) {
|
||||||
tolua_pushusertype(lua_state, (void*)a_Pickup, "cPickup");
|
|
||||||
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
|
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
|
||||||
|
tolua_pushusertype(lua_state, (void*)a_Pickup, "cPickup");
|
||||||
ToluaBase::dbcall(lua_state, 3, 1);
|
ToluaBase::dbcall(lua_state, 3, 1);
|
||||||
bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0);
|
bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0);
|
||||||
lua_pop(lua_state, 1);
|
lua_pop(lua_state, 1);
|
||||||
return tolua_ret;
|
return tolua_ret;
|
||||||
} else {
|
} else {
|
||||||
return ( bool ) cPlugin:: OnCollectItem(a_Pickup,a_Player);
|
return ( bool ) cPlugin:: OnCollectPickup(a_Player,a_Pickup);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
bool OnCraftingNoRecipe( const cPlayer* a_Player, const cCraftingGrid* a_Grid, cCraftingRecipe* a_Recipe) {
|
bool OnCraftingNoRecipe( const cPlayer* a_Player, const cCraftingGrid* a_Grid, cCraftingRecipe* a_Recipe) {
|
||||||
@ -8997,8 +8997,8 @@ public:
|
|||||||
bool cPlugin__OnChunkGenerating( cWorld* a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk* a_pLuaChunk) {
|
bool cPlugin__OnChunkGenerating( cWorld* a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk* a_pLuaChunk) {
|
||||||
return ( bool )cPlugin::OnChunkGenerating(a_World,a_ChunkX,a_ChunkZ,a_pLuaChunk);
|
return ( bool )cPlugin::OnChunkGenerating(a_World,a_ChunkX,a_ChunkZ,a_pLuaChunk);
|
||||||
};
|
};
|
||||||
bool cPlugin__OnCollectItem( cPickup* a_Pickup, cPlayer* a_Player) {
|
bool cPlugin__OnCollectPickup( cPlayer* a_Player, cPickup* a_Pickup) {
|
||||||
return ( bool )cPlugin::OnCollectItem(a_Pickup,a_Player);
|
return ( bool )cPlugin::OnCollectPickup(a_Player,a_Pickup);
|
||||||
};
|
};
|
||||||
bool cPlugin__OnCraftingNoRecipe( const cPlayer* a_Player, const cCraftingGrid* a_Grid, cCraftingRecipe* a_Recipe) {
|
bool cPlugin__OnCraftingNoRecipe( const cPlayer* a_Player, const cCraftingGrid* a_Grid, cCraftingRecipe* a_Recipe) {
|
||||||
return ( bool )cPlugin::OnCraftingNoRecipe(a_Player,a_Grid,a_Recipe);
|
return ( bool )cPlugin::OnCraftingNoRecipe(a_Player,a_Grid,a_Recipe);
|
||||||
@ -9390,16 +9390,16 @@ static int tolua_AllToLua_Lua__cPlugin_cPlugin__OnChunkGenerating00(lua_State* t
|
|||||||
}
|
}
|
||||||
#endif //#ifndef TOLUA_DISABLE
|
#endif //#ifndef TOLUA_DISABLE
|
||||||
|
|
||||||
/* method: cPlugin__OnCollectItem of class Lua__cPlugin */
|
/* method: cPlugin__OnCollectPickup of class Lua__cPlugin */
|
||||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_cPlugin__OnCollectItem00
|
#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPlugin_cPlugin__OnCollectPickup00
|
||||||
static int tolua_AllToLua_Lua__cPlugin_cPlugin__OnCollectItem00(lua_State* tolua_S)
|
static int tolua_AllToLua_Lua__cPlugin_cPlugin__OnCollectPickup00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
if (
|
if (
|
||||||
!tolua_isusertype(tolua_S,1,"Lua__cPlugin",0,&tolua_err) ||
|
!tolua_isusertype(tolua_S,1,"Lua__cPlugin",0,&tolua_err) ||
|
||||||
!tolua_isusertype(tolua_S,2,"cPickup",0,&tolua_err) ||
|
!tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) ||
|
||||||
!tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
|
!tolua_isusertype(tolua_S,3,"cPickup",0,&tolua_err) ||
|
||||||
!tolua_isnoobj(tolua_S,4,&tolua_err)
|
!tolua_isnoobj(tolua_S,4,&tolua_err)
|
||||||
)
|
)
|
||||||
goto tolua_lerror;
|
goto tolua_lerror;
|
||||||
@ -9407,20 +9407,20 @@ static int tolua_AllToLua_Lua__cPlugin_cPlugin__OnCollectItem00(lua_State* tolua
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
Lua__cPlugin* self = (Lua__cPlugin*) tolua_tousertype(tolua_S,1,0);
|
Lua__cPlugin* self = (Lua__cPlugin*) tolua_tousertype(tolua_S,1,0);
|
||||||
cPickup* a_Pickup = ((cPickup*) tolua_tousertype(tolua_S,2,0));
|
cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0));
|
||||||
cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
|
cPickup* a_Pickup = ((cPickup*) tolua_tousertype(tolua_S,3,0));
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin__OnCollectItem'", NULL);
|
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin__OnCollectPickup'", NULL);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
bool tolua_ret = (bool) self->cPlugin__OnCollectItem(a_Pickup,a_Player);
|
bool tolua_ret = (bool) self->cPlugin__OnCollectPickup(a_Player,a_Pickup);
|
||||||
tolua_pushboolean(tolua_S,(bool)tolua_ret);
|
tolua_pushboolean(tolua_S,(bool)tolua_ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_lerror:
|
tolua_lerror:
|
||||||
tolua_error(tolua_S,"#ferror in function 'cPlugin__OnCollectItem'.",&tolua_err);
|
tolua_error(tolua_S,"#ferror in function 'cPlugin__OnCollectPickup'.",&tolua_err);
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -10315,16 +10315,16 @@ public:
|
|||||||
return ( bool ) cPlugin_NewLua:: OnChunkGenerating(a_World,a_ChunkX,a_ChunkZ,a_pLuaChunk);
|
return ( bool ) cPlugin_NewLua:: OnChunkGenerating(a_World,a_ChunkX,a_ChunkZ,a_pLuaChunk);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
bool OnCollectItem( cPickup* a_Pickup, cPlayer* a_Player) {
|
bool OnCollectPickup( cPlayer* a_Player, cPickup* a_Pickup) {
|
||||||
if (push_method("OnCollectItem", tolua_AllToLua_cPlugin_OnCollectItem00)) {
|
if (push_method("OnCollectPickup", tolua_AllToLua_cPlugin_OnCollectPickup00)) {
|
||||||
tolua_pushusertype(lua_state, (void*)a_Pickup, "cPickup");
|
|
||||||
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
|
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
|
||||||
|
tolua_pushusertype(lua_state, (void*)a_Pickup, "cPickup");
|
||||||
ToluaBase::dbcall(lua_state, 3, 1);
|
ToluaBase::dbcall(lua_state, 3, 1);
|
||||||
bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0);
|
bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0);
|
||||||
lua_pop(lua_state, 1);
|
lua_pop(lua_state, 1);
|
||||||
return tolua_ret;
|
return tolua_ret;
|
||||||
} else {
|
} else {
|
||||||
return ( bool ) cPlugin_NewLua:: OnCollectItem(a_Pickup,a_Player);
|
return ( bool ) cPlugin_NewLua:: OnCollectPickup(a_Player,a_Pickup);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
bool OnCraftingNoRecipe( const cPlayer* a_Player, const cCraftingGrid* a_Grid, cCraftingRecipe* a_Recipe) {
|
bool OnCraftingNoRecipe( const cPlayer* a_Player, const cCraftingGrid* a_Grid, cCraftingRecipe* a_Recipe) {
|
||||||
@ -10522,8 +10522,8 @@ public:
|
|||||||
bool cPlugin_NewLua__OnChunkGenerating( cWorld* a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk* a_pLuaChunk) {
|
bool cPlugin_NewLua__OnChunkGenerating( cWorld* a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk* a_pLuaChunk) {
|
||||||
return ( bool )cPlugin_NewLua::OnChunkGenerating(a_World,a_ChunkX,a_ChunkZ,a_pLuaChunk);
|
return ( bool )cPlugin_NewLua::OnChunkGenerating(a_World,a_ChunkX,a_ChunkZ,a_pLuaChunk);
|
||||||
};
|
};
|
||||||
bool cPlugin_NewLua__OnCollectItem( cPickup* a_Pickup, cPlayer* a_Player) {
|
bool cPlugin_NewLua__OnCollectPickup( cPlayer* a_Player, cPickup* a_Pickup) {
|
||||||
return ( bool )cPlugin_NewLua::OnCollectItem(a_Pickup,a_Player);
|
return ( bool )cPlugin_NewLua::OnCollectPickup(a_Player,a_Pickup);
|
||||||
};
|
};
|
||||||
bool cPlugin_NewLua__OnCraftingNoRecipe( const cPlayer* a_Player, const cCraftingGrid* a_Grid, cCraftingRecipe* a_Recipe) {
|
bool cPlugin_NewLua__OnCraftingNoRecipe( const cPlayer* a_Player, const cCraftingGrid* a_Grid, cCraftingRecipe* a_Recipe) {
|
||||||
return ( bool )cPlugin_NewLua::OnCraftingNoRecipe(a_Player,a_Grid,a_Recipe);
|
return ( bool )cPlugin_NewLua::OnCraftingNoRecipe(a_Player,a_Grid,a_Recipe);
|
||||||
@ -21373,6 +21373,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
|||||||
tolua_beginmodule(tolua_S,"cPluginManager");
|
tolua_beginmodule(tolua_S,"cPluginManager");
|
||||||
tolua_constant(tolua_S,"HOOK_TICK",cPluginManager::HOOK_TICK);
|
tolua_constant(tolua_S,"HOOK_TICK",cPluginManager::HOOK_TICK);
|
||||||
tolua_constant(tolua_S,"HOOK_CHAT",cPluginManager::HOOK_CHAT);
|
tolua_constant(tolua_S,"HOOK_CHAT",cPluginManager::HOOK_CHAT);
|
||||||
|
tolua_constant(tolua_S,"HOOK_COLLECT_PICKUP",cPluginManager::HOOK_COLLECT_PICKUP);
|
||||||
tolua_constant(tolua_S,"HOOK_COLLECT_ITEM",cPluginManager::HOOK_COLLECT_ITEM);
|
tolua_constant(tolua_S,"HOOK_COLLECT_ITEM",cPluginManager::HOOK_COLLECT_ITEM);
|
||||||
tolua_constant(tolua_S,"HOOK_BLOCK_DIG",cPluginManager::HOOK_BLOCK_DIG);
|
tolua_constant(tolua_S,"HOOK_BLOCK_DIG",cPluginManager::HOOK_BLOCK_DIG);
|
||||||
tolua_constant(tolua_S,"HOOK_BLOCK_PLACE",cPluginManager::HOOK_BLOCK_PLACE);
|
tolua_constant(tolua_S,"HOOK_BLOCK_PLACE",cPluginManager::HOOK_BLOCK_PLACE);
|
||||||
@ -21436,7 +21437,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
|||||||
tolua_function(tolua_S,"OnChat",tolua_AllToLua_cPlugin_OnChat00);
|
tolua_function(tolua_S,"OnChat",tolua_AllToLua_cPlugin_OnChat00);
|
||||||
tolua_function(tolua_S,"OnChunkGenerated",tolua_AllToLua_cPlugin_OnChunkGenerated00);
|
tolua_function(tolua_S,"OnChunkGenerated",tolua_AllToLua_cPlugin_OnChunkGenerated00);
|
||||||
tolua_function(tolua_S,"OnChunkGenerating",tolua_AllToLua_cPlugin_OnChunkGenerating00);
|
tolua_function(tolua_S,"OnChunkGenerating",tolua_AllToLua_cPlugin_OnChunkGenerating00);
|
||||||
tolua_function(tolua_S,"OnCollectItem",tolua_AllToLua_cPlugin_OnCollectItem00);
|
tolua_function(tolua_S,"OnCollectPickup",tolua_AllToLua_cPlugin_OnCollectPickup00);
|
||||||
tolua_function(tolua_S,"OnCraftingNoRecipe",tolua_AllToLua_cPlugin_OnCraftingNoRecipe00);
|
tolua_function(tolua_S,"OnCraftingNoRecipe",tolua_AllToLua_cPlugin_OnCraftingNoRecipe00);
|
||||||
tolua_function(tolua_S,"OnDisconnect",tolua_AllToLua_cPlugin_OnDisconnect00);
|
tolua_function(tolua_S,"OnDisconnect",tolua_AllToLua_cPlugin_OnDisconnect00);
|
||||||
tolua_function(tolua_S,"OnKilled",tolua_AllToLua_cPlugin_OnKilled00);
|
tolua_function(tolua_S,"OnKilled",tolua_AllToLua_cPlugin_OnKilled00);
|
||||||
@ -21477,7 +21478,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
|||||||
tolua_function(tolua_S,"cPlugin__OnChat",tolua_AllToLua_Lua__cPlugin_cPlugin__OnChat00);
|
tolua_function(tolua_S,"cPlugin__OnChat",tolua_AllToLua_Lua__cPlugin_cPlugin__OnChat00);
|
||||||
tolua_function(tolua_S,"cPlugin__OnChunkGenerated",tolua_AllToLua_Lua__cPlugin_cPlugin__OnChunkGenerated00);
|
tolua_function(tolua_S,"cPlugin__OnChunkGenerated",tolua_AllToLua_Lua__cPlugin_cPlugin__OnChunkGenerated00);
|
||||||
tolua_function(tolua_S,"cPlugin__OnChunkGenerating",tolua_AllToLua_Lua__cPlugin_cPlugin__OnChunkGenerating00);
|
tolua_function(tolua_S,"cPlugin__OnChunkGenerating",tolua_AllToLua_Lua__cPlugin_cPlugin__OnChunkGenerating00);
|
||||||
tolua_function(tolua_S,"cPlugin__OnCollectItem",tolua_AllToLua_Lua__cPlugin_cPlugin__OnCollectItem00);
|
tolua_function(tolua_S,"cPlugin__OnCollectPickup",tolua_AllToLua_Lua__cPlugin_cPlugin__OnCollectPickup00);
|
||||||
tolua_function(tolua_S,"cPlugin__OnCraftingNoRecipe",tolua_AllToLua_Lua__cPlugin_cPlugin__OnCraftingNoRecipe00);
|
tolua_function(tolua_S,"cPlugin__OnCraftingNoRecipe",tolua_AllToLua_Lua__cPlugin_cPlugin__OnCraftingNoRecipe00);
|
||||||
tolua_function(tolua_S,"cPlugin__OnDisconnect",tolua_AllToLua_Lua__cPlugin_cPlugin__OnDisconnect00);
|
tolua_function(tolua_S,"cPlugin__OnDisconnect",tolua_AllToLua_Lua__cPlugin_cPlugin__OnDisconnect00);
|
||||||
tolua_function(tolua_S,"cPlugin__OnKilled",tolua_AllToLua_Lua__cPlugin_cPlugin__OnKilled00);
|
tolua_function(tolua_S,"cPlugin__OnKilled",tolua_AllToLua_Lua__cPlugin_cPlugin__OnKilled00);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
** Lua binding: AllToLua
|
** Lua binding: AllToLua
|
||||||
** Generated automatically by tolua++-1.0.92 on 08/24/12 09:56:22.
|
** Generated automatically by tolua++-1.0.92 on 08/24/12 10:55:13.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Exported function */
|
/* Exported function */
|
||||||
|
@ -1930,6 +1930,22 @@ void cChunk::BroadcastSpawn(cEntity & a_Entity, const cClientHandle * a_Exclude)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cChunk::BroadcastCollectPickup(const cPickup & a_Pickup, const cPlayer & a_Player, const cClientHandle * a_Exclude)
|
||||||
|
{
|
||||||
|
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
||||||
|
{
|
||||||
|
if (*itr == a_Exclude)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
(*itr)->SendCollectPickup(a_Pickup, a_Player);
|
||||||
|
} // for itr - LoadedByClient[]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cChunk::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
// We can operate on entity pointers, we're inside the ChunkMap's CS lock which guards the list
|
// We can operate on entity pointers, we're inside the ChunkMap's CS lock which guards the list
|
||||||
|
@ -42,6 +42,7 @@ class cChestEntity;
|
|||||||
class cFurnaceEntity;
|
class cFurnaceEntity;
|
||||||
class cBlockArea;
|
class cBlockArea;
|
||||||
class cPawn;
|
class cPawn;
|
||||||
|
class cPickup;
|
||||||
|
|
||||||
typedef std::list<cClientHandle *> cClientHandleList;
|
typedef std::list<cClientHandle *> cClientHandleList;
|
||||||
typedef cItemCallback<cEntity> cEntityCallback;
|
typedef cItemCallback<cEntity> cEntityCallback;
|
||||||
@ -188,6 +189,7 @@ public:
|
|||||||
void BroadcastMetadata (const cPawn & a_Pawn, const cClientHandle * a_Exclude = NULL);
|
void BroadcastMetadata (const cPawn & a_Pawn, const cClientHandle * a_Exclude = NULL);
|
||||||
void BroadcastSpawn (cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
|
void BroadcastSpawn (cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
|
||||||
void BroadcastBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = NULL);
|
void BroadcastBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = NULL);
|
||||||
|
void BroadcastCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player, const cClientHandle * a_Exclude = NULL);
|
||||||
|
|
||||||
void SendBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle & a_Client);
|
void SendBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle & a_Client);
|
||||||
|
|
||||||
|
@ -451,6 +451,22 @@ void cChunkMap::BroadcastSpawn(cEntity & a_Entity, const cClientHandle * a_Exclu
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cChunkMap::BroadcastCollectPickup(const cPickup & a_Pickup, const cPlayer & a_Player, const cClientHandle * a_Exclude)
|
||||||
|
{
|
||||||
|
cCSLock Lock(m_CSLayers);
|
||||||
|
cChunkPtr Chunk = GetChunkNoGen(a_Pickup.GetChunkX(), a_Pickup.GetChunkY(), a_Pickup.GetChunkZ());
|
||||||
|
if (Chunk == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// It's perfectly legal to broadcast packets even to invalid chunks!
|
||||||
|
Chunk->BroadcastCollectPickup(a_Pickup, a_Player, a_Exclude);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cChunkMap::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude)
|
void cChunkMap::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CSLayers);
|
cCSLock Lock(m_CSLayers);
|
||||||
|
@ -21,6 +21,7 @@ class cPlayer;
|
|||||||
class cChestEntity;
|
class cChestEntity;
|
||||||
class cFurnaceEntity;
|
class cFurnaceEntity;
|
||||||
class cPawn;
|
class cPawn;
|
||||||
|
class cPickup;
|
||||||
|
|
||||||
typedef std::list<cClientHandle *> cClientHandleList;
|
typedef std::list<cClientHandle *> cClientHandleList;
|
||||||
typedef cChunk * cChunkPtr;
|
typedef cChunk * cChunkPtr;
|
||||||
@ -77,6 +78,8 @@ public:
|
|||||||
|
|
||||||
void BroadcastSpawn(cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
|
void BroadcastSpawn(cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
|
||||||
|
|
||||||
|
void BroadcastCollectPickup(const cPickup & a_Pickup, const cPlayer & a_Player, const cClientHandle * a_Exclude = NULL);
|
||||||
|
|
||||||
/// Broadcasts the block entity, if it is at the coords specified, to all clients except a_Exclude
|
/// Broadcasts the block entity, if it is at the coords specified, to all clients except a_Exclude
|
||||||
void BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude);
|
void BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude);
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include "packets/cPacket_BlockDig.h"
|
#include "packets/cPacket_BlockDig.h"
|
||||||
#include "packets/cPacket_BlockPlace.h"
|
#include "packets/cPacket_BlockPlace.h"
|
||||||
#include "packets/cPacket_Chat.h"
|
#include "packets/cPacket_Chat.h"
|
||||||
|
#include "packets/cPacket_CollectItem.h"
|
||||||
#include "packets/cPacket_CreativeInventoryAction.h"
|
#include "packets/cPacket_CreativeInventoryAction.h"
|
||||||
#include "packets/cPacket_DestroyEntity.h"
|
#include "packets/cPacket_DestroyEntity.h"
|
||||||
#include "packets/cPacket_Disconnect.h"
|
#include "packets/cPacket_Disconnect.h"
|
||||||
@ -1895,6 +1896,18 @@ void cClientHandle::SendUpdateSign(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cClientHandle::SendCollectPickup(const cPickup & a_Pickup, const cPlayer & a_Player)
|
||||||
|
{
|
||||||
|
cPacket_CollectItem ci;
|
||||||
|
ci.m_CollectedID = a_Pickup.GetUniqueID();
|
||||||
|
ci.m_CollectorID = a_Player.GetUniqueID();
|
||||||
|
Send(ci);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cClientHandle::CheckIfWorldDownloaded(void)
|
void cClientHandle::CheckIfWorldDownloaded(void)
|
||||||
{
|
{
|
||||||
if (m_State != csDownloadingWorld)
|
if (m_State != csDownloadingWorld)
|
||||||
|
@ -113,6 +113,7 @@ public:
|
|||||||
void SendPickupSpawn(const cPickup & a_Pickup);
|
void SendPickupSpawn(const cPickup & a_Pickup);
|
||||||
void SendSpawnMob (const cMonster & a_Mob);
|
void SendSpawnMob (const cMonster & a_Mob);
|
||||||
void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4);
|
void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4);
|
||||||
|
void SendCollectPickup(const cPickup & a_Pickup, const cPlayer & a_Player);
|
||||||
|
|
||||||
const AString & GetUsername(void) const; //tolua_export
|
const AString & GetUsername(void) const; //tolua_export
|
||||||
|
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
#include "cRoot.h"
|
#include "cRoot.h"
|
||||||
#include "cTracer.h"
|
#include "cTracer.h"
|
||||||
|
|
||||||
#include "packets/cPacket_CollectItem.h"
|
|
||||||
|
|
||||||
#include "Vector3d.h"
|
#include "Vector3d.h"
|
||||||
#include "Vector3f.h"
|
#include "Vector3f.h"
|
||||||
|
|
||||||
@ -244,18 +242,25 @@ void cPickup::HandlePhysics(float a_Dt)
|
|||||||
|
|
||||||
bool cPickup::CollectedBy( cPlayer* a_Dest )
|
bool cPickup::CollectedBy( cPlayer* a_Dest )
|
||||||
{
|
{
|
||||||
if(m_bCollected) return false; // It's already collected!
|
if (m_bCollected)
|
||||||
// 800 is to long
|
|
||||||
if(m_Timer < 500.f) return false; // Not old enough
|
|
||||||
|
|
||||||
if( cRoot::Get()->GetPluginManager()->CallHook( cPluginManager::E_PLUGIN_COLLECT_ITEM, 2, this, a_Dest ) ) return false;
|
|
||||||
|
|
||||||
if( a_Dest->GetInventory().AddItem( *m_Item ) )
|
|
||||||
{
|
{
|
||||||
cPacket_CollectItem CollectItem;
|
return false; // It's already collected!
|
||||||
CollectItem.m_CollectedID = m_UniqueID;
|
}
|
||||||
CollectItem.m_CollectorID = a_Dest->GetUniqueID();
|
|
||||||
cRoot::Get()->GetServer()->Broadcast( CollectItem );
|
// 800 is to long
|
||||||
|
if (m_Timer < 500.f)
|
||||||
|
{
|
||||||
|
return false; // Not old enough
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cRoot::Get()->GetPluginManager()->CallHookCollectPickup(a_Dest, *this))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a_Dest->GetInventory().AddItem(*m_Item))
|
||||||
|
{
|
||||||
|
m_World->BroadcastCollectPickup(*this, *a_Dest);
|
||||||
|
|
||||||
m_bCollected = true;
|
m_bCollected = true;
|
||||||
m_Timer = 0;
|
m_Timer = 0;
|
||||||
|
@ -118,10 +118,10 @@ bool cPlugin::OnChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cL
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cPlugin::OnCollectItem(cPickup * a_Pickup, cPlayer * a_Player)
|
bool cPlugin::OnCollectPickup(cPlayer * a_Player, cPickup * a_Pickup)
|
||||||
{
|
{
|
||||||
UNUSED(a_Pickup);
|
|
||||||
UNUSED(a_Player);
|
UNUSED(a_Player);
|
||||||
|
UNUSED(a_Pickup);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public:
|
|||||||
virtual bool OnChat (cPlayer * a_Player, const AString & a_Message);
|
virtual bool OnChat (cPlayer * a_Player, const AString & a_Message);
|
||||||
virtual void OnChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ);
|
virtual void OnChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ);
|
||||||
virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk);
|
virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk);
|
||||||
virtual bool OnCollectItem (cPickup* a_Pickup, cPlayer* a_Player );
|
virtual bool OnCollectPickup (cPlayer * a_Player, cPickup * a_Pickup);
|
||||||
virtual bool OnCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
|
virtual bool OnCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
|
||||||
virtual bool OnDisconnect (cPlayer * a_Player, const AString & a_Reason);
|
virtual bool OnDisconnect (cPlayer * a_Player, const AString & a_Reason);
|
||||||
virtual bool OnKilled (cPawn * a_Killed, cEntity* a_Killer );
|
virtual bool OnKilled (cPawn * a_Killed, cEntity* a_Killer );
|
||||||
|
@ -198,22 +198,6 @@ bool cPluginManager::CallHook(PluginHook a_Hook, unsigned int a_NumArgs, ...)
|
|||||||
|
|
||||||
switch( a_Hook )
|
switch( a_Hook )
|
||||||
{
|
{
|
||||||
case HOOK_COLLECT_ITEM:
|
|
||||||
{
|
|
||||||
if( a_NumArgs != 2 ) break;
|
|
||||||
va_list argptr;
|
|
||||||
va_start( argptr, a_NumArgs);
|
|
||||||
cPickup* Pickup = va_arg(argptr, cPickup* );
|
|
||||||
cPlayer* Player = va_arg(argptr, cPlayer* );
|
|
||||||
va_end (argptr);
|
|
||||||
for( PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr )
|
|
||||||
{
|
|
||||||
if( (*itr)->OnCollectItem( Pickup, Player ) )
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case HOOK_PLAYER_JOIN:
|
case HOOK_PLAYER_JOIN:
|
||||||
{
|
{
|
||||||
if( a_NumArgs != 1 ) break;
|
if( a_NumArgs != 1 ) break;
|
||||||
@ -451,6 +435,27 @@ bool cPluginManager::CallHookChunkGenerating(cWorld * a_World, int a_ChunkX, int
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool cPluginManager::CallHookCollectPickup(cPlayer * a_Player, cPickup & a_Pickup)
|
||||||
|
{
|
||||||
|
HookMap::iterator Plugins = m_Hooks.find(HOOK_COLLECT_PICKUP);
|
||||||
|
if (Plugins == m_Hooks.end())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
|
||||||
|
{
|
||||||
|
if ((*itr)->OnCollectPickup(a_Player, &a_Pickup))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cPluginManager::CallHookPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe)
|
bool cPluginManager::CallHookPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe)
|
||||||
{
|
{
|
||||||
HookMap::iterator Plugins = m_Hooks.find(HOOK_PRE_CRAFTING);
|
HookMap::iterator Plugins = m_Hooks.find(HOOK_PRE_CRAFTING);
|
||||||
|
@ -22,6 +22,9 @@ class cPlayer;
|
|||||||
class cCraftingGrid;
|
class cCraftingGrid;
|
||||||
class cCraftingRecipe;
|
class cCraftingRecipe;
|
||||||
|
|
||||||
|
// fwd: cPickup.h
|
||||||
|
class cPickup;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +41,8 @@ public: //tolua_export
|
|||||||
{
|
{
|
||||||
HOOK_TICK,
|
HOOK_TICK,
|
||||||
HOOK_CHAT,
|
HOOK_CHAT,
|
||||||
HOOK_COLLECT_ITEM,
|
HOOK_COLLECT_PICKUP,
|
||||||
|
HOOK_COLLECT_ITEM = HOOK_COLLECT_PICKUP, // OBSOLETE, use HOOK_COLLECT_PICKUP instead
|
||||||
HOOK_BLOCK_DIG,
|
HOOK_BLOCK_DIG,
|
||||||
HOOK_BLOCK_PLACE,
|
HOOK_BLOCK_PLACE,
|
||||||
HOOK_DISCONNECT,
|
HOOK_DISCONNECT,
|
||||||
@ -102,6 +106,7 @@ public: //tolua_export
|
|||||||
bool CallHookBlockToPickup (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, const cPlayer * a_Player, const cItem & a_EquippedItem, cItems & a_Pickups);
|
bool CallHookBlockToPickup (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, const cPlayer * a_Player, const cItem & a_EquippedItem, cItems & a_Pickups);
|
||||||
bool CallHookChat (cPlayer * a_Player, const AString & a_Message);
|
bool CallHookChat (cPlayer * a_Player, const AString & a_Message);
|
||||||
bool CallHookChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_Chunk);
|
bool CallHookChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_Chunk);
|
||||||
|
bool CallHookCollectPickup (cPlayer * a_Player, cPickup & a_Pickup);
|
||||||
bool CallHookCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
|
bool CallHookCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
|
||||||
bool CallHookDisconnect (cPlayer * a_Player, const AString & a_Reason);
|
bool CallHookDisconnect (cPlayer * a_Player, const AString & a_Reason);
|
||||||
bool CallHookLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username);
|
bool CallHookLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username);
|
||||||
|
@ -159,20 +159,23 @@ void cPlugin_NewLua::Tick(float a_Dt)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cPlugin_NewLua::OnCollectItem( cPickup* a_Pickup, cPlayer* a_Player )
|
bool cPlugin_NewLua::OnCollectPickup(cPlayer * a_Player, cPickup * a_Pickup)
|
||||||
{
|
{
|
||||||
cCSLock Lock( m_CriticalSection );
|
cCSLock Lock(m_CriticalSection);
|
||||||
if( !PushFunction("OnCollectItem") )
|
if (!PushFunction("OnCollectPickup"))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
tolua_pushusertype(m_LuaState, a_Pickup, "cPickup");
|
|
||||||
tolua_pushusertype(m_LuaState, a_Player, "cPlayer");
|
tolua_pushusertype(m_LuaState, a_Player, "cPlayer");
|
||||||
|
tolua_pushusertype(m_LuaState, a_Pickup, "cPickup");
|
||||||
|
|
||||||
if( !CallFunction(2, 1, "OnCollectItem") )
|
if (!CallFunction(2, 1, "OnCollectPickup"))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool bRetVal = (tolua_toboolean( m_LuaState, -1, 0) > 0);
|
return (tolua_toboolean(m_LuaState, -1, 0) > 0);
|
||||||
return bRetVal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public: //tolua_export
|
|||||||
virtual bool OnChat (cPlayer * a_Player, const AString & a_Message) override;
|
virtual bool OnChat (cPlayer * a_Player, const AString & a_Message) override;
|
||||||
virtual void OnChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ) override;
|
virtual void OnChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ) override;
|
||||||
virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk ) override;
|
virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk ) override;
|
||||||
virtual bool OnCollectItem (cPickup* a_Pickup, cPlayer* a_Player ) override;
|
virtual bool OnCollectPickup (cPlayer * a_Player, cPickup * a_Pickup) override;
|
||||||
virtual bool OnCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
|
virtual bool OnCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
|
||||||
virtual bool OnDisconnect (cPlayer * a_Player, const AString & a_Reason) override;
|
virtual bool OnDisconnect (cPlayer * a_Player, const AString & a_Reason) override;
|
||||||
virtual bool OnKilled (cPawn* a_Killed, cEntity* a_Killer ) override;
|
virtual bool OnKilled (cPawn* a_Killed, cEntity* a_Killer ) override;
|
||||||
|
@ -99,13 +99,16 @@ void cPlugin_Squirrel::Tick(float a_Dt)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cPlugin_Squirrel::OnCollectItem( cPickup* a_Pickup, cPlayer* a_Player )
|
bool cPlugin_Squirrel::OnCollectPickup(cPlayer * a_Player, cPickup * a_Pickup)
|
||||||
{
|
{
|
||||||
cCSLock Lock( m_CriticalSection );
|
cCSLock Lock(m_CriticalSection);
|
||||||
|
|
||||||
if(!m_Plugin->HasFunction("OnCollectItem")) return false;
|
if (!m_Plugin->HasFunction("OnCollectPickup"))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return m_Plugin->GetFunction("OnCollectItem").Evaluate<bool>(a_Pickup, a_Player);
|
return m_Plugin->GetFunction("OnCollectPickup").Evaluate<bool>(a_Player, a_Pickup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,16 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cPlugin.h"
|
#include "cPlugin.h"
|
||||||
#include <sqrat.h>
|
#include <sqrat.h>
|
||||||
#include "squirrelbindings/SquirrelObject.h"
|
#include "squirrelbindings/SquirrelObject.h"
|
||||||
|
|
||||||
class cPlugin_Squirrel : public cPlugin
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class cPlugin_Squirrel :
|
||||||
|
public cPlugin
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cPlugin_Squirrel(const char* a_PluginName);
|
cPlugin_Squirrel(const char* a_PluginName);
|
||||||
@ -20,7 +27,7 @@ public:
|
|||||||
virtual bool OnChat (cPlayer * a_Player, const AString & a_Message) override;
|
virtual bool OnChat (cPlayer * a_Player, const AString & a_Message) override;
|
||||||
virtual void OnChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ) override;
|
virtual void OnChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ) override;
|
||||||
virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk ) override;
|
virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk ) override;
|
||||||
virtual bool OnCollectItem (cPickup* a_Pickup, cPlayer* a_Player ) override;
|
virtual bool OnCollectPickup (cPlayer * a_Player, cPickup * a_Pickup) override;
|
||||||
virtual bool OnCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
|
virtual bool OnCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
|
||||||
virtual bool OnDisconnect (cPlayer * a_Player, const AString & a_Reason) override;
|
virtual bool OnDisconnect (cPlayer * a_Player, const AString & a_Reason) override;
|
||||||
virtual bool OnKilled (cPawn* a_Killed, cEntity* a_Killer ) override;
|
virtual bool OnKilled (cPawn* a_Killed, cEntity* a_Killer ) override;
|
||||||
@ -39,4 +46,8 @@ protected:
|
|||||||
const char * m_PluginName;
|
const char * m_PluginName;
|
||||||
cCriticalSection m_CriticalSection;
|
cCriticalSection m_CriticalSection;
|
||||||
SquirrelObject *m_Plugin;
|
SquirrelObject *m_Plugin;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1399,6 +1399,15 @@ void cWorld::BroadcastSpawn(cEntity & a_Entity, const cClientHandle * a_Exclude)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cWorld::BroadcastCollectPickup(const cPickup & a_Pickup, const cPlayer & a_Player, const cClientHandle * a_Exclude)
|
||||||
|
{
|
||||||
|
m_ChunkMap->BroadcastCollectPickup(a_Pickup, a_Player, a_Exclude);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cWorld::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude)
|
void cWorld::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
m_ChunkMap->BroadcastBlockEntity(a_BlockX, a_BlockY, a_BlockZ, a_Exclude);
|
m_ChunkMap->BroadcastBlockEntity(a_BlockX, a_BlockY, a_BlockZ, a_Exclude);
|
||||||
|
@ -91,6 +91,7 @@ public:
|
|||||||
void BroadcastEntityStatus (const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude = NULL);
|
void BroadcastEntityStatus (const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude = NULL);
|
||||||
void BroadcastMetadata (const cPawn & a_Pawn, const cClientHandle * a_Exclude = NULL);
|
void BroadcastMetadata (const cPawn & a_Pawn, const cClientHandle * a_Exclude = NULL);
|
||||||
void BroadcastSpawn (cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
|
void BroadcastSpawn (cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
|
||||||
|
void BroadcastCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player, const cClientHandle * a_Exclude = NULL);
|
||||||
|
|
||||||
/// If there is a block entity at the specified coods, sends it to all clients except a_Exclude
|
/// If there is a block entity at the specified coods, sends it to all clients except a_Exclude
|
||||||
void BroadcastBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = NULL);
|
void BroadcastBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user