Skip to content

Commit

Permalink
Added toggle crosshair command
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiephan committed Feb 1, 2021
1 parent 47ae02e commit 8c8e8e8
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 1 deletion.
72 changes: 72 additions & 0 deletions (10)trymemode.stormmap/base.stormdata/Modules/LibUtilities.galaxy
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ bool libUTIL_gv_isFOWEnabled;
bool libUTIL_gv_isMassCDREnabled;
int libUTIL_gv_massCDRPlayer;
bool libUTIL_gv_isACTSEnabled;
int libUTIL_gv_crosshair_marker;
bool libUTIL_gv_isCrosshairEnabled;

// Trigger Declarations
trigger libUTIL_gt_MapInit;
Expand All @@ -33,6 +35,8 @@ trigger libUTIL_gt_ToggleACTS;
trigger libUTIL_gt_MinionWaveInterval;
trigger libUTIL_gt_FloatingCombatText;
trigger libUTIL_gt_DisplayString;
trigger libUTIL_gt_RunCrossHair;
trigger libUTIL_gt_ToggleCrosshair;

// Library Initialization
void libUTIL_InitVariables ();
Expand All @@ -59,6 +63,7 @@ void libUTIL_InitVariables () {

libUTIL_gv_isUIEnabled = true;
libUTIL_gv_isFOWEnabled = true;
libUTIL_gv_crosshair_marker = c_textTagNone;
}

