Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open editable objects dialog when clicking main action #430

Merged
merged 1 commit into from
Aug 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;