MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / ProcessPlayerLeftPluginHooks

Function ProcessPlayerLeftPluginHooks

src/openrct2/network/NetworkBase.cpp:1951–1969  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1949 }
1950
1951 static void ProcessPlayerLeftPluginHooks(uint8_t playerId)
1952 {
1953 #ifdef ENABLE_SCRIPTING
1954 using namespace OpenRCT2::Scripting;
1955
1956 auto& hookEngine = GetContext()->GetScriptEngine().GetHookEngine();
1957 if (hookEngine.HasSubscriptions(HookType::networkLeave))
1958 {
1959 auto ctx = GetContext()->GetScriptEngine().GetContext();
1960
1961 // Create event args object
1962 JSValue obj = JS_NewObject(ctx);
1963 JS_SetPropertyStr(ctx, obj, "player", JS_NewInt32(ctx, playerId));
1964
1965 // Call the subscriptions
1966 hookEngine.Call(HookType::networkLeave, obj, false);
1967 }
1968 #endif
1969 }
1970
1971 void NetworkBase::ProcessPlayerList()
1972 {

Callers 2

ProcessPlayerListMethod · 0.85

Calls 4

GetContextFunction · 0.85
HasSubscriptionsMethod · 0.80
CallMethod · 0.80
GetContextMethod · 0.45

Tested by

no test coverage detected