Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple prefabs with same TechType #383

Conversation

LeeTwentyThree
Copy link
Member

Changes made in this pull request

  • No more NREs for fragments and such.
  • If multiple prefabs are added for a given TechType, only the first one will be spawnable via TechType.

@LeeTwentyThree
Copy link
Member Author

Does not seem to cause any errors.

Copy link
Contributor

@EldritchCarMaker EldritchCarMaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regardless of whether same-techtype prefabs overwrite each other or not, I think this is fine


// If multiple prefabs sharing the same TechType are patched, only the first one will be spawnable by its TechType.
var techTypeString = info.TechType.AsString();
if (!_techTypePrefabs.ContainsKey(techTypeString))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be better as

_techTypePrefabs[info.TechType.AsString()] = info;

I think there could theoretically be a use case for actually replacing another prefab by using the same techtype. It's up to you if this is something we should encourage or not, though, as it is a fairly "hacky" thing to do.

@LeeTwentyThree LeeTwentyThree merged commit cf08a09 into SubnauticaModding:master Jun 2, 2023
@MrPurple6411
Copy link
Member

This SHOULD NOT be a thing.
Fragments have a whole other techtypeoverride system for making fragments that unlock something else.
Techtypes are supposed to be unique

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants