mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
manual merge
This commit is contained in:
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
@ -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 "";
|
||||
};
|
||||
};
|
@ -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}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
20
addons/interaction/functions/fnc_canPardon.sqf
Normal file
20
addons/interaction/functions/fnc_canPardon.sqf
Normal 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}
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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]
|
||||
|
@ -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"];
|
||||
|
||||
|
@ -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]);
|
||||
|
@ -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}
|
23
addons/interaction/functions/fnc_handleScrollWheel.sqf
Normal file
23
addons/interaction/functions/fnc_handleScrollWheel.sqf
Normal 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
|
@ -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);
|
@ -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
|
||||
}
|
@ -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);
|
||||
};
|
||||
|
@ -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 {};
|
||||
|
||||
|
@ -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 != "");
|
@ -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;
|
||||
};
|
@ -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);
|
||||
};
|
||||
};
|
@ -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);
|
@ -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;
|
||||
|
@ -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);
|
@ -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);
|
||||
};
|
18
addons/interaction/functions/fnc_pardon.sqf
Normal file
18
addons/interaction/functions/fnc_pardon.sqf
Normal 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);
|
@ -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
|
@ -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);
|
||||
|
@ -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]);
|
||||
|
@ -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;
|
||||
};
|
||||
};
|
@ -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 >", (localize LSTRING(YouWereTappedRight))];
|
||||
} else {
|
||||
_message = format ["< %1", (localize LSTRING(YouWereTappedLeft))];
|
||||
};
|
||||
|
||||
[parseText _message] call EFUNC(common,displayTextStructured);
|
||||
["tapShoulder", [_target], [_target, _shoulderNum]] call EFUNC(common,targetEvent);
|
||||
|
@ -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;
|
Reference in New Issue
Block a user