-
Notifications
You must be signed in to change notification settings - Fork 82
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
Add Entity Collider Components to Entities #858
base: dev
Are you sure you want to change the base?
Add Entity Collider Components to Entities #858
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some of my thoughs.
For the issue of a tracker in another scene technically having a type tracked, while that not acctually being the case, perhaps provide a method to refresh tracked entities/components and just let mods handle it themselves?
… date, especially if a Scene change happens
…way the Tracker's Initializer works, plus method to include all or no subtypes
…ain without type being added to Tracker first
…if added mid-scene and EntityAwake if added pre-scene
don't think generic type can be tracked |
USSRNAME (wuke32767) wants to provide a pull request to my changes so if changes come in, it's their pull request code and will be added to the conversation because it includes some MonoMod things I don't fully understand |
use version to determine if tracker is outdated
… to prevent refreshes immediately after creation
…Scene if not passed
This is ready for final review / merging |
While making this to fulfill an idea for a single part of my mod, I instead generalized the idea and made it in such a way that having it in Everest would be useful for anyone.
The 2 components added, EntityCollider and EntityColliderByComponent, work in the same way a PlayerCollider or PufferCollider work in vanilla, except they are made so they can instead collide with any entity as defined with the generic type parameter. Entity Collider collides based on Entity, EntityColliderByComponent collides based on if an entity has the component of type.
Additionally, two methods were added to patch_Tracker: AddEntityToTracker and AddColliderToTracker. This allows for any type that is not normally tracked to become tracked and have its entities added to the Tracker. This is done in conjunction to the Entity Colliders due to performance, so it's not required to look through the Scene's Entities every single Update call. Some entities, like Springs, aren't tracked, but are a good candidate for something you'd want to collide with. This is why these methods were made. If anyone thinks this can be unsafe, anyone can find any entity anyways by going through Scene.Entities, so it does not add any vulnerability to normally untracked entities.