mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
function to return all turned on lights of any objects
This commit is contained in:
parent
0d126dc562
commit
5df25cf44d
@ -73,6 +73,7 @@ PREP(getStringFromMissionSQM);
|
||||
PREP(getTargetAzimuthAndInclination);
|
||||
PREP(getTargetDistance);
|
||||
PREP(getTargetObject);
|
||||
PREP(getTurnedOnLights);
|
||||
PREP(getTurretCommander);
|
||||
PREP(getTurretConfigPath);
|
||||
PREP(getTurretCopilot);
|
||||
|
36
addons/common/functions/fnc_getTurnedOnLights.sqf
Normal file
36
addons/common/functions/fnc_getTurnedOnLights.sqf
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Returns all turned on lights of any vehicle or streetlamp.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: A vehicle, not the classname (Object)
|
||||
*
|
||||
* Return Value:
|
||||
* All burning lights (Array)
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_vehicle";
|
||||
|
||||
_vehicle = _this select 0;
|
||||
|
||||
if (!isLightOn _vehicle) exitWith {[]};
|
||||
|
||||
private ["_reflectorsWithSelections", "_lights", "_hitpoints"];
|
||||
|
||||
_reflectorsWithSelections = [_vehicle] call FUNC(getReflectorsWithSelections);
|
||||
|
||||
_lights = _reflectorsWithSelections select 0;
|
||||
_hitpoints = _reflectorsWithSelections select 1;
|
||||
|
||||
private "_turnedOnLights";
|
||||
_turnedOnLights = [];
|
||||
{
|
||||
if (_vehicle getHit _x <= 0.9) then {
|
||||
_turnedOnLights pushBack (_lights select _forEachIndex);
|
||||
};
|
||||
|
||||
} forEach _hitpoints;
|
||||
|
||||
_turnedOnLights
|
Loading…
Reference in New Issue
Block a user