Skip to content

Commit

Permalink
Add modifiable clock rate for spawn attempts (#186)
Browse files Browse the repository at this point in the history
* Add slider setting for spawn rate
* Update PFH to use set spawn rate

---------

Co-authored-by: Moritz Schmidt <[email protected]>
  • Loading branch information
SpicyBagpipes and Fusselwurm authored Feb 19, 2023
1 parent 898b8d5 commit 7ae6688
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion addons/lifecycle/functions/fnc_initConfig.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ private _settingsGroup = ["GRAD Civilians", "2) lifecycle - performance & spawni
false
] call CBA_fnc_addSetting;


[
QGVAR(spawnRate),
"SLIDER",
["Spawn rate", "Spawn attempts per second"],
_settingsGroup,
[0.1, 25, 0.5, 2],
true,
{},
true
] call CBA_fnc_addSetting;


[
QGVAR(minCivOwnerFps),
"SLIDER",
Expand Down Expand Up @@ -120,7 +133,7 @@ private _settingsGroup = ["GRAD Civilians", "2) lifecycle - performance & spawni
removeMissionEventHandler ["EachFrame", _x];
} forEach GVAR(efIDs);
GVAR(efIDs) = [];

[] call FUNC(overclockStateMachines);
},
false
Expand Down
2 changes: 1 addition & 1 deletion addons/lifecycle/functions/fnc_initHCs.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ GVAR(globalSpawnHandler) = [QGVAR(globalSpawn), FUNC(localSpawnPass)] call CBA_f
[FUNC(cleanupLocalCivs), 10, []] call CBA_fnc_addPerFrameHandler;

if (isServer) then {
[FUNC(globalSpawnPass), 2, []] call CBA_fnc_addPerFrameHandler;
[FUNC(globalSpawnPass), 1 / GVAR(spawnRate), []] call CBA_fnc_addPerFrameHandler;
};

if (CBA_isHeadlessClient) then {
Expand Down

0 comments on commit 7ae6688

Please sign in to comment.