Merge pull request #2635 from acemod/340interactcleanup

Code Cleanup Interaction
This commit is contained in:
commy2 2015-09-28 21:04:28 +02:00
commit 34793ce044
42 changed files with 391 additions and 899 deletions

View File

@ -83,6 +83,9 @@
["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);
["assignTeam", {(_this select 0) assignTeam (_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,6 +1,7 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE( call COMPILE_FILE(XEH_preInit) );
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
@ -9,3 +10,11 @@ class Extended_PostInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
class Extended_Respawn_EventHandlers {
class CAManBase {
class ADDON {
respawn = QUOTE((_this select 0) setVariable [ARR_3(QUOTE(QGVAR(assignedFireTeam)),(_this select 0) getVariable [ARR_2(QUOTE(QGVAR(assignedFireTeam)),'MAIN')],true)]);
};
};
};

View File

@ -1,25 +1,28 @@
class CfgVehicles {
class ACE_Module;
class ACE_ModuleInteraction: ACE_Module {
author = ECSTRING(common,ACETeam);
category = "ACE";
displayName = CSTRING(Module_DisplayName);
function = "ACE_Interaction_fnc_moduleInteraction";
scope = 2;
isGlobal = 1;
icon = PATHTOF(UI\Icon_Module_Interaction_ca.paa);
class Arguments {
class EnableTeamManagement {
displayName = CSTRING(EnableTeamManagement_DisplayName);
description = CSTRING(EnableTeamManagement_Description);
typeName = "BOOL";
defaultValue = 1;
};
class ACE_Module;
class ACE_ModuleInteraction: ACE_Module {
author = ECSTRING(common,ACETeam);
category = "ACE";
displayName = CSTRING(Module_DisplayName);
function = "ACE_Interaction_fnc_moduleInteraction";
scope = 2;
isGlobal = 1;
icon = PATHTOF(UI\Icon_Module_Interaction_ca.paa);
class Arguments {
class EnableTeamManagement {
displayName = CSTRING(EnableTeamManagement_DisplayName);
description = CSTRING(EnableTeamManagement_Description);
typeName = "BOOL";
defaultValue = 1;
};
};
class ModuleDescription {
description = CSTRING(Module_Description);
};
};
class ModuleDescription {
description = CSTRING(Module_Description);
};
};
class Man;
class CAManBase: Man {
@ -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,29 +100,29 @@ class CfgVehicles {
icon = PATHTOF(UI\team\team_management_ca.paa);
hotkey = "J";
};
class ACE_GetDown {
displayName = CSTRING(GetDown);
condition = QUOTE([_target] call DFUNC(canInteractWithCivilian));
statement = QUOTE([_target] call DFUNC(getDown));
condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canInteractWithCivilian));
statement = QUOTE([ARR_2(_player,_target)] call DFUNC(getDown));
showDisabled = 0;
priority = 2.2;
};
class ACE_SendAway {
displayName = CSTRING(SendAway);
condition = QUOTE([_target] call DFUNC(canInteractWithCivilian));
statement = QUOTE([_target] call DFUNC(sendAway));
condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canInteractWithCivilian));
statement = QUOTE([ARR_2(_player,_target)] call DFUNC(sendAway));
showDisabled = 0;
priority = 2.0;
};
class ACE_Pardon {
displayName = CSTRING(Pardon);
condition = QUOTE(rating _target < -2000 && {alive _target} && {side group _player == side group _target});
statement = QUOTE([ARR_3(_target,'{_this addRating -rating _this}',_target)] call DEFUNC(common,execRemoteFnc));
condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canPardon));
statement = QUOTE([ARR_2(_player,_target)] call DFUNC(pardon));
showDisabled = 0;
priority = 2.5;
};
};
class ACE_Torso {
displayName = CSTRING(Torso);
selection = "spine3";
@ -165,12 +167,11 @@ class CfgVehicles {
};
class ACE_Weapon {
displayName = CSTRING(Weapon);
position = QUOTE(call FUNC(getWeaponPos));
position = QUOTE(call DFUNC(getWeaponPos));
distance = 1.50;
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,26 +559,29 @@ 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 {
position = "[-0.172852,0.164063,-0.476091]";
};
};
class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions {
position = "[-0.172852,0.164063,-0.476091]";
};
};
};
class AA_01_base_F: StaticMGWeapon {
class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions {
position = "[0,0.515869,-0.200671]";
};
};
class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions {
position = "[0,0.515869,-0.200671]";
};
};
};
class AT_01_base_F: StaticMGWeapon {
class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions {
position = "[0,0.515869,-0.200671]";
};
};
class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions {
position = "[0,0.515869,-0.200671]";
};
};
};
class thingX;
@ -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,13 +45,15 @@ 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 {
class back: IGUIBack {
x = X_OFFSET;
y = 0;
w = 0.6;
@ -66,7 +69,7 @@ class RscACE_SelectAnItem {
style = 0x02;
text = "";
};
class itemList:RscListBox {
class itemList: RscListBox {
onMouseButtonDblClick = "_this call ACE_Interaction_fnc_onSelectMenuDblClick";
idc = 8866;
x = X_OFFSET + 0.005;
@ -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,52 @@
// 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;
["pardon", {(_this select 0) addRating -rating (_this select 0)}] call EFUNC(common,addEventHandler);
["getDown", {
params ["_target"];
_target setUnitPos "DOWN";
}] call EFUNC(common,addEventHandler);
//Pushing boats from FUNC(push)
[QGVAR(pushBoat), {
params ["_boat", "_newVelocity"];
_boat setVelocity _newVelocity;
}] call EFUNC(common,addEventHandler);
["sendAway", {
params ["_unit", "_position"];
_unit setUnitPos "AUTO";
_unit doMove _position;
}] call EFUNC(common,addEventHandler);
if (!hasInterface) exitWith {};
GVAR(isOpeningDoor) = false;
[{_this call FUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler);
["tapShoulder", {
params ["_unit", "_shoulderNum"];
if (_unit == ACE_player) then {
addCamShake [4, 0.5, 5];
};
private "_message";
_message = parseText format ([["%1 &gt;", localize LSTRING(YouWereTappedRight)], ["&lt; %1", localize LSTRING(YouWereTappedLeft)]] select (_shoulderNum == 0));
["displayTextStructured", _message] call EFUNC(common,targetEvent);
}] call EFUNC(common,addEventHandler);
// 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 +55,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 +75,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 +85,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

@ -2,37 +2,38 @@
ADDON = false;
// interaction menu
PREP(addPassengerActions);
PREP(addPassengersActions);
PREP(addSelectableItem);
PREP(applyButtons);
PREP(canBecomeLeader);
PREP(getWeaponPos);
PREP(moduleInteraction);
PREP(removeTag);
// scroll wheel hint
PREP(showMouseHint);
PREP(hideMouseHint);
// interaction with units
PREP(canInteractWithCivilian);
PREP(getDown);
PREP(sendAway);
PREP(canJoinGroup);
PREP(canJoinTeam);
PREP(canTapShoulder);
PREP(joinTeam);
PREP(canBecomeLeader);
PREP(doBecomeLeader);
PREP(canTapShoulder);
PREP(tapShoulder);
PREP(canPardon);
PREP(pardon);
// interaction with doors
PREP(getDoor);
PREP(getDoorAnimations);
PREP(getDown);
PREP(getSelectedButton);
PREP(getWeaponPos);
PREP(hideMenu);
PREP(hideMouseHint);
PREP(isInRange);
PREP(joinTeam);
PREP(moduleInteraction);
PREP(moveDown);
PREP(onSelectMenuDblClick);
PREP(handleScrollWheel);
PREP(openDoor);
PREP(openMenuSelectUI);
PREP(openSelectMenu);
PREP(prepareSelectMenu);
// interaction with boats
PREP(push);
PREP(removeTag);
PREP(sendAway);
PREP(showMouseHint);
PREP(sortOptionsByPriority);
PREP(tapShoulder);
ADDON = true;

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);
_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,13 +1,13 @@
/*
* Author: esteldunedain
* Create one action per passenger
* Create one action per passenger.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Player <OBJECT>
* 3: Parameters <ARRAY>
*
* Return value:
* Return Value:
* Children actions <ARRAY>
*
* Example:
@ -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

@ -1,32 +0,0 @@
/*
* Author: Garth de Wet (LH)
* Adds an item to the select menu
*
* Arguments:
* 0: List container <ARRAY/NUMBER>
* 1: Display name <STRING>
* 2: Picture <STRING>
* 3: Data <STRING/CODE>
*
* Return value:
* Container <ARRAY/NUMBER>
*
* Example:
* [actions, "Banana", "UI\dot_ca.paa", "bananaContents"] call ace_interaction_fnc_addSelectableItem
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_4(_container,_displayName,_picture,_data);
if (_picture == "" || _picture == "PictureThing") then {
_picture = QUOTE(PATHTOF(UI\dot_ca.paa));
};
private ["_index"];
_index = lbAdd [_container, _displayName];
lbSetData [_container, _index, str _data];
lbSetPicture [_container, _index, _picture];
_container

View File

@ -1,66 +0,0 @@
/*
* Author: commy2
* Applies buttons
*
* Arguments:
* None
*
* Return value:
* None
*
* Example:
* call ace_interaction_fnc_applyButtons
*
* Public: No
*/
#include "script_component.hpp"
private ["_object", "_actions", "_dlgInteractionDialog", "_ctrlInteractionDialog", "_index", "_ctrlInteractionDialogIcon", "_a", "_action", "_count"];
_object = GVAR(Target);
_actions = GVAR(Buttons);
disableSerialization;
_dlgInteractionDialog = uiNamespace getVariable QGVAR(Dialog);
/*
for "_a" from 0 to (_count - 1) do {
_action = GVAR(Buttons) select _a;
_ctrlInteractionDialog = _dlgInteractionDialog displayCtrl (10 + _a);
_ctrlInteractionDialog ctrlShow true;
_ctrlInteractionDialog ctrlSetText (_action select 0);
_ctrlInteractionDialog ctrlEnable (call (_action select 2));
};
*/
_ctrlInteractionDialog = _dlgInteractionDialog displayCtrl 3;
GVAR(MainButton) = "(findDisplay 1713999) closeDisplay 1;";
if (_object isKindOf "Man") then {
_ctrlInteractionDialog ctrlSetText (if (alive _object) then {name _object} else {_object getVariable ["ACE_Name", "Unknown"]});
} else {
_ctrlInteractionDialog ctrlSetText (getText (configFile >> "CfgVehicles" >> typeOf _object >> "displayName"));
};
for "_index" from 0 to 9 do {
_ctrlInteractionDialog = _dlgInteractionDialog displayCtrl (10 + _index);
_ctrlInteractionDialog ctrlShow true;
_ctrlInteractionDialogIcon = _dlgInteractionDialog displayCtrl (20 + _index);
if (_index < _count) then {
_action = GVAR(Buttons) select _index;
_ctrlInteractionDialog ctrlSetText (_action select 0);
_ctrlInteractionDialog ctrlEnable (call (_action select 2));
_ctrlInteractionDialogIcon ctrlSetText (_action select 5);
} else {
_ctrlInteractionDialog ctrlSetText "";
_ctrlInteractionDialog ctrlEnable false;
_ctrlInteractionDialogIcon ctrlSetText "";
};
};

View File

@ -1,21 +1,20 @@
/*
* Author: PabstMirror
* Test if can Become Leader of group
* Test if can Become Leader of group.
*
* Arguments:
* 0: Target <OBJECT>
* 1: Player <OBJECT>
* 1: Unit <OBJECT>
*
* Return Value:
* Able to become leader of group <BOOL>
*
* Example:
* [player, player] call ace_interaction_fnc_canBecomeLeader
* [player] call ace_interaction_fnc_canBecomeLeader
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_target,_player);
params ["_unit"];
(count (units group _player) > 1) && {leader group _player != _player}
count units group _unit > 1 && {leader group _unit != _unit}

View File

@ -1,11 +1,13 @@
/*
* Author: commy2
* Checks if the player can interact with civilian
* Checks if the unit can interact with civilian
*
* Arguments:
* 0: Target <OBJECT>
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
* 2: Target has to be on the civilian side (default: true) <BOOL>
*
* Return value:
* Return Value:
* Able to interact with civilian <BOOL>
*
* Example:
@ -15,10 +17,6 @@
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_unit,_isCivilian);
params ["_unit", "_target", ["_isCivilian", true]];
if (isNil "_isCivilian") then {_isCivilian = true};
alive _unit
&& [side _unit != side ACE_player, side group _unit == civilian] select _isCivilian
//&& {count (weapons _unit) == 0}
alive _target && [side _target != side _unit, side group _target == civilian] select _isCivilian // return

View File

@ -1,12 +1,12 @@
/*
* Author: commy2
* Checks if the player can join a group
* Checks if the unit can join a group
*
* Arguments:
* 0: Player <OBJECT>
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
*
* Return value:
* Return Value:
* Able to join a group <BOOL>
*
* Example:
@ -16,9 +16,9 @@
*/
#include "script_component.hpp"
PARAMS_2(_unit,_target);
params ["_unit", "_target"];
alive _target
&& {!(_target getVariable ["ACE_isUnconscious", false])}
&& {side group _unit == side group _target}
&& {group _unit != group _target}
&& {group _unit != group _target} // return

View File

@ -0,0 +1,20 @@
/*
* Author: commy2
* Checks if the unit can pardon the target.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* Unit can pardon target <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_target"];
alive _target
&& {rating _target < -2000}
&& {side group _unit == side group _target}

View File

@ -1,12 +1,12 @@
/*
* Author: commy2
* Checks if the player can tap a shoulder
* Checks if the player can tap a shoulder.
*
* Arguments:
* 0: Player <OBJECT>
* 1: Target <OBJECT>
*
* Return value:
* Return Value:
* Able to tap a shoulder <BOOL>
*
* Example:
@ -16,9 +16,9 @@
*/
#include "script_component.hpp"
PARAMS_2(_unit,_target);
params ["_unit", "_target"];
_target isKindOf "CAManBase" &&
{alive _target} &&
{_unit distance _target < 4} &&
{!(_target getVariable ["ACE_isUnconscious", false])}
{!(_target getVariable ["ACE_isUnconscious", false])} // return

View File

@ -1,21 +1,20 @@
/*
* Author: PabstMirror
* Become Leader of group
* Become Leader of group.
*
* Arguments:
* 0: Target <OBJECT>
* 1: Player <OBJECT>
* 0: Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, player] call ace_interaction_fnc_doBecomeLeader
* [player] call ace_interaction_fnc_doBecomeLeader
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_target,_player);
params ["_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

@ -1,11 +1,11 @@
/*
* Author: commy2
* Get door
* Find door.
*
* Arguments:
* 0: Distance <NUMBER>
*
* Return value:
* Return Value:
* House objects and door <ARRAY>
* 0: House <OBJECT>
* 1: Door Name <STRING>
@ -17,19 +17,18 @@
*/
#include "script_component.hpp"
PARAMS_1(_distance);
params ["_distance"];
private ["_position0", "_position1", "_intersections", "_count", "_house", "_door"];
private ["_position0", "_position1", "_intersections", "_house", "_door"];
_position0 = positionCameraToWorld [0, 0, 0];
_position1 = positionCameraToWorld [0, 0, _distance];
_intersections = lineIntersectsWith [ATLToASL _position0, ATLToASL _position1, objNull, objNull, true];
_intersections = lineIntersectsSurfaces [AGLToASL _position0, AGLToASL _position1, cameraOn, objNull, true, 1, "GEOM"];
_count = count _intersections;
if (_count == 0) exitWith {[objNull, ""]};
if (_intersections isEqualTo []) exitWith {[objNull, ""]};
_house = _intersections select (_count - 1);
_house = _intersections select 0 select 2;
// shithouse is bugged
if (typeOf _house == "") exitWith {[objNull, ""]};
@ -37,6 +36,7 @@ if (typeOf _house == "") exitWith {[objNull, ""]};
_intersections = [_house, "GEOM"] intersect [_position0, _position1];
_door = _intersections select 0 select 0;
if (isNil "_door") exitWith {[_house, ""]};
[_house, _door]

View File

@ -1,12 +1,12 @@
/*
* Author: commy2
* Get door animations
* Get door animations. @todo rewrite for better custom building support
*
* Arguments:
* 0: House <OBJECT>
* 1: Door <STRING>
*
* Return value:
* Return Value:
* Animation and Locked variable <ARRAY>
* 0: Animation <STRING>
* 1: Locked variable <STRING>
@ -18,7 +18,7 @@
*/
#include "script_component.hpp"
PARAMS_2(_house,_door);
params ["_house", "_door"];
private ["_index", "_animations", "_lockedVariable"];

View File

@ -1,38 +1,33 @@
/*
* Author: KoffeinFlummi
* Forces a civilian to the ground (with a chance of failure)
* Author: KoffeinFlummi, commy2
* Forces a civilian to the ground with a chance of failure.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
*
* Return value:
* Return Value:
* None
*
* Example:
* [target] call ace_interaction_fnc_getDown
* [civillian] call ace_interaction_fnc_getDown
*
* Public: No
*/
#include "script_component.hpp"
#define RADIUS 10
#define SEND_RADIUS 10
PARAMS_1(_unit);
params ["_unit", "_target"];
private ["_chance", "_x"];
_unit playActionNow "GestureGo";
ACE_player playActionNow "GestureGo"; // put something else here.
if (count (weapons ACE_player) > 0) then {
_chance = 0.8;
} else {
_chance = 0.5;
};
private "_chance";
_chance = [0.5, 0.8] select (count weapons _unit > 0);
{
if (count (weapons _unit) == 0 and random 1 < _chance) then {
[-2, {
_this setUnitPos "DOWN";
}, _x] call CBA_fnc_globalExecute;
};
} forEach (_unit nearEntities ["Civilian", RADIUS]);
if (count weapons _x == 0 && {random 1 < _chance}) then {
["getDown", [_x], [_x]] call EFUNC(common,targetEvent);
};
false
} count (_target nearEntities ["Civilian", SEND_RADIUS]);

View File

@ -1,38 +0,0 @@
/*
* Author: commy2
* Get selected button
*
* Arguments:
* None
*
* Return value:
* Angle <NUMBER>
*
* Example:
* call ace_interaction_fnc_getSelectedButton
*
* Public: No
*/
#include "script_component.hpp"
#define MIN_DISTANCE 0.0065
private ["_position", "_distance", "_angle"];
_position = uiNamespace getVariable [QGVAR(CursorPosition), [0.5, 0.5, 0]];
_position = [((_position select 1) - 0.5) / safezoneH, ((_position select 2) - 0.5) / safezoneW, 0];
_distance = [0, 0, 0] vectorDistanceSqr _position;
// is in center
if (_distance < MIN_DISTANCE) exitWith {-1};
_angle = (_position select 0) atan2 (_position select 1);
// rotate circle
_angle = 180 - _angle + 360 / 10 / 2;
if (_angle < 0) then {_angle = _angle + 360};
_angle = floor (_angle / 360 * 10);
if (_angle == 10) then {0} else {_angle}

View File

@ -0,0 +1,23 @@
/*
* Author: commy2
* Handles incremental door opening
*
* Arguments:
* 0: scroll amount <NUMBER>
*
* Return Value:
* handled <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
params ["_scroll"];
if !(GVAR(isOpeningDoor)) exitWith {false};
GVAR(doorTargetPhase) = ((GVAR(doorTargetPhase) + (_scroll / (1.2 * 12))) max 0) min 1;
GVAR(usedScrollWheel) = true;
true

View File

@ -1,22 +0,0 @@
/*
* Author: Garth de Wet (LH)
* Closes the Interaction menu
*
* Arguments:
* None
*
* Return value:
* None
*
* Example:
* call ace_interaction_fnc_hideMenu
*
* Public: No
*/
#include "script_component.hpp"
closeDialog 0;
(findDisplay 1713999) closeDisplay 1;
(uiNameSpace getVariable QGVAR(Flow_Display)) closeDisplay 0;
GVAR(MainButton) = nil;
call FUNC(hideMouseHint);

View File

@ -1,53 +0,0 @@
/*
* Author: commy2
* Check if the vehicle is in range of the player.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Distance in meters <NUMBER>
*
* Return value:
* Vehicle in range of player <BOOL>
*
* Example:
* [target, 5] call ace_interaction_fnc_isInRange
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_vehicle,_distance);
private ["_player", "_position0", "_position1"];
_player = ACE_player;
if (_vehicle isKindOf "Man") exitWith {_player distance _vehicle < _distance};
private ["_position0", "_position1"];//, "_direction"];
_position0 = getPosASL _player;
_position1 = getPosASL _vehicle;
/*
_direction = _position1 vectorDiff _position0;
_direction = _direction vectorMultiply (_distance / (vectorMagnitude _direction));
_position0 = eyePos _player;
_position1 = _position0 vectorAdd _direction;
_vehicle in lineIntersectsWith [_position0, _position1] || {_player distance _vehicle < _distance}
*/
_position0 = ATLToASL positionCameraToWorld [0, 0, 0];
_position0 set [2, (_position0 select 2) - (getTerrainHeightASL _position0 min 0)];
_position1 = ATLToASL positionCameraToWorld [0, 0, _distance];
_position1 set [2, (_position1 select 2) - (getTerrainHeightASL _position1 min 0)];
if (_vehicle in lineIntersectsWith [_position0, _position1] || {_player distance _vehicle < _distance}) then {
true
} else {
["Not in Range"] call FUNC(addToTooltip);
false
}

View File

@ -1,35 +1,39 @@
/*
* Author: commy2
* Assigns a unit to the team
* Unit joins a fire team.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Team <STRING>
*
* Return value:
* Return Value:
* None
*
* Example:
* [target, "YELLOW"] call ace_interaction_fnc_joinTeam
* [player, "YELLOW"] call ace_interaction_fnc_joinTeam
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_team);
private ["_message"];
params ["_unit", "_team"];
// make sure correct team is set on JIP
_unit setVariable [QGVAR(assignedFireTeam), _team, true];
[_unit, format ["{_this assignTeam '%1'}", _team]] call EFUNC(common,execRemoteFnc);
// join fire team on every machine in that group
["assignTeam", units group _unit, [_unit, _team]] call EFUNC(common,targetEvent);
// display message
if (_unit == ACE_player) then {
_message = if (_team == "MAIN") then {
localize LSTRING(LeftTeam);
private "_message";
if (_team == "MAIN") then {
_message = localize LSTRING(LeftTeam);
} else {
_team = localize format [LSTRING(Team%1), _team];
format [localize LSTRING(JoinedTeam), _team];
_message = format [localize LSTRING(JoinedTeam), _team];
};
[_message] call EFUNC(common,displayTextStructured);
["displayTextStructured", _message] call EFUNC(common,localEvent);
};

View File

@ -1,13 +1,13 @@
/*
* Author: bux578
* Initializes the Interaction module
* Initializes the Interaction module.
*
* Arguments:
* 0: Logic <NUMBER>
* 1: ???
* 1: Units <ARRAY>
* 2: Activation State <BOOL>
*
* Return value:
* Return Value:
* None
*
* Example:
@ -17,10 +17,7 @@
*/
#include "script_component.hpp"
private ["_logic", "_activated"];
_logic = _this select 0;
_activated = _this select 2;
params ["_logic", "", "_activated"];
if !(_activated) exitWith {};

View File

@ -1,67 +0,0 @@
/*
* Author: Garth de Wet (LH)
* Scrolls through the list down or up
*
* Arguments:
* 0: Amount <NUMBER>
*
* Return value:
* None
*
* Example:
* [2] call ace_interaction_fnc_moveDown
*
* Public: No
*/
#include "script_component.hpp"
private ["_count", "_player", "_vehicle", "_dlgInteractionDialog", "_top", "_i", "", "_ctrl", "_index", "_action", "_color", "_current", "_infoText", "_target"];
#define CLAMP(x,low,high) (if(x > high)then{high}else{if(x < low)then{low}else{x}})
if (isNil QGVAR(MainButton)) exitWith{};
if (isNil QGVAR(Buttons)) exitWith{};
_count = (count GVAR(Buttons))- 1;
GVAR(SelectedButton) = CLAMP(GVAR(SelectedButton) + _this, 0, _count);
_target = GVAR(Target);
_player = ACE_player;
_vehicle = vehicle _player;
disableSerialization;
_dlgInteractionDialog = uiNamespace getVariable QGVAR(Flow_Display);
_top = GVAR(SelectedButton) - 2;
_i = 0;
while {_i <= 4} do {
_index =_i + _top;
_ctrl = _dlgInteractionDialog displayCtrl (1200 + _i);
if (_index >= 0 && {_index <= _count}) then {
_action = GVAR(Buttons) select _index;
_ctrl ctrlShow true;
_ctrl ctrlSetText (_action select 5);
_color = [1,1,1,1];
if !([_target, _player] call (_action select 2)) then {
_color = [0.3,0.3,0.3,0.8];
};
if (_i == 0 || _i == 4) then {
_color set [3, 0.5];
};
if (_i == 1 || _i == 3) then {
_color set [3, 0.75];
};
_ctrl ctrlSetTextColor _color;
}else{
_ctrl ctrlShow false;
};
_i = _i + 1;
};
_ctrl = _dlgInteractionDialog displayCtrl 1000;
_ctrl ctrlSetText ((GVAR(Buttons) select GVAR(SelectedButton)) select 0);
_ctrl = _dlgInteractionDialog displayCtrl 1100;
_current = (GVAR(Buttons) select GVAR(SelectedButton));
_infoText = "";
if !([_target, _player] call (_current select 2)) then {
_infoText = "Unavailable";
};
_ctrl ctrlSetText _infoText;
_ctrl ctrlShow (_infoText != "");

View File

@ -1,44 +0,0 @@
/*
* Author: commy2
* On button up
*
* Arguments:
* None
*
* Return value:
* None
*
* Example:
* call ace_interaction_fnc_onButtonUp
*
* Public: No
*/
#include "script_component.hpp"
private ["_player", "_vehicle", "_target", "_count", "_index", "_action", "_statement", "_condition", "_conditionShow", "_distance"];
_player = ACE_player;
_vehicle = vehicle _player;
_target = [GVAR(Target), _player] select (GVAR(MenuType) % 2 == 1);
_count = count GVAR(Buttons);
_index = call FUNC(getSelectedButton);
_action = if (_index != -1 && {_index < _count}) then {
GVAR(Buttons) select _index
} else {
["", {}, {false}, 0, [], "", "", {false}, [], 0]
};
(findDisplay 1713999) closeDisplay 1;
closeDialog 0;
_statement = _action select 1;
_condition = _action select 2;
_conditionShow = _action select 7;
_distance = _action select 9;
if ((_distance == 0 || {[GVAR(Target), _distance] call FUNC(isInRange)}) && {[_target, _player] call _condition} && {[_target, _player] call _conditionShow}) then {
[_target, _player] call _statement;
};

View File

@ -1,57 +0,0 @@
/*
* Author: commy2
* On click
*
* Arguments:
* Index <NUMBER>
*
* Return value:
* None
*
* Example:
* 5 call ace_interaction_fnc_onClick
*
* Public: No
*/
#include "script_component.hpp"
private ["_player", "_vehicle", "_target", "_count", "_index", "_action", "_subMenu", "_statement", "_condition", "_conditionShow", "_distance"];
_player = ACE_player;
_vehicle = vehicle _player;
_target = [GVAR(Target), _player] select (GVAR(MenuType) % 2 == 1);
_count = count GVAR(Buttons);
_index = _this;
_action = if (_index != -1 && {_index < _count}) then {
GVAR(Buttons) select _index
} else {
["", {}, {false}, 0, [], "", "", {false}, [], 0]
};
_subMenu = _action select 4;
// back
if (_index == -1) exitWith {
call GVAR(MainButton);
};
if (count _subMenu < 2) then {
(findDisplay 1713999) closeDisplay 1;
closeDialog 0;
_statement = _action select 1;
_condition = _action select 2;
_conditionShow = _action select 7;
_distance = _action select 9;
if ((_distance == 0 || {[GVAR(Target), _distance] call FUNC(isInRange)}) && {[_target, _player] call _condition} && {[_target, _player] call _conditionShow}) then {
[_target, _player] call _statement;
};
} else {
if (_subMenu select 1 < 1) then {
[_subMenu select 0] call FUNC(openSubMenu);
} else {
[_subMenu select 0] call FUNC(openSubMenuSelf);
};
};

View File

@ -1,18 +0,0 @@
/*
* Author: CorruptedHeart, commy2
* On select menu double click
*
* Arguments:
* None
*
* Return value:
* None
*
* Example:
* call ace_interaction_fnc_onSelectMenuDblClick
*
* Public: No
*/
#include "script_component.hpp"
call compile (lbData [8866, lbCurSel 8866]) call GVAR(SelectAccept);

View File

@ -1,12 +1,12 @@
/*
* Author: commy2
* Opens door
* Open door.
*
* Arguments:
* 0: House <OBJECT>
* 1: Door <STRING>
*
* Return value:
* Return Value:
* None
*
* Example:
@ -16,56 +16,56 @@
*/
#include "script_component.hpp"
private ["_info", "_phase", "_position", "_time", "_usedMouseWheel", "_getDoorAnimations"];
private "_info";
_info = [MACRO_DOOR_REACH_DISTANCE] call FUNC(getDoor);
EXPLODE_2_PVT(_info,_house,_door);
_info params ["_house", "_door"];
if (isNull _house) exitWith {};
private "_getDoorAnimations";
_getDoorAnimations = [_house, _door] call FUNC(getDoorAnimations);
EXPLODE_2_PVT(_getDoorAnimations,_animations,_lockedVariable);
_getDoorAnimations params ["_animations", "_lockedVariable"];
if (count _animations == 0) exitWith {};
if (_animations isEqualTo []) exitWith {};
if (_house animationPhase (_animations select 0) <= 0 && {_house getVariable [_lockedVariable select 0, 0] == 1}) exitWith {
_lockedVariable set [0, _house];
_lockedVariable spawn compile preprocessFileLineNumbers "\A3\Structures_F\scripts\LockedDoor_open.sqf";
_lockedVariable call BIS_fnc_LockedDoorOpen;
};
playSound "ACE_Sound_Click"; // @todo replace with smth. more fitting
GVAR(doorTargetPhase) = _house animationPhase (_animations select 0);
GVAR(isOpeningDoor) = true;
playSound "ACE_Sound_Click"; //@todo replace with smth. more fitting
GVAR(usedScrollWheel) = false;
[_house, _animations] spawn {
private ["_house", "_animations", "_phase", "_position", "_time", "_usedMouseWheel"];
_house = _this select 0;
_animations = _this select 1;
[{
(_this select 0) params ["_house", "_animations", "_position", "_time", "_frame"];
_phase = _house animationPhase (_animations select 0);
_position = getPosASL ACE_player;
if !(GVAR(isOpeningDoor)) exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
_time = ACE_time + 0.2;
_usedMouseWheel = false;
waitUntil {
if (inputAction "PrevAction" > 0 || {inputAction "NextAction" > 0}) then {
_usedMouseWheel = true;
// didn't use incremental opening. Just do animation normally.
if !(GVAR(usedScrollWheel)) then {
private "_phase";
_phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5);
{_house animate [_x, _phase]; false} count _animations;
};
_phase = _phase + (inputAction "PrevAction" / 12) min 1;
_phase = _phase - (inputAction "NextAction" / 12) max 0;
{_house animate [_x, _phase]} forEach _animations;
!GVAR(isOpeningDoor) || {getPosASL ACE_player distance _position > 1}
};
if (!_usedMouseWheel && {ACE_time < _time} && {[ACE_player, objNull, []] call EFUNC(common,canInteractWith)}) then {
_phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5);
{_house animate [_x, _phase]} forEach _animations;
// check if player moved too far away
if (getPosASL ACE_player distance _position > 1) exitWith {
GVAR(isOpeningDoor) = false;
};
GVAR(isOpeningDoor) = false;
};
// this allows for holding the door in it's current state.
if (ACE_time > _time && {diag_frameno > _frame}) then {
GVAR(usedScrollWheel) = true;
};
// do incremental door opening
{_house animate [_x, GVAR(doorTargetPhase)]; false} count _animations;
}, 0.1, [_house, _animations, getPosASL ACE_player, ACE_time + 0.2, diag_frameno + 2]] call CBA_fnc_addPerFrameHandler;

View File

@ -1,57 +0,0 @@
/*
* Author: commy2
* Opens menu select UI
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Vehicle <OBJECT>
*
* Return value:
* None
*
* Example:
* [unit, vehicle] call ace_interaction_fnc_openMenuSelectUI
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_vehicle);
private ["_cargo", "_actions"];
// Allow interaction with all cargo slots and all FFV slots
_cargo = [_vehicle, ["cargo", "ffv"], true] call EFUNC(common,getVehicleCrew);
// You can only interact if you are in cargo or FFV yourself. exit otherwise
if !(_unit in _cargo) exitWith {};
GVAR(InteractionMenu_Crew) = _cargo;
// Prepare: add header and "OK" button to select menu
_actions = [localize LSTRING(InteractionMenu), localize LSTRING(Interact)] call FUNC(prepareSelectMenu);
// Prepare: add all cargo units as options to select menu
{
if (_x != _unit) then {
_actions = [
_actions,
[_x] call EFUNC(common,getName),
QUOTE(PATHTOF(UI\dot_ca.paa)),
_forEachIndex
] call FUNC(addSelectableItem);
};
} forEach _cargo;
// Open select menu
[
_actions,
{
call FUNC(hideMenu);
[0, GVAR(InteractionMenu_Crew) select _this, ""] spawn FUNC(showMenu);
GVAR(InteractionMenu_Crew) = nil;
},
{
call FUNC(hideMenu);
}
] call FUNC(openSelectMenu);

View File

@ -1,49 +0,0 @@
/*
* Author: Garth de Wet (LH)
* Opens the select menu UI and sets up the UI
*
* Arguments:
* 0: Items <ARRAY>
* 0: Text <STRING>
* 1: Statement to execute <CODE>
* 2: Condition before execute <CODE>
* 3: showDisabled <BOOL>
* 4: Priority <NUMBER>
* 5: Icon <STRING>
* 6: Extra variables passed to the code <ARRAY>
* 1: Select Action <CODE>
* 2: Cancel Action <CODE>
*
* Return value:
* None
*
* Example:
* [["text", {statement}, {condition}, showDisabled, priority, "icon", [variables]], {selectAction}, {cancelAction}] call ace_interaction_fnc_openSelectMenu
*
* Public: No
*/
#include "script_component.hpp"
private["_action", "_count", "_customActions", "_i"];
if (!(profileNamespace getVariable [QGVAR(FlowMenu), false])) then {
GVAR(SelectAccept) = _this select 1;
GVAR(SelectCancel) = _this select 2;
buttonSetAction [8855, QUOTE( call GVAR(SelectCancel); )]; // Cancel
buttonSetAction [8860, QUOTE( (call compile (lbData [ARR_2(8866, lbCurSel 8866)])) call GVAR(SelectAccept); )]; // Accept
lbSetCurSel [8866, 0];
}else{
PARAMS_1(_customActions);
private ["_count", "_action"];
_count = count _customActions;
if (_count == 0) exitWith {};
_customActions call FUNC(sortOptionsByPriority);
for "_i" from 0 to _count -1 do {
_action = _customActions select _i;
_action set [1, (_this select 1)];
};
GVAR(Buttons) = _customActions;
[(_this select 2), true, true, false, ACE_player] call FUNC(initialiseInteraction);
};

View File

@ -0,0 +1,18 @@
/*
* Author: commy2
* Unit pardons target unit.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
params ["", "_target"];
["pardon", [_target], [_target]] call EFUNC(common,targetEvent);

View File

@ -1,33 +0,0 @@
/*
* Author: Garth de Wet (LH)
* Prepares the select menu for use
*
* Arguments:
* 0: Header Text <STRING>
* 1: Approve Button Text <STRING>
*
* Return value:
* Container object <NUMBER>
*
* Example:
* array = ["Select Explosive", "Place"] call ace_interaction_fnc_prepareSelectMenu
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_header,_buttonText);
closeDialog 0;
if (isNil "_buttonText" or {_buttonText == ""}) then {
_buttonText = localize LSTRING(MakeSelection);
};
createDialog "RscACE_SelectAnItem";
ctrlSetText [8860, _buttonText];
ctrlSetText [8870, _header];
lbClear 8866;
8866

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);

View File

@ -1,40 +1,37 @@
/*
* Author: KoffeinFlummi
* Sends a civilian crowd away with a chance of failure
* Author: KoffeinFlummi, commy2
* Sends a near civilian crowd away with a chance of failure.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return value:
* Return Value:
* None
*
* Example:
* [target] call ace_interaction_fnc_sendAway
* [civillian] call ace_interaction_fnc_sendAway
*
* Public: No
*/
#include "script_component.hpp"
#define DISTANCE 50
#define RADIUS 10
#define SEND_DISTANCE 50
#define SEND_RADIUS 10
PARAMS_1(_unit);
params ["_unit"];
private ["_chance", "_x"];
_unit playActionNow "GestureGo";
ACE_player playActionNow "GestureGo";
if (count weapons ACE_player > 0) then {
_chance = 0.8;
} else {
_chance = 0.5;
};
private "_chance";
_chance = [0.5, 0.8] select (count weapons _unit > 0);
{
if (count (weapons _unit) == 0 and random 1 < _chance) then {
[-2, {
(_this select 0) setUnitPos "AUTO";
(_this select 0) doMove [(getPos (_this select 0) select 0) + DISTANCE * (eyeDirection (_this select 1) select 0), (getPos (_this select 0) select 1) + DISTANCE * (eyeDirection (_this select 1) select 1), 0];
}, [_x, ACE_player]] call CBA_fnc_globalExecute;
if (count weapons _x == 0 && {random 1 < _chance}) then {
private "_position";
_position = getPosASL _unit vectorAdd (eyeDirection _unit vectorMultiply SEND_DISTANCE);
_position set [2, 0];
["sendAway", [_x], [_x, _position]] call EFUNC(common,targetEvent);
};
} forEach (_unit nearEntities ["Civilian", RADIUS]);
false
} count (_unit nearEntities ["Civilian", SEND_RADIUS]);

View File

@ -1,35 +0,0 @@
/*
* Author: commy2
* Sort options by priority
*
* Arguments:
* Actions <ARRAY>
*
* Return value:
* None
*
* Example:
* customActions call ace_interaction_fnc_sortOptionsByPriority
*
* Public: No
*/
#include "script_component.hpp"
private ["_actions", "_count", "_index", "_actionN", "_actionM"];
_actions = _this;
_count = count _actions;
_index = 0;
while {_index < _count - 1} do {
_actionN = + _actions select _index;
_actionM = + _actions select (_index + 1);
if (_actionN select 3 < _actionM select 3) then {
_actions set [_index, _actionM];
_actions set [_index + 1, _actionN];
_index = 0;
} else {
_index = _index + 1;
};
};

View File

@ -3,38 +3,26 @@
* Taps a shoulder
*
* Arguments:
* 0: Player <OBJECT>
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
* 2: Shoulder which was tapped <NUMBER>
* 2: Shoulder which was tapped [0: left, 1: right] <NUMBER>
*
* Return value:
* Return Value:
* None
*
* Example:
* [player, target] call ace_interaction_fnc_tapShoulder
* [player, target, 0] call ace_interaction_fnc_tapShoulder
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_3(_tapper,_target,_shoulderNum);
params ["_unit", "_target", "_shoulderNum"];
if (_target != ACE_player) exitWith {
if (_unit == ACE_player) then {
addCamShake [4, 0.5, 5];
ACE_player playActionNow "PutDown";
if !(local _target) then {
[[_tapper, _target, _shoulderNum], QUOTE(DFUNC(tapShoulder)), _target] call EFUNC(common,execRemoteFnc);
};
};
addCamShake [4, 0.5, 5];
_unit playActionNow "PutDown";
private ["_message"];
//localize is converting the escaped <> symbols, so just add them here instead of in the stringtable
if (_shoulderNum == 0) then {
_message = format ["%1 &gt;", (localize LSTRING(YouWereTappedRight))];
} else {
_message = format ["&lt; %1", (localize LSTRING(YouWereTappedLeft))];
};
[parseText _message] call EFUNC(common,displayTextStructured);
["tapShoulder", [_target], [_target, _shoulderNum]] call EFUNC(common,targetEvent);

View File

@ -1,33 +0,0 @@
/*
* Author: commy2
* Updates tooltip's position
*
* Arguments:
* 0: Tooltip Display <NUMBER>
* 1: X Coordinate <NUMBER>
* 2: Y Coordinate <NUMBER>
*
* Return value:
* None
*
* Example:
* [player, 0.5, 0.5] call ace_interaction_fnc_updateTooltipPosition
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_3(_tooltip,_coordinateX,_coordinateY);
private["_ctrl"];
disableSerialization;
_ctrl = ctrlParent _tooltip displayCtrl 40;
_ctrl ctrlSetPosition [
_coordinateX + 0.01 * safezoneW,
_coordinateY + 0.01 * safezoneH,
2.0 / 16 * safezoneW,
0.3 / 9 * safezoneH
];
_ctrl ctrlCommit 0;