Entity.SourceData and SourceId, provide way to efficiently search by EntityData name #879
+678
−183
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.
Second take on the TypeHelper PR, considering the previous one is dead.
Entity.SourceData
,Entity.SourceId
Scene.FindEntitiesWithSid(string sid)
, which filters by entity data name, while still using the tracker.Tracker.Get[Entities/Components]TrackIfNeeded
, which add the type to the tracker if needed, used by theFindEntitiesWithSid
method, but is useful in general.Celste.Mod.Registry.EntityRegistry
static class, with functions allowing for checking relations between c# types and EntityData names.These relations are generated as follows:
Everest.Events.Level.LoadEntity
event. This does mean that the sets returned by them are not guaranteed to be exhaustive - there could be relations that haven't occurred this session. However, that is fine realistically, because the main point of these APIs is to use them together with the tracker, in which case you don't care about searching for entity types that have never been instantiated anyway.Tracker.Refresh/AddTypeToTracker
wasn't properly tested? In my testing, the function never did anything, and forcing a refresh caused a missing dictionary key crash for triggers. This PR fixes those bugs as well because these functions are crucial forFindEntitiesWithSid