Skip to content

Commit

Permalink
Fixed "Not being able to route to The Company Moon" issue IAmBatby#91,
Browse files Browse the repository at this point in the history
…IAmBatby#87, IAmBatby#83 , IAmBatby#80 , IAmBatby#78, IAmBatby#77

- ``ExtendedLevel.cs``
  - Removed the restriction of applying the terminal node changes on custom levels only.
  - Reasoning being that it's easier for every level to follow a standard rather than having special cases (CompanyRoute having a displayPlanetInfo of -1, leading to OutOfBounds).

- ``General/Patches.cs``
  - Changed applying the ``SetLevelID()`` method from ``CustomExtendedLevels`` to ``ExtendedLevels`` to include the vanilla moons as well.

- ``AssetBundleLoader.cs``
  - Added case to acquire the terminal nodes associated to the Company Moon due to the noun object name being ``CompanyMoon`` rather than ``Gordion``.
  • Loading branch information
WhiteSpike committed May 11, 2024
1 parent bc89e5b commit 5950bb7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
13 changes: 5 additions & 8 deletions LethalLevelLoader/Components/ExtendedContent/ExtendedLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,11 @@ internal static string GetNumberlessPlanetName(SelectableLevel selectableLevel)

internal void SetLevelID()
{
if (ContentType == ContentType.Custom)
{
SelectableLevel.levelID = PatchedContent.ExtendedLevels.IndexOf(this);
if (RouteNode != null)
RouteNode.displayPlanetInfo = SelectableLevel.levelID;
if (RouteConfirmNode != null)
RouteConfirmNode.buyRerouteToMoon = SelectableLevel.levelID;
}
SelectableLevel.levelID = PatchedContent.ExtendedLevels.IndexOf(this);
if (RouteNode != null)
RouteNode.displayPlanetInfo = SelectableLevel.levelID;
if (RouteConfirmNode != null)
RouteConfirmNode.buyRerouteToMoon = SelectableLevel.levelID;
}

internal void SetExtendedDungeonFlowMatches()
Expand Down
2 changes: 1 addition & 1 deletion LethalLevelLoader/General/Patches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ internal static void StartOfRoundAwake_Prefix(StartOfRound __instance)
//Initialize ExtendedContent Objects For Custom Content.
AssetBundleLoader.InitializeBundles();

foreach (ExtendedLevel extendedLevel in PatchedContent.CustomExtendedLevels)
foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels)
extendedLevel.SetLevelID();

//Some Debugging.
Expand Down
11 changes: 10 additions & 1 deletion LethalLevelLoader/Tools/AssetBundleLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -472,13 +472,22 @@ internal static void CreateVanillaExtendedLevels(StartOfRound startOfRound)
ExtendedLevel extendedLevel = ExtendedLevel.Create(selectableLevel);

foreach (CompatibleNoun compatibleRouteNoun in TerminalManager.routeKeyword.compatibleNouns)
if (compatibleRouteNoun.noun.name.Contains(ExtendedLevel.GetNumberlessPlanetName(selectableLevel)))
{

string comparedName = compatibleRouteNoun.noun.name;
switch(comparedName)
{
// Terminal node noun is called "CompanyMoon", not "Gordion" so it will never grab the respective nodes if we don't change the compared name
case "CompanyMoon": comparedName = "Gordion"; break;
}
if (comparedName.Contains(ExtendedLevel.GetNumberlessPlanetName(selectableLevel)))
{
extendedLevel.RouteNode = compatibleRouteNoun.result;
extendedLevel.RouteConfirmNode = compatibleRouteNoun.result.terminalOptions[1].result;
extendedLevel.RoutePrice = compatibleRouteNoun.result.itemCost;
break;
}
}
PatchedContent.AllLevelSceneNames.Add(extendedLevel.SelectableLevel.sceneName);

extendedLevel.Initialize("Lethal Company", generateTerminalAssets: false);
Expand Down

0 comments on commit 5950bb7

Please sign in to comment.