CBA Macros to Interaction functions

This commit is contained in:
jonpas 2015-05-09 22:14:00 +02:00
parent e9abd8c27a
commit 633e94a114
25 changed files with 63 additions and 74 deletions

View File

@ -18,9 +18,9 @@
#include "script_component.hpp"
EXPLODE_3_PVT(_this,_vehicle,_player,_parameters);
EXPLODE_1_PVT(_parameters,_unit);
private ["_unit","_actions"];
_unit = _parameters select 0;
private ["_varName", "_actionTrees", "_actions"];
_varName = format [QEGVAR(interact_menu,Act_%1), typeOf _unit];
_actionTrees = missionNamespace getVariable [_varName, []];

View File

@ -18,17 +18,13 @@
*/
#include "script_component.hpp"
private ["_container", "_displayName", "_picture", "_data", "_index"];
_container = _this select 0;
_displayName = _this select 1;
_picture = _this select 2;
_data = _this select 3;
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];

View File

@ -16,10 +16,7 @@
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
PARAMS_2(_unit,_target);
alive _target
&& {!(_target getVariable ["ACE_isUnconscious", false])}

View File

@ -16,10 +16,7 @@
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
PARAMS_2(_unit,_target);
alive _target
&& {!(_target getVariable ["ACE_isUnconscious", false])}

View File

@ -16,10 +16,7 @@
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
PARAMS_2(_unit,_target);
_target isKindOf "CAManBase" &&
{alive _target} &&

View File

@ -17,9 +17,9 @@
*/
#include "script_component.hpp"
private ["_distance", "_position0", "_position1", "_intersections", "_count", "_house", "_door", "_index", "_id"];
PARAMS_1(_distance);
_distance = _this select 0;
private ["_position0", "_position1", "_intersections", "_count", "_house", "_door"];
_position0 = positionCameraToWorld [0, 0, 0];
_position1 = positionCameraToWorld [0, 0, _distance];
@ -38,4 +38,5 @@ _intersections = [_house, "GEOM"] intersect [_position0, _position1];
_door = _intersections select 0 select 0;
if (isNil "_door") exitWith {[_house, ""]};
[_house, _door]

View File

@ -18,10 +18,9 @@
*/
#include "script_component.hpp"
private ["_house", "_door", "_animations", "_lockedVariable"];
PARAMS_2(_house,_door);
_house = _this select 0;
_door = _this select 1;
private ["_index", "_animations", "_lockedVariable"];
_index = [
"door_1",

View File

@ -17,9 +17,9 @@
#define RADIUS 10
private ["_unit", "_chance", "_x"];
PARAMS_1(_unit);
_unit = _this select 0;
private ["_chance", "_x"];
ACE_player playActionNow "GestureGo"; // put something else here.
@ -35,4 +35,4 @@ if (count (weapons ACE_player) > 0) then {
_this setUnitPos "DOWN";
}, _x] call CBA_fnc_globalExecute;
};
} foreach (_unit nearEntities ["Civilian", RADIUS]);
} forEach (_unit nearEntities ["Civilian", RADIUS]);

View File

@ -16,7 +16,7 @@
#include "script_component.hpp"
// IGNORE_PRIVATE_WARNING(_target);
private ["_weaponDir","_refSystem"];
private ["_weaponDir", "_refSystem"];
_weaponDir = _target weaponDirection currentWeapon _target;
_refSystem = _weaponDir call EFUNC(common,createOrthonormalReference);

View File

@ -16,10 +16,9 @@
*/
#include "script_component.hpp"
private ["_vehicle", "_distance", "_player"];
PARAMS_2(_vehicle,_distance);
_vehicle = _this select 0;
_distance = _this select 1;
private ["_player", "_position0", "_position1"];
_player = ACE_player;

View File

@ -16,10 +16,9 @@
*/
#include "script_component.hpp"
private ["_unit", "_team", "_message"];
PARAMS_2(_unit,_team);
_unit = _this select 0;
_team = _this select 1;
private ["_message"];
_unit setVariable [QGVAR(assignedFireTeam), _team, true];
[_unit, format ["{_this assignTeam '%1'}", _team]] call EFUNC(common,execRemoteFnc);

