2015-08-22 18:00:26 +00:00
|
|
|
/*
|
|
|
|
* Author: SzwedzikPL
|
|
|
|
* Turn on/off lamp
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Lamp <OBJECT>
|
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2016-02-05 02:41:18 +00:00
|
|
|
* lamp call ace_interaction_fnc_switchLamp
|
2015-08-22 18:00:26 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
#define DISABLED_LAMP_DMG 0.95
|
|
|
|
|
2016-02-05 01:02:46 +00:00
|
|
|
params ["_lamp"];
|
2015-08-22 18:00:26 +00:00
|
|
|
|
2016-02-05 02:41:18 +00:00
|
|
|
_isOn = _lamp getVariable ["ACE_lampOn", true];
|
|
|
|
private _reflectors = "true" configClasses (configfile >> "CfgVehicles" >> (typeof _lamp) >> "Reflectors");
|
2016-02-05 01:02:46 +00:00
|
|
|
private _hitPointsDamage = [];
|
2015-08-22 18:00:26 +00:00
|
|
|
{
|
2016-02-05 01:02:46 +00:00
|
|
|
private _hitPoint = getText (_x >> "hitpoint");
|
|
|
|
_hitPointsDamage pushback [_hitPoint, _lamp getHit _hitPoint];
|
|
|
|
nil
|
2015-08-22 18:00:26 +00:00
|
|
|
} count _reflectors;
|
|
|
|
|
2016-02-05 03:26:54 +00:00
|
|
|
//if lamp is on turn it off
|
2016-05-25 18:23:53 +00:00
|
|
|
private _eventName = [QGVAR(lampTurnOn), QGVAR(lampTurnOff)] select _isOn;
|
|
|
|
[_eventName, [_lamp, _hitPointsDamage, DISABLED_LAMP_DMG], [_lamp]] call CBA_fnc_targetEvent;
|
|
|
|
|
2016-02-05 02:41:18 +00:00
|
|
|
_lamp setVariable ["ACE_lampOn", !_isOn, true];
|