Skip to content

Commit df87745

Browse files
authored
Merge pull request #54 from DekuDesu/development
fixed bug where enabled/disabled icons were ignored in config
2 parents 9c662f7 + 3f97f62 commit df87745

File tree

5 files changed

+17
-3
lines changed

5 files changed

+17
-3
lines changed

MiniMapLibrary/Scanner/DefaultSorter.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Text;
44
using UnityEngine;
5+
using MiniMapLibrary;
56

67
#nullable enable
78
namespace MiniMapLibrary.Scanner
@@ -13,6 +14,7 @@ public class DefaultSorter<T> : ISorter<T>
1314
private readonly Func<T, bool>? selector;
1415
private readonly Func<T, GameObject> converter;
1516
private readonly Func<T, bool>? activeChecker;
17+
private readonly bool enabled;
1618

1719
public DefaultSorter(InteractableKind kind,
1820
Func<T, GameObject> converter,
@@ -23,9 +25,10 @@ public DefaultSorter(InteractableKind kind,
2325
this.selector = selector;
2426
this.converter = converter;
2527
this.activeChecker = activeChecker;
28+
this.enabled = Settings.GetSetting(kind).Config.Enabled.Value;
2629
}
2730

28-
public bool IsKind(T value) => selector?.Invoke(value) ?? false;
31+
public bool IsKind(T value) => enabled && (selector?.Invoke(value) ?? false);
2932

3033
public GameObject GetGameObject(T value) => converter(value);
3134

MiniMapLibrary/Scanner/SingleKindScanner.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class SingleKindScanner<T> : ITrackedObjectScanner where T : MonoBehaviou
1717
private readonly Range3D range;
1818
private readonly ISpriteManager spriteManager;
1919
private readonly Func<float> playerHeightRetriver;
20+
private readonly bool enabled;
2021

2122
public SingleKindScanner(InteractableKind kind, bool dynamic, IScanner<T> scanner, Range3D range, ISpriteManager spriteManager, Func<float> playerHeightRetriever, Func <T, GameObject> converter, Func<T, bool>? activeChecker = null, Func<T, bool>? selector = null)
2223
{
@@ -34,10 +35,17 @@ public SingleKindScanner(InteractableKind kind, bool dynamic, IScanner<T> scanne
3435
this.range = range ?? throw new ArgumentNullException(nameof(range));
3536
this.spriteManager = spriteManager ?? throw new ArgumentNullException(nameof(spriteManager));
3637
this.playerHeightRetriver = playerHeightRetriever;
38+
enabled = Settings.GetSetting(kind).Config.Enabled.Value;
3739
}
3840

3941
public void ScanScene(IList<ITrackedObject> list)
4042
{
43+
// if the kind is disabled, don't bother scanning
44+
if (enabled is false)
45+
{
46+
return;
47+
}
48+
4149
IEnumerable<T> foundObjects = scanner.Scan();
4250

4351
foreach (var item in foundObjects)

MiniMapMod/MiniMapPlugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace MiniMapMod
1414
{
15-
[BepInPlugin("MiniMap", "Mini Map Mod", "3.3.1")]
15+
[BepInPlugin("MiniMap", "Mini Map Mod", "3.3.2")]
1616
public class MiniMapPlugin : BaseUnityPlugin
1717
{
1818
private ISpriteManager SpriteManager;

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ Huge thanks to these awesome people who assisted in creating awesome features fo
8484
[Arcafanetiz](https://github.com/Arcafanetiz)
8585

8686
### Change Log
87+
Hotfix 3.1.2
88+
- fixed error that ignored icon's enabled options in config
89+
8790
Minor 3.1.1
8891
- equipment drones no longer show up as equipment
8992
- fixed stack trace logging to be more meaningful

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "MiniMapMod",
3-
"version_number": "3.3.1",
3+
"version_number": "3.3.2",
44
"website_url": "https://github.com/DekuDesu",
55
"description": "Adds a MiniMap to your game v3.3",
66
"dependencies": [

0 commit comments

Comments
 (0)