Skip to content

Commit

Permalink
Fix state machine multiplicator (#116)
Browse files Browse the repository at this point in the history
* fix state machine overclocking on headless clients
* react to smMultiplicator settings change
  • Loading branch information
Fusselwurm authored Jan 3, 2021
1 parent c3f9707 commit c9a0fbe
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
1 change: 0 additions & 1 deletion addons/activities/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ PREP(initCommonEventhandlers);
PREP(initConfig);
PREP(isInHouse);
PREP(onCivAdded);
PREP(overclockStateMachines);
PREP(reverse_abort);
PREP(reverse_internal_end);
PREP(reverse_internal_pfh);
Expand Down
1 change: 1 addition & 0 deletions addons/lifecycle/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ PREP(getGlobalCivs);
PREP(globalSpawnPass);
PREP(initHCs);
PREP(isInDistanceFromOtherPlayers);
PREP(overclockStateMachines);
PREP(sm_lifecycle);
PREP(sm_lifecycle_state_death_enter);
PREP(sm_lifecycle_state_despawn_enter);
Expand Down
13 changes: 12 additions & 1 deletion addons/lifecycle/functions/fnc_initConfig.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ private _settingsGroup = ["GRAD Civs", "2) lifecycle - performance & spawning"];
_settingsGroup,
[1, 10, 1, 0],
true,
{},
{
if (!CBA_isHeadlessClient) exitWith {};

ISNILS(GVAR(efIDs), []);
INFO_1("removing %1 previous addditional state machine ticks per frame", count GVAR(efIDs));
{
removeMissionEventHandler ["EachFrame", _x];
} forEach GVAR(efIDs);
GVAR(efIDs) = [];

[] call FUNC(overclockStateMachines);
},
false
] call CBA_fnc_addSetting;
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include "..\script_component.hpp"

ISNILS(GVAR(efIDs), []);
for "_i" from 2 to GVAR(smMultiplicator) do {

for "_i" from 2 to (round GVAR(smMultiplicator)) do {
GVAR(efIDs) pushBack (addMissionEventHandler ["EachFrame", {call cba_statemachine_fnc_clockwork}]);
};
INFO_1("CBA statemachines are running %1 more ticks per frame now", count GVAR(efIDs));

0 comments on commit c9a0fbe

Please sign in to comment.