Skip to content

Commit

Permalink
tweak(gamestate/server): Parse SCRIPT_ENTITY_STATE_CHANGE_EVENT
Browse files Browse the repository at this point in the history
* This game event is sent when a client tries to change state values on a remotely owned entity.
* This event can be received and parsed in ScRTs using an event-handler for 'scriptEntityStateChangeEvent'.

Revert "tweak(gamestate/server): Parse SCRIPT_ENTITY_STATE_CHANGE_EVENT"

This reverts commit 534d698.

tweak(gamestate/server):

Update ServerGameState.cpp
  • Loading branch information
tens0rfl0w committed Jun 9, 2024
1 parent 0fc6406 commit b3b2a0f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions code/components/citizen-server-impl/src/state/ServerGameState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ static bool g_networkedSoundsEnabled;
static std::shared_ptr<ConVar<bool>> g_networkedPhoneExplosionsEnabledVar;
static bool g_networkedPhoneExplosionsEnabled;

static std::shared_ptr<ConVar<bool>> g_networkedScriptEntityStatesEnabledVar;
static bool g_networkedScriptEntityStatesEnabled;

static std::shared_ptr<ConVar<int>> g_requestControlVar;
static std::shared_ptr<ConVar<int>> g_requestControlSettleVar;

Expand Down Expand Up @@ -7125,6 +7128,14 @@ std::function<bool()> fx::ServerGameState::GetGameEventHandler(const fx::ClientS
return false;
};
}

if (eventType == SCRIPT_ENTITY_STATE_CHANGE_EVENT)
{
return []()
{
return g_networkedScriptEntityStatesEnabled;
};
}
#endif

#ifdef STATE_FIVE
Expand Down Expand Up @@ -7220,6 +7231,8 @@ static InitFunction initFunction([]()

g_networkedPhoneExplosionsEnabledVar = instance->AddVariable<bool>("sv_enableNetworkedPhoneExplosions", ConVar_None, false, &g_networkedPhoneExplosionsEnabled);

g_networkedScriptEntityStatesEnabledVar = instance->AddVariable<bool>("sv_enableNetworkedScriptEntityStates", ConVar_None, true, &g_networkedScriptEntityStatesEnabled);

g_requestControlVar = instance->AddVariable<int>("sv_filterRequestControl", ConVar_None, (int)RequestControlFilterMode::NoFilter, (int*)&g_requestControlFilterState);
g_requestControlSettleVar = instance->AddVariable<int>("sv_filterRequestControlSettleTimer", ConVar_None, 30000, &g_requestControlSettleDelay);

Expand Down

0 comments on commit b3b2a0f

Please sign in to comment.