Code Cleanup Interaction

This commit is contained in:
commy2
2015-09-28 14:35:05 +02:00
parent af24428363
commit 4b536425b1
12 changed files with 137 additions and 119 deletions

View File

@ -1,13 +1,13 @@
/*
* Author: esteldunedain
* Mount unit actions inside passenger submenu
* Mount unit actions inside passenger submenu.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Player <OBJECT>
* 3: Parameters <ARRAY>
*
* Return value:
* Return Value:
* Children actions <ARRAY>
*
* Example:
@ -17,8 +17,8 @@
*/
#include "script_component.hpp"
EXPLODE_3_PVT(_this,_vehicle,_player,_parameters);
EXPLODE_1_PVT(_parameters,_unit);
params ["", "", "_parameters"];
_parameters params ["_unit"];
private ["_varName", "_actionTrees", "_actions"];
@ -26,11 +26,13 @@ _varName = format [QEGVAR(interact_menu,Act_%1), typeOf _unit];
_actionTrees = missionNamespace getVariable [_varName, []];
_actions = [];
// Mount unit MainActions menu
// Mount unit MainActions menu
{
EXPLODE_2_PVT(_x,_actionData,_children);
_actions pushBack [_actionData, _children, _unit];
} forEach ((_actionTrees select 0) select 1);
_x params ["_actionData", "_children"];
_actions pushBack [_actionData, _children, _unit];
false
} count (_actionTrees select 0 select 1);
_actions

View File

@ -1,6 +1,6 @@
/*
* Author: esteldunedain
* Create one action per passenger
* Create one action per passenger.
*
* Arguments:
* 0: Vehicle <OBJECT>
@ -17,39 +17,43 @@
*/
#include "script_component.hpp"
EXPLODE_3_PVT(_this,_vehicle,_player,_parameters);
params ["_vehicle", "_player"];
private ["_actions"];
private "_actions";
_actions = [];
{
private ["_unit", "_icon"];
_unit = _x;
if ((_unit != _player) && {(getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "simulation")) != "UAVPilot"}) then {
_icon = switch _unit do {
case (driver _vehicle): { QUOTE(A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_driver_ca.paa) };
case (gunner _vehicle): { QUOTE(A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_gunner_ca.paa) };
case (commander _vehicle): { QUOTE(A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_commander_ca.paa) };
default { "" };
};
if (_unit != _player && {getText (configFile >> "CfgVehicles" >> typeOf _unit >> "simulation") != "UAVPilot"}) then {
_icon = [
"",
"A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_driver_ca.paa",
"A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_gunner_ca.paa",
"A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_commander_ca.paa"
] select (([driver _vehicle, gunner _vehicle, commander _vehicle] find _unit) + 1);
if (_unit getVariable [QEGVAR(captives,isHandcuffed), false]) then {
_icon = QUOTE(PATHTOEF(captives,UI\handcuff_ca.paa));
};
_actions pushBack
_actions pushBack [
[
[
str(_unit),
[_unit, true] call EFUNC(common,getName),
_icon,
{},
{true},
{_this call FUNC(addPassengerActions);},
[_unit]
] call EFUNC(interact_menu,createAction),
[],
_unit
];
format ["%1", _unit],
[_unit, true] call EFUNC(common,getName),
_icon,
{},
{true},
{_this call FUNC(addPassengerActions)},
[_unit]
] call EFUNC(interact_menu,createAction),
[],
_unit
];
};
} forEach crew _vehicle;
false
} count crew _vehicle;
_actions

View File

@ -4,7 +4,7 @@
*
* Arguments:
* 0: Target <OBJECT>
* 1: Player <OBJECT>
* 1: Unit <OBJECT>
*
* Return Value:
* None
@ -16,6 +16,6 @@
*/
#include "script_component.hpp"
PARAMS_2(_target,_player);
params ["_target", "_unit"];
[QGVAR(selectLeader), (units group _player), [(group _player), _player]] call EFUNC(common,targetEvent);
["selectLeader", units group _unit, [group _unit, _unit]] call EFUNC(common,targetEvent);

View File

@ -4,7 +4,7 @@
*
* Arguments:
* 0: Boat <OBJECT>
* 1: Player <OBJECT>
* 1: Unit <OBJECT>
*
* Return Value:
* None
@ -14,13 +14,13 @@
*
* Public: No
*/
#include "script_component.hpp"
params ["_boat", "_player"];
params ["_boat", "_unit"];
private ["_newVelocity"];
private "_newVelocity";
_newVelocity = vectorDir _unit;
_newVelocity set [2, 0.25];
_newVelocity = _newVelocity vectorMultiply 2;
_newVelocity = [2 * (vectorDir _player select 0), 2 * (vectorDir _player select 1), 0.5];
[QGVAR(pushBoat), [_boat], [_boat, _newVelocity]] call EFUNC(common,targetEvent);
["setVelocity", [_boat], [_boat, _newVelocity]] call EFUNC(common,targetEvent);