Experimental vehicle spatial actions. Cockpit action for the littlebird.

This commit is contained in:
esteldunedain 2016-02-26 01:12:44 -03:00 committed by BaerMitUmlaut
parent ab09e0989b
commit 1e47d51538
5 changed files with 64 additions and 7 deletions

View File

@ -33,10 +33,26 @@ private _recurseFnc = {
private _entryCfg = _x;
if(isClass _entryCfg) then {
private _displayName = getText (_entryCfg >> "displayName");
private _distance = 10;
if (isNumber (_entryCfg >> "distance")) then {_distance = getNumber (_entryCfg >> "distance");};
private _icon = getText (_entryCfg >> "icon");
private _statement = compile (getText (_entryCfg >> "statement"));
// If the position entry is present, compile it
private _position = getText (_entryCfg >> "position");
if (_position != "") then {
_position = compile _position;
} else {
// If the not, but the selection entry is present use that
_position = getText (_entryCfg >> "selection");
if (_position != "") then {
_position = compile format ["_target selectionPosition '%1'", _position];
} else {
// Otherwise, just use the origin
_position = {[0,0,0]};
};
};
private _condition = getText (_entryCfg >> "condition");
if (_condition == "") then {_condition = "true"};
@ -68,8 +84,8 @@ private _recurseFnc = {
_condition,
_insertChildren,
[],
[0,0,0],
10, //distace
_position,
distace,
[_showDisabled,_enableInside,_canCollapse,_runOnHover, true],
_modifierFunction
],
@ -125,4 +141,8 @@ private _actions = [
]
];
private _actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_SelfSpatialActions";
private _actions2 = [_actionsCfg, 0] call _recurseFnc;
_actions = _actions + _actions2;
_namespace setVariable [_objectType, _actions];

View File

@ -108,7 +108,15 @@ private _fnc_renderSelfActions = {
{
_action = _x;
if ((_action select 0 select 0) isEqualTo "ACE_SelfActions") then {
if (_target == ACE_player) then {
[_target, _action, _pos] call FUNC(renderBaseMenu);
} else {
[_target, _action, [0.5, 0.2]] call FUNC(renderBaseMenu);
};
} else {
[_target, _action] call FUNC(renderBaseMenu);
};
nil
} count _classActions;
};

View File

@ -1,8 +1,8 @@
#define COMPONENT interact_menu
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
//#define DEBUG_MODE_FULL
#define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS

View File

@ -380,6 +380,30 @@ class CfgVehicles {
insertChildren = QUOTE(_this call DFUNC(addPassengersActions));
};
};
class ACE_SelfSpatialActions {};
};
class Helicopter_Base_F: Helicopter {};
class Helicopter_Base_H: Helicopter_Base_F {};
class Heli_Light_01_base_F: Helicopter_Base_H {
class ACE_SelfSpatialActions: ACE_SelfSpatialActions {
class ACE_TurnEngineOn {
displayName = "Turn Engine On";
selection = "";
position = "[0.15,1.75,0.15]";
distance = 1.5;
condition = "!isEngineOn _target";
statement = QUOTE([ARR_3('ace_interaction_engineOn',_target,[ARR_2(_target, true)])] call EFUNC(common,objectEvent););
};
class ACE_TurnEngineOff {
displayName = "Turn Engine Off";
selection = "";
position = "[0.15,1.75,0.15]";
distance = 1.5;
condition = "isEngineOn _target";
statement = QUOTE([ARR_3('ace_interaction_engineOn',_target,[ARR_2(_target, false)])] call EFUNC(common,objectEvent););
};
};
};
class Plane: Air {

View File

@ -79,3 +79,8 @@ GVAR(isOpeningDoor) = false;
["isNotSwimming", {!underwater (_this select 0)}] call EFUNC(common,addCanInteractWithCondition);
["isNotOnLadder", {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState (_this select 0) >> "ACE_isLadder") != 1}] call EFUNC(common,addCanInteractWithCondition);
[QGVAR(engineOn), {
params ["_unit", "_state"];
_unit engineOn _state;
}] call EFUNC(common,addEventHandler);