Skip to content

Commit

Permalink
Fix wrong units dismounting and use distanceSqr in some assault funct…
Browse files Browse the repository at this point in the history
…ions

Fix vehicles dismounting wrong seats
Use DistanceSqr for a few more assault functions
  • Loading branch information
nk3nny committed Jan 28, 2024
1 parent 1955ff3 commit af1cd17
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion addons/danger/functions/fnc_brainVehicle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ if (_armored && {!isNull _dangerCausedBy}) exitWith {
// foot infantry support ~ unload
private _group = group _vehicle;
private _cargo = ((fullCrew [_vehicle, "cargo"]) apply {_x select 0});
_cargo append ((fullCrew [_vehicle, "turret"]) apply {_x select 0});
_cargo append ((fullCrew [_vehicle, "turret"] select {_x select 4}) apply {_x select 0});
if (
_validTarget
&& {_cargo isNotEqualTo []}
Expand Down
2 changes: 1 addition & 1 deletion addons/main/functions/GroupAction/fnc_doGroupAssault.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private _targetPos = _pos select 0;
_assaultPos = _unit getPos [20, _unit getDir _assaultPos];
};
// set movement
if (((expectedDestination _unit) select 0) distance2D _assaultPos > 1) then {
if (((expectedDestination _unit) select 0) distanceSqr _assaultPos > 1) then {
_unit doMove _assaultPos;
_unit setDestination [_assaultPos, "LEADER PLANNED", true];
};
Expand Down
10 changes: 5 additions & 5 deletions addons/main/functions/UnitAction/fnc_doAssaultSpeed.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ params ["_unit", ["_target", objNull]];

// speed
if ((behaviour _unit) isEqualTo "STEALTH") exitWith {_unit forceSpeed 1; 1};
private _distance = _unit distance2D _target;
if ((speedMode _unit) isEqualTo "FULL") exitWith {private _speed = [24, 3] select (_distance < 12); _unit forceSpeed _speed; _speed};
if (_distance > 80) exitWith {_unit forceSpeed -1; -1};
if (_distance > 6) exitWith {_unit forceSpeed 3; 3};
if (_distance > 3) exitWith {_unit forceSpeed 2; 2};
private _distanceSqr = _unit distanceSqr _target;
if ((speedMode _unit) isEqualTo "FULL") exitWith {private _speed = [24, 3] select (_distanceSqr < 144); _unit forceSpeed _speed; _speed};
if (_distanceSqr > 6400) exitWith {_unit forceSpeed -1; -1};
if (_distanceSqr > 36) exitWith {_unit forceSpeed 3; 3};
if (_distanceSqr > 9) exitWith {_unit forceSpeed 2; 2};
_unit forceSpeed 1;
1

0 comments on commit af1cd17

Please sign in to comment.