Add Camping Light interaction (#6078)

* Add camping light interaction

* Add dragging

* Add cargo loading

* Handle Camping_Light_off objects

* Fix work in MP

* Replace action with command
This commit is contained in:
Dystopian 2018-02-26 21:12:21 +03:00 committed by PabstMirror
parent d4825f920f
commit a2804f6097
5 changed files with 87 additions and 18 deletions

View File

@ -421,7 +421,6 @@ class CfgVehicles {
};
// objects
class Lamps_base_F;
class RoadCone_F: ThingX {
GVAR(size) = 1;
GVAR(canLoad) = 1;
@ -429,10 +428,22 @@ class CfgVehicles {
class RoadBarrier_F: RoadCone_F {
GVAR(size) = 2;
};
class Lamps_base_F;
class Land_PortableLight_single_F: Lamps_base_F {
GVAR(size) = 1;
GVAR(size) = 2;
GVAR(canLoad) = 1;
};
class FloatingStructure_F;
class Land_Camping_Light_F: FloatingStructure_F {
GVAR(size) = 0.2;
GVAR(canLoad) = 1;
};
class Land_Camping_Light_off_F: ThingX {
GVAR(size) = 0.2;
GVAR(canLoad) = 1;
};
class Scrapyard_base_F;
class Land_PaperBox_closed_F: Scrapyard_base_F {

View File

@ -38,6 +38,11 @@ class Extended_Init_EventHandlers {
init = QUOTE(_this call DFUNC(initObject));
};
};
class Land_Camping_Light_F {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
};
class Extended_Killed_EventHandlers {

View File

@ -249,4 +249,24 @@ class CfgVehicles {
GVAR(dragPosition)[] = {0,1.2,0};
GVAR(dragDirection) = 180;
};
class FloatingStructure_F;
class Land_Camping_Light_F: FloatingStructure_F {
GVAR(canCarry) = 1;
// if y < 0.9 player gets damage
GVAR(carryPosition)[] = {0,0.9,1};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,0.7,0};
GVAR(dragDirection) = 0;
};
class Land_Camping_Light_off_F: ThingX {
GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,0.9,1};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,0.7,0};
GVAR(dragDirection) = 0;
};
};

View File

@ -640,38 +640,49 @@ class CfgVehicles {
class EventHandlers {
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};
};
scope = 2;
class ACE_Actions {
class ACE_MainActions {
displayName = CSTRING(MainAction);
selection = "";
distance = 2;
condition = "true";
class ACE_LampTurnOn {
class GVAR(TurnOn) {
displayName = CSTRING(TurnOn);
icon = "\A3\Ui_f\data\IGUI\Cfg\VehicleToggles\LightsIconOn_ca.paa";
condition = QUOTE(alive _target && !(_target getVariable [ARR_2('ACE_lampOn',true)]));
statement = QUOTE(_target call DFUNC(switchLamp));
selection = "";
distance = 2;
};
class ACE_LampTurnOff {
class GVAR(TurnOff) {
displayName = CSTRING(TurnOff);
icon = "\A3\ui_f\data\igui\cfg\actions\ico_cpt_land_OFF_ca.paa";
condition = QUOTE(alive _target && _target getVariable [ARR_2('ACE_lampOn',true)]);
statement = QUOTE(_target call DFUNC(switchLamp));
selection = "";
};
};
};
};
class FloatingStructure_F;
class Land_Camping_Light_F: FloatingStructure_F {
class ACE_Actions {
class ACE_MainActions {
displayName = CSTRING(MainAction);
distance = 2;
class GVAR(TurnOn) {
displayName = CSTRING(TurnOn);
icon = "\A3\Ui_f\data\IGUI\Cfg\VehicleToggles\LightsIconOn_ca.paa";
condition = QUOTE(alive _target && !isCollisionLightOn _target);
statement = QUOTE([ARR_3(QQGVAR(setCollisionLight),[ARR_2(_target,true)],_target)] call CBA_fnc_targetEvent);
};
class GVAR(TurnOff) {
displayName = CSTRING(TurnOff);
icon = "\A3\ui_f\data\igui\cfg\actions\ico_cpt_land_OFF_ca.paa";
condition = QUOTE(alive _target && isCollisionLightOn _target);
statement = QUOTE([ARR_3(QQGVAR(setCollisionLight),[ARR_2(_target,false)],_target)] call CBA_fnc_targetEvent);
};
};
};
};
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 {

View File

@ -28,6 +28,10 @@ ACE_Modifier = 0;
{_lamp setHit [_x select 0, (_x select 1) max _disabledLampDMG];nil} count _hitPointsDamage;
}] call CBA_fnc_addEventHandler;
[QGVAR(setCollisionLight), {
(_this select 0) setCollisionLight (_this select 1);
}] call CBA_fnc_addEventHandler;
// Zeus action events
[QGVAR(zeusStance),{
{ _x setUnitPos (_this select 0); } forEach (_this select 1);
@ -116,3 +120,21 @@ GVAR(isOpeningDoor) = false;
}];
};
}] call CBA_fnc_addEventHandler;
// to make "Camping Lantern (Off)" be turned on we replace it with "Camping Lantern"
private _action = [
QGVAR(TurnOn),
localize LSTRING(TurnOn),
"\A3\Ui_f\data\IGUI\Cfg\VehicleToggles\LightsIconOn_ca.paa",
{
private _position = getPosATL _target;
private _vectorDirAndUp = [vectorDir _target, vectorUp _target];
deleteVehicle _target;
private _newLamp = "Land_Camping_Light_F" createVehicle [0,0,0];
_newLamp setPosATL _position;
_newLamp setVectorDirAndUp _vectorDirAndUp;
},
{alive _target}
] call EFUNC(interact_menu,createAction);
["Land_Camping_Light_off_F", 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToClass);