simlify some select CODE statements

This commit is contained in:
commy2 2016-02-06 14:59:31 +01:00
parent ac007e6995
commit 0a9048815b
3 changed files with 18 additions and 24 deletions

View File

@ -41,10 +41,11 @@ GVAR(Medical_ItemList) = [];
("true" configClasses (configFile >> QEGVAR(Medical,Actions) >> "Advanced"))
);
// remove all numbers from list
GVAR(Medical_ItemList) = GVAR(Medical_ItemList) select {_x isEqualType ""};
// make list case insensitive
GVAR(Medical_ItemList) = GVAR(Medical_ItemList) apply {
if (_x isEqualType "") then {toLower _x};
};
GVAR(Medical_ItemList) = GVAR(Medical_ItemList) apply {toLower _x};
// filter duplicates
GVAR(Medical_ItemList) = GVAR(Medical_ItemList) arrayIntersect GVAR(Medical_ItemList);

View File

@ -16,15 +16,14 @@ if (GVAR(BFT_Enabled) and {(!isNil "ACE_player") and {alive ACE_player}}) then {
_groupsToDrawMarkers = [];
_playerSide = call EFUNC(common,playerSide);
if !(GVAR(BFT_HideAiGroups)) then {
_groupsToDrawMarkers = allGroups select {side _x == _playerSide};
} else {
_groupsToDrawMarkers = allGroups select {
_anyPlayers = {
[_x] call EFUNC(common,isPlayer);
} count units _x;
(side _x == _playerSide) && _anyPlayers > 0
}; // @todo, simplify this
if (GVAR(BFT_HideAiGroups)) then {
_groupsToDrawMarkers = _groupsToDrawMarkers select {
{
_x call EFUNC(common,isPlayer);
} count units _x > 0;
};
};
{

View File

@ -90,27 +90,21 @@ TRACE_1("Player is on foot or in an open vehicle","");
_lightLevel = _lightLevel max ([_unit, _x] call EFUNC(common,lightIntensityFromObject));
} forEach nearestObjects [_unit, ["All"], 40];
// @todo: Illumination flares (timed)
// Using chemlights
_nearObjects = (_unit nearObjects ["SmokeShell", 4]) select {
alive _x && {(typeOf _x == "Chemlight_red") || {
(typeOf _x == "Chemlight_green") || {
(typeOf _x == "Chemlight_blue") || {
(typeOf _x == "Chemlight_yellow")}}}}}; // @todo, simplify this
_nearObjects = (_unit nearObjects ["SmokeShell", 4]) select {alive _x && {toLower typeOf _x in ["chemlight_red", "chemlight_green", "chemlight_blue", "chemlight_yellow"]}};
if (count (_nearObjects) > 0) then {
_light = _nearObjects select 0;
_ll = (1 - ((((_unit distance _light) - 2)/2) max 0)) * 0.4;
if (_ll > _lightLevel) then {
_flareTint = switch (typeOf _light) do {
case "Chemlight_red" : {[1,0,0,1]};
case "Chemlight_green" : {[0,1,0,1]};
case "Chemlight_blue" : {[0,0,1,1]};
case "Chemlight_yellow" : {[1,1,0,1]};
_flareTint = switch (toLower typeOf _light) do {
case "chemlight_red" : {[1,0,0,1]};
case "chemlight_green" : {[0,1,0,1]};
case "chemlight_blue" : {[0,0,1,1]};
case "chemlight_yellow" : {[1,1,0,1]};
};
_lightTint = [_lightTint, _flareTint, (_ll - _lightLevel)/(1 - _lightLevel)] call _fnc_blendColor;
_lightLevel = _ll;