Skip to content

Commit 7b0d0e2

Browse files
committed
- added long over due zoom feature
- added minimap key to config - added zoom keys to config - added minimap scale to config to save zoom level between sessions
1 parent ab21dab commit 7b0d0e2

4 files changed

Lines changed: 40 additions & 3 deletions

File tree

MiniMapLibrary/Settings.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ public static class Colors
7272

7373
private static IConfigEntry<LogLevel> _logLevel;
7474

75+
public static float MinimapScale => _minimapScale.Value;
76+
private static IConfigEntry<float> _minimapScale;
77+
78+
public static KeyCode MinimapKey => _MiniMapKey.Value;
79+
private static IConfigEntry<KeyCode> _MiniMapKey;
80+
81+
public static KeyCode MinimapIncreaseScaleKey => _MinimapIncreaseScaleKey.Value;
82+
private static IConfigEntry<KeyCode> _MinimapIncreaseScaleKey;
83+
84+
public static KeyCode MinimapDecreaseScaleKey => _MinimapDecreaseScaleKey.Value;
85+
private static IConfigEntry<KeyCode> _MinimapDecreaseScaleKey;
86+
7587
private static ILogger logger;
7688

7789
static Settings()
@@ -271,7 +283,12 @@ public static void LoadApplicationSettings(ILogger logger, IConfig config)
271283
{
272284
Settings.logger = logger;
273285
_logLevel = config.Bind<LogLevel>($"Settings.General", "LogLevel", LogLevel.info, "The amount of information that the minimap mod should output to the console during runtime");
274-
logger.LogDebug($"Loaded log level: {Settings.LogLevel}");
286+
_MinimapDecreaseScaleKey = config.Bind<KeyCode>($"Settings.Zoom", "UnZoomKey", KeyCode.Minus, "Zooms the minimap OUT");
287+
_MinimapIncreaseScaleKey = config.Bind<KeyCode>($"Settings.Zoom", "ZoomKey", KeyCode.Equals, "Zooms the minimap IN");
288+
_MiniMapKey = config.Bind<KeyCode>($"Settings.General", "EnableKey", KeyCode.M, "Key that enables or disabled the minimap");
289+
_minimapScale = config.Bind<float>($"Settings.Zoom", "zoomLevel", 1.0f, "How far the minimap should be zoomed in");
290+
291+
logger.LogDebug($"Loaded log level: {Settings.LogLevel} Minimap[Key: {MinimapKey}] Zoom[{Settings.MinimapScale * 100}% UnZoomKey:{MinimapDecreaseScaleKey} ZoomKey:{MinimapIncreaseScaleKey}]");
275292
}
276293

277294
public static void LoadConfigEntries(InteractableKind type, IConfig config)

MiniMapMod/MiniMapPlugin.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public void Awake()
8989
//The Update() method is run on every frame of the game.
9090
private void Update()
9191
{
92-
if (UnityEngine.Input.GetKeyDown(KeyCode.M))
92+
if (UnityEngine.Input.GetKeyDown(Settings.MinimapKey))
9393
{
9494
Enable = !Enable;
9595

@@ -121,6 +121,15 @@ private void Update()
121121
Minimap.SetRotation(Camera.main.transform.rotation);
122122

123123
UpdateIconPositions();
124+
125+
if (Input.GetKeyDown(Settings.MinimapIncreaseScaleKey))
126+
{
127+
Minimap.Container.transform.localScale *= 1.1f;
128+
}else
129+
if (Input.GetKeyDown(Settings.MinimapDecreaseScaleKey))
130+
{
131+
Minimap.Container.transform.localScale *= 0.90f;
132+
}
124133
}
125134
catch (NullReferenceException)
126135
{
@@ -207,6 +216,8 @@ private bool TryCreateMinimap()
207216

208217
Minimap.CreateMinimap(this.SpriteManager, objectivePanel.gameObject);
209218

219+
Minimap.Container.transform.localScale = Vector3.one * Settings.MinimapScale;
220+
210221
logger.LogInfo("Finished creating Minimap");
211222

212223
return true;
@@ -234,6 +245,11 @@ private void Reset()
234245

235246
private void ScanScene()
236247
{
248+
// don't scan if the minimap isn't enabled
249+
if (Enable == false)
250+
{
251+
return;
252+
}
237253
// when other mods hook into the various global events
238254
// and this method throws exceptions, the entire event will throw and fail to invoke their methods
239255
// as a result, this method should never throw an exception and should output meaningful

MiniMapMod/Minimap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void CreateMinimap(ISpriteManager spriteManager, GameObject Parent)
4242

4343
SetParent(gameObject, Parent);
4444

45-
// make sure it's the last thing within the objective box
45+
// make sure it's the first thing within the objective box
4646
gameObject.transform.SetAsFirstSibling();
4747

4848
CreateIconContainer();

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ Minor 3.1.1
8888
- equipment drones no longer show up as equipment
8989
- fixed stack trace logging to be more meaningful
9090
- added elevation markers for all icons denoting where they are located vertically from player
91+
- added long over due zoom feature
92+
- added minimap key to config
93+
- added zoom keys to config
94+
- added minimap scale to config to save zoom level between sessions
9195

9296
Major 3.3
9397
- performance major, limited min time between scans to 2 seconds, previous was unlimited, when in 2hr+ runs auto-enemy killing builds caused constant scene scanning

0 commit comments

Comments
 (0)