more interaction cleanup, remove dead code

This commit is contained in:
commy2 2015-09-28 17:11:53 +02:00
parent 9189148b3f
commit f48636e633
23 changed files with 115 additions and 647 deletions

View File

@ -167,7 +167,7 @@ class CfgVehicles {
};
class ACE_Weapon {
displayName = CSTRING(Weapon);
position = QUOTE(call FUNC(getWeaponPos));
position = QUOTE(call DFUNC(getWeaponPos));
distance = 1.50;
condition = "";
statement = "";

View File

@ -3,8 +3,34 @@
ACE_Modifier = 0;
["getDown", {
params ["_target"];
_target setUnitPos "DOWN";
}] call EFUNC(common,addEventHandler);
["sendAway", {
params ["_unit", "_position"];
_unit setUnitPos "AUTO";
_unit doMove _position;
}] call EFUNC(common,addEventHandler);
if (!hasInterface) exitWith {};
["tapShoulder", {
params ["_unit", "_shoulderNum"];
if (_unit == ACE_player) then {
addCamShake [4, 0.5, 5];
};
private "_message";
_message = parseText format ([["%1 >", localize LSTRING(YouWereTappedRight)], ["< %1", localize LSTRING(YouWereTappedLeft)]] select (_shoulderNum == 0));
["displayTextStructured", _message] call EFUNC(common,targetEvent);
}] call EFUNC(common,addEventHandler);
GVAR(isOpeningDoor) = false;
// restore global fire teams for JIP

View File

@ -2,37 +2,35 @@
ADDON = false;
PREP(addPassengerActions);
// 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(doBecomeLeader);
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(openDoor);
PREP(openMenuSelectUI);
PREP(openSelectMenu);
PREP(prepareSelectMenu);
PREP(push);
PREP(removeTag);
PREP(sendAway);
PREP(showMouseHint);
PREP(sortOptionsByPriority);
PREP(canBecomeLeader);
PREP(doBecomeLeader);
PREP(canTapShoulder);
PREP(tapShoulder);
// interaction with doors
PREP(getDoor);
PREP(getDoorAnimations);
PREP(openDoor);
// interaction with boats
PREP(push);
ADDON = true;

View File

@ -1,33 +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 ["_container", "_displayName", "_picture", "_data"];
if (toLower _picture in ["", "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,6 +1,6 @@
/*
* Author: commy2
* Checks if the player can tap a shoulder
* Checks if the player can tap a shoulder.
*
* Arguments:
* 0: Player <OBJECT>
@ -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,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,16 +17,17 @@
*/
#include "script_component.hpp"
PARAMS_1(_distance);
params ["_distance"];
private ["_position0", "_position1", "_intersections", "_count", "_house", "_door"];
_position0 = positionCameraToWorld [0, 0, 0];
_position1 = positionCameraToWorld [0, 0, _distance];
_intersections = lineIntersectsWith [ATLToASL _position0, ATLToASL _position1, objNull, objNull, true];
_intersections = lineIntersectsWith [AGLToASL _position0, AGLToASL _position1, objNull, objNull, true]; // @todo LIS
_count = count _intersections;
if (_count == 0) exitWith {[objNull, ""]};
_house = _intersections select (_count - 1);
@ -37,6 +38,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,6 +1,6 @@
/*
* 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>
@ -9,30 +9,24 @@
* 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"];
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 (_unit 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

@ -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,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,6 +1,6 @@
/*
* Author: commy2
* Opens door
* Open door.
*
* Arguments:
* 0: House <OBJECT>
@ -16,38 +16,40 @@
*/
#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 spawn compile preprocessFileLineNumbers "\A3\Structures_F\scripts\LockedDoor_open.sqf"; // note: spawn because thats what the house does too.
};
GVAR(isOpeningDoor) = true;
playSound "ACE_Sound_Click"; //@todo replace with smth. more fitting
[_house, _animations] spawn {
private ["_house", "_animations", "_phase", "_position", "_time", "_usedMouseWheel"];
_house = _this select 0;
_animations = _this select 1;
playSound "ACE_Sound_Click"; // @todo replace with smth. more fitting
[_house, _animations] spawn { // @todo
params ["_house", "_animations"];
private ["_phase", "_position", "_time", "_usedMouseWheel"];
_phase = _house animationPhase (_animations select 0);
_position = getPosASL ACE_player;
_time = ACE_time + 0.2;
_usedMouseWheel = false;
waitUntil {
if (inputAction "PrevAction" > 0 || {inputAction "NextAction" > 0}) then {
_usedMouseWheel = true;

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

@ -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

@ -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:
* 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;