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")) ("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 // make list case insensitive
GVAR(Medical_ItemList) = GVAR(Medical_ItemList) apply { GVAR(Medical_ItemList) = GVAR(Medical_ItemList) apply {toLower _x};
if (_x isEqualType "") then {toLower _x};
};
// filter duplicates // filter duplicates
GVAR(Medical_ItemList) = GVAR(Medical_ItemList) arrayIntersect GVAR(Medical_ItemList); 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 = []; _groupsToDrawMarkers = [];
_playerSide = call EFUNC(common,playerSide); _playerSide = call EFUNC(common,playerSide);
if !(GVAR(BFT_HideAiGroups)) then {
_groupsToDrawMarkers = allGroups select {side _x == _playerSide}; _groupsToDrawMarkers = allGroups select {side _x == _playerSide};
} else {
_groupsToDrawMarkers = allGroups select { if (GVAR(BFT_HideAiGroups)) then {
_anyPlayers = { _groupsToDrawMarkers = _groupsToDrawMarkers select {
[_x] call EFUNC(common,isPlayer); {
} count units _x; _x call EFUNC(common,isPlayer);
(side _x == _playerSide) && _anyPlayers > 0 } count units _x > 0;
}; // @todo, simplify this };
}; };
{ {

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)); _lightLevel = _lightLevel max ([_unit, _x] call EFUNC(common,lightIntensityFromObject));
} forEach nearestObjects [_unit, ["All"], 40]; } forEach nearestObjects [_unit, ["All"], 40];
// @todo: Illumination flares (timed) // @todo: Illumination flares (timed)
// Using chemlights // Using chemlights
_nearObjects = (_unit nearObjects ["SmokeShell", 4]) select { _nearObjects = (_unit nearObjects ["SmokeShell", 4]) select {alive _x && {toLower typeOf _x in ["chemlight_red", "chemlight_green", "chemlight_blue", "chemlight_yellow"]}};
alive _x && {(typeOf _x == "Chemlight_red") || {
(typeOf _x == "Chemlight_green") || {
(typeOf _x == "Chemlight_blue") || {
(typeOf _x == "Chemlight_yellow")}}}}}; // @todo, simplify this
if (count (_nearObjects) > 0) then { if (count (_nearObjects) > 0) then {
_light = _nearObjects select 0; _light = _nearObjects select 0;
_ll = (1 - ((((_unit distance _light) - 2)/2) max 0)) * 0.4; _ll = (1 - ((((_unit distance _light) - 2)/2) max 0)) * 0.4;
if (_ll > _lightLevel) then { if (_ll > _lightLevel) then {
_flareTint = switch (typeOf _light) do { _flareTint = switch (toLower typeOf _light) do {
case "Chemlight_red" : {[1,0,0,1]}; case "chemlight_red" : {[1,0,0,1]};
case "Chemlight_green" : {[0,1,0,1]}; case "chemlight_green" : {[0,1,0,1]};
case "Chemlight_blue" : {[0,0,1,1]}; case "chemlight_blue" : {[0,0,1,1]};
case "Chemlight_yellow" : {[1,1,0,1]}; case "chemlight_yellow" : {[1,1,0,1]};
}; };
_lightTint = [_lightTint, _flareTint, (_ll - _lightLevel)/(1 - _lightLevel)] call _fnc_blendColor; _lightTint = [_lightTint, _flareTint, (_ll - _lightLevel)/(1 - _lightLevel)] call _fnc_blendColor;
_lightLevel = _ll; _lightLevel = _ll;