Skip to content

Commit

Permalink
Release v1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
IAmBatby committed Jan 18, 2025
1 parent e44075f commit 78dbace
Show file tree
Hide file tree
Showing 12 changed files with 86 additions and 21 deletions.
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
**Changelog**
--

**<details><summary>Version 1.4.2</summary>**

**<details><summary>Features</summary>**

* Added OverrideNoun value to ExtendedLevel, allowing authors to optionally modify the word used when accessing the level from the Terminal

</details>

**<details><summary>Fixes</summary>**

* Fixed issue with ContentTags failing to be applied to Vanilla content

</details>

</details>

**<details><summary>Version 1.4.1</summary>**

**<details><summary>Fixes</summary>**

* Fixed issue with older mods not being registered correctly
* Improved stalling during AssetBundle unloading on initial load

</details>

</details>

**<details><summary>Version 1.4.0</summary>**

**<details><summary>Features</summary>**

* Overhauled AssetBundleLoading system
* Added Scene AssetBundle hot-reloading


</details>

</details>

**<details><summary>Version 1.3.8</summary>**

**<details><summary>Features</summary>**
Expand Down
6 changes: 0 additions & 6 deletions LethalLevelLoader/AssetBundles/AssetBundleInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,6 @@ private IEnumerator UnloadBundleRequest()
UnityEngine.Object.Destroy(assetBundle);
assetBundle = null; // I think we need to do this so it isn't deemed missing (?)
activeUnloadRequest = null;
AsyncOperation unloadUnused = Resources.UnloadUnusedAssets();
yield return unloadUnused;
Caching.ClearCache();
GC.Collect();
unloadUnused = Resources.UnloadUnusedAssets();
yield return unloadUnused;
bundleUnloadStopwatch.Stop();
LastTimeUnloaded = Time.time;
DebugHelper.Log(AssetBundleFileName + " Unloaded (" + LastUnloadTime + ")", DebugType.User);
Expand Down
22 changes: 22 additions & 0 deletions LethalLevelLoader/AssetBundles/AssetBundleLoader.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -47,6 +48,8 @@ public static AssetBundleLoader Instance

internal static bool AllowLoading { get; set; } = true;

private bool onCooldown;

public static bool LoadAllBundlesRequest(DirectoryInfo directory = null, string specifiedFileName = null, string specifiedFileExtension = null, ParameterEvent<AssetBundleGroup> onProcessedCallback = null)
{
if (AllowLoading == false)
Expand All @@ -73,6 +76,21 @@ public static bool LoadAllBundlesRequest(DirectoryInfo directory = null, string
return (true);
}

private IEnumerator ClearCacheRoutine()
{
AsyncOperation unloadUnused = Resources.UnloadUnusedAssets();
yield return unloadUnused;
Caching.ClearCache();
GC.Collect();
unloadUnused = Resources.UnloadUnusedAssets();
yield return unloadUnused;
}

internal static void ClearCache()
{
Instance.StartCoroutine(Instance.ClearCacheRoutine());
}

private static void LoadAllBundles(DirectoryInfo directory = null, string specifiedFileName = null, string specifiedFileExtension = null, ParameterEvent<AssetBundleGroup> onProcessedCallback = null)
{

Expand Down Expand Up @@ -124,7 +142,11 @@ private static void OnAssetBundleLoadChanged(AssetBundleInfo info)
if (info.IsAssetBundleLoaded)
OnBundleLoaded.Invoke(info);
else
{
OnBundleUnloaded.Invoke(info);
if (Plugin.IsSetupComplete)
ClearCache();
}
}

private static void ProcessInitialBundleLoading(AssetBundleInfo info)
Expand Down
4 changes: 4 additions & 0 deletions LethalLevelLoader/AssetBundles/LethalBundleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ private static void FinialiseFoundContent()

NetworkRegisterCustomScenes();

AssetBundles.AssetBundleLoader.ClearCache();

DebugHelper.Log("Custom Content Processed. Unlocking Main Menu.", DebugType.User);

CurrentStatus = ModProcessingStatus.Complete;

OnFinishedProcessing.Invoke();
Expand Down
3 changes: 3 additions & 0 deletions LethalLevelLoader/Components/ExtendedContent/ExtendedLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public class ExtendedLevel : ExtendedContent
[field: Space(5)]
[field: Header("Terminal Route Override Settings")]

[field: SerializeField] public string OverrideRouteNoun { get; set; } = string.Empty;
[field: SerializeField] [field: TextArea(2, 20)] public string OverrideInfoNodeDescription { get; set; } = string.Empty;
[field: SerializeField] [field: TextArea(2, 20)] public string OverrideRouteNodeDescription { get; set; } = string.Empty;
[field: SerializeField] [field: TextArea(2, 20)] public string OverrideRouteConfirmNodeDescription { get; set; } = string.Empty;
Expand Down Expand Up @@ -99,6 +100,8 @@ public int RoutePrice
}
}

public string TerminalNoun => string.IsNullOrEmpty(OverrideRouteNoun) ? NumberlessPlanetName.StripSpecialCharacters().Sanitized() : OverrideRouteNoun.StripSpecialCharacters().Sanitized();

