more interaction cleanup

This commit is contained in:
commy2 2015-09-28 15:37:18 +02:00
parent 4b536425b1
commit 9189148b3f
8 changed files with 43 additions and 108 deletions

View File

@ -84,6 +84,7 @@
["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 {

View File

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

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,12 @@
/*
* 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 has to be on the civilian side (default: true) <BOOL>
*
* Return value:
* Return Value:
* Able to interact with civilian <BOOL>
*
* Example:
@ -15,10 +16,6 @@
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_unit,_isCivilian);
params ["_unit", ["_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 _unit && [side _unit != side ACE_player, side group _unit == 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

@ -1,21 +1,20 @@
/*
* Author: PabstMirror
* Become Leader of group
* Become Leader of group.
*
* Arguments:
* 0: Target <OBJECT>
* 1: Unit <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 ["_target", "_unit"];
params ["_unit"];
["selectLeader", units group _unit, [group _unit, _unit]] call EFUNC(common,targetEvent);

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);
params ["_unit", "_team"];
private ["_message"];
// make sure correct team is set on JIP
_unit setVariable [QGVAR(assignedFireTeam), _team, true]; // @todo reset variable for Respawn+JIP - bug
_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);
};