Skip to content

Commit

Permalink
Merge pull request #15 from gruppe-adler/allow-expressions-in-point-t…
Browse files Browse the repository at this point in the history
…hreshold

allow sqf expressions as pointThreshold value
  • Loading branch information
Fusselwurm authored Apr 29, 2018
2 parents 77f1a13 + 2687e9a commit 01db824
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions functions/endings/fn_presetPoints.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@

params ["_winName","_presetParams"];

_presetParams params ["_side",["_pointThreshold",9999],["_timeout",99999]];
_presetParams params ["_side",["_pointThreshold", 9999, [0, ""]],["_timeout",99999]];
_side = call compile _side;

if (typeName _pointThreshold == "SCALAR") then {
_pointThreshold = str _pointThreshold;
};
_pointThreshold = compile _pointThreshold;

private _startTime = CBA_missionTime;
[{
params ["_args","_handle"];
_args params ["_winName","_side","_pointThreshold","_timeout","_startTime"];

if (CBA_missionTime - _startTime > _timeout || [_side] call grad_points_fnc_getPoints >= _pointThreshold) exitWith {
private _currentThreshold = [] call _pointThreshold;
private _sidePoints = [_side] call grad_points_fnc_getPoints;
if (
CBA_missionTime - _startTime > _timeout
|| _sidePoints >= _currentThreshold
) exitWith {
[_winName,_side] call grad_endings_fnc_presetPointsEnd;
[_handle] call CBA_fnc_removePerFrameHandler;
};
Expand Down

0 comments on commit 01db824

Please sign in to comment.