mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #2230 from SzwedzikPL/interactions_lamps
Interaction with portable lamps
This commit is contained in:
commit
27c6934ff2
@ -95,4 +95,9 @@ class Extended_InitPost_EventHandlers {
|
||||
init = QUOTE(_this call DFUNC(initObject));
|
||||
};
|
||||
};
|
||||
class Land_PortableLight_single_F {
|
||||
class ADDON {
|
||||
init = QUOTE(_this call DFUNC(initObject));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -45,7 +45,7 @@ class CfgVehicles {
|
||||
description = CSTRING(MakeLoadable_description);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
};
|
||||
class setSize {
|
||||
displayName = CSTRING(makeLoadable_setSize_displayName);
|
||||
typeName = "NUMBER";
|
||||
@ -492,4 +492,10 @@ class CfgVehicles {
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Lamps_base_F;
|
||||
class Land_PortableLight_single_F: Lamps_base_F {
|
||||
GVAR(size) = 1;
|
||||
GVAR(canLoad) = 1;
|
||||
};
|
||||
};
|
||||
|
@ -27,6 +27,11 @@ class Extended_Init_EventHandlers {
|
||||
init = QUOTE(_this call DFUNC(initObject));
|
||||
};
|
||||
};
|
||||
class Land_PortableLight_single_F {
|
||||
class ADDON {
|
||||
init = QUOTE(_this call DFUNC(initObject));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_Killed_EventHandlers {
|
||||
|
@ -112,4 +112,15 @@ class CfgVehicles {
|
||||
GVAR(carryPosition[]) = {0,1,1};
|
||||
GVAR(carryDirection) = 0;
|
||||
};
|
||||
|
||||
class Lamps_base_F;
|
||||
class Land_PortableLight_single_F: Lamps_base_F {
|
||||
GVAR(canCarry) = 1;
|
||||
GVAR(carryPosition[]) = {0,1.2,0};
|
||||
GVAR(carryDirection) = 180;
|
||||
|
||||
GVAR(canDrag) = 1;
|
||||
GVAR(dragPosition[]) = {0,1.2,0};
|
||||
GVAR(dragDirection) = 180;
|
||||
};
|
||||
};
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
class CfgVehicles {
|
||||
class ACE_Module;
|
||||
class ACE_ModuleInteraction: ACE_Module {
|
||||
@ -10,7 +9,6 @@ class CfgVehicles {
|
||||
isGlobal = 1;
|
||||
isSingular = 1;
|
||||
icon = PATHTOF(UI\Icon_Module_Interaction_ca.paa);
|
||||
|
||||
class Arguments {
|
||||
class EnableTeamManagement {
|
||||
displayName = CSTRING(EnableTeamManagement_DisplayName);
|
||||
@ -19,7 +17,6 @@ class CfgVehicles {
|
||||
defaultValue = 1;
|
||||
};
|
||||
};
|
||||
|
||||
class ModuleDescription {
|
||||
description = CSTRING(Module_Description);
|
||||
};
|
||||
@ -540,6 +537,41 @@ class CfgVehicles {
|
||||
class ACE_SelfActions {};
|
||||
};
|
||||
|
||||
class Lamps_base_F;
|
||||
class Land_PortableLight_single_F: Lamps_base_F {
|
||||
scope = 2;
|
||||
XEH_ENABLED;
|
||||
class ACE_Actions {
|
||||
class ACE_MainActions {
|
||||
displayName = CSTRING(MainAction);
|
||||
selection = "";
|
||||
distance = 2;
|
||||
condition = "true";
|
||||
class ACE_LampTurnOn {
|
||||
displayName = CSTRING(TurnOn);
|
||||
condition = QUOTE(alive _target && !(_target getVariable [ARR_2('ACE_lampOn',true)]));
|
||||
statement = QUOTE(_target call DFUNC(switchLamp));
|
||||
selection = "";
|
||||
distance = 2;
|
||||
};
|
||||
class ACE_LampTurnOff {
|
||||
displayName = CSTRING(TurnOff);
|
||||
condition = QUOTE(alive _target && _target getVariable [ARR_2('ACE_lampOn',true)]);
|
||||
statement = QUOTE(_target call DFUNC(switchLamp));
|
||||
selection = "";
|
||||
distance = 2;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
class Land_PortableLight_single_off_F: Land_PortableLight_single_F {
|
||||
scope = 1;
|
||||
};
|
||||
class Land_PortableLight_double_F: Land_PortableLight_single_F {};
|
||||
class Land_PortableLight_double_off_F: Land_PortableLight_double_F {
|
||||
scope = 1;
|
||||
};
|
||||
|
||||
class RoadCone_F: ThingX {
|
||||
class ACE_Actions {
|
||||
class ACE_MainActions {
|
||||
|
@ -18,6 +18,16 @@ ACE_Modifier = 0;
|
||||
_unit doMove _position;
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
||||
["lampTurnOn", {
|
||||
params ["_lamp", "_hitPointsDamage", "_disabledLampDMG"];
|
||||
{if((_x select 1) == _disabledLampDMG) then {_lamp setHit [_x select 0, 0];};nil} count _hitPointsDamage;
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
||||
["lampTurnOff", {
|
||||
params ["_lamp", "_hitPointsDamage", "_disabledLampDMG"];
|
||||
{_lamp setHit [_x select 0, (_x select 1) max _disabledLampDMG];nil} count _hitPointsDamage;
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
GVAR(isOpeningDoor) = false;
|
||||
@ -61,7 +71,7 @@ GVAR(isOpeningDoor) = false;
|
||||
|
||||
//Tap whichever shoulder is closest
|
||||
private _shoulderNum = [0, 1] select (([cursorTarget, ACE_player] call BIS_fnc_relativeDirTo) > 180);
|
||||
|
||||
|
||||
// Statement
|
||||
[ACE_player, cursorTarget, _shoulderNum] call FUNC(tapShoulder);
|
||||
true
|
||||
|
@ -38,4 +38,7 @@ PREP(openDoor);
|
||||
// interaction with boats
|
||||
PREP(push);
|
||||
|
||||
|
||||
PREP(switchLamp);
|
||||
|
||||
ADDON = true;
|
||||
|
38
addons/interaction/functions/fnc_switchLamp.sqf
Normal file
38
addons/interaction/functions/fnc_switchLamp.sqf
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Author: SzwedzikPL
|
||||
* Turn on/off lamp
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Lamp <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* lamp call ace_interaction_fnc_switchLamp
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define DISABLED_LAMP_DMG 0.95
|
||||
|
||||
params ["_lamp"];
|
||||
|
||||
_isOn = _lamp getVariable ["ACE_lampOn", true];
|
||||
private _reflectors = "true" configClasses (configfile >> "CfgVehicles" >> (typeof _lamp) >> "Reflectors");
|
||||
private _hitPointsDamage = [];
|
||||
{
|
||||
private _hitPoint = getText (_x >> "hitpoint");
|
||||
_hitPointsDamage pushback [_hitPoint, _lamp getHit _hitPoint];
|
||||
nil
|
||||
} count _reflectors;
|
||||
|
||||
//if lamp is on turn it off
|
||||
private _eventName = ["lampTurnOn", "lampTurnOff"] select _isOn;
|
||||
if(local _lamp) then {
|
||||
[_eventName, [_lamp, _hitPointsDamage, DISABLED_LAMP_DMG]] call EFUNC(common,localEvent);
|
||||
} else {
|
||||
[_eventName, [_lamp], [_lamp, _hitPointsDamage, DISABLED_LAMP_DMG]] call EFUNC(common,targetEvent);
|
||||
};
|
||||
_lamp setVariable ["ACE_lampOn", !_isOn, true];
|
@ -700,6 +700,14 @@
|
||||
<Russian>Управление группами позволяет назначать цвета членам групп, брать командование, вступать в группы или покидать их.</Russian>
|
||||
<Italian>La gestione del team permette di cambiare colori ai membri, prendere il comando e lasciare o unirsi ai team.</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Interaction_TurnOn">
|
||||
<English>Turn on</English>
|
||||
<Polish>Włącz</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Interaction_TurnOff">
|
||||
<English>Turn off</English>
|
||||
<Polish>Wyłącz</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Interaction_PassMagazine">
|
||||
<English>Pass magazine</English>
|
||||
<German>Magazin geben</German>
|
||||
|
Loading…
Reference in New Issue
Block a user