Skip to content

Commit

Permalink
Open editable objects dialog when clicking main action (#430)
Browse files Browse the repository at this point in the history
  • Loading branch information
mharis001 authored Aug 25, 2020
1 parent bd15d9f commit 55d6b1c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
5 changes: 3 additions & 2 deletions addons/context_actions/CfgContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,15 @@ class EGVAR(context_menu,actions) {
};
class EditableObjects {
displayName = CSTRING(EditableObjects);
statement = QUOTE(call FUNC(openEditableObjectsDialog));
icon = QPATHTOEF(modules,ui\edit_obj_ca.paa);
priority = 30;
class Add {
displayName = ECSTRING(common,Add);
icon = QPATHTOF(ui\add_ca.paa);
class 10m {
displayName = CSTRING(10m);
statement = QUOTE([ARR_2(true,_args)] call FUNC(editableObjects));
statement = QUOTE([ARR_3(true,_position,_args)] call FUNC(updateEditableObjects));
icon = QPATHTOF(ui\add_ca.paa);
args = 10;
};
Expand All @@ -342,7 +343,7 @@ class EGVAR(context_menu,actions) {
icon = QPATHTOF(ui\remove_ca.paa);
class 10m {
displayName = CSTRING(10m);
statement = QUOTE([ARR_2(false,_args)] call FUNC(editableObjects));
statement = QUOTE([ARR_3(false,_position,_args)] call FUNC(updateEditableObjects));
icon = QPATHTOF(ui\remove_ca.paa);
args = 10;
};
Expand Down
3 changes: 2 additions & 1 deletion addons/context_actions/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ PREP(canRefuelVehicles);
PREP(canRepairVehicles);
PREP(canToggleSurrender);
PREP(copyVehicleAppearance);
PREP(editableObjects);
PREP(getArtilleryActions);
PREP(healUnits);
PREP(openEditableObjectsDialog);
PREP(pasteVehicleAppearance);
PREP(rearmVehicles);
PREP(refuelVehicles);
Expand All @@ -25,3 +25,4 @@ PREP(teleportPlayers);
PREP(teleportZeus);
PREP(toggleCaptive);
PREP(toggleSurrender);
PREP(updateEditableObjects);
23 changes: 23 additions & 0 deletions addons/context_actions/functions/fnc_openEditableObjectsDialog.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "script_component.hpp"
/*
* Author: mharis001
* Opens the "Update Editable Objects" module dialog at the given position.
*
* Arguments:
* 0: Position <ARRAY>
*
* Return Value:
* None
*
* Example:
* [_position] call zen_context_actions_fnc_openEditableObjectsDialog
*
* Public: No
*/

params ["_position"];

private _logic = QEGVAR(modules,moduleEditableObjects) createVehicleLocal [0, 0, 0];
_logic setPosASL _position;

_logic call BIS_fnc_showCuratorAttributes;
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@
*
* Arguments:
* 0: Mode (Add/Remove) <BOOL>
* 1: Radius <NUMBER>
* 1: Position <ARRAY>
* 2: Radius <NUMBER>
*
* Return Value:
* None
*
* Example:
* [true, 100] call zen_context_actions_fnc_editableObjects
* [true, [0, 0, 0], 100] call zen_context_actions_fnc_editableObjects
*
* Public: No
*/

params ["_mode", "_radius"];
params ["_mode", "_position", "_radius"];

private _curator = getAssignedCuratorLogic player;
private _objects = nearestObjects [ASLtoAGL _contextPosASL, ["All"], _radius, true];
private _objects = nearestObjects [ASLtoAGL _position, ["All"], _radius, true];
private _eventName = [QEGVAR(common,removeObjects), QEGVAR(common,addObjects)] select _mode;

[_eventName, [_objects, _curator]] call CBA_fnc_serverEvent;

0 comments on commit 55d6b1c

Please sign in to comment.