SubnauticaModding / Nautilus

Nautilus, the Subnautica Modding API (formerly SMLHelper)
https://subnauticamodding.github.io/Nautilus/
GNU General Public License v3.0
69 stars 37 forks source link

Not compatible with mods that adds new entries to the Mobile Vehicle Bay #44

Closed K07H closed 6 years ago

K07H commented 6 years ago

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.

PrimeSonic commented 6 years ago

CraftTreeHandler.AddCraftingNode(CraftTree.Type.Constructor, techType, "Vehicles"); Works fine for me, as far as simple crafting goes.

Alexejhero commented 6 years ago

I think he means added by other mods with harmony

K07H commented 6 years ago

Yes I'm talking about Subnautica mods. I never said I was talking about SML Helper mods.

PrimeSonic commented 6 years ago

Why go through the trouble of manually patching that when SMLHelper offers a simple and reliable way to do it? If the problem has been solved, why would any modder waste time solving the problem from scratch? That's basically re-inventing the wheel at that point.

It's the same reason you don't see everyone writing their own mod loader. Everyone just uses QMods because it solves the problem reliably.

Alexejhero commented 6 years ago

Why? Is not the question that needs answering. What if? Is the one @primesonic

K07H commented 6 years ago

That is a totally different question, to which I would answer that you don't want to force people into using this library. Also, there isn't any problem: I add my item to the CraftTree without any difficulty and with only few lines. I don't need the 10 level of indirections that SML Helper provide (hundreds of lines of codes and numerous classes), it's way more simple to add my node with Harmony.

K07H commented 6 years ago

The problem is that I can't do it, because SML Helper v2 is taking ownership of Subnautica CraftTree (instead of manipulating the tree like I do).

K07H commented 6 years ago

Actually I wrote SML Helper v2, but I think this issue should be reported for v1.7 as well. I didn't test. EDIT: Yep, just tested and this issue also occurs on version 1.7.

ahk1221 commented 6 years ago

Should be fixed in the 2.0NodeHandling branch

K07H commented 6 years ago

Ok tell me if you need help. I can provide my source code if you want, it's only few lines of codes (about 20 are required to add new nodes to existing CraftTrees).

PrimeSonic commented 6 years ago

Pull Request https://github.com/ahk1221/SMLHelper/pull/45 contains the proposed changes to resolve this. This change reverts the underlying handling of the craft tree patch back to the style used in 1,x where the individual scheme methods are patched with in-place alterations done to their CraftNode result.

PrimeSonic commented 6 years ago

@K07H Look at the Pull Request. This is already compatible with current mods that update existing craft trees. But since you mentioned encountering this issue on the Mobile Vehicle Bay. we need more info to figure out what is going on.

If you have a code snippet to share that can point to potential conflicts, that will be helpful.

Alexejhero commented 6 years ago

The pull request was merged, but I don't recommend closing this until @K07H does further testing

ahk1221 commented 6 years ago

Yeah

K07H commented 6 years ago

The fix seems to be working from what I tested. I guess you can close this now.