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

Fixes and improves doAssaultMemory #387

Merged
merged 1 commit into from
May 5, 2024
Merged
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
2 changes: 1 addition & 1 deletion addons/danger/functions/fnc_brainAssess.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if (
private _groupMemory = (group _unit) getVariable [QEGVAR(main,groupMemory), []];

// sympathetic CQB/suppressive fire
if (_groupMemory isNotEqualTo []) exitWith {
if (_groupMemory isNotEqualTo [] && (getSuppression _unit) isEqualTo 0) exitWith {
[_unit, _groupMemory] call EFUNC(main,doAssaultMemory);
_timeout
};
Expand Down
8 changes: 7 additions & 1 deletion addons/main/functions/UnitAction/fnc_doAssaultMemory.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ _groupMemory = _groupMemory apply {_x select 2};
// get distance
private _pos = _groupMemory select 0;
private _distance2D = _unit distance2D _pos;

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

private _indoor = _unit call FUNC(isIndoor);
if (_distance2D > 20 && {!_indoor}) then {
_pos = _unit getPos [20, _unit getDir _pos];
Expand All @@ -77,7 +83,7 @@ _unit setDestination [_pos, "LEADER PLANNED", _indoor];

// update variable
if (RND(0.95)) then {_groupMemory deleteAt 0;};
_groupMemory = _groupMemory select {_unit distanceSqr _x < 25 && {[objNull, "VIEW", objNull] checkVisibility [eyePos _unit, (AGLToASL _x) vectorAdd [0, 0, 0.5]] isEqualTo 0}};
_groupMemory = _groupMemory select {_unit distanceSqr _x > 25 && {[objNull, "VIEW", objNull] checkVisibility [eyePos _unit, (AGLToASL _x) vectorAdd [0, 0, 0.5]] isEqualTo 0}};

// variables
_group setVariable [QGVAR(groupMemory), _groupMemory, false];
Expand Down
Loading