Replaced `BIS_fnc_conditionalSelect` with sensible `select`

This commit is contained in:
Wyqer 2019-05-05 13:33:07 +02:00
parent d5907c1df4
commit 5528589527
No known key found for this signature in database
GPG Key ID: D7E2F8BD7F1E48FA
40 changed files with 199 additions and 181 deletions

View File

@ -116,17 +116,17 @@ KP_liberation_storage_buildings = [KP_liberation_small_storage_building,KP_liber
KP_liberation_crates = [KP_liberation_supply_crate,KP_liberation_ammo_crate,KP_liberation_fuel_crate];
KP_liberation_upgrade_buildings = [KP_liberation_recycle_building,KP_liberation_air_vehicle_building,KP_liberation_heli_slot_building,KP_liberation_plane_slot_building];
KP_liberation_air_slots = [KP_liberation_heli_slot_building,KP_liberation_plane_slot_building];
militia_squad = [militia_squad, {[_x] call F_checkClass}] call BIS_fnc_conditionalSelect;
militia_vehicles = [militia_vehicles, {[_x] call F_checkClass}] call BIS_fnc_conditionalSelect;
opfor_vehicles = [opfor_vehicles, {[_x] call F_checkClass}] call BIS_fnc_conditionalSelect;
opfor_vehicles_low_intensity = [opfor_vehicles_low_intensity, {[_x] call F_checkClass}] call BIS_fnc_conditionalSelect;
opfor_battlegroup_vehicles = [opfor_battlegroup_vehicles, {[_x] call F_checkClass}] call BIS_fnc_conditionalSelect;
opfor_battlegroup_vehicles_low_intensity = [opfor_battlegroup_vehicles_low_intensity, {[_x] call F_checkClass}] call BIS_fnc_conditionalSelect;
opfor_troup_transports = [opfor_troup_transports, {[_x] call F_checkClass}] call BIS_fnc_conditionalSelect;
opfor_choppers = [opfor_choppers, {[_x] call F_checkClass}] call BIS_fnc_conditionalSelect;
opfor_air = [opfor_air, {[_x] call F_checkClass}] call BIS_fnc_conditionalSelect;
civilians = [civilians, {[_x] call F_checkClass}] call BIS_fnc_conditionalSelect;
civilian_vehicles = [civilian_vehicles, {[_x] call F_checkClass}] call BIS_fnc_conditionalSelect;
militia_squad = militia_squad select {[_x] call F_checkClass};
militia_vehicles = militia_vehicles select {[_x] call F_checkClass};
opfor_vehicles = opfor_vehicles select {[_x] call F_checkClass};
opfor_vehicles_low_intensity = opfor_vehicles_low_intensity select {[_x] call F_checkClass};
opfor_battlegroup_vehicles = opfor_battlegroup_vehicles select {[_x] call F_checkClass};
opfor_battlegroup_vehicles_low_intensity = opfor_battlegroup_vehicles_low_intensity select {[_x] call F_checkClass};
opfor_troup_transports = opfor_troup_transports select {[_x] call F_checkClass};
opfor_choppers = opfor_choppers select {[_x] call F_checkClass};
opfor_air = opfor_air select {[_x] call F_checkClass};
civilians = civilians select {[_x] call F_checkClass};
civilian_vehicles = civilian_vehicles select {[_x] call F_checkClass};
military_alphabet = ["Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Golf","Hotel","India","Juliet","Kilo","Lima","Mike","November","Oscar","Papa","Quebec","Romeo","Sierra","Tango","Uniform","Victor","Whiskey","X-Ray","Yankee","Zulu"];
land_vehicles_classnames = (opfor_vehicles + militia_vehicles);
opfor_squad_8_standard = [opfor_squad_leader,opfor_team_leader,opfor_machinegunner,opfor_heavygunner,opfor_medic,opfor_marksman,opfor_grenadier,opfor_rpg];
@ -150,8 +150,8 @@ zeropos = [0,0,0];
squads_names = [localize "STR_LIGHT_RIFLE_SQUAD", localize "STR_RIFLE_SQUAD", localize "STR_AT_SQUAD", localize "STR_AA_SQUAD", localize "STR_RECON_SQUAD", localize "STR_PARA_SQUAD"];
ammobox_transports_typenames = [];
{ammobox_transports_typenames pushback (_x select 0)} foreach box_transport_config;
ammobox_transports_typenames = [ammobox_transports_typenames, {[_x] call F_checkClass}] call BIS_fnc_conditionalSelect;
elite_vehicles = [elite_vehicles, {[_x] call F_checkClass}] call BIS_fnc_conditionalSelect;
ammobox_transports_typenames = ammobox_transports_typenames select {[_x] call F_checkClass};
elite_vehicles = elite_vehicles select {[_x] call F_checkClass};
opfor_infantry = [opfor_sentry,opfor_rifleman,opfor_grenadier,opfor_squad_leader,opfor_team_leader,opfor_marksman,opfor_machinegunner,opfor_heavygunner,opfor_medic,opfor_rpg,opfor_at,opfor_aa,opfor_officer,opfor_sharpshooter,opfor_sniper,opfor_engineer];
GRLIB_intel_file = "Land_File1_F";
GRLIB_intel_laptop = "Land_Laptop_device_F";

View File

@ -46,9 +46,19 @@ while {true} do {
_fobdistance = player distance _nearfob;
};
if (KP_liberation_mobilearsenal) then {KP_liberation_neararsenal = [ ( (getpos player) nearobjects [ Arsenal_typename, _distarsenal ]), { getObjectType _x >= 8 } ] call BIS_fnc_conditionalSelect;} else {KP_liberation_neararsenal = [];};
_nearfobbox = ( (getpos player) nearEntities [ [ FOB_box_typename, FOB_truck_typename ] , _distbuildfob ] );
if (KP_liberation_mobilerespawn) then {KP_liberation_nearspawn = ( (getpos player) nearEntities [ [ Respawn_truck_typename, huron_typename ] , _distspawn ] );} else {KP_liberation_nearspawn = [];};
if (KP_liberation_mobilearsenal) then {
KP_liberation_neararsenal = ((getpos player) nearobjects [Arsenal_typename, _distarsenal]) select {getObjectType _x >= 8};
} else {
KP_liberation_neararsenal = [];
};
_nearfobbox = ((getpos player) nearEntities [[FOB_box_typename, FOB_truck_typename], _distbuildfob]);
if (KP_liberation_mobilerespawn) then {
KP_liberation_nearspawn = ((getpos player) nearEntities [[Respawn_truck_typename, huron_typename], _distspawn]);
} else {
KP_liberation_nearspawn = [];
};
if (GRLIB_removefobboxes) then {
GRLIB_removefobboxes = false;

View File

@ -22,13 +22,13 @@ if (((typeOf _vehtorecycle) in _building_classnames) ||
_ammoMulti = 0.5;
_fuelMulti = 0.5;
} else {
_currentAmmo = 0;
_currentAmmo = 0;
_allAmmo = 0;
if (count (magazinesAmmo _vehtorecycle) > 0) then {
{
_currentAmmo = _currentAmmo + (_x select 1);
{
_currentAmmo = _currentAmmo + (_x select 1);
_allAmmo = _allAmmo + (getNumber(configFile >> "CfgMagazines" >> (_x select 0) >> "count"));
} forEach (magazinesAmmo _vehtorecycle);
} forEach (magazinesAmmo _vehtorecycle);
} else {
_allAmmo = 1;
};
@ -60,7 +60,7 @@ if ((typeOf _vehtorecycle) in all_hostile_classnames) then {
_price_f = round (150 * _fuelMulti);
};
} else {
_objectinfo = ([(light_vehicles + heavy_vehicles + air_vehicles + static_vehicles + support_vehicles + buildings), {(typeOf _vehtorecycle) == (_x select 0)}] call BIS_fnc_conditionalSelect) select 0;
_objectinfo = ((light_vehicles + heavy_vehicles + air_vehicles + static_vehicles + support_vehicles + buildings) select {(typeOf _vehtorecycle) == (_x select 0)}) select 0;
_disName = getText (_cfg >> (_objectinfo select 0) >> "displayName");
_price_s = round ((_objectinfo select 1) * GRLIB_recycling_percentage * _suppMulti);
_price_a = round ((_objectinfo select 2) * GRLIB_recycling_percentage * _ammoMulti);
@ -83,12 +83,12 @@ if ( dialog ) then { closeDialog 0 };
if (_vehtorecycle getVariable ["KP_liberation_preplaced", false]) exitWith {hint localize "STR_PREPLACED_ERROR";};
if ( dorecycle == 1 && !(isnull _vehtorecycle) && alive _vehtorecycle) then {
_nearfob = [] call F_getNearestFob;
if (!(KP_liberation_recycle_building_near) && ((_price_s + _price_a + _price_f) > 0)) exitWith {hint localize "STR_NORECBUILDING_ERROR";};
_storage_areas = [_nearfob nearobjects (GRLIB_fob_range * 2), {(_x getVariable ["KP_liberation_storage_type",-1]) == 0}] call BIS_fnc_conditionalSelect;
_storage_areas = (_nearfob nearobjects (GRLIB_fob_range * 2)) select {(_x getVariable ["KP_liberation_storage_type",-1]) == 0};
_supplyCrates = ceil (_price_s / 100);
_ammoCrates = ceil (_price_a / 100);

View File

@ -20,7 +20,7 @@ if ( dorepackage > 0 ) then {
publicVariable "GRLIB_all_fobs";
};
{ deleteVehicle _x } foreach ( [ ( (getpos player) nearobjects [ FOB_typename, 250 ] ) , { getObjectType _x >= 8 } ] call BIS_fnc_conditionalSelect );
{deleteVehicle _x} foreach (((getpos player) nearobjects [ FOB_typename, 250 ]) select {getObjectType _x >= 8});
sleep 0.5;
@ -41,4 +41,4 @@ if ( dorepackage > 0 ) then {
hint localize "STR_FOB_REPACKAGE_HINT";
};
};

View File

@ -22,20 +22,18 @@ while {true} do {
waitUntil {sleep 2; (player distance ([] call F_getNearestFob)) < GRLIB_fob_range};
if ([player, 4] call F_fetchPermission) then {
private _detected_vehicles = [
(getPos player) nearObjects veh_action_detect_distance, {
(((typeof _x in _recycleable_classnames ) && (({alive _x} count (crew _x)) == 0 || (unitIsUAV _x)) && ((locked _x == 0 || locked _x == 1))) ||
((typeOf _x) in _building_classnames) ||
(((typeOf _x) in KP_liberation_storage_buildings) && ((_x getVariable ["KP_liberation_storage_type",-1]) == 0)) ||
((typeOf _x) in KP_liberation_upgrade_buildings) ||
((typeOf _x) in KP_liberation_ace_crates)) &&
(alive _x) &&
((count(attachedObjects _x) == 0) || ((typeOf _x) == "rhsusf_mkvsoc")) &&
(_x distance startbase > 1000) &&
(_x distance ( [] call F_getNearestFob) < GRLIB_fob_range) &&
(getObjectType _x >= 8)
}
] call BIS_fnc_conditionalSelect;
private _detected_vehicles = (getPos player) nearObjects veh_action_detect_distance select {
(((typeof _x in _recycleable_classnames ) && (({alive _x} count (crew _x)) == 0 || (unitIsUAV _x)) && ((locked _x == 0 || locked _x == 1))) ||
((typeOf _x) in _building_classnames) ||
(((typeOf _x) in KP_liberation_storage_buildings) && ((_x getVariable ["KP_liberation_storage_type",-1]) == 0)) ||
((typeOf _x) in KP_liberation_upgrade_buildings) ||
((typeOf _x) in KP_liberation_ace_crates)) &&
(alive _x) &&
((count(attachedObjects _x) == 0) || ((typeOf _x) == "rhsusf_mkvsoc")) &&
(_x distance startbase > 1000) &&
(_x distance ( [] call F_getNearestFob) < GRLIB_fob_range) &&
(getObjectType _x >= 8)
};
{
private _next_vehicle = _x;

View File

@ -7,7 +7,11 @@ while { true } do {
if ( [ player, 5 ] call F_fetchPermission ) then {
_detected_vehicles = [ (getpos player) nearEntities [["Tank","APC","IFV","Car"], veh_action_distance] , { (count crew _x) == 0 && ((locked _x == 0 || locked _x == 1)) && (_x distance startbase > 1000) } ] call BIS_fnc_conditionalSelect;
_detected_vehicles = ((getpos player) nearEntities [["Tank","APC","IFV","Car"], veh_action_distance]) select {
(count crew _x) == 0 &&
((locked _x == 0 || locked _x == 1)) &&
(_x distance startbase > 1000)
};
{
_next_vehicle = _x;

View File

@ -2,7 +2,7 @@ params [ "_ammobox", ["_max_transport_distance", 15] ];
private [ "_neartransporttrucks", "_truck_to_load", "_truck_load", "_next_truck", "_maxload", "_i" ];
_maxload = 3;
_neartransporttrucks = [ ((getpos _ammobox) nearEntities [ ammobox_transports_typenames, _max_transport_distance]), { alive _x && speed _x < 5 && ((getpos _x) select 2) < 5 } ] call BIS_fnc_conditionalSelect;
_neartransporttrucks = ((getpos _ammobox) nearEntities [ ammobox_transports_typenames, _max_transport_distance]) select {alive _x && speed _x < 5 && ((getpos _x) select 2) < 5};
_truck_to_load = objNull;

View File

@ -32,7 +32,7 @@ waitUntil { sleep 5;
if ( !_is_near_blufor ) then {
{
if ((_x distance _unit) < 100) exitWith { _is_near_blufor = true };
} foreach ( [ allUnits, { !(((typeof _x) in opfor_infantry) || ((typeof _x) in militia_squad)) } ] call BIS_fnc_conditionalSelect );
} foreach (allUnits select {!(((typeof _x) in opfor_infantry) || ((typeof _x) in militia_squad))});
};
!alive _unit || !(_is_near_blufor) || (_is_near_fob && (vehicle _unit == _unit))
@ -83,4 +83,4 @@ if (alive _unit) then {
};
};
};
};
};

View File

@ -41,12 +41,12 @@ while { cinematic_camera_started } do {
};
if ( GRLIB_endgame == 0 ) then {
_activeplayers = ( [ allPlayers , { alive _x && ( _x distance ( getmarkerpos GRLIB_respawn_marker ) ) > 100 } ] call BIS_fnc_conditionalSelect );
if ( count _activeplayers > 0 ) then {
for [ {_idx=0},{_idx < 3},{_idx=_idx+1} ] do {
_positions pushback (getpos (selectRandom _activeplayers));
};
};
_activeplayers = (allPlayers select {alive _x && (_x distance (getmarkerpos GRLIB_respawn_marker)) > 100});
if ( count _activeplayers > 0 ) then {
for [ {_idx=0},{_idx < 3},{_idx=_idx+1} ] do {
_positions pushback (getpos (selectRandom _activeplayers));
};
};
};
};
@ -58,11 +58,11 @@ while { cinematic_camera_started } do {
if ( first_camera_round ) then {
_camtarget = startbase;
} else {
if ( count ( [ _nearentities , { alive _x && isPlayer _x } ] call BIS_fnc_conditionalSelect ) != 0 ) then {
_camtarget = selectRandom ([_nearentities, {alive _x && isPlayer _x}] call BIS_fnc_conditionalSelect);
if (count (_nearentities select {alive _x && isPlayer _x}) != 0) then {
_camtarget = selectRandom (_nearentities select {alive _x && isPlayer _x});
} else {
if ( count ( [ _nearentities , { alive _x } ] call BIS_fnc_conditionalSelect ) != 0 ) then {
_camtarget = selectRandom ([_nearentities, {alive _x}] call BIS_fnc_conditionalSelect);
if (count (_nearentities select { alive _x }) != 0) then {
_camtarget = selectRandom (_nearentities select {alive _x});
};
};
};
@ -256,7 +256,7 @@ while { cinematic_camera_started } do {
if ( _nearest_sector != "" ) then {
_nearest_sector = markertext _nearest_sector;
} else {
_nearfobs = [ GRLIB_all_fobs, { _x distance _position < 300 } ] call BIS_fnc_conditionalSelect;
_nearfobs = GRLIB_all_fobs select {_x distance _position < 300};
if ( count _nearfobs > 0 ) then {
_nearest_sector = format [ "FOB %1", military_alphabet select ( GRLIB_all_fobs find ( _nearfobs select 0 ) ) ];
};

View File

@ -84,27 +84,27 @@ while { true } do {
_overlayshown = false;
_first_iteration = true;
};
_nearfob = [] call F_getNearestFob;
_fobdistance = 9999;
_actual_fob = [];
if ( count _nearfob == 3 ) then {
_fobdistance = player distance _nearfob;
_actual_fob = [KP_liberation_fob_resources, {((_x select 0) distance _nearfob) < GRLIB_fob_range}] call BIS_fnc_conditionalSelect;
_actual_fob = KP_liberation_fob_resources select {((_x select 0) distance _nearfob) < GRLIB_fob_range};
};
if (_fobdistance < _distfob) then {
_resources = true;
if (KP_liberation_resources_global) then {
_resource_area = localize "STR_RESOURCE_GLOBAL";
KP_liberation_supplies = KP_liberation_supplies_global;
KP_liberation_ammo = KP_liberation_ammo_global;
KP_liberation_fuel = KP_liberation_fuel_global;
KP_liberation_fuel = KP_liberation_fuel_global;
} else {
_resource_area = toUpper ([_nearfob] call F_getFobName);
KP_liberation_supplies = ((_actual_fob select 0) select 1);
KP_liberation_ammo = ((_actual_fob select 0) select 2);
KP_liberation_fuel = ((_actual_fob select 0) select 3);
KP_liberation_fuel = ((_actual_fob select 0) select 3);
};
KP_liberation_air_vehicle_building_near = ((_actual_fob select 0) select 4);
KP_liberation_recycle_building_near = ((_actual_fob select 0) select 5);
@ -116,7 +116,7 @@ while { true } do {
KP_liberation_air_vehicle_building_near = false;
KP_liberation_recycle_building_near = false;
};
if ( _overlayshown) then {
((uiNamespace getVariable 'GUI_OVERLAY') displayCtrl (266)) ctrlSetText format [ "%1", GRLIB_ui_notif ];
@ -142,7 +142,7 @@ while { true } do {
if (isNil "KP_liberation_supplies") then {KP_liberation_supplies = 0;};
if (isNil "KP_liberation_ammo") then {KP_liberation_ammo = 0;};
if (isNil "KP_liberation_fuel") then {KP_liberation_fuel = 0;};
if ((_uiticks % 5 == 0) || _notNearFOB) then {
((uiNamespace getVariable 'GUI_OVERLAY') displayCtrl (758004)) ctrlSetText format ["%1", _resource_area];
@ -178,7 +178,7 @@ while { true } do {
{((uiNamespace getVariable 'GUI_OVERLAY') displayCtrl (_x)) ctrlShow false;} foreach _resourcescontrols;
_notNearFOB = true;
};
if ( _uiticks % 25 == 0 ) then {
if (!isNil "active_sectors" && ( [] call F_opforCap >= GRLIB_sector_cap)) then {
@ -245,4 +245,4 @@ while { true } do {
_uiticks = _uiticks + 1;
if ( _uiticks > 1000 ) then { _uiticks = 0 };
uiSleep 0.25;
};
};

View File

@ -7,21 +7,21 @@ KP_liberation_asymmetric_sectors = [];
while {GRLIB_endgame == 0} do {
private _sectors_to_remove = [];
{
if (!(_x in blufor_sectors) || (KP_liberation_civ_rep > -25)) then {
_sectors_to_remove pushBack _x;
};
} forEach KP_liberation_asymmetric_sectors;
KP_liberation_asymmetric_sectors = KP_liberation_asymmetric_sectors - _sectors_to_remove;
if (KP_liberation_civ_rep <= -25) then {
if (KP_liberation_civ_rep <= -25) then {
{
private _sector = _x;
private _blocked = false;
private _units_at_sector = [getmarkerpos _sector, GRLIB_sector_size, GRLIB_side_friendly] call F_getUnitsCount;
{
if ((_x select 0) == _sector) exitWith {
if ((((_x select 1) + 1800) < time) && (_units_at_sector == 0)) then {
@ -33,7 +33,7 @@ while {GRLIB_endgame == 0} do {
};
};
} forEach asymm_blocked_sectors;
if ((_units_at_sector > 0) && !(_sector in KP_liberation_asymmetric_sectors) && !_blocked) then {
KP_liberation_asymmetric_sectors pushBack _sector;
@ -54,7 +54,7 @@ while {GRLIB_endgame == 0} do {
if (!(_units_at_sector > 0) && (_sector in KP_liberation_asymmetric_sectors)) then {
KP_liberation_asymmetric_sectors = KP_liberation_asymmetric_sectors - [_sector];
};
} forEach ([(sectors_capture + sectors_bigtown), {_x in blufor_sectors}] call BIS_fnc_conditionalSelect);
} forEach ((sectors_capture + sectors_bigtown) select {_x in blufor_sectors});
};
publicVariable "KP_liberation_asymmetric_sectors";
publicVariable "asymm_blocked_sectors";

View File

@ -31,8 +31,8 @@ if (!(isnull _roadobj)) then {
if (KP_liberation_asymmetric_debug > 0) then {private _text = format ["[KP LIBERATION] [ASYMMETRIC] manage_asymIED.sqf -> IED %1 spawned at %2", _count, markerText _sector];_text remoteExec ["diag_log",2];};
while {(_sector in KP_liberation_asymmetric_sectors) && (mineActive _ied_obj) && !_goes_boom} do {
_nearinfantry = [(getpos _ied_obj) nearEntities ["Man", _activation_radius_infantry] , {side _x == GRLIB_side_friendly}] call BIS_fnc_conditionalSelect;
_nearvehicles = [(getpos _ied_obj) nearEntities [["Car", "Tank", "Air"], _activation_radius_vehicles] , {side _x == GRLIB_side_friendly}] call BIS_fnc_conditionalSelect;
_nearinfantry = ((getpos _ied_obj) nearEntities ["Man", _activation_radius_infantry]) select {side _x == GRLIB_side_friendly};
_nearvehicles = ((getpos _ied_obj) nearEntities [["Car", "Tank", "Air"], _activation_radius_vehicles]) select {side _x == GRLIB_side_friendly};
if (count _nearinfantry >= _infantry_trigger || count _nearvehicles >= _vehicle_trigger) then {
_ied_obj setDamage 1;
stats_ieds_detonated = stats_ieds_detonated + 1; publicVariable "stats_ieds_detonated";

View File

@ -4,7 +4,7 @@ if (KP_liberation_asymmetric_debug > 0) then {private _text = format ["[KP LIBER
waitUntil {sleep 1; _sector in KP_liberation_asymmetric_sectors};
private _buildings = [nearestObjects [(markerPos _sector), ["House"], 75], {(alive _x) && !((typeOf _x) in KP_liberation_cr_ign_buildings)}] call BIS_fnc_conditionalSelect;
private _buildings = (nearestObjects [(markerPos _sector), ["House"], 75]) select {(alive _x) && !((typeOf _x) in KP_liberation_cr_ign_buildings)};
private _positions = [];
{
_positions = _positions + ([_x] call BIS_fnc_buildingPositions);
@ -45,7 +45,7 @@ while {(_sector in KP_liberation_asymmetric_sectors) && (!isNull _grp)} do {
} forEach (units _grp);
(units _grp) doFollow (leader _grp);
_grp setBehaviour "COMBAT";
_grp setCombatMode "RED";
_grp setCombatMode "RED";
private _waypoint = _grp addWaypoint [markerpos _sector, 20];
_waypoint setWaypointType "SAD";
_waypoint setWaypointSpeed "FULL";

View File

@ -16,7 +16,7 @@ while {true} do {
if (KP_liberation_civinfo_debug > 0) then {private _text = "[KP LIBERATION] [CIVINFO] Informant waitUntil passed";_text remoteExec ["diag_log",2];};
if ((KP_liberation_civinfo_chance >= (random 100)) && GRLIB_endgame == 0) then {
private _sector = selectRandom ([blufor_sectors, {_x in sectors_capture || _x in sectors_bigtown}] call BIS_fnc_conditionalSelect);
private _sector = selectRandom (blufor_sectors select {_x in sectors_capture || _x in sectors_bigtown});
private _house = (nearestObjects [[((getMarkerPos _sector select 0) - 100 + (random 200)), ((getMarkerPos _sector select 1) - 100 + (random 200))],["House", "Building"], 100]) select 0;
private _grp = createGroup [GRLIB_side_civilian, true];

View File

@ -1,6 +1,6 @@
sleep 5;
_blufor_bigtowns = [ blufor_sectors, { _x in sectors_bigtown } ] call BIS_fnc_conditionalSelect;
_blufor_bigtowns = blufor_sectors select {_x in sectors_bigtown};
if ( count _blufor_bigtowns == count sectors_bigtown ) then {
GRLIB_endgame = 1;
@ -43,4 +43,4 @@ if ( count _blufor_bigtowns == count sectors_bigtown ) then {
{ if ( !(isPlayer _x)) then { deleteVehicle _x } } foreach allUnits;
};
};

View File

@ -458,8 +458,8 @@ if (count GRLIB_vehicle_to_military_base_links == 0) then {
private _assigned_vehicles = [];
while {count _assigned_bases < count sectors_military && count _assigned_vehicles < count elite_vehicles} do {
private _nextbase = selectRandom ([sectors_military, {!(_x in _assigned_bases)}] call BIS_fnc_conditionalSelect);
private _nextvehicle = selectRandom ([elite_vehicles, {!(_x in _assigned_vehicles)}] call BIS_fnc_conditionalSelect);
private _nextbase = selectRandom (sectors_military select {!(_x in _assigned_bases)});
private _nextvehicle = selectRandom (elite_vehicles select {!(_x in _assigned_vehicles)});
_assigned_bases pushback _nextbase;
_assigned_vehicles pushback _nextvehicle;
GRLIB_vehicle_to_military_base_links pushback [_nextvehicle, _nextbase];
@ -501,19 +501,19 @@ while {true} do {
private _all_storages = [];
{
private _fobpos = _x;
private _nextbuildings = [_fobpos nearobjects (GRLIB_fob_range * 2), {
private _nextbuildings = (_fobpos nearobjects (GRLIB_fob_range * 2)) select {
((typeof _x) in _classnames_to_save ) &&
(alive _x) && // Exclude dead or broken objects
(speed _x < 5) && // Exclude moving objects (like civilians driving through)
(isNull attachedTo _x) && // Exclude attachTo'd objects
(((getpos _x) select 2) < 10) && // Exclude hovering helicopters and the like
(getObjectType _x >= 8) && // Exclude preplaced terrain objects
(alive _x) && // Exclude dead or broken objects
(speed _x < 5) && // Exclude moving objects (like civilians driving through)
(isNull attachedTo _x) && // Exclude attachTo'd objects
(((getpos _x) select 2) < 10) && // Exclude hovering helicopters and the like
(getObjectType _x >= 8) && // Exclude preplaced terrain objects
!((typeOf _x) in KP_liberation_crates) && // Exclude storage crates (those are handled separately)
!(_x getVariable ["KP_liberation_preplaced", false])
}] call BIS_fnc_conditionalSelect;
};
_all_buildings = [(_all_buildings + _nextbuildings), {!((typeOf _x) in KP_liberation_storage_buildings)}] call BIS_fnc_conditionalSelect;
_all_storages = [(_all_storages + _nextbuildings), {(_x getVariable ["KP_liberation_storage_type",-1]) == 0}] call BIS_fnc_conditionalSelect;
_all_buildings = (_all_buildings + _nextbuildings) select {!((typeOf _x) in KP_liberation_storage_buildings)};
_all_storages = (_all_storages + _nextbuildings) select {(_x getVariable ["KP_liberation_storage_type",-1]) == 0};
{
private _nextgroup = _x;

View File

@ -1,34 +1,35 @@
private [ "_blufor_ai_groups", "_localgroup", "_is_ai_only", "_commander" ];
while {GRLIB_endgame == 0} do {
private _commander = [] call F_getCommander;
while { GRLIB_endgame == 0 } do {
if !(isNull _commander) then {
private _blufor_ai_groups = [];
private _localgroup = grpNull;
private _is_ai_only = true;
_commander = [] call F_getCommander;
{
if (side _x == GRLIB_side_friendly) then {
_localgroup = _x;
_is_ai_only = true;
if ( !(isNull _commander ) ) then {
{
if (isPlayer _x) exitWith {_is_ai_only = false;};
} foreach units _localgroup;
_blufor_ai_groups = [];
if (_is_ai_only) then {
_blufor_ai_groups pushback _localgroup;
};
{
if ( side _x == GRLIB_side_friendly ) then {
_localgroup = _x;
_is_ai_only = true;
};
} foreach (allGroups select {groupOwner _x != owner _commander});
{ if ( isPlayer _x ) then { _is_ai_only = false; }; } foreach units _localgroup;
if ( _is_ai_only ) then { _blufor_ai_groups pushback _localgroup };
};
} foreach ( [ allGroups, { groupOwner _x != owner _commander } ] call BIS_fnc_conditionalSelect );
if ( count _blufor_ai_groups > 0 ) then {
{
if ( ( ( leader _x ) distance startbase ) > 500 && ( groupOwner _x != owner _commander ) ) then {
_x setGroupOwner (owner _commander);
sleep 1;
};
} foreach _blufor_ai_groups;
};
};
sleep 15;
};
if (count _blufor_ai_groups > 0) then {
{
if (((leader _x) distance startbase) > 500 && (groupOwner _x != owner _commander)) then {
_x setGroupOwner (owner _commander);
sleep 1;
};
} foreach _blufor_ai_groups;
};
};
sleep 15;
};

View File

@ -4,7 +4,7 @@ params ["_index", "_nearfob", "_clientID", "_supplies", "_ammo", "_fuel"];
logiError = 0;
private _storage_areas = [_nearfob nearobjects (GRLIB_fob_range * 2), {(_x getVariable ["KP_liberation_storage_type",-1]) == 0}] call BIS_fnc_conditionalSelect;
private _storage_areas = (_nearfob nearobjects (GRLIB_fob_range * 2)) select {(_x getVariable ["KP_liberation_storage_type",-1]) == 0};
if ((count _storage_areas) == 0) exitWith {(localize "STR_LOGISTIC_CANTAFFORD") remoteExec ["hint",_clientID]; logiError = 1; _clientID publicVariableClient "logiError";};
@ -15,7 +15,7 @@ private _price_f = 100;
if ((_price_s > _supplies) || (_price_a > _ammo) || (_price_f > _fuel)) exitWith {(localize "STR_LOGISTIC_CANTAFFORD") remoteExec ["hint",_clientID]; logiError = 1; _clientID publicVariableClient "logiError";};
{
private _storage_positions = [];
private _storedCrates = (attachedObjects _x);
@ -25,7 +25,7 @@ if ((_price_s > _supplies) || (_price_a > _ammo) || (_price_f > _fuel)) exitWith
private _crateValue = _x getVariable ["KP_liberation_crate_value",0];
switch ((typeOf _x)) do {
case KP_liberation_supply_crate: {
case KP_liberation_supply_crate: {
if (_price_s > 0) then {
if (_crateValue > _price_s) then {
_crateValue = _crateValue - _price_s;
@ -67,7 +67,7 @@ if ((_price_s > _supplies) || (_price_a > _ammo) || (_price_f > _fuel)) exitWith
default {diag_log format ["[KP LIBERATION] [ERROR] Invalid object (%1) at storage area", (typeOf _x)];};
};
} forEach _storedCrates;
switch (typeOf _x) do {
case KP_liberation_small_storage_building: {_storage_positions = KP_liberation_small_storage_positions;};
case KP_liberation_large_storage_building: {_storage_positions = KP_liberation_large_storage_positions;};
@ -90,7 +90,7 @@ if ((_price_s > _supplies) || (_price_a > _ammo) || (_price_f > _fuel)) exitWith
} forEach attachedObjects (_x);
if ((_price_s == 0) && (_price_a == 0) && (_price_f == 0)) exitWith {};
} forEach _storage_areas;
please_recalculate = true;

View File

@ -19,7 +19,7 @@ switch (_fac) do {
if ((_x select 1) == (_sector select 1)) exitWith {
if (((_x select 9) >= _price_s) && ((_x select 10) >= _price_a) && ((_x select 11) >= _price_f)) then {
private _storage = nearestObjects [(markerPos (_x select 1)), [KP_liberation_small_storage_building], GRLIB_fob_range];
_storage = [_storage, {(_x getVariable ["KP_liberation_storage_type",-1]) == 1}] call BIS_fnc_conditionalSelect;
_storage = _storage select {(_x getVariable ["KP_liberation_storage_type",-1]) == 1};
if ((count _storage) == 0) exitWith {};
_storage = (_storage select 0);
private _storedCrates = (attachedObjects _storage);
@ -29,7 +29,7 @@ switch (_fac) do {
private _crateValue = _x getVariable ["KP_liberation_crate_value",0];
switch ((typeOf _x)) do {
case KP_liberation_supply_crate: {
case KP_liberation_supply_crate: {
if (_price_s > 0) then {
if (_crateValue > _price_s) then {
_crateValue = _crateValue - _price_s;

View File

@ -6,7 +6,7 @@ logiError = 0;
if (((KP_liberation_logistics select _index) select 1) <= 0) exitWith {logiError = 1; _clientID publicVariableClient "logiError";};
private _storage_areas = [_nearfob nearobjects (GRLIB_fob_range * 2), {(_x getVariable ["KP_liberation_storage_type",-1]) == 0}] call BIS_fnc_conditionalSelect;
private _storage_areas = (_nearfob nearobjects (GRLIB_fob_range * 2)) select {(_x getVariable ["KP_liberation_storage_type",-1]) == 0};
if ((count _storage_areas) == 0) exitWith {(localize "STR_LOGISTIC_NOSPACE") remoteExec ["hint",_clientID]; logiError = 1; _clientID publicVariableClient "logiError";};

View File

@ -35,7 +35,7 @@ stats_sectors_liberated = stats_sectors_liberated + 1;
if (_liberated_sector in sectors_factory) then {
private _sectorType = 1;
private _sectorFacilities = ([KP_liberation_production_markers, {_liberated_sector == (_x select 0)}] call BIS_fnc_conditionalSelect) select 0;
private _sectorFacilities = (KP_liberation_production_markers select {_liberated_sector == (_x select 0)}) select 0;
private _producing = 3;
{

View File

@ -9,7 +9,7 @@ if (KP_liberation_production_debug > 0) then {diag_log "[KP LIBERATION] [PRODUCT
while {GRLIB_endgame == 0} do {
recalculate_sectors = false;
if (((count (allPlayers - entities "HeadlessClient_F")) > 0) && ((count KP_liberation_production) > 0)) then {
waitUntil {sleep 0.5; !sectors_recalculating};
sectors_recalculating = true;
@ -28,16 +28,16 @@ while {GRLIB_endgame == 0} do {
private _time = _x select 8;
private _storage = nearestObjects [(markerPos (_x select 1)), [KP_liberation_small_storage_building], GRLIB_fob_range];
_storage = [_storage, {(_x getVariable ["KP_liberation_storage_type",-1]) == 1}] call BIS_fnc_conditionalSelect;
_storage = _storage select {(_x getVariable ["KP_liberation_storage_type",-1]) == 1};
if ((count _storage) > 0) then {
_storage = (_storage select 0);
_storageArray = [(getPosATL _storage),(getDir _storage),(vectorUpVisual _storage)];
if (_time_update) then {
if ((_time - 1) < 1) then {
_time = KP_liberation_production_interval;
if (((count (attachedObjects _storage)) < 12) && !((_x select 7) == 3)) then {
private _crateType = KP_liberation_supply_crate;
switch (_x select 7) do {

View File

@ -23,21 +23,21 @@ while {true} do {
private _local_heli_slots = 0;
private _local_plane_slots = 0;
private _local_infantry_cap = 50 * GRLIB_resources_multiplier;
{
private _fob_buildings = _x nearobjects (GRLIB_fob_range * 2);
private _storage_areas = [_fob_buildings, {(_x getVariable ["KP_liberation_storage_type",-1]) == 0}] call BIS_fnc_conditionalSelect;
private _storage_areas = _fob_buildings select {(_x getVariable ["KP_liberation_storage_type",-1]) == 0};
private _heliSlots = {(typeOf _x) == KP_liberation_heli_slot_building;} count _fob_buildings;
private _planeSlots = {(typeOf _x) == KP_liberation_plane_slot_building;} count _fob_buildings;
private _hasAirBuilding = {(typeOf _x) == KP_liberation_air_vehicle_building;} count _fob_buildings;
if (_hasAirBuilding > 0) then {_hasAirBuilding = true;} else {_hasAirBuilding = false;};
private _hasRecBuilding = {(typeOf _x) == KP_liberation_recycle_building;} count _fob_buildings;
if (_hasRecBuilding > 0) then {_hasRecBuilding = true;} else {_hasRecBuilding = false;};
private _supplyValue = 0;
private _ammoValue = 0;
private _fuelValue = 0;
{
{
switch ((typeOf _x)) do {
@ -48,15 +48,15 @@ while {true} do {
};
} forEach (attachedObjects _x);
} forEach _storage_areas;
_local_fob_resources pushBack [_x, _supplyValue, _ammoValue, _fuelValue, _hasAirBuilding, _hasRecBuilding];
_local_supplies_global = _local_supplies_global + _supplyValue;
_local_ammo_global = _local_ammo_global + _ammoValue;
_local_fuel_global = _local_fuel_global + _fuelValue;
_local_heli_slots = _local_heli_slots + _heliSlots;
_local_plane_slots = _local_plane_slots + _planeSlots;
} forEach GRLIB_all_fobs;
} forEach GRLIB_all_fobs;
{
if ( _x in sectors_capture ) then {
_local_infantry_cap = _local_infantry_cap + (10 * GRLIB_resources_multiplier);

View File

@ -50,7 +50,7 @@ if ( GRLIB_endgame == 0 ) then {
stats_fobs_lost = stats_fobs_lost + 1;
} else {
[_thispos, 3] remoteExec ["remote_call_fob"];
{ [_x] spawn prisonner_ai; } foreach ( [ _thispos nearEntities [ "Man", GRLIB_capture_size * 0.8], { side group _x == GRLIB_side_enemy } ] call BIS_fnc_conditionalSelect );
{[_x] spawn prisonner_ai;} foreach ((_thispos nearEntities ["Man", GRLIB_capture_size * 0.8]) select {side group _x == GRLIB_side_enemy});
};
};
@ -60,4 +60,4 @@ if ( GRLIB_blufor_defenders ) then {
{
if ( alive _x ) then { deleteVehicle _x };
} foreach units _grp;
};
};

View File

@ -58,7 +58,7 @@ if ( GRLIB_endgame == 0 ) then {
detach _x;
deleteVehicle _x;
} forEach (attachedObjects ((nearestObjects [((_x select 3) select 0), [KP_liberation_small_storage_building], 10]) select 0));
deleteVehicle ((nearestObjects [((_x select 3) select 0), [KP_liberation_small_storage_building], 10]) select 0);
};
KP_liberation_production = KP_liberation_production - [_x];
@ -66,7 +66,7 @@ if ( GRLIB_endgame == 0 ) then {
} forEach KP_liberation_production;
} else {
[_sector, 3] remoteExec ["remote_call_sector"];
{ [_x] spawn prisonner_ai; } foreach ( [ (markerpos _sector) nearEntities [ "Man", GRLIB_capture_size * 0.8 ], { side group _x == GRLIB_side_enemy } ] call BIS_fnc_conditionalSelect );
{[_x] spawn prisonner_ai;} foreach (((markerpos _sector) nearEntities ["Man", GRLIB_capture_size * 0.8]) select {side group _x == GRLIB_side_enemy});
};
};
@ -76,4 +76,4 @@ if ( GRLIB_blufor_defenders ) then {
{
if ( alive _x ) then { deleteVehicle _x };
} foreach units _grp;
};
};

View File

@ -5,7 +5,7 @@ classnames_to_destroy = [FOB_typename];
classnames_to_destroy = classnames_to_destroy + [(_x select 0)];
} foreach buildings;
_nextbuildingsdestroy = [ (_fobposdestroy nearobjects 150) , { getObjectType _x >= 8 } ] call BIS_fnc_conditionalSelect;
_nextbuildingsdestroy = (_fobposdestroy nearobjects 150) select {getObjectType _x >= 8};
_all_buildings_to_destroy = [];
{
if ( (typeof _x) in classnames_to_destroy ) then {
@ -16,4 +16,4 @@ _all_buildings_to_destroy = [];
{
_x setdamage 1;
sleep (random 3);
} foreach _all_buildings_to_destroy
} foreach _all_buildings_to_destroy

View File

@ -37,8 +37,8 @@ if (!(isnull _roadobj)) then {
if (KP_liberation_asymmetric_debug > 0) then {private _text = format ["[KP LIBERATION] [ASYMMETRIC] ied_manager.sqf -> IED %1 spawned at %2", _number, markerText _sector];_text remoteExec ["diag_log",2];};
while {_sector in active_sectors && mineActive _ied_obj && !_goes_boom} do {
_nearinfantry = [(getpos _ied_obj) nearEntities ["Man", _activation_radius_infantry] , {side _x == GRLIB_side_friendly}] call BIS_fnc_conditionalSelect;
_nearvehicles = [(getpos _ied_obj) nearEntities [["Car", "Tank", "Air"], _activation_radius_vehicles] , {side _x == GRLIB_side_friendly}] call BIS_fnc_conditionalSelect;
_nearinfantry = ((getpos _ied_obj) nearEntities ["Man", _activation_radius_infantry]) select {side _x == GRLIB_side_friendly};
_nearvehicles = ((getpos _ied_obj) nearEntities [["Car", "Tank", "Air"], _activation_radius_vehicles]) select {side _x == GRLIB_side_friendly};
if (count _nearinfantry >= _infantry_trigger || count _nearvehicles >= _vehicle_trigger) then {
if (_ultra_strong) then {
"Bomb_04_F" createVehicle (getpos _ied_obj);

View File

@ -27,14 +27,14 @@ if (!(_sector in KP_military_sectors_already_activated)) then {
KP_military_sectors_already_activated pushback _sector;
private _nearbuildings = [nearestObjects [markerpos _sector, _compatible_classnames, _intel_range], {alive _x}] call BIS_fnc_conditionalSelect;
private _nearbuildings = (nearestObjects [markerpos _sector, _compatible_classnames, _intel_range]) select {alive _x};
if ((count _nearbuildings) > 0) then {
private _building_positions = [];
{_building_positions = _building_positions + ([_x] call BIS_fnc_buildingPositions);} foreach _nearbuildings;
_building_positions = [_building_positions, {(_x select 2) < 2 }] call BIS_fnc_conditionalSelect;
_building_positions = _building_positions select {(_x select 2) < 2};
if ((count _building_positions) >= (_nbintel * 4)) then {
@ -43,7 +43,7 @@ if (!(_sector in KP_military_sectors_already_activated)) then {
while {_nbintel > 0} do {
private _buildingposition = selectRandom _building_positions;
while {_buildingposition in _used_positions} do {
_buildingposition = selectRandom _building_positions;
};

View File

@ -34,9 +34,9 @@ private _opforcount = [] call F_opforCap;
if ((!(_sector in blufor_sectors)) && (([getmarkerpos _sector, [_opforcount] call F_getCorrectedSectorRange, GRLIB_side_friendly] call F_getUnitsCount) > 0)) then {
if (_sector in sectors_bigtown) then {
if (_sector in sectors_bigtown) then {
if (combat_readiness > 30) then {_infsquad = "army";};
_squad1 = ([_infsquad] call F_getAdaptiveSquadComp);
_squad2 = ([_infsquad] call F_getAdaptiveSquadComp);
if (GRLIB_unitcap >= 1) then {_squad3 = ([_infsquad] call F_getAdaptiveSquadComp);};
@ -50,7 +50,7 @@ if ((!(_sector in blufor_sectors)) && (([getmarkerpos _sector, [_opforcount] cal
_vehtospawn pushback ([] call F_getAdaptiveVehicle);
if ((random 100) > (33 / GRLIB_difficulty_modifier)) then {_vehtospawn pushback ([] call F_getAdaptiveVehicle);};
};
_spawncivs = true;
if (((random 100) <= KP_liberation_resistance_sector_chance) && (([] call F_cr_getMulti) > 0)) then {
@ -60,7 +60,7 @@ if ((!(_sector in blufor_sectors)) && (([getmarkerpos _sector, [_opforcount] cal
_building_ai_max = round (50 * _popfactor);
_building_range = 200;
_local_capture_size = _local_capture_size * 1.4;
if (KP_liberation_civ_rep < 0) then {
_iedcount = round (2 + (ceil (random 4)) * (round ((KP_liberation_civ_rep * -1) / 33)) * GRLIB_difficulty_modifier);
} else {
@ -71,10 +71,10 @@ if ((!(_sector in blufor_sectors)) && (([getmarkerpos _sector, [_opforcount] cal
if (_sector in sectors_capture) then {
if (combat_readiness > 50) then {_infsquad = "army";};
_squad1 = ([_infsquad] call F_getAdaptiveSquadComp);
if (GRLIB_unitcap >= 1.25) then {_squad2 = ([_infsquad] call F_getAdaptiveSquadComp);};
if ((random 100) > (66 / GRLIB_difficulty_modifier)) then {_vehtospawn pushback (selectRandom militia_vehicles);};
if ((random 100) > (33 / GRLIB_difficulty_modifier)) then {_vehtospawn pushback (selectRandom militia_vehicles);};
if (_infsquad == "army") then {
@ -84,16 +84,16 @@ if ((!(_sector in blufor_sectors)) && (([getmarkerpos _sector, [_opforcount] cal
_squad3 = ([_infsquad] call F_getAdaptiveSquadComp);
};
};
_spawncivs = true;
if (((random 100) <= KP_liberation_resistance_sector_chance) && (([] call F_cr_getMulti) > 0)) then {
_guerilla = true;
};
_building_ai_max = round ((floor (18 + (round (combat_readiness / 10 )))) * _popfactor);
_building_range = 120;
if (KP_liberation_civ_rep < 0) then {
_iedcount = round ((ceil (random 4)) * (round ((KP_liberation_civ_rep * -1) / 33)) * GRLIB_difficulty_modifier);
} else {
@ -104,42 +104,42 @@ if ((!(_sector in blufor_sectors)) && (([getmarkerpos _sector, [_opforcount] cal
if (_sector in sectors_military) then {
_infsquad = "army";
_squad1 = ([_infsquad] call F_getAdaptiveSquadComp);
_squad2 = ([_infsquad] call F_getAdaptiveSquadComp);
if (GRLIB_unitcap >= 1.5) then {_squad3 = ([_infsquad] call F_getAdaptiveSquadComp);};
_vehtospawn = [([] call F_getAdaptiveVehicle),([] call F_getAdaptiveVehicle)];
if ((random 100) > (33 / GRLIB_difficulty_modifier)) then {
_vehtospawn pushback ([] call F_getAdaptiveVehicle);
_squad4 = ([_infsquad] call F_getAdaptiveSquadComp);
};
if ((random 100) > (66 / GRLIB_difficulty_modifier)) then {_vehtospawn pushback ([] call F_getAdaptiveVehicle);};
_spawncivs = false;
_building_ai_max = round ((floor (18 + (round (combat_readiness / 4 )))) * _popfactor);
_building_range = 120;
};
if (_sector in sectors_factory) then {
if (combat_readiness > 40) then {_infsquad = "army";};
_squad1 = ([_infsquad] call F_getAdaptiveSquadComp);
if (GRLIB_unitcap >= 1.25) then {_squad2 = ([_infsquad] call F_getAdaptiveSquadComp);};
if ((random 100) > 66) then {_vehtospawn pushback ([] call F_getAdaptiveVehicle);};
if ((random 100) > 33) then {_vehtospawn pushback (selectRandom militia_vehicles);};
_spawncivs = false;
if (((random 100) <= KP_liberation_resistance_sector_chance) && (([] call F_cr_getMulti) > 0)) then {
_guerilla = true;
};
_building_ai_max = round ((floor (18 + (round (combat_readiness / 10 )))) * _popfactor);
_building_range = 120;
if (KP_liberation_civ_rep < 0) then {
_iedcount = round ((ceil (random 3)) * (round ((KP_liberation_civ_rep * -1) / 33)) * GRLIB_difficulty_modifier);
} else {
@ -177,7 +177,7 @@ if ((!(_sector in blufor_sectors)) && (([getmarkerpos _sector, [_opforcount] cal
} forEach _vehtospawn;
if (_building_ai_max > 0) then {
_allbuildings = [nearestObjects [_sectorpos, ["House"], _building_range], {alive _x}] call BIS_fnc_conditionalSelect;
_allbuildings = (nearestObjects [_sectorpos, ["House"], _building_range]) select {alive _x};
_buildingpositions = [];
{
_buildingpositions = _buildingpositions + ([_x] call BIS_fnc_buildingPositions);

View File

@ -1,2 +1,2 @@
params [ "_classname" ];
[ _classname , { [ ( _x select 0 ) ] call F_checkClass } ] call BIS_fnc_conditionalSelect;
_classname select {[( _x select 0)] call F_checkClass}

View File

@ -1,9 +1,14 @@
private [ "_respawn_trucks_unsorted", "_respawn_trucks_sorted" ];
_respawn_trucks_unsorted = [ vehicles, { ( typeof _x == Respawn_truck_typename || typeof _x == huron_typename ) && _x distance startbase > 500 &&
!surfaceIsWater (getpos _x) && ((getpos _x) select 2) < 5 && alive _x && speed _x < 5 }
] call BIS_fnc_conditionalSelect;
_respawn_trucks_unsorted = vehicles select {
(typeof _x == Respawn_truck_typename || typeof _x == huron_typename ) &&
_x distance startbase > 500 &&
!surfaceIsWater (getpos _x) &&
((getpos _x) select 2) < 5 &&
alive _x &&
speed _x < 5
};
_respawn_trucks_sorted = [ _respawn_trucks_unsorted , [] , { (getpos _x) select 0 } , 'ASCEND' ] call BIS_fnc_sortBy;
_respawn_trucks_sorted

View File

@ -1,3 +1,3 @@
params [ "_searchposition", "_distance"];
[ allPlayers, { alive _x && _x distance _searchposition < _distance } ] call BIS_fnc_conditionalSelect
allPlayers select {alive _x && _x distance _searchposition < _distance}

View File

@ -1,7 +1,7 @@
params ["_limit", ["_postosearch", getpos player]];
private _sector_to_return = "";
private _close_sectors = [sectors_allSectors, {(markerPos _x) distance _postosearch < _limit}] call BIS_fnc_conditionalSelect;
private _close_sectors = sectors_allSectors select {(markerPos _x) distance _postosearch < _limit};
private _close_sectors_sorted = [_close_sectors, [_postosearch, _limit], {(markerPos _x) distance _input0}, "ASCEND"] call BIS_fnc_sortBy;
if (count _close_sectors_sorted > 0) then {_sector_to_return = _close_sectors_sorted select 0;};

View File

@ -7,10 +7,10 @@ waitUntil {!isNil "blufor_sectors"};
if ( _side == GRLIB_side_enemy ) then {
_sectors_to_search = (sectors_tower - blufor_sectors);
} else {
_sectors_to_search = [ blufor_sectors , { _x in sectors_tower } ] call BIS_fnc_conditionalSelect;
_sectors_to_search = blufor_sectors select {_x in sectors_tower};
};
_sectors_to_search = [ _sectors_to_search , { (markerPos _x) distance _postosearch < _limit } ] call BIS_fnc_conditionalSelect;
_sectors_to_search = _sectors_to_search select {(markerPos _x) distance _postosearch < _limit};
_sectors_to_search_sorted = [ _sectors_to_search , [_postosearch] , { (markerPos _x) distance _input0 } , 'ASCEND' ] call BIS_fnc_sortBy;
if ( count _sectors_to_search_sorted > 0 ) then { _sector_to_return = _sectors_to_search_sorted select 0; } else { _sector_to_return = '' };

View File

@ -1,7 +1,7 @@
params ["_position", "_distance", "_side"];
private _infantrycount = _side countSide ([_position nearEntities ["Man", _distance] , {!(captive _x) && ((getpos _x) select 2 < 100)}] call BIS_fnc_conditionalSelect);
private _countedvehicles = [(_position nearEntities [["Car", "Tank", "Air"], _distance]), {((getpos _x) select 2 < 750) && count (crew _x) > 0}] call BIS_fnc_conditionalSelect;
private _infantrycount = _side countSide ((_position nearEntities ["Man", _distance]) select {!(captive _x) && ((getpos _x) select 2 < 100)});
private _countedvehicles = (_position nearEntities [["Car", "Tank", "Air"], _distance]) select {((getpos _x) select 2 < 750) && count (crew _x) > 0};
private _vehiclecrewcount = 0;
{_vehiclecrewcount = _vehiclecrewcount + (_side countSide (crew _x))} forEach _countedvehicles;

View File

@ -1,2 +1,2 @@
params [ "_veh" ];
_veh setVehicleAmmo 1;
_veh setVehicleAmmoDef 1;

View File

@ -1,6 +1,6 @@
private [ "_spartans", "_spartan" ];
_spartans = [ vehicles , { typeof _x == huron_typename && alive _x } ] call BIS_fnc_conditionalSelect;
_spartans = vehicles select {typeof _x == huron_typename && alive _x};
_spartan = objNull;
if ( count _spartans != 0 ) then { _spartan = _spartans select 0 };

View File

@ -2,7 +2,7 @@ params ["_squadpos"];
private _spawned_units_local = [];
private _allposts = [nearestObjects [_squadpos, ["Land_Cargo_Patrol_V1_F","Land_Cargo_Patrol_V2_F","Land_Cargo_Patrol_V3_F","Land_Cargo_Patrol_V4_F"], GRLIB_capture_size] , {alive _x}] call BIS_fnc_conditionalSelect;
private _allposts = (nearestObjects [_squadpos, ["Land_Cargo_Patrol_V1_F","Land_Cargo_Patrol_V2_F","Land_Cargo_Patrol_V3_F","Land_Cargo_Patrol_V4_F"], GRLIB_capture_size]) select {alive _x};
if (count _allposts > 0) then {
private _grp = createGroup [GRLIB_side_enemy, true];

View File

@ -27,7 +27,7 @@ if (isServer) then {
if ((side _killer) == GRLIB_side_friendly) then {
private _nearby_bigtown = [sectors_bigtown, {!(_x in blufor_sectors) && (_unit distance (markerpos _x) < 250) } ] call BIS_fnc_conditionalSelect;
private _nearby_bigtown = sectors_bigtown select {!(_x in blufor_sectors) && (_unit distance (markerpos _x) < 250)};
if (count _nearby_bigtown > 0) then {
combat_readiness = combat_readiness + (0.5 * GRLIB_difficulty_modifier);
stats_readiness_earned = stats_readiness_earned + (0.5 * GRLIB_difficulty_modifier);

View File

@ -1,6 +1,6 @@
set_skill = compile preprocessfilelinenumbers "scripts\shared\set_skill.sqf";
while {true} do {
{[_x] call set_skill} forEach ([allUnits, {local _x && !isplayer _x}] call BIS_fnc_conditionalSelect);
{[_x] call set_skill} forEach (allUnits select {local _x && !isplayer _x});
sleep 15;
};