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

Fix Mechanized infantry shoots friendly units that start firing their… #321

Merged
merged 1 commit into from
Jun 8, 2022
Merged
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
5 changes: 3 additions & 2 deletions addons/danger/functions/fnc_brainVehicle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@ if (_armored && {!isNull _dangerCausedBy}) exitWith {

// delay + info
private _delay = 2 + random 3;
private _validTarget = (side _unit) isNotEqualTo (side _dangerCausedBy);

// vehicle jink
private _oldDamage = _vehicle getVariable [QGVAR(vehicleDamage), 0];
if (_vehicle distance _dangerCausedBy < (12 + random 15) || {damage _vehicle > _oldDamage}) exitWith {
if (_validTarget && {_vehicle distance _dangerCausedBy < (12 + random 15) || {damage _vehicle > _oldDamage}}) exitWith {
_vehicle setVariable [QGVAR(vehicleDamage), damage _vehicle];
_vehicle doWatch _dangerCausedBy;
[_unit] call EFUNC(main,doVehicleJink);
Expand All @@ -146,7 +147,7 @@ if (_armored && {!isNull _dangerCausedBy}) exitWith {

// foot infantry support
private _units = [_unit] call EFUNC(main,findReadyUnits);
if !(_units isEqualTo [] && {_unit knowsAbout _dangerCausedBy < 2}) then {
if (_validTarget && {_units isNotEqualTo []} && {_unit knowsAbout _dangerCausedBy > 2}) then {
{
_x setUnitPosWeak "MIDDLE";
_x doWatch _dangerCausedBy;
Expand Down