mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Add support for a zeus module position attribute
Allows zeus to select a position for the module task to be carried out at - as a bonus it works alongside the radius attribute and will draw a circle preview if a radius is present. Unfortunately control types 100 & 101 don't play nicely with controls groups and so I've commented out the position attribute from the displays that would currently use it. Otherwise it is all seemingly working fine, just that the position of the control is all wrong and it doesn't stay within the bounds of the controls group. I opened an issue tracker ticket for the problem here: https://feedback.bistudio.com/T116708
This commit is contained in:
parent
adaa10aea5
commit
b3192adbb7
@ -19,6 +19,7 @@ PREP(moduleTeleportPlayers);
|
||||
PREP(moduleUnconscious);
|
||||
PREP(moduleZeusSettings);
|
||||
PREP(ui_attributeCargo);
|
||||
//PREP(ui_attributePosition);
|
||||
PREP(ui_attributeRadius);
|
||||
PREP(ui_defendArea);
|
||||
PREP(ui_globalSetSkill);
|
||||
|
60
addons/zeus/functions/fnc_ui_attributePosition.sqf
Normal file
60
addons/zeus/functions/fnc_ui_attributePosition.sqf
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Author: SilentSpike
|
||||
* Initalises the `position` zeus module attribute
|
||||
*
|
||||
* Arguments:
|
||||
* 0: position controls group <CONTROL>
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
disableSerialization;
|
||||
|
||||
//Generic Init:
|
||||
params ["_control"];
|
||||
private _display = ctrlParent _control;
|
||||
private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull);
|
||||
|
||||
_control ctrlRemoveAllEventHandlers "setFocus";
|
||||
|
||||
//Specific on-load stuff:
|
||||
private _map = _control controlsGroupCtrl 26469;
|
||||
|
||||
// Centre map on the logic initially
|
||||
_map ctrlMapAnimAdd [0, ctrlMapScale _map, _logic];
|
||||
ctrlMapAnimCommit _map;
|
||||
|
||||
private _fnc_onDraw = {
|
||||
params ["_map"];
|
||||
|
||||
private _display = ctrlParent _map;
|
||||
private _pos = GETVAR(_display,GVAR(position),[]);
|
||||
private _radius = GETVAR(_display,GVAR(radius),0);
|
||||
|
||||
if !(_pos isEqualTo []) then {
|
||||
// Works alongside radius attribute
|
||||
if (_radius == 0) then {
|
||||
_map drawIcon ["\A3\ui_f\data\map\markers\military\dot_CA.paa", [0,0,0,1], _pos, 19, 19, 0, "", 0, 0];
|
||||
} else {
|
||||
_map drawEllipse [_pos, _radius, _radius, 0, [0,0,0,1], ""];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
private _fnc_onMapClick = {
|
||||
params ["_map","_button","_x","_y","_shift","_ctrl","_alt"];
|
||||
|
||||
if (_button == 0) then {
|
||||
private _display = ctrlParent _map;
|
||||
SETVAR(_display,GVAR(position),_pos);
|
||||
};
|
||||
};
|
||||
|
||||
SETVAR(_display,GVAR(position),getPos _logic);
|
||||
_map ctrlAddEventHandler ["draw",_fnc_onDraw];
|
||||
_map ctrlAddEventHandler ["mouseButtonDown",_fnc_onMapClick];
|
@ -24,7 +24,7 @@ _control ctrlRemoveAllEventHandlers "setFocus";
|
||||
//Specific on-load stuff:
|
||||
private _edit = _control controlsGroupCtrl 26467;
|
||||
|
||||
_edit ctrlSetText "50";
|
||||
_edit ctrlSetText "100";
|
||||
|
||||
private _fnc_onKeyUp = {
|
||||
params ["_display"];
|
||||
@ -36,7 +36,6 @@ private _fnc_onKeyUp = {
|
||||
if (_radius == 0) then {
|
||||
_edit ctrlSetTooltip (localize LSTRING(AttributeRadiusInvalid));
|
||||
_edit ctrlSetTextColor [1,0,0,1];
|
||||
SETVAR(_display,GVAR(radius),50);
|
||||
} else {
|
||||
_edit ctrlSetTooltip "";
|
||||
_edit ctrlSetTextColor [1,1,1,1];
|
||||
|
@ -66,8 +66,9 @@ private _fnc_onConfirm = {
|
||||
|
||||
private _unit = effectiveCommander (attachedTo _logic);
|
||||
private _radius = GETVAR(_display,GVAR(radius),50);
|
||||
private _position = GETVAR(_display,GVAR(position),getPos _logic);
|
||||
|
||||
[QGVAR(moduleDefendArea), _unit, [_unit,getPosASL _logic,_radius]] call EFUNC(common,targetEvent);
|
||||
[QGVAR(moduleDefendArea), _unit, [_unit,_position,_radius]] call EFUNC(common,targetEvent);
|
||||
deleteVehicle _logic;
|
||||
};
|
||||
|
||||
|
@ -66,8 +66,9 @@ private _fnc_onConfirm = {
|
||||
|
||||
private _unit = effectiveCommander (attachedTo _logic);
|
||||
private _radius = GETVAR(_display,GVAR(radius),50);
|
||||
private _position = GETVAR(_display,GVAR(position),getPos _logic);
|
||||
|
||||
[QGVAR(modulePatrolArea), _unit, [_unit,getPosASL _logic,_radius,5]] call EFUNC(common,targetEvent);
|
||||
[QGVAR(modulePatrolArea), _unit, [_unit,_position,_radius,5]] call EFUNC(common,targetEvent);
|
||||
deleteVehicle _logic;
|
||||
};
|
||||
|
||||
|
@ -66,9 +66,10 @@ private _fnc_onConfirm = {
|
||||
|
||||
private _unit = effectiveCommander (attachedTo _logic);
|
||||
private _radius = GETVAR(_display,GVAR(radius),50);
|
||||
private _position = GETVAR(_display,GVAR(position),getPos _logic);
|
||||
private _marker = QGVAR(ModuleSearchArea) + str(_unit);
|
||||
|
||||
createMarker [_marker, getPosASL _logic];
|
||||
createMarker [_marker, _position];
|
||||
_marker setMarkerAlpha 0;
|
||||
_marker setMarkerShape "ELLIPSE";
|
||||
_marker setMarkerSize [_radius,_radius];
|
||||
|
@ -447,6 +447,12 @@
|
||||
<Key ID="STR_ACE_Zeus_AttributeCargo">
|
||||
<English>Cargo:</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Zeus_AttributePosition">
|
||||
<English>Task Position</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Zeus_AttributePosition_desc">
|
||||
<English>Select a position to perform the task at</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Zeus_AttributeRadius">
|
||||
<English>Task Radius</English>
|
||||
</Key>
|
||||
|
@ -7,6 +7,7 @@ class RscEdit;
|
||||
class RscXSliderH;
|
||||
class RscCheckBox;
|
||||
class RscActivePicture;
|
||||
class RscMapControl;
|
||||
|
||||
class RscDisplayAttributes {
|
||||
class Controls {
|
||||
@ -49,6 +50,34 @@ class GVAR(AttributeRadius): RscControlsGroupNoScrollbars {
|
||||
};
|
||||
};
|
||||
|
||||
class GVAR(AttributePosition): RscControlsGroupNoScrollbars {
|
||||
onSetFocus = QUOTE(_this call FUNC(ui_attributePosition));
|
||||
idc = 26468;
|
||||
x = 0;
|
||||
y = 0;
|
||||
w = W_PART(26);
|
||||
h = H_PART(26);
|
||||
class controls {
|
||||
class Title1: RscText {
|
||||
idc = -1;
|
||||
text = CSTRING(AttributePosition);
|
||||
toolTip = CSTRING(AttributePosition_desc);
|
||||
x = 0;
|
||||
y = 0;
|
||||
w = W_PART(26);
|
||||
h = H_PART(1);
|
||||
colorBackground[] = {0,0,0,0.5};
|
||||
};
|
||||
class Position: RscMapControl {
|
||||
idc = 26469;
|
||||
x = W_PART(0.5);
|
||||
y = H_PART(1.1);
|
||||
w = W_PART(25);
|
||||
h = H_PART(24.8);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class GVAR(RscDefendArea): RscDisplayAttributes {
|
||||
onLoad = QUOTE([ARR_3('onLoad', _this, QUOTE(QGVAR(RscDefendArea)))] call FUNC(zeusAttributes));
|
||||
onUnload = QUOTE([ARR_3('onUnload', _this, QUOTE(QGVAR(RscDefendArea)))] call FUNC(zeusAttributes));
|
||||
@ -58,6 +87,7 @@ class GVAR(RscDefendArea): RscDisplayAttributes {
|
||||
class Content: Content {
|
||||
class Controls {
|
||||
class radius: GVAR(AttributeRadius) {};
|
||||
//class position: GVAR(AttributePosition) {};
|
||||
};
|
||||
};
|
||||
class ButtonOK: ButtonOK {
|
||||
@ -249,6 +279,7 @@ class GVAR(RscPatrolArea): RscDisplayAttributes {
|
||||
class Content: Content {
|
||||
class Controls {
|
||||
class radius: GVAR(AttributeRadius) {};
|
||||
//class position: GVAR(AttributePosition) {};
|
||||
};
|
||||
};
|
||||
class ButtonOK: ButtonOK {
|
||||
@ -267,6 +298,7 @@ class GVAR(RscSearchArea): RscDisplayAttributes {
|
||||
class Content: Content {
|
||||
class Controls {
|
||||
class radius: GVAR(AttributeRadius) {};
|
||||
//class position: GVAR(AttributePosition) {};
|
||||
};
|
||||
};
|
||||
class ButtonOK: ButtonOK {
|
||||
|
Loading…
Reference in New Issue
Block a user