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

Bugfix and optimizations to spawner selection #3455

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
16 changes: 8 additions & 8 deletions A3A/addons/core/functions/Base/fn_distance.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -416,15 +416,16 @@ do
{
_counter = 0;

// only count one spawner per vehicle
_occupants = units Occupants select { _x getVariable ["spawner", false] and _x == effectiveCommander vehicle _x };
_invaders = units Invaders select { _x getVariable ["spawner", false] and _x == effectiveCommander vehicle _x };
// Only count one spawner per vehicle. SimpleVM is much faster with split selects
_occupants = units Occupants select { _x getVariable ["spawner", false] } select { _x == effectiveCommander vehicle _x };
_invaders = units Invaders select { _x getVariable ["spawner", false] } select { _x == effectiveCommander vehicle _x };

// No effective-commander optimization for players because it breaks on disconnection
_teamplayer = units teamPlayer select { _x getVariable ["spawner", false] };
// Exclude players in fast-moving fixed-wing aircraft
_teamplayer = units teamPlayer select {
_teamplayer = _teamplayer select {
private _veh = vehicle _x;
_x getVariable ["spawner", false] and _x == effectiveCommander _veh
and (_veh == _x or {!(_veh isKindOf "Plane" and (!isTouchingGround _veh or speed _veh > 80))})
!(_veh isKindOf "Plane") or {isTouchingGround _veh or speed _veh < 80}
};
// Add in rebel-controlled UAVs
_teamplayer append (allUnitsUAV select { side group _x == teamPlayer });
Expand All @@ -434,8 +435,7 @@ do
{
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 };
if (!(_veh isKindOf "Air") or { speed _veh < 50 }) then { _players pushBack _rp };
} forEach (allPlayers - entities "HeadlessClient_F");
};

Expand Down