Skip to content

Commit

Permalink
Fix example (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeshus authored Jun 6, 2024
1 parent 5d08e2b commit 4b5a2cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/en/ss14-by-example/adding-a-simple-bikehorn.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ Also, we've added `[Dependency] private readonly SharedAudioSystem` to class. It
```csharp
private void OnUseInHand(Entity<PlaySoundOnUseComponent> ent, ref UseInHandEvent args)
{
_audio.PlayPvs(ent.Comp.Sound, uid);
_audio.PlayPvs(ent.Comp.Sound, ent.Owner);
}
```

Expand All @@ -305,7 +305,7 @@ In this case, we just pass it our `sound` field on our `PlaySoundOnUseComponent`

2. The source entity

This is an optional argument that is used for positional audio. In our case, we want the sound to come from the horn, so we pass in the horn's Uid. If this arugment is not given, the sound is played globally and will be audible to all players.
This is an optional argument that is used for positional audio. In our case, we want the sound to come from the horn, so we pass in the horn's Uid (which is the `Owner` property of the entity). If this arugment is not given, the sound is played globally and will be audible to all players.

If you compile the game and spawn our bike horn using the **F5** Entity Spawn Menu, you can try activating it in hand and--incredible! It plays the sound properly! Hopefully! If not, you might have messed something up in the YAML, or missed a method in the EntitySystem.

Expand Down

0 comments on commit 4b5a2cd

Please sign in to comment.