Skip to content

Add ExplosionCollider component - #1195

Open
earthwise01 wants to merge 3 commits into
EverestAPI:devfrom
earthwise01:explosion-collider
Open

earthwise01 wants to merge 3 commits into
EverestAPI:devfrom
earthwise01:explosion-collider

Conversation

@earthwise01

Copy link
Copy Markdown
Contributor

Adds an ExplosionCollider component to allow modded entities to more easily define custom interactions with the explosions created by puffers and seekers, without each mod having to hook the relevant explosion code.

Vanilla entities affected by puffer/seeker explosions (excluding players and theo crystals) have also been made to use ExplosionCollider components instead of having their interactions hardcoded.

This also allows modded entities which produce similar explosions to easily handle explosion interactions (including with other modded entities!) by calling the ExplosionCollider.TriggerExplosionColliders method.

@maddie480-bot maddie480-bot added the 1: review needed This PR needs 2 approvals to be merged (bot-managed) label Nov 15, 2026

@aonkeeper4 aonkeeper4 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

local kitty shocks everest team by ordering in perfect ilpatch

Comment on lines +61 to +72
public static void TriggerExplosionColliders(Entity entity) {
// collect the colliding components beforehand so no side effects from their `OnCollide` will affect which components are checked
ExplosionCollider[] collidingExplosionColliders = entity.Scene.Tracker
.GetComponents<ExplosionCollider>()
.Cast<ExplosionCollider>()
.Where(c => c.OnCollide != null && c.Check(entity))
.ToArray();

foreach (ExplosionCollider explosionCollider in collidingExplosionColliders) {
explosionCollider.OnCollide(entity, entity.Center);
}
}

@aonkeeper4 aonkeeper4 Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

would b nice to be able to specify the explosion center separately, e.g.

Suggested change
public static void TriggerExplosionColliders(Entity entity) {
// collect the colliding components beforehand so no side effects from their `OnCollide` will affect which components are checked
ExplosionCollider[] collidingExplosionColliders = entity.Scene.Tracker
.GetComponents<ExplosionCollider>()
.Cast<ExplosionCollider>()
.Where(c => c.OnCollide != null && c.Check(entity))
.ToArray();
foreach (ExplosionCollider explosionCollider in collidingExplosionColliders) {
explosionCollider.OnCollide(entity, entity.Center);
}
}
public static void TriggerExplosionColliders(Entity entity, Vector2? explosionCenter = null) {
// collect the colliding components beforehand so no side effects from their `OnCollide` will affect which components are checked
ExplosionCollider[] collidingExplosionColliders = entity.Scene.Tracker
.GetComponents<ExplosionCollider>()
.Cast<ExplosionCollider>()
.Where(c => c.OnCollide != null && c.Check(entity))
.ToArray();
foreach (ExplosionCollider explosionCollider in collidingExplosionColliders) {
explosionCollider.OnCollide(entity, explosionCenter ?? entity.Center);
}
}

(would require changes to patches obviously)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ohh true that would be very nicies
would it b too evil to make the vector2 arg not nullable and have a TriggerExplosionColliders(Entity entity) => TriggerExplosionColliders(entity, entity.Center); overload though .. depending on if i feel like doing more generics in ilpatches ..

@aonkeeper4 aonkeeper4 Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

afaik you shouldnt even need to do any more generics stuff, just a ldnull should work to emit a null Vector2?, but like ya idm
(edit: don't do this. Vector2? is still a value type so emitting a null reference explod s 💥 )

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1: review needed This PR needs 2 approvals to be merged (bot-managed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants