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("PlayerSpectate"), EVT_PLAYERSPECTATE},
|
||||||
{_SC("PlayerUnspectate"), EVT_PLAYERUNSPECTATE},
|
{_SC("PlayerUnspectate"), EVT_PLAYERUNSPECTATE},
|
||||||
{_SC("PlayerCrashReport"), EVT_PLAYERCRASHREPORT},
|
{_SC("PlayerCrashReport"), EVT_PLAYERCRASHREPORT},
|
||||||
|
{_SC("PlayerModuleList"), EVT_PLAYERMODULELIST},
|
||||||
{_SC("VehicleExplode"), EVT_VEHICLEEXPLODE},
|
{_SC("VehicleExplode"), EVT_VEHICLEEXPLODE},
|
||||||
{_SC("VehicleRespawn"), EVT_VEHICLERESPAWN},
|
{_SC("VehicleRespawn"), EVT_VEHICLERESPAWN},
|
||||||
{_SC("ObjectShot"), EVT_OBJECTSHOT},
|
{_SC("ObjectShot"), EVT_OBJECTSHOT},
|
||||||
|
@ -532,6 +532,7 @@ protected:
|
|||||||
SignalPair mOnSpectate;
|
SignalPair mOnSpectate;
|
||||||
SignalPair mOnUnspectate;
|
SignalPair mOnUnspectate;
|
||||||
SignalPair mOnCrashreport;
|
SignalPair mOnCrashreport;
|
||||||
|
SignalPair mOnModuleList;
|
||||||
SignalPair mOnObjectShot;
|
SignalPair mOnObjectShot;
|
||||||
SignalPair mOnObjectTouched;
|
SignalPair mOnObjectTouched;
|
||||||
SignalPair mOnPickupClaimed;
|
SignalPair mOnPickupClaimed;
|
||||||
@ -1162,6 +1163,7 @@ public:
|
|||||||
void EmitPlayerSpectate(Int32 player_id, Int32 target_player_id);
|
void EmitPlayerSpectate(Int32 player_id, Int32 target_player_id);
|
||||||
void EmitPlayerUnspectate(Int32 player_id);
|
void EmitPlayerUnspectate(Int32 player_id);
|
||||||
void EmitPlayerCrashreport(Int32 player_id, CCStr report);
|
void EmitPlayerCrashreport(Int32 player_id, CCStr report);
|
||||||
|
void EmitPlayerModuleList(Int32 player_id, CCStr list);
|
||||||
void EmitVehicleExplode(Int32 vehicle_id);
|
void EmitVehicleExplode(Int32 vehicle_id);
|
||||||
void EmitVehicleRespawn(Int32 vehicle_id);
|
void EmitVehicleRespawn(Int32 vehicle_id);
|
||||||
void EmitObjectShot(Int32 object_id, Int32 player_id, Int32 weapon_id);
|
void EmitObjectShot(Int32 object_id, Int32 player_id, Int32 weapon_id);
|
||||||
@ -1320,6 +1322,7 @@ public:
|
|||||||
SignalPair mOnPlayerSpectate;
|
SignalPair mOnPlayerSpectate;
|
||||||
SignalPair mOnPlayerUnspectate;
|
SignalPair mOnPlayerUnspectate;
|
||||||
SignalPair mOnPlayerCrashreport;
|
SignalPair mOnPlayerCrashreport;
|
||||||
|
SignalPair mOnPlayerModuleList;
|
||||||
SignalPair mOnVehicleExplode;
|
SignalPair mOnVehicleExplode;
|
||||||
SignalPair mOnVehicleRespawn;
|
SignalPair mOnVehicleRespawn;
|
||||||
SignalPair mOnObjectShot;
|
SignalPair mOnObjectShot;
|
||||||
|
@ -611,6 +611,15 @@ void Core::EmitPlayerCrashreport(Int32 player_id, CCStr report)
|
|||||||
(*mOnPlayerCrashreport.first)(_player.mObj, rep);
|
(*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)
|
void Core::EmitVehicleExplode(Int32 vehicle_id)
|
||||||
{
|
{
|
||||||
|
@ -622,6 +622,7 @@ void Core::PlayerInst::InitEvents()
|
|||||||
InitSignalPair(mOnSpectate, mEvents, "Spectate");
|
InitSignalPair(mOnSpectate, mEvents, "Spectate");
|
||||||
InitSignalPair(mOnUnspectate, mEvents, "Unspectate");
|
InitSignalPair(mOnUnspectate, mEvents, "Unspectate");
|
||||||
InitSignalPair(mOnCrashreport, mEvents, "Crashreport");
|
InitSignalPair(mOnCrashreport, mEvents, "Crashreport");
|
||||||
|
InitSignalPair(mOnModuleList, mEvents, "ModuleList");
|
||||||
InitSignalPair(mOnObjectShot, mEvents, "ObjectShot");
|
InitSignalPair(mOnObjectShot, mEvents, "ObjectShot");
|
||||||
InitSignalPair(mOnObjectTouched, mEvents, "ObjectTouched");
|
InitSignalPair(mOnObjectTouched, mEvents, "ObjectTouched");
|
||||||
InitSignalPair(mOnPickupClaimed, mEvents, "PickupClaimed");
|
InitSignalPair(mOnPickupClaimed, mEvents, "PickupClaimed");
|
||||||
@ -701,6 +702,7 @@ void Core::PlayerInst::DropEvents()
|
|||||||
ResetSignalPair(mOnSpectate);
|
ResetSignalPair(mOnSpectate);
|
||||||
ResetSignalPair(mOnUnspectate);
|
ResetSignalPair(mOnUnspectate);
|
||||||
ResetSignalPair(mOnCrashreport);
|
ResetSignalPair(mOnCrashreport);
|
||||||
|
ResetSignalPair(mOnModuleList);
|
||||||
ResetSignalPair(mOnObjectShot);
|
ResetSignalPair(mOnObjectShot);
|
||||||
ResetSignalPair(mOnObjectTouched);
|
ResetSignalPair(mOnObjectTouched);
|
||||||
ResetSignalPair(mOnPickupClaimed);
|
ResetSignalPair(mOnPickupClaimed);
|
||||||
|
@ -129,6 +129,7 @@ void Core::InitEvents()
|
|||||||
InitSignalPair(mOnPlayerSpectate, m_Events, "PlayerSpectate");
|
InitSignalPair(mOnPlayerSpectate, m_Events, "PlayerSpectate");
|
||||||
InitSignalPair(mOnPlayerUnspectate, m_Events, "PlayerUnspectate");
|
InitSignalPair(mOnPlayerUnspectate, m_Events, "PlayerUnspectate");
|
||||||
InitSignalPair(mOnPlayerCrashreport, m_Events, "PlayerCrashreport");
|
InitSignalPair(mOnPlayerCrashreport, m_Events, "PlayerCrashreport");
|
||||||
|
InitSignalPair(mOnPlayerModuleList, m_Events, "PlayerModuleList");
|
||||||
InitSignalPair(mOnVehicleExplode, m_Events, "VehicleExplode");
|
InitSignalPair(mOnVehicleExplode, m_Events, "VehicleExplode");
|
||||||
InitSignalPair(mOnVehicleRespawn, m_Events, "VehicleRespawn");
|
InitSignalPair(mOnVehicleRespawn, m_Events, "VehicleRespawn");
|
||||||
InitSignalPair(mOnObjectShot, m_Events, "ObjectShot");
|
InitSignalPair(mOnObjectShot, m_Events, "ObjectShot");
|
||||||
@ -262,6 +263,7 @@ void Core::DropEvents()
|
|||||||
ResetSignalPair(mOnPlayerSpectate);
|
ResetSignalPair(mOnPlayerSpectate);
|
||||||
ResetSignalPair(mOnPlayerUnspectate);
|
ResetSignalPair(mOnPlayerUnspectate);
|
||||||
ResetSignalPair(mOnPlayerCrashreport);
|
ResetSignalPair(mOnPlayerCrashreport);
|
||||||
|
ResetSignalPair(mOnPlayerModuleList);
|
||||||
ResetSignalPair(mOnVehicleExplode);
|
ResetSignalPair(mOnVehicleExplode);
|
||||||
ResetSignalPair(mOnVehicleRespawn);
|
ResetSignalPair(mOnVehicleRespawn);
|
||||||
ResetSignalPair(mOnObjectShot);
|
ResetSignalPair(mOnObjectShot);
|
||||||
|
@ -703,6 +703,18 @@ static void OnPlayerCrashReport(int32_t player_id, CCStr report)
|
|||||||
SQMOD_RELOAD_CHECK(false)
|
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)
|
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->OnCheckpointExited = OnCheckpointExited;
|
||||||
_Clbk->OnEntityPoolChange = OnEntityPoolChange;
|
_Clbk->OnEntityPoolChange = OnEntityPoolChange;
|
||||||
_Clbk->OnServerPerformanceReport = OnServerPerformanceReport;
|
_Clbk->OnServerPerformanceReport = OnServerPerformanceReport;
|
||||||
|
_Clbk->OnPlayerModuleList = OnPlayerModuleList;
|
||||||
// Attempt to initialize the plug-in exports
|
// Attempt to initialize the plug-in exports
|
||||||
InitExports();
|
InitExports();
|
||||||
// Dummy spacing
|
// Dummy spacing
|
||||||
|
@ -366,6 +366,7 @@ enum EventType
|
|||||||
EVT_PLAYERSPECTATE,
|
EVT_PLAYERSPECTATE,
|
||||||
EVT_PLAYERUNSPECTATE,
|
EVT_PLAYERUNSPECTATE,
|
||||||
EVT_PLAYERCRASHREPORT,
|
EVT_PLAYERCRASHREPORT,
|
||||||
|
EVT_PLAYERMODULELIST,
|
||||||
EVT_VEHICLEEXPLODE,
|
EVT_VEHICLEEXPLODE,
|
||||||
EVT_VEHICLERESPAWN,
|
EVT_VEHICLERESPAWN,
|
||||||
EVT_OBJECTSHOT,
|
EVT_OBJECTSHOT,
|
||||||
|
Loading…
Reference in New Issue
Block a user