From f4d1090c0155177ae21ca51c055b60d46d1f0e2b Mon Sep 17 00:00:00 2001 From: Ken Mikkelsen Date: Wed, 8 Jun 2022 19:40:27 +0200 Subject: [PATCH] Fix Mechanized infantry shoots friendly units that start firing their weapon Fix Mechanized infantry shoots friendly units that start firing their weapon Fix Vehicles jinking to own side shooting(!) Reference: https://github.com/nk3nny/LambsDanger/issues/314 Thanks blake8090 --- addons/danger/functions/fnc_brainVehicle.sqf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/danger/functions/fnc_brainVehicle.sqf b/addons/danger/functions/fnc_brainVehicle.sqf index 36da983f..396a9dfb 100644 --- a/addons/danger/functions/fnc_brainVehicle.sqf +++ b/addons/danger/functions/fnc_brainVehicle.sqf @@ -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); @@ -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;