Skip to content

Commit

Permalink
Fix Mechanized infantry shoots friendly units that start firing their…
Browse files Browse the repository at this point in the history
… weapon (#321)

Fix Mechanized infantry shoots friendly units that start firing their weapon
Fix Vehicles jinking to own side shooting(!)

Reference: #314

Thanks blake8090
  • Loading branch information
nk3nny authored Jun 8, 2022
1 parent 1f0db3d commit 94f5ff6
Showing 1 changed file with 3 additions and 2 deletions.
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

0 comments on commit 94f5ff6

Please sign in to comment.