mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
bb03f55c5c
* Add garrison and un-garrison modules * Remove unnecessary text from garrison header * Add french translations to new strings * Add changes requested by review * Change pushback to pushBack * Move garrison funcs to ai, finish headers * Remove diag log debug * Fix typos and header issues * Add missing newlines * Fix strings, Fix typos and headers * Enable debug and disable compile cache, Add trace and comments * Rebase before review * Fix default case running instead of case 3 * Fix edge case related to players being in garrison group The player would make the enableAttack checks in ungarrison and garrisonMove fail, this is now fixed. * Fix some arrays in garrsionMove and garrison * Relax distance checks in garrisonMove, change AI behaviour while pathing to aware * Add debug view * Remove unused var, fix unit pos using the wrong format * Make debug more visually pleasing * Change garrison debug target to a waypoint icon * Change disableAI event to AISection, comment out doFollow in doMove EH * Fix locality issue
58 lines
1.5 KiB
Plaintext
58 lines
1.5 KiB
Plaintext
/*
|
|
* Author: alganthe
|
|
* Used to un-garrison units.
|
|
*
|
|
* Arguments:
|
|
* 0: Units to un-garrison <ARRAY>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [unit1, unit2, unit3] call ace_ai_fnc_unGarrison
|
|
*
|
|
* Public: Yes
|
|
*
|
|
*/
|
|
#include "script_component.hpp"
|
|
|
|
params [["_units", [], [[]]]];
|
|
|
|
_units = _units select {local _x};
|
|
|
|
{
|
|
if (!isPlayer _x && {local _x}) then {
|
|
_x enableAI "PATH";
|
|
_x enableAI "FSM";
|
|
|
|
private _leader = leader _x;
|
|
|
|
TRACE_3("fnc_ungarrison: unit and leader",_x , _leader, (_leader == _x));
|
|
|
|
_x setVariable [QGVAR(garrisonned), false, true];
|
|
|
|
if (_leader != _x) then {
|
|
doStop _x;
|
|
_x doFollow _leader;
|
|
|
|
} else {
|
|
_x doMove ((nearestBuilding (getPos _x)) buildingExit 0);
|
|
};
|
|
|
|
private _fnc_countGarrisonnedUnits = {
|
|
params ["_unit", "_bool"];
|
|
if (_bool) then {
|
|
({(_x getVariable [QGVAR(garrisonned), false]) && {!isPlayer _x}} count units _unit)
|
|
} else {
|
|
({!(_x getVariable [QGVAR(garrisonned), false]) && {!isPlayer _x}} count units _unit)
|
|
};
|
|
|
|
};
|
|
|
|
if ([_x, true] call _fnc_countGarrisonnedUnits == ({!isPlayer _x} count (units _x)) - 1 || {[_x, false] call _fnc_countGarrisonnedUnits == {!isPlayer _x} count (units _x)}) then {
|
|
LOG("fnc_ungarrison: enableAttack true");
|
|
(group _x) enableAttack true;
|
|
};
|
|
};
|
|
} foreach _units;
|