Skip to content

Restructured PathManager

Compare
Choose a tag to compare
@Emik03 Emik03 released this 21 Aug 13:34
· 278 commits to main since this release

MAJOR

PathManager restructure

  • Fixed bug which caused modules to throw exceptions when played locally with demand-based mod loading enabled.
  • IOExceptions are now suppressed, default values are now returned instead. Refer to the XML or MD documentation to see the default values for each method.
  • Removed methods where generics and types are passed in; this is now done implicitly just by calling the method and looking at the stack-trace to find the caller.
  • Rewrote the entire structure of PathManager to cache the results of every mod only once and by looking in the dictionary provided by the game as oppose to looking for each file. Performance significantly increased.

Additions

  • Added compatibility for vanilla modules to hook OnModuleSolved and OnModuleStrike.
  • Added ConsecutiveGroup, CustomComparer and UtilityExtensions, from RT.Util.Core
  • Added Profiler, allowing an easy of measuring code performance.
  • Added StringifyFormat class for customizing Helper.Stringify

Changes

  • Changed BigInteger to a new BigInt implementation by Timwi. Performance is better with more operators overloaded.
  • Changed Game.Vanilla to only return vanilla modules instead of all vanilla components that would be added to each module, modded-or-not.
  • Changed Helper.Modulo to return right-hand side negative values correctly by inverting the result.
  • Changed Number to be a struct rather than a class.
  • Changed OnSolvableSolved to OnModuleSolved.
  • Changed ToArray in TupleBase to Items, and subsequently all tuple types that inherit from TupleBase. Changed return type of KeyHelper.Catch to a Func<T>/Action to call it to be stackable.

Removals

  • Removed ability to implicitly convert an Array, string, or any object to BigInteger and passing them in a constructor. A BigInt.Parse exists for strings, the other ones aren't needed.
  • Removed deprecated OnActivate in ModuleContainer. Use Assign(onInteract: Action) instead.
  • Removed implicit casting from and to ValueType to Number.
  • Removed OnNeedySolved since not all modules necessarily solve when deactivated, causing inconsistent behavior.
  • OnModuleSolved and OnModuleStrike pass a ModuleContainer instead of a string. You can still access the module id with module.Id.
  • Removed Unwrap, and in-place added Combine which is a simpler Unwrap, and Stringify which is a much more complex version with customizable formatting.

MINOR

Additions

  • Added Add and Set overloads for Vector2Int and Vector3Int in TypeHelper.
  • Added Alphabet constant in Helper.
  • Added Game.References which indicates which library it references for Game. This value may only be modified by trusted sources.
  • Added IsAny<T>() and IsAll<T>() in Helper.
  • Added OnInteractSequence() overload in TPScript that allows you to press a sequence of buttons, just as you would yield returning a KMSelectable[].
  • Added overloads for IsBetween() in Helper.
  • Added ToReadOnly<T>() in Helper, which converts IEnumerable<T> to ReadOnlyCollection<T>.
  • Added ToString() in ModuleContainer.
  • Added Yield<T>() in KeyHelper.
  • Added Zip extension methods in Helper. Back-port of Enumerable.Zip

Changes

  • Changed Stringifier to unwrap dictionaries correctly and allowing for custom specified formatting with StringifyFormat.

PATCH

Additions

  • Added private ModuleId property for compatibility with LFA.

Changes

  • Changed OnInteractSequence() in TPScript to yield break instead of throwing a NullReferenceException when selectables is null.
  • Changed Helper.Combine to allow the parameter self to be null rather than throwing a NullReferenceException.
  • Changed ModuleScript to automatically now run Assign by default during Awake. This is so that the needy events get hooked with IsNeedyActive.
  • Changed Sound's explicit conversion to SoundEffect to throw a specific exception when Game is null.

Optimizations

  • Improved performance by making PathManager cache results for every other mod that is currently loaded, such that other modules using the same version of this library can grab information from the cached result.
  • Improved performance by only hooking modules if OnModuleSolved and/or OnModuleStrike is overriden.
  • Improved performance by only running colorblind when OnColorblindChanged is overriden.