View File

@ -17,6 +17,8 @@
*/
#include "script_component.hpp"
private ["_logic", "_activated"];
_logic = _this select 0;
_activated = _this select 2;

View File

@ -15,6 +15,8 @@
*/
#include "script_component.hpp"
private ["_count", "_player", "_vehicle", "_dlgInteractionDialog", "_top", "_i", "", "_ctrl", "_index", "_action", "_color", "_current", "_infoText"];
#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{};

View File

@ -15,7 +15,7 @@
*/
#include "script_component.hpp"
private ["_player", "_vehicle", "_target", "_count", "_index", "_action", "_statement", "_condition", "_conditionShow", "_exceptions", "_distance"];
private ["_player", "_vehicle", "_target", "_count", "_index", "_action", "_statement", "_condition", "_conditionShow", "_distance"];
_player = ACE_player;
_vehicle = vehicle _player;
@ -34,11 +34,9 @@ _action = if (_index != -1 && {_index < _count}) then {
closeDialog 0;
_statement = _action select 1;
_condition = _action select 2;
_conditionShow = _action select 7;
_exceptions = _action select 8;//
_distance = _action select 9;
if ((_distance == 0 || {[GVAR(Target), _distance] call FUNC(isInRange)}) && {[_target, _player] call _condition} && {[_target, _player] call _conditionShow}) then {

View File

@ -14,7 +14,7 @@
* Public: No
*/
#include "script_component.hpp"
private ["_player", "_vehicle", "_target", "_count", "_index", "_action", "_subMenu", "_statement", "_condition", "_conditionShow", "_exceptions", "_distance"];
private ["_player", "_vehicle", "_target", "_count", "_index", "_action", "_subMenu", "_statement", "_condition", "_conditionShow", "_distance"];
_player = ACE_player;
_vehicle = vehicle _player;
@ -43,7 +43,6 @@ if (count _subMenu < 2) then {
_statement = _action select 1;
_condition = _action select 2;
_conditionShow = _action select 7;
_exceptions = _action select 8;//
_distance = _action select 9;
if ((_distance == 0 || {[GVAR(Target), _distance] call FUNC(isInRange)}) && {[_target, _player] call _condition} && {[_target, _player] call _conditionShow}) then {

View File

@ -16,19 +16,17 @@
*/
#include "script_component.hpp"
private ["_info", "_house", "_door", "_animations", "_lockedVariable"];
private ["_info", "_animations", "_phase", "_position", "_time", "_usedMouseWheel"];
_info = [2] call FUNC(getDoor);
_house = _info select 0;
_door = _info select 1;
EXPLODE_2_PVT(_info,_house,_door);
if (isNull _house) exitWith {};
_animations = [_house, _door] call FUNC(getDoorAnimations);
_lockedVariable = _animations select 1;
_animations = _animations select 0;
EXPLODE_2_PVT(_animations,_animations,_lockedVariable);
if (count _animations == 0) exitWith {};

View File

@ -16,24 +16,22 @@
*/
#include "script_component.hpp"
private ["_unit", "_vehicle", "_cargo"];
PARAMS_2(_unit,_vehicle);
_unit = _this select 0;
_vehicle = _this select 1;
private ["_cargo", "_actions"];
// allow interaction with all cargo slots and all ffv slots
// 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
// 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
private "_actions";
// Prepare: add header and "OK" button to select menu
_actions = [localize "STR_ACE_Interaction_InteractionMenu", localize "STR_ACE_Interaction_Interact"] call FUNC(prepareSelectMenu);
// prepare: add all cargo units as options to select menu
// Prepare: add all cargo units as options to select menu
{
if (_x != _unit) then {
_actions = [
@ -45,7 +43,7 @@ _actions = [localize "STR_ACE_Interaction_InteractionMenu", localize "STR_ACE_In
};
} forEach _cargo;
// open select menu
// Open select menu
[
_actions,
{

View File

@ -27,11 +27,14 @@
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
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{
_customActions = _this select 0;
PARAMS_1(_customActions);
private ["_count", "_action"];
_count = count _customActions;
if (_count == 0) exitWith {};
_customActions call FUNC(sortOptionsByPriority);

View File

@ -16,13 +16,14 @@
*/
#include "script_component.hpp"
private ["_buttonAction", "_header", "_buttonText", "_cancelButton"];
PARAMS_2(_header,_buttonText);
closeDialog 0;
_header = _this select 0;
_buttonText = _this select 1;
if (isNil "_buttonText" or {_buttonText == ""}) then {
_buttonText = localize "STR_ACE_Interaction_MakeSelection";
};
createDialog "RscACE_SelectAnItem";
ctrlSetText [8860, _buttonText];
ctrlSetText [8870, _header];

View File

@ -17,8 +17,7 @@
#include "script_component.hpp"
_boat = _this select 0;
_velocity = _this select 1;
PARAMS_2(_boat,_velocity);
if !(local _boat) exitWith {
[_this, QUOTE(FUNC(push)), _boat] call EFUNC(common,execRemoteFnc);

View File

@ -16,6 +16,8 @@
#include "script_component.hpp"
0 spawn {
private ["_index"];
waitUntil {player getVariable ["ACE_Name", ""] != ""};
_name = player getVariable ["ACE_Name", ""];

View File

@ -18,9 +18,9 @@
#define DISTANCE 50
#define RADIUS 10
private ["_unit", "_chance", "_x"];
PARAMS_1(_unit);
_unit = _this select 0;
private ["_chance", "_x"];
ACE_player playActionNow "GestureGo";

View File

@ -19,9 +19,10 @@
#define GUI_GRID_W (0.025)
#define GUI_GRID_H (0.04)
private ["_leftClick", "_rightClick", "_scroll"];
_leftClick = _this select 0;
_rightClick = _this select 1;
private ["_scroll", "_display"];
PARAMS_2(_leftClick,_rightClick);
_scroll = "";
if (count _this > 2) then {
_scroll = _this select 2;
@ -43,9 +44,8 @@ if (isNull _display) exitWith{};
if (_scroll == "") exitWith {
(_display displayCtrl 1002) ctrlShow false;
(_display displayCtrl 1202) ctrlShow false;
(_display displayCtrl 1001) ctrlSetPosition [21 * GUI_GRID_W, 18 * GUI_GRID_H, 8 * GUI_GRID_W, 1.5 * GUI_GRID_H];
(_display displayCtrl 1201) ctrlSetPosition [20 * GUI_GRID_W, 18.5 * GUI_GRID_H, 1 * GUI_GRID_W, 1 * GUI_GRID_H];
(_display displayCtrl 1001) ctrlSetPosition [21 * GUI_GRID_W, 18 * GUI_GRID_H, 8 * GUI_GRID_W, 1.5 * GUI_GRID_H];
(_display displayCtrl 1201) ctrlSetPosition [20 * GUI_GRID_W, 18.5 * GUI_GRID_H, 1 * GUI_GRID_W, 1 * GUI_GRID_H];
(_display displayCtrl 1001) ctrlCommit 0;
(_display displayCtrl 1201) ctrlCommit 0;
};

View File

@ -28,7 +28,7 @@ if (_target != ACE_player) exitWith {
addCamShake [4, 0.5, 5];
private "_message";
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 "STR_ACE_Interaction_YouWereTappedRight")];

View File

@ -17,12 +17,14 @@
*/
#include "script_component.hpp"
PARAMS_3(_tooltip,_coordinateX,_coordinateY);
disableSerialization;
_ctrl = ctrlParent (_this select 0) displayCtrl 40;
_ctrl = ctrlParent _tooltip displayCtrl 40;
_ctrl ctrlSetPosition [
(_this select 1) + 0.01 * safezoneW,
(_this select 2) + 0.01 * safezoneH,
_coordinateX + 0.01 * safezoneW,
_coordinateY + 0.01 * safezoneH,
2.0 / 16 * safezoneW,
0.3 / 9 * safezoneH
];