Skip to content

Commit

Permalink
Obfuscate the sound location
Browse files Browse the repository at this point in the history
  • Loading branch information
iceBear67 committed Oct 16, 2024
1 parent 02e8e9c commit f710d08
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/main/java/dev/tylerm/khs/game/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import dev.tylerm.khs.game.util.WinType;
import dev.tylerm.khs.util.Helper;
import org.bukkit.*;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
Expand Down Expand Up @@ -338,13 +339,12 @@ private void whilePlaying() {
break;
}
}
if (gameTick % 10 == 0 && gameTick / 10 < whenToHighlight * 20) {
if (gameTick % 10 == 0 && gameTimer < whenToHighlight ) {
for (Player seeker : board.getSeekers()) {
for (Entity nearbyEntity : seeker.getNearbyEntities(2, 2, 2)) {
for (Entity nearbyEntity : seeker.getNearbyEntities(8, 2, 8)) {
if (nearbyEntity instanceof Player player) {
if (board.isHider(player)) {
heartbeatSound.play(player.getLocation());
player.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 20, 1));
heartbeatSound.play(Helper.obfuscateLocation(player.getLocation()));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/dev/tylerm/khs/util/Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public class Helper {
public static Location obfuscateLocation(Location location) {
var rand = ThreadLocalRandom.current();
return location.clone().add(
rand.nextInt(0, 6) - 3,
rand.nextInt(0, 6) - 3,
rand.nextInt(0, 6) - 3
rand.nextInt(0, 16) - 8,
rand.nextInt(0, 16) - 8,
rand.nextInt(0, 16) - 8
);
}
}
2 changes: 1 addition & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spawnPatch: false
gameLength: 300

# The last seconds in the game we'll highlight hiders around seekers.
whenToHighlight: 10
whenToHighlight: 30

# How long will be added into the timer when a seeker is found
extendPerKill: 30
Expand Down

0 comments on commit f710d08

Please sign in to comment.