Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to brainEngage #421

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions addons/danger/functions/fnc_brainEngage.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* handles responses while engaging
*
* Arguments:
* 0: unit doing the avaluation <OBJECT>
* 0: unit doing the evaluation <OBJECT>
* 1: type of data <NUMBER>
* 2: known target <OBJECT>
*
Expand Down Expand Up @@ -32,10 +32,12 @@ private _timeout = time + 0.5;
// check
if (
isNull _target
|| {_unit knowsAbout _target isEqualTo 0}
|| {(_unit knowsAbout _target) isEqualTo 0}
|| {(speed _target) > 20}
|| {(weapons _unit) isEqualTo []}
|| {(combatMode _unit) in ["BLUE", "GREEN"]}
|| {(behaviour _unit) isEqualTo "STEALTH"}
|| {(getUnitState _unit) in ["PLANNING", "BUSY"]}
) exitWith {
_timeout + 1
};
Expand Down Expand Up @@ -72,7 +74,7 @@ if (
_posASL set [2, 0.5];
_posASL = AGLToASL _posASL
};
_unit forceSpeed 0;
_unit forceSpeed 1;
_unit suppressFor 4;
[_unit, _posASL vectorAdd [0, 0, 0.8], true] call EFUNC(main,doSuppress);
_timeout + 4
Expand Down
6 changes: 6 additions & 0 deletions addons/main/functions/UnitAction/fnc_doAssault.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ private _pos = call {
getPosATL _unit
};

// forget targets when too close
if (_unit distance2D _getHide < 1.7) then {
_unit forgetTarget _target;
};

// select target location
_doMove = true;
_getHide
Expand All @@ -62,6 +67,7 @@ private _pos = call {
private _group = group _unit;
private _groupMemory = _group getVariable [QGVAR(groupMemory), []];
if (_groupMemory isEqualTo []) then {
_buildings pushBack _getHide;
_group setVariable [QGVAR(groupMemory), _buildings];
};
};
Expand Down
4 changes: 2 additions & 2 deletions addons/main/functions/UnitAction/fnc_doAssaultMemory.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
params ["_unit", ["_groupMemory", []]];

// check if stopped
if (!(_unit checkAIFeature "PATH")) exitWith {false};
if (!(_unit checkAIFeature "PATH") || {(getUnitState _unit) isEqualTo "PLANNING"}) exitWith {false};

// check it
private _group = group _unit;
Expand Down Expand Up @@ -54,7 +54,7 @@ private _pos = _groupMemory select 0;
private _distance2D = _unit distance2D _pos;

// check for nearby enemy
if (_unit distance2D _nearestEnemy < _distance2D) exitWith {
if (_unit distance2D (_unit getHideFrom _nearestEnemy) < _distance2D) exitWith {
[_unit, _nearestEnemy, 12, true] call FUNC(doAssault);
};

Expand Down
Loading