Add methods for runtime creation and deletion of prototypes without YAML#6609
Open
MACMAN2003 wants to merge 1 commit into
Open
Add methods for runtime creation and deletion of prototypes without YAML#6609MACMAN2003 wants to merge 1 commit into
MACMAN2003 wants to merge 1 commit into
Conversation
Added two methods to IPrototypeManager for dynamically creating a prototype from a filled out MappingDataNode and deleting a prototype.
PJB3005
reviewed
Jun 2, 2026
Comment on lines
+421
to
+424
| /// To properly use this, you will need to make <paramref name="data"/> resemble how other prototypes of its kind appear in | ||
| /// _kinds' KindData.Results or KindData.RawResults. <br/> | ||
| /// You will need to utilize a debugger and a breakpoint if you want to get a reference of how the prototypes are | ||
| /// represented in _kinds. |
Author
There was a problem hiding this comment.
I can't think of a way to word it accurately and concisely.
Like if one prototype kind has a "foo" ValueDataNode and a "bar" SequenceDataNode in every instance then the MappingDataNode provided to the method needs to have both "foo" and "bar" nodes in its children.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
might fulfill #4814 probably?
Added two methods to IPrototypeManager for dynamically creating a prototype from a filled out MappingDataNode and deleting a prototype using and it's id string.
Concerning the creation method, it is quite makeshift compared to what I would consider ideal but it was the simplest way that I could think of that did not involve insane levels of reflection.
Utilizing the creation method involves having to assemble a MappingDataNode and all of its DataNode children recursively, which is a little painful, but not as much as generating an entire yaml file in the code. It does involve having to use a debugger to see how the prototypes appear in memory.
The deletion method removes the provided id from the kind . It's there as a way to remove prototypes if they are round-dependent OR as a safeguard against the attack of the 90000 rogue prototypes.
Both methods were tested and confirmed to work with Content.Shared.Chemistry.Reagent.ReagentPrototype