public string NumberlessPlanetName => GetNumberlessPlanetName(SelectableLevel);
public int CalculatedDifficultyRating => LevelManager.CalculateExtendedLevelDifficultyRating(this);
public bool IsCurrentLevel => LevelManager.CurrentExtendedLevel == this;
Expand Down
4 changes: 2 additions & 2 deletions LethalLevelLoader/General/Content.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public static void RegisterExtendedDungeonFlow(ExtendedDungeonFlow extendedDunge
extendedDungeonFlow.name = extendedDungeonFlow.DungeonFlow.name;
}
//AssetBundleLoader.RegisterNewExtendedContent(extendedDungeonFlow, extendedDungeonFlow.name);
//LethalBundleManager.RegisterNewExtendedContent(extendedDungeonFlow, extendedDungeonFlow.name);
LethalBundleManager.RegisterNewExtendedContent(extendedDungeonFlow, null);
}

public static void RegisterExtendedLevel(ExtendedLevel extendedLevel)
Expand All @@ -246,7 +246,7 @@ public static void RegisterExtendedLevel(ExtendedLevel extendedLevel)

public static void RegisterExtendedMod(ExtendedMod extendedMod)
{
DebugHelper.Log("Registering ExtendedMod: " + extendedMod.ModName + " Manually.", DebugType.Developer);
DebugHelper.Log("Registering ExtendedMod: " + extendedMod.ModName + " Manually.", DebugType.IAmBatby);
//AssetBundleLoader.RegisterExtendedMod(extendedMod);
LethalBundleManager.RegisterExtendedMod(extendedMod, null);
}
Expand Down
13 changes: 6 additions & 7 deletions LethalLevelLoader/General/Patches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,12 @@ internal static void PreInitSceneScriptAwake_Prefix(PreInitSceneScript __instanc
//AssetBundleLoader.LoadBundles(__instance);
//AssetBundleLoader.onBundlesFinishedLoading += AssetBundleLoader.LoadContentInBundles;

if (LethalBundleManager.CurrentStatus == LethalBundleManager.ModProcessingStatus.Complete)
/*
if (AssetBundleLoader.noBundlesFound == true)
{
CurrentLoadingStatus = LoadingStatus.Complete;
AssetBundleLoader.OnBundlesFinishedLoadingInvoke();
}*/
/*if (LethalBundleManager.CurrentStatus == LethalBundleManager.ModProcessingStatus.Complete)
if (AssetBundleLoader.noBundlesFound == true)
{
CurrentLoadingStatus = LoadingStatus.Complete;
AssetBundleLoader.OnBundlesFinishedLoadingInvoke();
}*/


ContentTagParser.ImportVanillaContentTags();
Expand Down
4 changes: 2 additions & 2 deletions LethalLevelLoader/Patches/NetworkBundleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public override void OnNetworkSpawn()

internal void Refresh()
{
if (IsHost == false) return;
allowedToLoadLevel.Value = true;
if (IsHost)
allowedToLoadLevel.Value = true;
OnRouteChanged();
}

Expand Down
4 changes: 2 additions & 2 deletions LethalLevelLoader/Patches/TerminalManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ internal static void CreateLevelTerminalData(ExtendedLevel extendedLevel, int ro
//Terminal Route Keyword
TerminalKeyword terminalKeyword = CreateNewTerminalKeyword();
terminalKeyword.name = extendedLevel.NumberlessPlanetName.StripSpecialCharacters().Sanitized() + "Keyword";
terminalKeyword.word = extendedLevel.NumberlessPlanetName.StripSpecialCharacters().Sanitized();
terminalKeyword.word = extendedLevel.TerminalNoun;
terminalKeyword.defaultVerb = routeKeyword;

//Terminal Route Node
Expand Down Expand Up @@ -920,7 +920,7 @@ internal static void CreateMoonsFilterTerminalAssets()
//Simulate Keywords
List<string> simulateMoonsKeywords = new List<string>();
foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels)
simulateMoonsKeywords.Add(extendedLevel.NumberlessPlanetName.StripSpecialCharacters().Sanitized());
simulateMoonsKeywords.Add(extendedLevel.TerminalNoun);

int counter = 0;
foreach (TerminalNode simulateNode in CreateTerminalEventNodes("simulate", simulateMoonsKeywords))
Expand Down
2 changes: 1 addition & 1 deletion LethalLevelLoader/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Plugin : BaseUnityPlugin
{
public const string ModGUID = "imabatby.lethallevelloader";
public const string ModName = "LethalLevelLoader";
public const string ModVersion = "1.4.0";
public const string ModVersion = "1.4.2";

internal static Plugin Instance;

Expand Down
4 changes: 4 additions & 0 deletions LethalLevelLoader/Tools/AssetBundleLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ internal static void OnBundlesFinishedLoading()
action(extendedMod);
}
*/
internal static void RegisterNewExtendedContent(ExtendedContent extendedContent, string fallbackName)
{
LethalBundleManager.RegisterNewExtendedContent(extendedContent, null);
}
/*
//This Function is used to Register new ExtendedConte to LethalLevelLoader, assiging content to it's relevant ExtendedMod or creating a new ExtendedMod if neccasary.
internal static void RegisterNewExtendedContent(ExtendedContent extendedContent, string fallbackName)
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "LethalLevelLoader",
"version_number": "1.3.11",
"version_number": "1.4.2",
"website_url": "https://github.com/IAmBatby/LethalLevelLoader",
"description": "A Custom API to support the manual and dynamic integration of all forms of custom content in Lethal Company. (v65 Compatible)",
"dependencies": [
Expand Down

0 comments on commit 78dbace

Please sign in to comment.