Skip to content

Commit

Permalink
Mission - Alter and update mission functions (#654)
Browse files Browse the repository at this point in the history
Co-authored-by: jonpas <[email protected]>
  • Loading branch information
Mike-MF and jonpas authored Dec 6, 2023
1 parent 2e1f1ec commit d5e8cb8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
2 changes: 2 additions & 0 deletions addons/mission/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ if (isServer) then {
GVAR(collectIntel_records) pushBack _this;
[QGVAR(collectIntel_update), [_this]] call CBA_fnc_globalEvent;
}] call CBA_fnc_addEventHandler;

GVAR(huntGroups) = [];
};

if (hasInterface) then {
Expand Down
4 changes: 2 additions & 2 deletions addons/mission/functions/fnc_contaminationGas.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* Arguments:
* 0: Marker <STRING>
* 1: Colour RGBA <ARRAY> (default: [1, 1, 0, 0.06])
* 1: Colour RGBA <ARRAY> (default: [1, 1, 0, 0.04])
* 2: Gas cloud size <NUMBER> (default: 1)
*
* Return Value:
Expand All @@ -20,7 +20,7 @@
* GVAR(gasOne) = ["MyMarker", [1, 1, 1, 0.04]] call MFUNC(contaminationGas)
*/

params ["_marker", ["_colour", [1, 1, 0, 0.06]], ["_cloudSize", 1]];
params ["_marker", ["_colour", [1, 1, 0, 0.04]], ["_cloudSize", 1]];

// Marker shape should always be either "RECTANGLE" or "ELLIPSE"
if (markerShape _marker == "") exitWith {
Expand Down
2 changes: 1 addition & 1 deletion addons/mission/functions/fnc_dialogue.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* None
*
* Example:
* ["John James", "I hate all of you.", 0, 2] call MFUNC(dialogue)
* ["John James", "I hate all of you.", "#ffffff", 2] call MFUNC(dialogue)
*/

params ["_speaker", "_message", ["_colour", "#ffffff"], ["_time", 1]];
Expand Down
11 changes: 10 additions & 1 deletion addons/mission/functions/fnc_hunt.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Author: Mike
* Has an enemy group hunt a player group.
* If no hunted group is given it will select nearest player group within a given distance and target those.
* Hunt groups are capped to a maximum of 6 for performance reasons.
*
* Call from Trigger with (isServer) check.
*
Expand All @@ -26,6 +27,13 @@ params ["_hunters", ["_refresh", 5], ["_hunted", grpNull], ["_searchDistance", 1

if (!isServer) exitWith {};

if (count GVAR(huntGroups) >= 6) exitWith {
ERROR_MSG("The maximum amount of hunt groups has been reached (6)!");
};

// Add hunter group to array.
GVAR(huntGroups) pushBack _hunters;

// Headless Blacklist
_hunters setVariable ["acex_headless_blacklist", true, true];

Expand Down Expand Up @@ -70,8 +78,9 @@ _hunters setCombatMode "RED";
// Check for alive units
private _huntersDead = {alive _x} count units _hunters == 0;

// Remove PFH.
// Remove PFH and remove group from array
if (_huntersDead) then {
GVAR(huntGroups) deleteAt (GVAR(huntGroups) find _hunters);
_handle call CBA_fnc_removePerFrameHandler;
};
}, _refresh, [_hunters, _refresh, _hunted, _searchDistance]] call CBA_fnc_addPerFrameHandler;
15 changes: 8 additions & 7 deletions addons/mission/functions/fnc_ping.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,19 @@
*
* Arguments:
* 0: Location <OBJECT>
* 1: Marker Name (must be unique unless tracking the same object) <STRING>
* 2: Global <BOOL> (default: false)
* 3: Max size of ping <NUMBER> (default: 60, max 120)
* 4: Colour <STRING> (default: "ColorRed")
* 1: Global <BOOL> (default: false)
* 2: Max size of ping <NUMBER> (default: 60, max 120)
* 3: Colour <STRING> (default: "ColorRed")
*
* Return Value:
* None
*
* Examples:
* [MyObject, "UniqueName"] call MFUNC(ping)
* [MyObject, "UniqueName", true, 70, "ColorGrey"] call MFUNC(ping)
* [MyObject] call MFUNC(ping)
* [MyObject, true, 70, "ColorGrey"] call MFUNC(ping)
*/

params ["_location", "_markerName", ["_isGlobal", false], ["_maxSize", 60], ["_colour", "ColorRed"]];
params ["_location", ["_isGlobal", false], ["_maxSize", 60], ["_colour", "ColorRed"]];

if (_maxSize > 120) exitWith {
WARNING_1("Max Size (%1) cannot be greater than 120",_maxSize);
Expand All @@ -35,6 +34,8 @@ if (_location getVariable [QGVAR(pingInProgress), false]) exitWith {
_location setVariable [QGVAR(pingInProgress), true, _isGlobal];

// Markers are synced globally with every global command. Only needs it done via PFH.
(position _location) params ["_xPos", "_yPos", "_zPos"];
private _markerName = format ["%1_%2%3%4", QUOTE(ADDON), _xPos, _yPos, _zPos];
private _marker = createMarkerLocal [_markerName, _location];
_marker setMarkerShapeLocal "ELLIPSE";
_marker setMarkerBrushLocal "Border";
Expand Down

0 comments on commit d5e8cb8

Please sign in to comment.