First rough implementation of the passengers menu, with mounted main actions

This commit is contained in:
Nicolás Badano 2015-03-20 00:53:58 -03:00
parent b854db0195
commit 66731c9cdd
6 changed files with 137 additions and 8 deletions

View File

@ -412,7 +412,14 @@ class CfgVehicles {
condition = "true";
};
};
class ACE_SelfActions {};
class ACE_SelfActions {
class ACE_Passengers {
displayName = "$STR_ACE_Interaction_Passengers";
condition = "true";
statement = "";
insertChildren = QUOTE(_this call FUNC(addPassengersActions));
};
};
};
class Tank: LandVehicle {
class ACE_Actions {
@ -423,7 +430,14 @@ class CfgVehicles {
condition = "true";
};
};
class ACE_SelfActions {};
class ACE_SelfActions {
class ACE_Passengers {
displayName = "$STR_ACE_Interaction_Passengers";
condition = "true";
statement = "";
insertChildren = QUOTE(_this call FUNC(addPassengersActions));
};
};
};
class Air;
@ -436,7 +450,14 @@ class CfgVehicles {
condition = "true";
};
};
class ACE_SelfActions {};
class ACE_SelfActions {
class ACE_Passengers {
displayName = "$STR_ACE_Interaction_Passengers";
condition = "true";
statement = "";
insertChildren = QUOTE(_this call FUNC(addPassengersActions));
};
};
};
class Plane: Air {
class ACE_Actions {
@ -447,7 +468,14 @@ class CfgVehicles {
condition = "true";
};
};
class ACE_SelfActions {};
class ACE_SelfActions {
class ACE_Passengers {
displayName = "$STR_ACE_Interaction_Passengers";
condition = "true";
statement = "";
insertChildren = QUOTE(_this call FUNC(addPassengersActions));
};
};
};
class Ship;
@ -469,7 +497,14 @@ class CfgVehicles {
};
};
};
class ACE_SelfActions {};
class ACE_SelfActions {
class ACE_Passengers {
displayName = "$STR_ACE_Interaction_Passengers";
condition = "true";
statement = "";
insertChildren = QUOTE(_this call FUNC(addPassengersActions));
};
};
};
class StaticWeapon: LandVehicle {
@ -481,7 +516,14 @@ class CfgVehicles {
condition = "true";
};
};
class ACE_SelfActions {};
class ACE_SelfActions {
class ACE_Passengers {
displayName = "$STR_ACE_Interaction_Passengers";
condition = "true";
statement = "";
insertChildren = QUOTE(_this call FUNC(addPassengersActions));
};
};
};
class StaticMortar;
@ -494,7 +536,14 @@ class CfgVehicles {
condition = "true";
};
};
class ACE_SelfActions {};
class ACE_SelfActions {
class ACE_Passengers {
displayName = "$STR_ACE_Interaction_Passengers";
condition = "true";
statement = "";
insertChildren = QUOTE(_this call FUNC(addPassengersActions));
};
};
};
class thingX;

View File

@ -2,6 +2,8 @@
ADDON = false;
PREP(addPassengerActions);
PREP(addPassengersActions);
PREP(addSelectableItem);
PREP(applyButtons);
PREP(canInteractWithCivilian);

View File

@ -5,7 +5,7 @@ class CfgPatches {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
requiredAddons[] = {"ace_interact_menu"};
author[] = {"commy2", "KoffeinFlummi", "CAA-Picard", "bux578"};
authorUrl = "https://github.com/commy2/";
VERSION_CONFIG;

View File

@ -0,0 +1,32 @@
/*
* Author: CAA-Picard
* Mount unit actions inside passenger submenu
* Note: This function is NOT global.
*
* Argument:
* 0: Vehicle <OBJECT>
* 1: Player <OBJECT>
* 3: Parameters <ARRAY>
*
* Return value:
* Children actions <ARRAY>
*
* Public: No
*/
#include "script_component.hpp"
EXPLODE_3_PVT(_this,_vehicle,_player,_parameters);
diag_log "addPassengerActions";
private ["_unit","_actions"];
_unit = _parameters select 0;
_varName = format [QEGVAR(interact_menu,Act_%1), typeOf _unit];
_actionTrees = missionNamespace getVariable [_varName, []];
_actions = [];
// Mount unit MainActions menu
_actions pushBack (_actionTrees select 0);
_actions

View File

@ -0,0 +1,43 @@
/*
* Author: CAA-Picard
* Create one action per passenger
* Note: This function is NOT global.
*
* Argument:
* 0: Vehicle <OBJECT>
* 1: Player <OBJECT>
* 3: Parameters <ARRAY>
*
* Return value:
* Children actions <ARRAY>
*
* Public: No
*/
#include "script_component.hpp"
EXPLODE_3_PVT(_this,_vehicle,_player,_parameters);
private ["_actions"];
_actions = [];
{
_unit = _x;
if (_x != _player) then {
_actions pushBack
[
[
str(_unit),
[_unit, true] call EFUNC(common,getName),
"",
{systemChat "selected passenger"},
{true},
{_this call FUNC(addPassengerActions);},
[_unit]
] call EFUNC(interact_menu,createAction),
[],
_unit
];
};
} forEach crew _vehicle;
_actions

View File

@ -650,5 +650,8 @@
<Polish>Interakcja</Polish>
<Spanish>Interactuar</Spanish>
</Key>
<Key ID="STR_ACE_Interaction_Passengers">
<English>Passengers &gt;&gt;</English>
</Key>
</Package>
</Project>