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

@ -83,6 +83,8 @@
["setDir", {(_this select 0) setDir (_this select 1)}] call FUNC(addEventhandler);
["setFuel", {(_this select 0) setFuel (_this select 1)}] call FUNC(addEventhandler);
["setSpeaker", {(_this select 0) setSpeaker (_this select 1)}] call FUNC(addEventhandler);
["selectLeader", {(_this select 0) selectLeader (_this select 1)}] call FUNC(addEventHandler);
["setVelocity", {(_this select 0) setVelocity (_this select 1)}] call FUNC(addEventHandler);
if (isServer) then {
["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler);

View File

@ -1,3 +1,4 @@
class ACE_Settings {
class GVAR(EnableTeamManagement) {
value = 1;

View File

@ -1,6 +1,5 @@
class ACE_ZeusActions {
// _target = curatorLogic
// curatorSelected = [objects,groups,waypoints,markers]
class ZeusUnits {
displayName = "$STR_A3_RscDisplayCurator_ModeUnits_tooltip";
icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeUnits_ca.paa";
@ -29,12 +28,14 @@ class ACE_ZeusActions {
statement = "{_x setUnitPos 'AUTO';} forEach (curatorSelected select 0);";
};
};
class remoteControl {
displayName = "$STR_A3_CfgVehicles_ModuleRemoteControl_F";
icon = "\A3\Modules_F_Curator\Data\portraitRemoteControl_ca.paa";
statement = "_unit = objNull; { if ((side _x in [east,west,resistance,civilian]) && !(isPlayer _x)) exitWith { _unit = _x; }; } forEach (curatorSelected select 0); bis_fnc_curatorObjectPlaced_mouseOver = ['OBJECT',_unit]; (group _target) createUnit ['ModuleRemoteControl_F',[0,0,0],[],0,''];";
};
};
class ZeusGroups {
displayName = "$STR_A3_RscDisplayCurator_ModeGroups_tooltip";
icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeGroups_ca.paa";
@ -67,6 +68,7 @@ class ACE_ZeusActions {
statement = "{ _x setBehaviour 'STEALTH'; } forEach (curatorSelected select 1);";
};
};
class speed {
displayName = "$STR_HC_Menu_Speed";
@ -86,6 +88,7 @@ class ACE_ZeusActions {
statement = "{_x setSpeedMode 'FULL';} forEach (curatorSelected select 1);";
};
};
class formation {
displayName = "$STR_Formation";
@ -136,6 +139,7 @@ class ACE_ZeusActions {
};
};
};
class ZeusWaypoints {
displayName = "Waypoints";
icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeRecent_ca.paa";
@ -168,6 +172,7 @@ class ACE_ZeusActions {
statement = "{ _x setWaypointBehaviour 'STEALTH'; } forEach (curatorSelected select 2);";
};
};
class speed {
displayName = "$STR_HC_Menu_Speed";
@ -187,6 +192,7 @@ class ACE_ZeusActions {
statement = "{ _x setWaypointSpeed 'FULL'; } forEach (curatorSelected select 2);";
};
};
class formation {
displayName = "$STR_Formation";
@ -237,6 +243,7 @@ class ACE_ZeusActions {
};
};
};
class ZeusMarkers {
displayName = "$STR_A3_RscDisplayCurator_ModeMarkers_tooltip";
icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeMarkers_ca.paa";

View File

@ -1,3 +1,4 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));

View File

@ -1,3 +1,4 @@
class CfgVehicles {
class ACE_Module;
class ACE_ModuleInteraction: ACE_Module {
@ -8,6 +9,7 @@ class CfgVehicles {
scope = 2;
isGlobal = 1;
icon = PATHTOF(UI\Icon_Module_Interaction_ca.paa);
class Arguments {
class EnableTeamManagement {
displayName = CSTRING(EnableTeamManagement_DisplayName);
@ -16,6 +18,7 @@ class CfgVehicles {
defaultValue = 1;
};
};
class ModuleDescription {
description = CSTRING(Module_Description);
};
@ -77,7 +80,6 @@ class CfgVehicles {
priority = 2.1;
hotkey = "Y";
};
class ACE_UnassignTeam {
displayName = CSTRING(LeaveTeam);
condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {assignedTeam _target != 'MAIN'});
@ -98,7 +100,6 @@ class CfgVehicles {
icon = PATHTOF(UI\team\team_management_ca.paa);
hotkey = "J";
};
class ACE_GetDown {
displayName = CSTRING(GetDown);
condition = QUOTE([_target] call DFUNC(canInteractWithCivilian));
@ -121,6 +122,7 @@ class CfgVehicles {
priority = 2.5;
};
};
class ACE_Torso {
displayName = CSTRING(Torso);
selection = "spine3";
@ -170,7 +172,6 @@ class CfgVehicles {
condition = "";
statement = "";
};
class ACE_TapShoulderRight {
displayName = CSTRING(TapShoulder);
selection = "rightshoulder";
@ -238,7 +239,6 @@ class CfgVehicles {
icon = PATHTOF(UI\team\team_yellow_ca.paa);
hotkey = "Y";
};
class ACE_LeaveTeam {
displayName = CSTRING(LeaveTeam);
condition = QUOTE(assignedTeam _player != 'MAIN');
@ -405,6 +405,7 @@ class CfgVehicles {
};
};
};
class ACE_SelfActions {
class ACE_Passengers {
displayName = CSTRING(Passengers);
@ -414,6 +415,7 @@ class CfgVehicles {
};
};
};
class Tank: LandVehicle {
class ACE_Actions {
class ACE_MainActions {
@ -429,6 +431,7 @@ class CfgVehicles {
};
};
};
class ACE_SelfActions {
class ACE_Passengers {
displayName = CSTRING(Passengers);
@ -455,6 +458,7 @@ class CfgVehicles {
};
};
};
class ACE_SelfActions {
class ACE_Passengers {
displayName = CSTRING(Passengers);
@ -464,6 +468,7 @@ class CfgVehicles {
};
};
};
class Plane: Air {
class ACE_Actions {
class ACE_MainActions {
@ -479,6 +484,7 @@ class CfgVehicles {
};
};
};
class ACE_SelfActions {
class ACE_Passengers {
displayName = CSTRING(Passengers);
@ -501,7 +507,7 @@ class CfgVehicles {
class ACE_Push {
displayName = CSTRING(Push);
distance = 6;
condition = QUOTE(((getMass _target) <= 2600) && {alive _target} && {(vectorMagnitude (velocity _target)) < 3});
condition = QUOTE(getMass _target <= 2600 && {alive _target} && {vectorMagnitude velocity _target < 3});
statement = QUOTE(_this call FUNC(push));
showDisabled = 0;
priority = -1;
@ -514,6 +520,7 @@ class CfgVehicles {
};
};
};
class ACE_SelfActions {
class ACE_Passengers {
displayName = CSTRING(Passengers);
@ -539,6 +546,7 @@ class CfgVehicles {
};
};
};
class ACE_SelfActions {
class ACE_Passengers {
displayName = CSTRING(Passengers);
@ -551,6 +559,7 @@ class CfgVehicles {
class StaticMGWeapon: StaticWeapon {};
class HMG_01_base_F: StaticMGWeapon {};
class HMG_01_high_base_F: HMG_01_base_F {
class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions {
@ -558,6 +567,7 @@ class CfgVehicles {
};
};
};
class AA_01_base_F: StaticMGWeapon {
class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions {
@ -565,6 +575,7 @@ class CfgVehicles {
};
};
};
class AT_01_base_F: StaticMGWeapon {
class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions {
@ -581,6 +592,7 @@ class CfgVehicles {
selection = "";
distance = 2;
condition = "true";
class ACE_OpenBox {
displayName = CSTRING(OpenBox);
condition = QUOTE(alive _target);
@ -590,6 +602,7 @@ class CfgVehicles {
};
};
};
class ACE_SelfActions {};
};
@ -602,6 +615,7 @@ class CfgVehicles {
condition = "true";
};
};
class ACE_SelfActions {};
};
};

View File

@ -1,3 +1,4 @@
#define HSPACE 0.5-2.0/16/2
#define VSPACE 0.5-0.3/9/2
@ -44,11 +45,13 @@ class ACE_Interaction_Button_Base {
class RscListbox;
class IGUIBack;
class RscText;
#define X_OFFSET 0.2
class RscACE_SelectAnItem {
idd = 8854;
movingEnable = 0;
class controls {
class back: IGUIBack {
x = X_OFFSET;
@ -139,18 +142,21 @@ class RscInteractionIcon: RscPicture {
w = 2*GUI_GRID_H;
h = 2*GUI_GRID_H;
};
class RscInteractionHelperIcon: RscInteractionIcon {
x = 20 * GUI_GRID_W;
y = 16 * GUI_GRID_H;
w = GUI_GRID_H;
h = GUI_GRID_H;
};
class RscInteractionText: RscText{
x = 21 * GUI_GRID_W;
y = 16 * GUI_GRID_H;
w = 8 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
};
class RscTitles {
class GVAR(InteractionHelper) {
idd = 9930;

View File

@ -1,37 +1,22 @@
// by commy2 and esteldunedain
#include "script_component.hpp"
ACE_Modifier = 0;
//SelectLeader Event Handler for BecomeLeader action:
[QGVAR(selectLeader), {
PARAMS_2(_group,_leader);
_group selectLeader _leader;
}] call EFUNC(common,addEventHandler);
//Pushing boats from FUNC(push)
[QGVAR(pushBoat), {
params ["_boat", "_newVelocity"];
_boat setVelocity _newVelocity;
}] call EFUNC(common,addEventHandler);
if (!hasInterface) exitWith {};
GVAR(isOpeningDoor) = false;
// restore global fire teams for JIP
private ["_team"];
private "_team";
{
_team = _x getVariable [QGVAR(assignedFireTeam), ""];
if (_team != "") then {_x assignTeam _team};
} forEach allUnits;
false
} count allUnits;
// Add keybinds
["ACE3 Common", QGVAR(openDoor), localize LSTRING(OpenDoor),
{
// add keybinds
["ACE3 Common", QGVAR(openDoor), localize LSTRING(OpenDoor), {
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
@ -40,18 +25,16 @@ private ["_team"];
// Statement
call EFUNC(interaction,openDoor);
true
},
{
}, {
//Probably don't want any condidtions here, so variable never gets locked down
// Statement
GVAR(isOpeningDoor) = false;
true
},
[57, [false, true, false]], false] call cba_fnc_addKeybind; //Key CTRL+Space
[57, [false, true, false]], false] call CBA_fnc_addKeybind; //Key CTRL+Space
["ACE3 Common", QGVAR(tapShoulder), localize LSTRING(TapShoulder),
{
["ACE3 Common", QGVAR(tapShoulder), localize LSTRING(TapShoulder), {
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
@ -62,10 +45,9 @@ private ["_team"];
true
},
{false},
[20, [true, false, false]], false] call cba_fnc_addKeybind;
[20, [true, false, false]], false] call CBA_fnc_addKeybind;
["ACE3 Common", QGVAR(modifierKey), localize LSTRING(ModifierKey),
{
["ACE3 Common", QGVAR(modifierKey), localize LSTRING(ModifierKey), {
// Conditions: canInteract
//if !([ACE_player, objNull, ["isNotDragging"]] call EFUNC(common,canInteractWith)) exitWith {false}; // not needed
@ -73,13 +55,12 @@ private ["_team"];
ACE_Modifier = 1;
// Return false so it doesn't block other actions
false
},
{
}, {
//Probably don't want any condidtions here, so variable never gets locked down
ACE_Modifier = 0;
false;
},
[29, [false, false, false]], false] call cba_fnc_addKeybind;
[29, [false, false, false]], false] call CBA_fnc_addKeybind;
["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);

View File

@ -14,6 +14,6 @@ class CfgPatches {
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
#include "Menu_Config.hpp"
#include "RscTitles.hpp"
#include "ACE_Settings.hpp"
#include "ACE_ZeusActions.hpp"

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);
_x params ["_actionData", "_children"];
_actions pushBack [_actionData, _children, _unit];
} forEach ((_actionTrees select 0) select 1);
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),
format ["%1", _unit],
[_unit, true] call EFUNC(common,getName),
_icon,
{},
{true},
{_this call FUNC(addPassengerActions);},
{_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);