[V63] Porcupine Framework
For the less tech-savy amongst us, you shouldn’t need this mod unless another mod depends on this mod.
This framework serves as an abstraction layer for common routines and structures in the game, aggregating multiple instances of different interface types including IScriptEntity, ITickCapable, IRenderCapable, and ISerializable. Its primary goal is to provide a clearer and easier-to-use interface for accessing the scripting capabilities of the base game. The framework also aims to intercept erroneous calls to the base game’s API by routing all access through the framework, improving the stability and reliability of scripts that use it and protecting against malicious or poorly-written scripts.
Please note that this framework is in an early development phase and has not yet undergone thorough testing or optimization. It may contain bugs or issues that could cause problems or unexpected behavior. The API is subject to change as development progresses and it is not recommended to rely on specific implementation details or behavior that may change in future updates. It is recommended to check for updates regularly and adapt your code accordingly. The framework is not designed to support multiple instances running concurrently and may result in unpredictable behavior if attempted. Use at your own risk.
Porcupine partially wraps and replaces the script loading process of the game, providing four implementable interfaces that provide the callbacks a script might need. Every Porcupine script (referred to as a module) must implement at least IScriptEntity. When Porcupine is initialized by the game, it looks for attached .jars to the mods and tries to extract and initialize a module if one is found. From that point on, Porcupine forwards update and render calls from the game to all modules, along with save and load calls. A bootstrap project is available to help developers quickly get started creating scripts.
Currently, a module is virtually identical to a vanilla game script, with the sole difference being that Porcupine handles update and render calls, as well as save and load calls. This framework should not cause any incompatibilities with other mods, it doesn’t touch any game files and it doesn’t change any game behaviour.
Mod created by Milan, a.k.a. Ghost. Special thanks to Jake for creating a wonderful game, along with being a tremendous help in figuring out how to develop a mod for SoS. I’d also like to thank Fatmice and the other people on the SoS Discord for helping me figure out the mystery that is SoS modding.
https://steamcommunity.com/sharedfiles/filedetails/?id=2915064549