Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

Commit

Permalink
Include waypoints in start terms for pathfinder
Browse files Browse the repository at this point in the history
  • Loading branch information
syyePhenomenol committed Jul 5, 2022
1 parent 2e9b7f4 commit 2bca0fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions MapModS/Data/Pathfinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ public static void Initialize()
{
localPm = new(PD.lm, RM.RS.Context);

// Remove start transitions
foreach (string transition in PD.GetStartTransitions())
// Remove start terms
foreach (string term in PD.GetStartTerms())
{
localPm.Set(transition, 0);
localPm.Set(term, 0);
}
}

Expand Down
13 changes: 6 additions & 7 deletions MapModS/Data/PathfinderData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,15 @@ public static void Load()
}
}

// Set Start Warp
string[] startTransitions = GetStartTransitions();
if (startTransitions.Length > 0)
string[] startTerms = GetStartTerms();
if (startTerms.Length > 0)
{
adjacentScenes["Warp-Start"] = ItemChanger.Internal.Ref.Settings.Start.SceneName;
adjacentTerms["Warp-Start"] = "Warp-Start";
lmb.AddWaypoint(new("Warp-Start", "FALSE"));
foreach (string transition in startTransitions)
foreach (string term in startTerms)
{
lmb.DoLogicEdit(new(transition, "ORIG | Warp-Start"));
lmb.DoLogicEdit(new(term, "ORIG | Warp-Start"));
}
}

Expand All @@ -125,12 +124,12 @@ public static void Load()
waypointScenes = lm.Waypoints.Where(w => RD.IsRoom(w.Name) || w.Name.IsSpecialRoom()).ToDictionary(w => w.Name, w => w);
}

public static string[] GetStartTransitions()
public static string[] GetStartTerms()
{
if (RM.RS.Context.InitialProgression is ProgressionInitializer pi)
{
return pi.Setters.Concat(pi.Increments)
.Where(tv => RM.RS.Context.LM.TransitionLookup.ContainsKey(tv.Term.Name) && tv.Value > 0)
.Where(tv => tv.Value > 0)
.Select(tv => tv.Term.Name)
.ToArray();
}
Expand Down

0 comments on commit 2bca0fc

Please sign in to comment.