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

small SpawnItemsOnUse cleanup #27625

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Resources/Prototypes/Entities/Objects/Fun/figurine_boxes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,5 @@
- id: ToyFigurineHamlet
prob: 0.20
orGroup: SpacemenFig
sound:
path: /Audio/Effects/unwrap.ogg
Copy link
Member

Choose a reason for hiding this comment

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

This should already be inherited from PresentBase. Is it not?

Copy link
Member Author

Choose a reason for hiding this comment

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

Doesn't the component get overwritten and the path reset to the default?

Copy link
Member

Choose a reason for hiding this comment

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

Component fields actually get merged with inheritance, so it should be fine.

The issue of wiping out parent data comes up when the field's data type is more complex and you try to change a value within it. Those don't get merged.

Like here, the sound field of SpawnItemsOnUse is a SoundSpecifier, which has a few data fields of its own, like the resource path and any audio parameters like volume or variance that should be applied. If you wanted to inherit from PresentBase but keep the same resource path and only change the volume, that wouldn't work - it would try to replace the entire SoundSpecifier as one field. The fields within the SoundSpecifier wouldn't get merged.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, I did not know that. Thanks for the explanation. Give me one moment, I will change it back.

5 changes: 2 additions & 3 deletions Resources/Prototypes/Entities/Objects/Misc/chopsticks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
- type: SpawnItemsOnUse
items:
- id: ChopSticks
sound:
path: /Audio/Effects/chopstickbreak.ogg
- type: Sprite
sprite: Objects/Misc/chopstick.rsi
state: paired
- type: EmitSoundOnUse
sound:
path: /Audio/Effects/chopstickbreak.ogg
Loading