Skip to content

Commit

Permalink
Add sound effect to balloon when popped
Browse files Browse the repository at this point in the history
  • Loading branch information
AntumDeluge committed May 10, 2024
1 parent 8e8754e commit 5744a0f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 3 deletions.
Binary file added data/sounds/balloon/pop.ogg
Binary file not shown.
Binary file added data/sounds/lossless_sources/balloon/pop.flac
Binary file not shown.
1 change: 1 addition & 0 deletions doc/contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,7 @@ The following people released their work to the public with a suitable license f
* [Hawkeye_Sprout](https://freesound.org/people/Hawkeye_Sprout/)
* [YuriNikolai](https://opengameart.org/users/yurinikolai)
* [Inchadney](http://inchadney.com/sounds.html)
* [Gniffelbaf](https://freesound.org/people/Gniffelbaf/)
<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
4 changes: 4 additions & 0 deletions doc/contributors/contributors.json
Original file line number Diff line number Diff line change
Expand Up @@ -4763,6 +4763,10 @@
"name": "Inchadney",
"link": "http://inchadney.com/sounds.html",
"link_alt": "https://freesound.org/people/inchadney/"
},
{
"name": "Gniffelbaf",
"link": "https://freesound.org/people/Gniffelbaf/"
}
]
}
1 change: 1 addition & 0 deletions doc/sources/audio-sfx.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

data/sounds/

balloon/pop Gniffelbaf; CC0; https://opengameart.org/node/132360, https://freesound.org/s/82119/
alligator-1.ogg U.S. Fish and Wildlife Service; public domain; https://fws.gov/video/sound.htm
arrow-hit-1.ogg Storyteller; GPL
attack-fire-1.* Nic3_one; CC0; https://freesound.org/people/Nic3_one/sounds/166555/
Expand Down
19 changes: 16 additions & 3 deletions src/games/stendhal/server/entity/item/scroll/BalloonScroll.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
import java.util.Map;

import games.stendhal.common.NotificationType;
import games.stendhal.common.constants.SoundLayer;
import games.stendhal.server.core.events.DelayedPlayerTextSender;
import games.stendhal.server.entity.player.Player;
import games.stendhal.server.events.SoundEvent;
import games.stendhal.server.maps.kikareukin.islands.Gatekeeper;
import games.stendhal.server.maps.kikareukin.islands.Gatekeeper.RequestState;
import games.stendhal.server.util.TimeUtil;
Expand Down Expand Up @@ -79,9 +81,7 @@ protected boolean useTeleportScroll(final Player player) {

final RequestState requestState = Gatekeeper.requestEntrance(player);
if (RequestState.DENIED.equals(requestState)) {
// balloon is used if player was punished
removeOne();
player.sendPrivateText(NotificationType.NEGATIVE, "Your balloon popped.");
onPopped(player);
return false;
} else if (RequestState.PUNISH_QUEUED.equals(requestState)) {
// player tried to use balloon again immediately after being denied
Expand All @@ -108,4 +108,17 @@ protected boolean useTeleportScroll(final Player player) {

return super.useTeleportScroll(player);
}

/**
* Events when a balloon "pops".
*
* @param player
* Player using balloon.
*/
private void onPopped(final Player player) {
player.addEvent(new SoundEvent("balloon/pop", SoundLayer.FIGHTING_NOISE));
// balloon is used
removeOne();
player.sendPrivateText(NotificationType.NEGATIVE, "Your balloon popped.");
}
}

0 comments on commit 5744a0f

Please sign in to comment.