mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Implement the PlayerModuleList
event callback.
This commit is contained in:
parent
6fa7fdfb10
commit
53b541ca60
@ -145,6 +145,7 @@ static const EnumElement g_EventEnum[] = {
|
||||
{_SC("PlayerSpectate"), EVT_PLAYERSPECTATE},
|
||||
{_SC("PlayerUnspectate"), EVT_PLAYERUNSPECTATE},
|
||||
{_SC("PlayerCrashReport"), EVT_PLAYERCRASHREPORT},
|
||||
{_SC("PlayerModuleList"), EVT_PLAYERMODULELIST},
|
||||
{_SC("VehicleExplode"), EVT_VEHICLEEXPLODE},
|
||||
{_SC("VehicleRespawn"), EVT_VEHICLERESPAWN},
|
||||
{_SC("ObjectShot"), EVT_OBJECTSHOT},
|
||||
|
@ -532,6 +532,7 @@ protected:
|
||||
SignalPair mOnSpectate;
|
||||
SignalPair mOnUnspectate;
|
||||
SignalPair mOnCrashreport;
|
||||
SignalPair mOnModuleList;
|
||||
SignalPair mOnObjectShot;
|
||||
SignalPair mOnObjectTouched;
|
||||
SignalPair mOnPickupClaimed;
|
||||
@ -1162,6 +1163,7 @@ public:
|
||||
void EmitPlayerSpectate(Int32 player_id, Int32 target_player_id);
|
||||
void EmitPlayerUnspectate(Int32 player_id);
|
||||
void EmitPlayerCrashreport(Int32 player_id, CCStr report);
|
||||
void EmitPlayerModuleList(Int32 player_id, CCStr list);
|
||||
void EmitVehicleExplode(Int32 vehicle_id);
|
||||
void EmitVehicleRespawn(Int32 vehicle_id);
|
||||
void EmitObjectShot(Int32 object_id, Int32 player_id, Int32 weapon_id);
|
||||
@ -1320,6 +1322,7 @@ public:
|
||||
SignalPair mOnPlayerSpectate;
|
||||
SignalPair mOnPlayerUnspectate;
|
||||
SignalPair mOnPlayerCrashreport;
|
||||
SignalPair mOnPlayerModuleList;
|
||||
SignalPair mOnVehicleExplode;
|
||||
SignalPair mOnVehicleRespawn;
|
||||
SignalPair mOnObjectShot;
|
||||
|
@ -611,6 +611,15 @@ void Core::EmitPlayerCrashreport(Int32 player_id, CCStr report)
|
||||
(*mOnPlayerCrashreport.first)(_player.mObj, rep);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Core::EmitPlayerModuleList(Int32 player_id, CCStr list)
|
||||
{
|
||||
PlayerInst & _player = m_Players.at(player_id);
|
||||
LightObj rep(list, -1);
|
||||
(*_player.mOnModuleList.first)(rep);
|
||||
(*mOnPlayerModuleList.first)(_player.mObj, rep);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Core::EmitVehicleExplode(Int32 vehicle_id)
|
||||
{
|
||||
|
@ -622,6 +622,7 @@ void Core::PlayerInst::InitEvents()
|
||||
InitSignalPair(mOnSpectate, mEvents, "Spectate");
|
||||
InitSignalPair(mOnUnspectate, mEvents, "Unspectate");
|
||||
InitSignalPair(mOnCrashreport, mEvents, "Crashreport");
|
||||
InitSignalPair(mOnModuleList, mEvents, "ModuleList");
|
||||
InitSignalPair(mOnObjectShot, mEvents, "ObjectShot");
|
||||
InitSignalPair(mOnObjectTouched, mEvents, "ObjectTouched");
|
||||
InitSignalPair(mOnPickupClaimed, mEvents, "PickupClaimed");
|
||||
@ -701,6 +702,7 @@ void Core::PlayerInst::DropEvents()
|
||||
ResetSignalPair(mOnSpectate);
|
||||
ResetSignalPair(mOnUnspectate);
|
||||
ResetSignalPair(mOnCrashreport);
|
||||
ResetSignalPair(mOnModuleList);
|
||||
ResetSignalPair(mOnObjectShot);
|
||||
ResetSignalPair(mOnObjectTouched);
|
||||
ResetSignalPair(mOnPickupClaimed);
|
||||
|
@ -129,6 +129,7 @@ void Core::InitEvents()
|
||||
InitSignalPair(mOnPlayerSpectate, m_Events, "PlayerSpectate");
|
||||
InitSignalPair(mOnPlayerUnspectate, m_Events, "PlayerUnspectate");
|
||||
InitSignalPair(mOnPlayerCrashreport, m_Events, "PlayerCrashreport");
|
||||
InitSignalPair(mOnPlayerModuleList, m_Events, "PlayerModuleList");
|
||||
InitSignalPair(mOnVehicleExplode, m_Events, "VehicleExplode");
|
||||
InitSignalPair(mOnVehicleRespawn, m_Events, "VehicleRespawn");
|
||||
InitSignalPair(mOnObjectShot, m_Events, "ObjectShot");
|
||||
@ -262,6 +263,7 @@ void Core::DropEvents()
|
||||
ResetSignalPair(mOnPlayerSpectate);
|
||||
ResetSignalPair(mOnPlayerUnspectate);
|
||||
ResetSignalPair(mOnPlayerCrashreport);
|
||||
ResetSignalPair(mOnPlayerModuleList);
|
||||
ResetSignalPair(mOnVehicleExplode);
|
||||
ResetSignalPair(mOnVehicleRespawn);
|
||||
ResetSignalPair(mOnObjectShot);
|
||||
|
@ -703,6 +703,18 @@ static void OnPlayerCrashReport(int32_t player_id, CCStr report)
|
||||
SQMOD_RELOAD_CHECK(false)
|
||||
}
|
||||
|
||||
static void OnPlayerModuleList(int32_t player_id, const char * list)
|
||||
{
|
||||
// Attempt to forward the event
|
||||
try
|
||||
{
|
||||
Core::Get().EmitPlayerModuleList(player_id, list);
|
||||
}
|
||||
SQMOD_CATCH_EVENT_EXCEPTION(OnPlayerModuleList)
|
||||
// See if a reload was requested
|
||||
SQMOD_RELOAD_CHECK(false)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static void OnVehicleUpdate(int32_t vehicle_id, vcmpVehicleUpdate update_type)
|
||||
{
|
||||
@ -939,6 +951,7 @@ SQMOD_API_EXPORT unsigned int VcmpPluginInit(PluginFuncs * funcs, PluginCallback
|
||||
_Clbk->OnCheckpointExited = OnCheckpointExited;
|
||||
_Clbk->OnEntityPoolChange = OnEntityPoolChange;
|
||||
_Clbk->OnServerPerformanceReport = OnServerPerformanceReport;
|
||||
_Clbk->OnPlayerModuleList = OnPlayerModuleList;
|
||||
// Attempt to initialize the plug-in exports
|
||||
InitExports();
|
||||
// Dummy spacing
|
||||
|
@ -366,6 +366,7 @@ enum EventType
|
||||
EVT_PLAYERSPECTATE,
|
||||
EVT_PLAYERUNSPECTATE,
|
||||
EVT_PLAYERCRASHREPORT,
|
||||
EVT_PLAYERMODULELIST,
|
||||
EVT_VEHICLEEXPLODE,
|
||||
EVT_VEHICLERESPAWN,
|
||||
EVT_OBJECTSHOT,
|
||||
|
Loading…
Reference in New Issue
Block a user