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

Add Entity Collider Components to Entities #858

Open
wants to merge 44 commits into
base: dev
Choose a base branch
from

Conversation

TheDavSmasher
Copy link

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.

Copy link
Member

@psyGamer psyGamer left a 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?

Celeste.Mod.mm/Mod/Entities/EntityCollider.cs Outdated Show resolved Hide resolved
Celeste.Mod.mm/Mod/Entities/EntityCollider.cs Outdated Show resolved Hide resolved
Celeste.Mod.mm/Mod/Entities/EntityCollider.cs Outdated Show resolved Hide resolved
Celeste.Mod.mm/Patches/Monocle/Tracker.cs Outdated Show resolved Hide resolved
Celeste.Mod.mm/Mod/Entities/EntityCollider.cs Show resolved Hide resolved
Celeste.Mod.mm/Mod/Entities/EntityCollider.cs Show resolved Hide resolved
Celeste.Mod.mm/Patches/Monocle/Tracker.cs Outdated Show resolved Hide resolved
Celeste.Mod.mm/Patches/Monocle/Tracker.cs Outdated Show resolved Hide resolved
Celeste.Mod.mm/Patches/Monocle/Tracker.cs Show resolved Hide resolved
Celeste.Mod.mm/Patches/Monocle/Tracker.cs Outdated Show resolved Hide resolved
Celeste.Mod.mm/Patches/Monocle/Tracker.cs Outdated Show resolved Hide resolved
Celeste.Mod.mm/Patches/Monocle/Tracker.cs Outdated Show resolved Hide resolved
Celeste.Mod.mm/Patches/Monocle/Tracker.cs Outdated Show resolved Hide resolved
…if added mid-scene and EntityAwake if added pre-scene
@wuke32767
Copy link

don't think generic type can be tracked

@TheDavSmasher
Copy link
Author

TheDavSmasher commented Dec 5, 2024

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

@TheDavSmasher
Copy link
Author

This is ready for final review / merging

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.

4 participants