Skip to content

Commit

Permalink
Minor updates to adding-a-simple-bikehorn.md (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxpiepenbrink authored Nov 4, 2024
1 parent 6de7851 commit d5b2bc9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/en/ss14-by-example/adding-a-simple-bikehorn.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Those helpers can be thought of as handling **client click -> server** and **ser
In the Space Station 14 codebase, Components & EntitySystems alike (along with other classes) go inside folders directly under the `Content.Server`, `Content.Shared`, or `Content.Client` projects. There are folders for `Atmos`, `Botany`, `Research`, `Storage`, and a lot more. If a suitable folder doesn't exist, create one! Never put files directly into the top directory of the project.
```

Under the `Content.Server` project, there's a folder called `Sound`. That seems like a good place to put our new component (and in fact, this is where the real EmitSoundOnUse is located). Let's call our version `PlaySoundOnUseComponent`. Note: if you just copy paste this code in, it may not work, as you'll need to import various classes. Your IDE can do this for you.
Under the `Content.Server` project, there's a folder called `Sound`. This folder contains an aptly named `Components` folder. That seems like a good place to put our new component (and in fact, this is where the real `EmitSoundOnTriggerComponent` is located). Let's call our version `PlaySoundOnUseComponent`. Note: if you just copy paste this code in, it may not work, as you'll need to import various classes. Your IDE can do this for you.

Now let's just make the most basic component possible:

Expand All @@ -166,6 +166,10 @@ In our prototype above, you might recall that we added `Sprite`, not `SpriteComp

Now, let's go ahead and add PlaySoundOnUse to our prototype.

```admonish info
You must remove the `Component` part of the class suffix when using them in the prototype yaml. So `PlaySoundOnUseComponent` would be resolved as `PlaySoundOnUse` in the `components:` list in the yaml definition.
```

```yaml
- type: entity
name: clown horn
Expand Down

0 comments on commit d5b2bc9

Please sign in to comment.