// Triggers
Expand Down Expand Up @@ -761,6 +766,71 @@ void libUTIL_gt_DisplayString_Init () {
TriggerAddEventChatMessage(libUTIL_gt_DisplayString, c_playerAny, "string", false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: RunCrossHair
//--------------------------------------------------------------------------------------------------
bool libUTIL_gt_RunCrossHair_Func (bool testConds, bool runActions) {
// Variable Declarations
const string lv_crosshair = "+";

// Automatic Variable Declarations
// Variable Initialization

// Conditions
if (testConds) {
if (!((libUTIL_gv_isCrosshairEnabled == true))) {
return false;
}
}

// Actions
if (!runActions) {
return true;
}

TextTagDestroy(libUTIL_gv_crosshair_marker);
TextTagCreate(StringToText(lv_crosshair), 24, CameraGetTarget(1), 0.0, true, false, PlayerGroupSingle(1));
libUTIL_gv_crosshair_marker = TextTagLastCreated();
TextTagShow(libUTIL_gv_crosshair_marker, PlayerGroupSingle(1), true);
return true;
}

//--------------------------------------------------------------------------------------------------
void libUTIL_gt_RunCrossHair_Init () {
libUTIL_gt_RunCrossHair = TriggerCreate("libUTIL_gt_RunCrossHair_Func");
TriggerEnable(libUTIL_gt_RunCrossHair, false);
TriggerAddEventCameraMove(libUTIL_gt_RunCrossHair, 1, c_cameraMoveReasonAny);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Toggle Crosshair
//--------------------------------------------------------------------------------------------------
bool libUTIL_gt_ToggleCrosshair_Func (bool testConds, bool runActions) {
// Automatic Variable Declarations
// Actions
if (!runActions) {
return true;
}

libUTIL_gv_isCrosshairEnabled = !(libUTIL_gv_isCrosshairEnabled);
if ((libUTIL_gv_isCrosshairEnabled == true)) {
TriggerEnable(libUTIL_gt_RunCrossHair, true);
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText("Turned on Crosshair"));
}
else {
TriggerEnable(libUTIL_gt_RunCrossHair, false);
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText("Turned off Crosshair"));
}
return true;
}

//--------------------------------------------------------------------------------------------------
void libUTIL_gt_ToggleCrosshair_Init () {
libUTIL_gt_ToggleCrosshair = TriggerCreate("libUTIL_gt_ToggleCrosshair_Func");
TriggerAddEventChatMessage(libUTIL_gt_ToggleCrosshair, c_playerAny, "tch", true);
TriggerAddEventChatMessage(libUTIL_gt_ToggleCrosshair, c_playerAny, "togglecrosshair", true);
}

void libUTIL_InitTriggers () {
libUTIL_gt_MapInit_Init();
libUTIL_gt_ClearTextMessage_Init();
Expand All @@ -781,6 +851,8 @@ void libUTIL_InitTriggers () {
libUTIL_gt_MinionWaveInterval_Init();
libUTIL_gt_FloatingCombatText_Init();
libUTIL_gt_DisplayString_Init();
libUTIL_gt_RunCrossHair_Init();
libUTIL_gt_ToggleCrosshair_Init();
}

//--------------------------------------------------------------------------------------------------
Expand Down
Binary file not shown.
17 changes: 17 additions & 0 deletions (10)trymemode.stormmap/base.stormdata/Modules/doc.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@
"overrideMarkdownContent": null
},
"commands": [
{
"shortCommand": "tch",
"command": "togglecrosshair",
"description": "Toggle to show a crosshair on the center of the camera. This allows for e.g more precise placement of [summon units](#cmd-summon) and [adding effects](#cmd-addeffectcamera).",
"uiAvailable": false,
"parameters": [],
"examples": [
{
"command": "{shortCommand}",
"description": "Toggle showing crosshair"
},
{
"command": "{command}",
"description": "Toggle showing crosshair"
}
]
},
{
"shortCommand": "tdb",
"command": "toggledebugmode",
Expand Down
34 changes: 33 additions & 1 deletion USAGE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<a name="meta-top"></a>

# Usage
<sup>*(Generated from [doc.json](./(10)trymemode.stormmap/base.stormdata/Modules/doc.json) at Mon, 25 Jan 2021 03:49:18 GMT)*</sup>
<sup>*(Generated from [doc.json](./(10)trymemode.stormmap/base.stormdata/Modules/doc.json) at Mon, 01 Feb 2021 18:50:28 GMT)*</sup>

Generally, most of the functionalities are using chat commands. Simply type the commands in the chat box (like how you would normally chat with teammates).
>Note: Remember to either use allies or all chat channel when try to use the commands. Public chat channels and Private Messages (PM) does not work.
Expand Down Expand Up @@ -52,6 +52,8 @@ Some of the commands have an UI counterpart implemented, which will display a me

- 💭 [Command: `string`](#cmd-string)

- 💭 [Command: `togglecrosshair`](#cmd-togglecrosshair)

- 💭 [Command: `toggledebugmode`](#cmd-toggledebugmode)

- 💭 [Command: `togglefogofwar`](#cmd-togglefogofwar)
Expand Down Expand Up @@ -617,6 +619,36 @@ This is pretty useful to quickly shows the string from the functions internally.



[\[Return to Table of Contents 🧾\]](#meta-toc)

[\[Return to Top ⬆\]](#meta-top)

<a name="cmd-togglecrosshair"></a>

## (`togglecrosshair` | `tch`)
<a name="cmd-togglecrosshair-description"></a>

#### ✏ Description:
Toggle to show a crosshair on the center of the camera. This allows for e.g more precise placement of [summon units](#cmd-summon) and [adding effects](#cmd-addeffectcamera).

<a name="cmd-togglecrosshair-parameters"></a>

#### ⚙ Parameters:
None
<a name="cmd-togglecrosshair-examples"></a>

#### 🔧 Examples:
> tch
(Toggle showing crosshair)
> togglecrosshair
(Toggle showing crosshair)
<a name="cmd-togglecrosshair-uiAvailability"></a>

#### 🖼 UI Availability:
-**Not Implemented**



[\[Return to Table of Contents 🧾\]](#meta-toc)

[\[Return to Top ⬆\]](#meta-top)
Expand Down

0 comments on commit 8c8e8e8

Please sign in to comment.