Skip to content

Commit

Permalink
Fix bugs and cleanup code for RC3
Browse files Browse the repository at this point in the history
  • Loading branch information
MattEqualsCoder committed Jan 3, 2025
1 parent 52ea7f3 commit b8d556b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
2 changes: 0 additions & 2 deletions src/TrackerCouncil.Smz3.Data/WorldData/Location.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,6 @@ public Accessibility GetAccessibility(Progression actualProgression, Progression
/// <summary>
/// Returns the status of a location based on the given items
/// </summary>
/// <param name="actualProgression"></param>
/// <param name="withKeysProgression"></param>
/// <param name="isAccessible"></param>
/// <param name="isAccessibleWithKeys"></param>
/// <returns></returns>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void Clear(Location location, float? confidence = null, bool autoTracked
// the "guess dungeon from location" algorithm excludes
// cleared items
location.Cleared = true;
var previousAccessibility = location.Accessibility;
location.SetAccessibility(Accessibility.Cleared);
World.LastClearedLocation = location;

Expand All @@ -76,7 +77,7 @@ public void Clear(Location location, float? confidence = null, bool autoTracked
var isKeysanityForLocation = (location.Region is Z3Region && World.Config.ZeldaKeysanity) || (location.Region is SMRegion && World.Config.MetroidKeysanity);
var items = playerProgressionService.GetProgression(!isKeysanityForLocation);

if (location.Accessibility is not (Accessibility.Available or Accessibility.AvailableWithKeys) && (confidence >= Options.MinimumSassConfidence || autoTracked))
if (previousAccessibility is not (Accessibility.Available or Accessibility.AvailableWithKeys) && (confidence >= Options.MinimumSassConfidence || autoTracked))
{
var locationInfo = location.Metadata;
var roomInfo = location.Room?.Metadata;
Expand Down Expand Up @@ -553,14 +554,7 @@ public void UpdateAccessibility(Location location, Progression? actualProgressio
}
catch (Exception e)
{
var legacyActuallyAccessible =
location.World.LegacyWorld!.IsLocationAccessible((int)location.Id,
actualProgression.LegacyProgression);
var legacyAccessibleWithKeys = actualProgression == withKeysProgression
? legacyActuallyAccessible
: location.World.LegacyWorld!.IsLocationAccessible((int)location.Id,
withKeysProgression.LegacyProgression);
location.UpdateLegacyAccessibility(legacyActuallyAccessible, legacyAccessibleWithKeys);
logger.LogError(e, "Unable to update legacy accessibility");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using BunLabs;
namespace TrackerCouncil.Smz3.Tracking.TrackingServices;

internal class TrackerModeService : TrackerService, ITrackerModeService
internal class TrackerModeService() : TrackerService, ITrackerModeService
{
public bool GoMode { get; set; }
public bool PegWorldMode { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public class CheatsModule(
TrackerBase tracker,
IPlayerProgressionService playerProgressionService,
IWorldQueryService worldQueryService,
ITrackerModeService trackerModeService,
ILogger<CheatsModule> logger) : TrackerModule(tracker,
playerProgressionService,
worldQueryService,
Expand All @@ -37,7 +36,7 @@ public class CheatsModule(

private bool PlayerCanCheat()
{
if (!trackerModeService.CheatsEnabled)
if (!TrackerBase.ModeTracker.CheatsEnabled)
{
TrackerBase.Say(x => x.Cheats.PromptEnableCheats);
return false;
Expand Down Expand Up @@ -218,12 +217,12 @@ public override void AddCommands()

AddCommand("Enable cheats", GetEnableCheatsRule(), (result) =>
{
trackerModeService.EnableCheats();
TrackerBase.ModeTracker.EnableCheats();
});

AddCommand("Disable cheats", GetDisableHintsRule(), (result) =>
{
trackerModeService.DisableCheats();
TrackerBase.ModeTracker.DisableCheats();
});

AddCommand("Fill rule", FillRule(), (result) =>
Expand Down

0 comments on commit b8d556b

Please sign in to comment.