-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sites: Refactor and improve performance for 'stolen objects' soft lock.
- Loading branch information
1 parent
dec52c4
commit 46f90a4
Showing
5 changed files
with
92 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
mission/functions/systems/sites/fn_sites_check_standard_site_completed.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
File: fn_sites_check_standard_site_completed.sqf | ||
Author: @dijksterhuis | ||
Public: Yes | ||
Description: | ||
Standardised check for whether a site should be considered completed or not. | ||
'Standardised' here basically means typical Mike Force sites where players need | ||
to clear/destroy/spike certain objects to complete that site and progress. | ||
The check also covers the case where a player has picked up a mortar/ZPU object | ||
and walked away from the site with the advanced logistics module. Or some 'arma' | ||
happened, yeeting the object away from the site. | ||
Parameter(s): | ||
* _objectsToCheck -- [ARRAY]: the objects in the site whose presence | ||
needs to be checked | ||
* _centrepointObjectOrPos -- [OBJECT/POSITION]: centrepoint for the area search. | ||
either an object (usually the _siteStore simple | ||
object), or a position array | ||
* _checkRadius -- [NUMBER]: how far away from the site do we need to | ||
check for the objects before considering them | ||
"gone". | ||
* _checkIsRectangle -- [BOOL]: whether the search area is an ellipse | ||
(default) or rectangular | ||
Returns: | ||
true if site is completed, false otherwise | ||
Example(s): | ||
// circular area search using _storeStore object as centre | ||
[ | ||
_siteStore getVariable ["aaGuns", []], | ||
_siteStore, | ||
20 | ||
] call vn_mf_fnc_sites_check_standard_site_completed; | ||
// circular area search using some other position as centre | ||
[ | ||
_siteStore getVariable ["staticMgs", []], | ||
[0, 0, 0], | ||
10, | ||
false | ||
] call vn_mf_fnc_sites_check_standard_site_completed; | ||
// rectangular area search | ||
[ | ||
_siteStore getVariable ["mortars", []], | ||
_siteStore, | ||
5, | ||
true | ||
] call vn_mf_fnc_sites_check_standard_site_completed; | ||
*/ | ||
|
||
params [ | ||
"_objectsToCheck", | ||
"_centrepointObjectOrPos", | ||
"_checkRadius", | ||
["_checkIsRectangle", false] | ||
]; | ||
|
||
private _objectsInArea = _objectsToCheck inAreaArray [ | ||
_centrepointObjectOrPos, | ||
_checkRadius, | ||
_checkRadius, | ||
0, | ||
false | ||
]; | ||
|
||
_objectsInArea findIf {alive _x} == -1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters