Skip to content

Commit

Permalink
Merge pull request #3114 from jaj22/fix-RC-spawning
Browse files Browse the repository at this point in the history
Fix remote-controlling players despawning rebel garrisons & civs
  • Loading branch information
Bob-Murphy authored Jan 30, 2024
2 parents 9fd39fb + 15e4e41 commit 84121b4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions A3A/addons/core/functions/Base/fn_distance.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -429,12 +429,14 @@ do
// Add in rebel-controlled UAVs
_teamplayer append (allUnitsUAV select { side group _x == teamPlayer });

// Players array is used to spawn civilians in cities and rebel garrisons, so ignore remote controlled and airborne units
_players = (allPlayers - entities "HeadlessClient_F") select {
private _veh = vehicle _x;
_x getVariable ["owner",objNull] == _x and _x == effectiveCommander _veh
and (_veh == _x or {!(_veh isKindOf "Air" and speed _veh > 50)})
};
// Players array is used to spawn civilians in cities and rebel garrisons, so ignore airborne units and translate remote-control
_players = [];
{
private _rp = _x getVariable ["owner", _x]; // real player unit in remote-control case
private _veh = vehicle _rp;
if (_rp != effectiveCommander _veh) then { continue };
if (_veh == _rp or {!(_veh isKindOf "Air" and speed _veh > 50)}) then { _players pushBack _rp };
} forEach (allPlayers - entities "HeadlessClient_F");
};

{
Expand Down

0 comments on commit 84121b4

Please sign in to comment.