subnauticamodding / nautilus Goto Github PK
View Code? Open in Web Editor NEWNautilus, the Subnautica Modding API (formerly SMLHelper)
Home Page: https://subnauticamodding.github.io/Nautilus/
License: GNU General Public License v3.0
Nautilus, the Subnautica Modding API (formerly SMLHelper)
Home Page: https://subnauticamodding.github.io/Nautilus/
License: GNU General Public License v3.0
Subnautica Below Zero
Release 2.14 & also tested on Release 2.12.1
There seems to be an issue envoking the post patch method on startup. Not sure if caused by SMLHelper directly or by a mod calling it.
Error Snippet from QMod Log:
[QModManager:ERROR] Invoking the specified entry method "PostPatch" failed for mod "SMLHelper"
[QModManager:ERROR] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Could not load type of field 'SMLHelper.V2.Patchers.CustomSoundPatcher:CustomSounds' (0) due to: Could not resolve type with token 0100002b (from typeref, class/assembly FMOD.Sound, Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null) assembly:Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null type:FMOD.Sound member:(null) signature:<none>
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <eae584ce26bc40229c1b1aa476bfa589>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <eae584ce26bc40229c1b1aa476bfa589>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <eae584ce26bc40229c1b1aa476bfa589>:0
at QModManager.Patching.QModPatchMethod.TryInvoke () [0x00034] in <0da21e14cfb64f0bb694361829b4a8b7>:0
Describe the feature
Page with examples of gadget usage, also points to the GadgetExtensions class for an extensive list of methods.
Purpose
It is very difficult even for the Nautilus developers themselves to remember all the ways to do things.
Dependent on #343
Describe the feature
A new category in the table of contents to hold all prefab-related docs.
Purpose
To separate the copious amounts of prefab related information from general features.
Describe the feature
A bunch of references to vanilla sounds/strings for the KnownTech system, either in the docs or in a specialized class for this data.
Purpose
It is annoying looking through runtime editor every time you want to add something.
Usage
Access through documentation page or classes like KnownTech.UnlockMessages.FishUnlock
and KnownTech.UnlockSounds.FishUnlock
.
For the stock Options menu you can navigate using a controller with the Dpad and A/B for select and back. Trying to enter the Mods menu with the controller highlights the Mods button but otherwise has no effect. You do need to hit back to get to any of the Stock options menus.
This is for version 2.15 on Subnautica Living Large update.
With the current state of development, this mod can conflict with any other mods that adds new items into the game.
This happens because the cache system of SMLHelper can associate already used IDs (from other mods) to new items (from SMLHelper).
This incompatibility problem will not occur for RandyKnapp's mods tho (since his mods items ID have been hardcoded into SMLHelper).
SubnauticaModding/Nautilus-Proto#28
Issue mirrored @JKohlman
SubnauticaModding/Nautilus-Proto#26
Issue mirrored @RamuneNeptune
Describe the feature
Purpose
These are useful.
Usage
Nautilus documentation.
PDALogHandler.AddCustomEntry(string key, string languageKey, Sprite icon = null, FMODAsset sound = null)
Subtitles does not appear, however the sound is played and the log is added to "Logs" tab of the PDA
Harvestable
: Based on Harvest methods in CraftDataHandler- (Released in 2.5.2)Crafter
: Based on CustomFabricatorBuildable from CC2 and crafting tree methods from CraftTreeHandler
Equipable
: Base on ideas from MoreCyclopsUpgrades and UpgradedVehiclesInventoryItemSize
: Based on item size method in CraftDataHandlerIsPickupable
property similar to the CustomFishPrefab, which would default to true
1x1
CompostableBioFuel
: Based on methods from BioReactorHandler
0
, implying that the item isn't to be used as biofuelEdible
: Based on ideas in CustomFoodPrefab from CC2CraftingTime
: Based on crafting time methods in CraftDataHandler0
, implying that no patching should be applied and default crafting time will be usedDescribe the feature
No idea what it is, I got it from Eldritch.
private static class Test21
{
[HarmonyPatch(typeof(uGUI_CraftingMenu), nameof(uGUI_CraftingMenu.IsGrid))]
private static void Postfix(uGUI_CraftingMenu.Node node, ref bool __result)
{
__result = ShouldGrid(node);
}
private static bool ShouldGrid(uGUI_CraftingMenu.Node node)
{
var craftings = 0;
var tabs = 0;
foreach (var child in node)
{
if (child.action == TreeAction.Expand) tabs++;
else if (child.action == TreeAction.Craft) craftings++;
}
return craftings > tabs;
}
[HarmonyPatch(typeof(uGUI_CraftingMenu), nameof(uGUI_CraftingMenu.Collapse))]
private static void Postfix(uGUI_CraftingMenu.Node parent)
{
if (parent == null) return;
if (parent.action != TreeAction.Craft) return;
parent.icon.SetActive(false);
}
}
The directions to simply place a .png in the mod directory don't work, because it looks in the wrong place, because AssetsFolder doesn't default to the mod directory.
Assembly.GetExecutingAssembly()
is the wrong call here; at that instant, code from SMLHelper is running, so it will always return the SMLHelper directory.
Leading to:
[SMLHelper/Error] Sprite for 'SurveyToolPrefab'
Did not find an image file at 'C:\Program Files (x86)\Steam\steamapps\common\Subnautica\QMods\Modding Helper\SurveyTool.png'
Presumably this wants to just reference the internal Mod
field set by ModPrefab, yes?
How to reproduce:
CraftDataHandler.SetTechData([techType], [techData]);
with an existing base piece and a new recipe different from the originalDescribe the bug
When registering a prefab after the player patch, the item doesn't show properly in the PDA techs:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The tech should show up only when the tech type is unlocked.
Closes #85
Error CS0117 "uGUI_SceneLoading" does not contain a definition for "BeginAsyncSceneLoad"
what am I doing wrong?
The master branch that has been imported into the project yesterday is in direct violation of the GNU GPL version 3 terms.
This license indicates that copyright notices must remain intact. More information here:
https://www.gnu.org/licenses/gpl-3.0.html
https://www.gnu.org/licenses/gpl-faq.en.html
For developpers:
Describe the feature
Radio log tutorial in documentation. Can be super short.
Describe the bug
Mod option sliders created through the attribute system throw an error when the OnChange attribute is added and hardly function.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No errors & value changes properly.
[Error : Unity Log] InvalidOperationException: Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true.
Stack trace:
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
HarmonyLib.Traverse.GetValue (System.Object[] arguments) (at <474744d65d8e460fa08cd5fd82b5d65f>:0)
Nautilus.Options.Attributes.MemberInfoMetadata`1[T].InvokeMethod (T config, System.Object[] arguments) (at <88913b91a6014dc8933bf1ac419772ff>:0)
Nautilus.Options.Attributes.ConfigFileMetadata`1[T].InvokeEvent[TSource] (Nautilus.Options.Attributes.MemberInfoMetadata`1[T] memberInfoMetadata, System.Object sender, TSource e) (at <88913b91a6014dc8933bf1ac419772ff>:0)
Nautilus.Options.Attributes.ConfigFileMetadata`1[T].InvokeOnChangeEvents[TSource] (Nautilus.Options.Attributes.ModOptionAttributeMetadata`1[T] modOptionMetadata, System.Object sender, TSource e) (at <88913b91a6014dc8933bf1ac419772ff>:0)
Nautilus.Options.Attributes.ConfigFileMetadata`1[T].InvokeOnChangeEvents (Nautilus.Options.Attributes.ModOptionAttributeMetadata`1[T] modOptionMetadata, System.Object sender) (at <88913b91a6014dc8933bf1ac419772ff>:0)
Nautilus.Options.Attributes.ConfigFileMetadata`1+<DeferredInvokeOnChangeEventsRoutine>d__38[T].MoveNext () (at <88913b91a6014dc8933bf1ac419772ff>:0)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <bd0d47c27bd84106afaaecc2c74cdb94>:0)
SubnauticaModding/Nautilus-Proto#27
Issue mirrored @K07H
Exceptions while loading game with builded objects with cellLevel = LargeWorldEntity.CellLevel.Global
.
Registering stray entity AlterraGaspodCollector
(Filename: C:\plastic_workspace_unity\Runtime/Export/Debug/Debug.bindings.h Line: 35)
NullReferenceException: Object reference not set to an instance of an object
at CellManager.RegisterGlobalEntity (UnityEngine.GameObject ent) [0x00006] in <44640028752f4a3fa44ae650c0744fda>:0
at CellManager.RegisterEntity (LargeWorldEntity lwe) [0x00020] in <44640028752f4a3fa44ae650c0744fda>:0
at LargeWorldEntity.Start () [0x0006c] in <44640028752f4a3fa44ae650c0744fda>:0
It happens because at the moment of prefab creating LargeWorldStreamer.globalRoot
is not created yet.
Describe the feature
Does not need to be elaborate, but a beginner's guide with examples and tips and tricks would be nice. We should also warn beginners that asynchronous prefabs are visible in the world at the origin while being constructed, so you need to set them inactive.
Game Version: January 2023, Build 49483
BepInEx 5.4.19.0 - SubnauticaZero
Using latest version of SMLHelper
QModManager log dump: qmodmanager_log-SubnauticaZero.txt
Error lines in the Log dump:
Describe the feature
PrefabUtils.AddEnergyMixin(???)
PrefabUtils.AddStorageContainer(???)
PrefabUtils.AddEatable(???)
[sic]Purpose
Reduces repetition of redundant code, allows us to document vanilla features, provide default values, reduce the chance of forgetting important steps, and reduces prefab creation code length by several lines.
Usage
Use these methods with GameObject creation.
Describe the feature
DuplicateGadgetException
or something similarRemoveGadget<TGadget>()
method to allow for manual removal of GadgetsAddGadget(...)
Purpose
It is currently very easy for beginners to override gadgets without being aware of it, therefore erasing any changes made through extension methods and such. It is not clear when this happens. AddGadget
should only be reserved for extension methods and advanced use cases.
I can open the Construction UI and so far, modded items do appear (cyclops docking mod) but clicking on any buildable items, vanilla or not causes nothing to happen. The UI stays open, but it's as if clicks do not register.
I Have gone and removed all other mods, testing 2 versions with SMLHelper installed, and a version with only QMM installed, and if i install SMLH it causes the habitat builder to stop working as described above.
I would completely understand if this isn't going to be patched until Steam and Epic versions update, but if you are willing to update and attempt to fix this bug, I will supply anything I'm able to in order to get it fixed
Attached files are the QMM log, after running the game with only SMLH
qmodmanager_log-Subnautica.txt
Describe the feature
Allow users to create vehicle upgrade modules for vanilla vehicles with custom actions on completion, for the Cyclops Seamoth and Cyclops.
We need to select a different set of wrapping characters than {
and }
and these cause issues when the language line starts or ends with a string.format
placeholder {0}
, {1}
,... {#}
.
Possibly even look into how this system might be affected when line breaks are added.
Multi-language support is very limited among Subnautica mods today.
Typically, only if the mod author directly adds multi-language support themselves will their mod have it.
This proposed feature would allow any mod built with SMLHelper to receive user provided translations and enable multi-language support with no additional work for the mod author.
I have a proposed, multi-step process to achieving this.
Step 1
Capture all calls into theLanguageHandler
'sSetLanguageLine
method and store the requests into a separate data structure.
For ease of use, separate all requests by calling assembly, so each mod's language lines are put together.Step 2
In a new folder "/Modding Helper/LanguageOriginal", write a file for each mod that supplied language entries.
Use a format that is easy to read and edit, along with being easy serialize, and deserialize to and from a Dictionary structure.
This will be the template or starting file that a user will copy and edit to provide transactions.
The file should be named after the calling assembly to make it easier to match files with mods.Step 3
Inside a different folder "/Modding Helper/LanguageOverrides", look for files that match the same names as the mod assemblies.
This file will provide a the overrides to the language entries that the mod originally provide.
Use these entries to override everything in theLanguagePatcher
customLines
dictionary with the user provided lines.
When all is said and done, the end result will be that the user provided text will be used instead of the text originally provided by the mod assembly.
This will allow users to create translation files and incorporate them into their mods without any intervention on behalf of the mod author.
Describe the bug
Nautilus options do not appear when SMLHelper is installed.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
All config files show.
Describe the feature
A databank entry for every mod that has the name, version, author and an optional description.
SubnauticaModding/Nautilus-Proto#32
Issue mirrored @RamuneNeptune
Describe the feature
Patch the method that spawns constructables and make sure they are active if needed.
Description
Nautilus not adding ScanningGadget into build menu
To Reproduce
Make a customprefab and assign a gadget, then try to add it to a TechGroup/TechCategory, it will not show up in game.
Example:
namespace TestMod
{
internal class TestPrefab
{
public static ScanningGadget TestGadget { get; private set; }
public static PrefabInfo Info { get; private set; } = PrefabInfo
.WithTechType("testgadget", "test gadget", "test")
.WithIcon(SpriteManager.Get(TechType.SmallLocker));
public static void Register()
{
var customPrefab = new CustomPrefab(Info);
TestGadget = new ScanningGadget(customPrefab) {
RequiredForUnlock = TechType.SmallLocker
};
CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, Info.TechType);
var testobj = new CloneTemplate(Info, TechType.SmallLocker);
customPrefab.SetGameObject(testobj);
customPrefab.SetRecipe(new RecipeData()
{
craftAmount = 1,
Ingredients = {
new Ingredient(TechType.Titanium, 1)
}
});
customPrefab.AddGadget(TestGadget)
.SetBuildable(true);
customPrefab.Register();
}
}
}
This does not work, its let you spawn in the buildable but It doesn't show up in the build menu
Expected behavior
CraftDataHandler.AddToGroup actually doing what its supposed to do
Describe the feature
Something like this but in Nautilus docs:
craft-trees.txt
Purpose
How else are you supposed to find it?
SubnauticaModding/Nautilus-Proto#31
Issue mirrored @RamuneNeptune
Coordinated spawns do not work after you quit to main menu and start a new game.
I'll probably fix this, just tracking the issue.
When I try to use KeyCode in QuickSlots+ it allows my 360 controller to activate the input, but it doesn't recognize any inputs afterwords except from keyboard.
For reference: https://github.com/celvro/QuickSlotsPlus/blob/53a81b7cac80ee491e0f398cedcdb336ecf5847b/StandardConfig.cs#L25-L65
In a related controller issue, you can't select the Toggle Headers from SMLHelper in the mod options.
SubnauticaModding/QModManager#275
With actual state of development, SML Helper is overwriting entries of the Mobile Vehicle Bay added by other mods.
This happens because SML Helper is taking ownership of game's CraftTree (thus CraftNodes) by overriding the CraftTree method "Get()" instead of manipulating the CraftTree directly.
CustomSoundHandler.RegisterCustomSound(string id, AudioClip sound, string busPath)
Does not register sound correctly. It looks like it blocks the loading of the mod after that.
Describe the feature
Cache prefabs in a dictionary (string, GameObject) after being constructed, and return this every time the prefab is grabbed in the future. These prefabs are never destroyed until the world is exited. This dictionary is static and is reset every time the main menu scene is loaded.
Purpose
The current cache only stops prefabs from appearing at the map origin and does not cache anything properly.
Usage
It would all be automatic for modders. All they need to know is that ideally their GetGameObject method will only ever be called once.
Game Version: 65667
[SMLHelper/Error] Caught exception while trying to initialize SMLHelper
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key)
at SMLHelper.V2.Patchers.SpritePatcher.GetSpriteGroup (SpriteManager+Group groupKey)
at SMLHelper.V2.Patchers.SpritePatcher.Patch()
at SMLHelper.V2.Initializer.Initialize()
at SMLHelper.V2.Initializer.PostPatch()
Issue in: SpritePatcher
Describe the bug
Modded command history is not accessible with the arrow keys when SMLHelper & Nautilus are installed at the same time.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
All command history is shown.
SubnauticaModding/Nautilus-Proto#30
Issue mirrored @MrJumpscare
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.