refactor getting alive players to function, refactor array inserts

This commit is contained in:
Eero af Heurlin 2016-07-26 11:23:07 +03:00
parent 42b41662f5
commit a984aa6203
10 changed files with 24 additions and 19 deletions

View File

@ -9,6 +9,7 @@ _centreCoords set [1, ((_centreCoords select 1) + 100 + (floor random 300))];
private _enemyPosition = _centreCoords findEmptyPosition [0,100];
// TODO: use some preconfigured fireteam setup
private _groupEnemy = createGroup east;
"O_Soldier_F" createUnit [_enemyPosition, _groupEnemy,"",0.6, "CORPORAL"];
"O_Soldier_F" createUnit [_enemyPosition, _groupEnemy,"",0.1, "PRIVATE"];

View File

@ -1,6 +1,7 @@
//diag_log format["createSquad called, _this: %1", _this];
private _spawnPos = _this select 0;
// TODO: use some preconfigured fireteam setup
private _groupTaxi = createGroup west;
"B_Soldier_F" createUnit [_spawnPos, _groupTaxi,"",0.6, "CORPORAL"];
"B_soldier_AR_F" createUnit [_spawnPos, _groupTaxi,"",0.3, "PRIVATE"];

View File

@ -29,10 +29,10 @@ class Params
class LZSize
{
//paramsArray[1]
title = "LZ Size";
values[] = {100,200,300,400,500,600,700,800,900,1000};
texts[] = {"100m","200m","300m","400m","500m","600m","700m","800m","900m","1000m"};
default = 300;
title = "LZ Size (land within X meters of center)";
values[] = {15, 25, 50, 100, 150, 200,300,400,500,600,700,800,900,1000};
texts[] = {"15m", "25m", "50m", "100m", "150m", "200m","300m","400m","500m","600m","700m","800m","900m","1000m"};
default = 100;
};
class SmokeSetting

View File

@ -0,0 +1,11 @@
private _returnValue = [];
private _justPlayers = (call BIS_fnc_listPlayers) - entities "HeadlessClient_F";
{
if (alive _x) then
{
[_returnValue, _x] call BIS_fnc_arrayPush;
};
} forEach _justPlayers;
_returnValue

View File

@ -5,7 +5,7 @@ private _returnValue = [];
{
if (!(_x call BIS_fnc_taskCompleted)) then
{
_returnValue = _returnValue + [_x];
[_returnValue, _x] call BIS_fnc_arrayPush;
};
} forEach ([_side] call getSideTasks);

View File

@ -1,8 +1,8 @@
// TODO: Rename this function, since it checks for the landing status too
//diag_log format["playerVehicleInList called, _this: %1", _this];
private _triggerList = _this select 0;
private _returnValue = false;
private _justPlayers = (call BIS_fnc_listPlayers) - entities "HeadlessClient_F";
scopeName "main";
{
private _plr = _x;
@ -12,7 +12,7 @@ scopeName "main";
_returnValue = _veh;
breakTo "main";
}
} forEach _justPlayers;
} forEach ([] call getAlivePlayers);
//diag_log format["playerVehicleInList returning: %1", _returnValue];
_returnValue

View File

@ -15,6 +15,7 @@ getSideTasks = compileFinal preProcessfile "getSideTasks.sqf";
getSideActiveTasks = compileFinal preProcessfile "getSideActiveTasks.sqf";
isLanded = compileFinal preProcessfile "isLanded.sqf";
selectLZ = compileFinal preProcessfile "selectLZ.sqf";
getAlivePlayers = compileFinal preProcessfile "getAlivePlayers.sqf";
taskSpawner = compileFinal preProcessfile "taskSpawner.sqf";
xenoRepair = compileFinal preProcessfile "xenoRepair.sqf";

View File

@ -32,7 +32,6 @@ lzList = [];
_x = 0;
while {_x < LZCOUNT} do
{
_lz = missionNamespace getVariable ("lz" + format["%1", _x + 1]);
lzList = lzList + [_lz];
[lzList, (missionNamespace getVariable (format["lz%1", _x + 1]))] call BIS_fnc_arrayPush;
_x = _x + 1;
};

View File

@ -9,7 +9,7 @@ if (!(_excludeList isEqualTo false)) then
};
private _taskLocations = [];
{
_taskLocations = _taskLocations + [([_x] call BIS_fnc_taskDestination)];
[_taskLocations, ([_x] call BIS_fnc_taskDestination)] call BIS_fnc_arrayPush;
} forEach ([west] call getSideActiveTasks);
scopeName "main";

View File

@ -8,19 +8,11 @@ scopeName "main";
while {true} do
{
scopeName "mainloop";
private _justPlayers = (call BIS_fnc_listPlayers) - entities "HeadlessClient_F";
private _alivePlayers = [];
{
if (alive _x) then
{
_alivePlayers = _alivePlayers + [_x];
};
} forEach _justPlayers;
private _alivePlayers = [] call getAlivePlayers;
while {count ([west] call getSideActiveTasks) < count _alivePlayers} do
{
scopename "spawnloop";
diag_log format["taskSpawner: active tasks: %1 players: %2", (count ([west] call getSideActiveTasks)), (count _alivePlayers)];
// TODO: Filter the list so that locations near currently active tasks are not considered
private _newLZLocation = [_lzexclude] call selectLZ;
private _plrAssigned = false;
if (_tryAssignPlr) then