diff --git a/(10)trymemode.stormmap/base.stormdata/Modules/LibUtilities.galaxy b/(10)trymemode.stormmap/base.stormdata/Modules/LibUtilities.galaxy index 8fc5084..d913a10 100644 --- a/(10)trymemode.stormmap/base.stormdata/Modules/LibUtilities.galaxy +++ b/(10)trymemode.stormmap/base.stormdata/Modules/LibUtilities.galaxy @@ -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; @@ -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 (); @@ -59,6 +63,7 @@ void libUTIL_InitVariables () { libUTIL_gv_isUIEnabled = true; libUTIL_gv_isFOWEnabled = true; + libUTIL_gv_crosshair_marker = c_textTagNone; } // Triggers @@ -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(); @@ -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(); } //-------------------------------------------------------------------------------------------------- diff --git a/(10)trymemode.stormmap/base.stormdata/Modules/Modules_Editor.SC2Mod b/(10)trymemode.stormmap/base.stormdata/Modules/Modules_Editor.SC2Mod index 6ba8f6e..7d91e25 100644 Binary files a/(10)trymemode.stormmap/base.stormdata/Modules/Modules_Editor.SC2Mod and b/(10)trymemode.stormmap/base.stormdata/Modules/Modules_Editor.SC2Mod differ diff --git a/(10)trymemode.stormmap/base.stormdata/Modules/doc.json b/(10)trymemode.stormmap/base.stormdata/Modules/doc.json index a1042b7..b1f9f98 100644 --- a/(10)trymemode.stormmap/base.stormdata/Modules/doc.json +++ b/(10)trymemode.stormmap/base.stormdata/Modules/doc.json @@ -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", diff --git a/USAGE.md b/USAGE.md index fcb009a..f5ecbc5 100644 --- a/USAGE.md +++ b/USAGE.md @@ -1,7 +1,7 @@ # Usage -*(Generated from [doc.json](./(10)trymemode.stormmap/base.stormdata/Modules/doc.json) at Mon, 25 Jan 2021 03:49:18 GMT)* +*(Generated from [doc.json](./(10)trymemode.stormmap/base.stormdata/Modules/doc.json) at Mon, 01 Feb 2021 18:50:28 GMT)* 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. @@ -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) @@ -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) + + + +## (`togglecrosshair` | `tch`) + + +#### โœ 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). + + + +#### โš™ Parameters: + None + + +#### ๐Ÿ”ง Examples: + > tch + (Toggle showing crosshair) + > togglecrosshair + (Toggle showing crosshair) + + +#### ๐Ÿ–ผ UI Availability: +- โŒ **Not Implemented** + + + [\[Return to Table of Contents ๐Ÿงพ\]](#meta-toc) [\[Return to Top โฌ†\]](#meta-top)