-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Embedded throwables are unembedded when the parent entity is destroyed #32707
base: master
Are you sure you want to change the base?
Conversation
…e objects are destroyed BUT it only applies to objects with Destructible or Body (when they're gibbed)
Eating a mouse with an embedded item still deletes the item. (This happened in a round recently which is why I thought of it. lol) |
- component to track embedded objects on embeddee - unembed checks for said component on parent
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.
I wouldn't say I'm familiar enough with the codebase at this time to give a proper review (my computer is too potato to even work in it), but I'll do what I can with my general C# knowledge.
clean up `using`s
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
BUT it only applies to entities which emit a
DestructionEventArgs
orBeingGibbedEvent
when they're destroyed.About the PR
Tracks projectiles embedded in an object, and un-embeds them when either [] is raised on the object (presently just before they're deleted).
Why / Balance
Fixes #22823
Technical details
HasProjectilesEmbeddedComponent
, which is applied to objects when a projectile is embedded in themEntityUid
s of the objects that're embeddedHasProjectilesEmbeddedComponent
.ProjectileSystem
which checks an entity for children withEmbeddableProjectile
, and uses this shared un-embedding code to unembed them.HasProjectilesEmbeddedComponent
has eitherDestructionEventArgs
orBeingGibbedEvent
raisedKnown Issues
In general, there're still a ton of cases where an embedded object will be destroyed when its parent id deleted. This is because there're so many cases where entities are just deleted or enqueued for deletion without raising any events to hook in some "pls drop embedded stuff before you die" logic. However, I think a great many of these are relatively violent in-game events (eg. gas canisters exploding due to overpressurization) that it won't be quite so noticeable.
The only solution I can think of for this would be to do some kind of audit of all places where things're deleted and make sure there's some generic "entity is being removed from game due to 'IC' reasons" event so that a hook can be implemented to react to it.
("IC reasons" as opposed to things like particle effects ending, admin deletion, etc.)
Because I only order embedding to occur before
Destructible
destruction, it's conceivable there's some case where something that'd embed in a body will gib it in the same interaction, and that'll have the same projectile-deleting effect. But, I figure that that's a markedly rarer case that's not worth adding a bunch of additionalbefore: [ ... ]
conditions for.I will leave it to the wisdom of the reviewers.
Media
unembed-all.mp4
Old revision media
LeReusableSpear.mp4
@YotaXP 's mouse-eating case:
eatmousedropsknife.mp4
Requirements
Breaking changes
None? Possibly something coming from the system ordering?
Added public method to
ProjectileSystemShared
to unembedEntity<EmbeddableProjectileComponent>
?Changelog
🆑