-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework respawn timer and spectator handling
- Loading branch information
Showing
8 changed files
with
44 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Runs once every second after game start. | ||
# respawn timer | ||
scoreboard players set @a[scores={deathsInternal=1..,health=1..},gamemode=survival] respawnTimer 600 | ||
gamemode adventure @a[scores={deathsInternal=1..,health=1..},gamemode=survival] | ||
scoreboard players set @a[gamemode=adventure] deathsInternal 0 | ||
scoreboard players remove @a[gamemode=adventure] respawnTimer 1 | ||
tellraw @a[scores={respawnTimer=599}] {"text":"","extra":[{"text":"[USC] If you died because of a player or while in the End, you're out of the game. In that case, click ","color":"gray"},{"text":"here","underlined":true,"clickEvent":{"action":"run_command","value":"/trigger spectate set 1"}},{"text":" to spectate.","color":"gray"}]} | ||
tellraw @a[scores={respawnTimer=540}] {"text":"","extra":[{"text":"[USC] Some suggestions while you're waiting:\n• Take a bathroom break\n• Grab some snacks\n• Remember to stay hydrated\n• Strategize\n• Hold ","color":"gray"},{"keybind":"key.playerlist","color":"gray"},{"text":" to watch players' health","color":"gray"}]} | ||
gamemode survival @a[scores={respawnTimer=0}] | ||
execute if entity @a[scores={respawnTimer=0}] run say @a[scores={respawnTimer=0}] respawned! | ||
scoreboard players reset @a[gamemode=spectator] respawnTimer | ||
scoreboard players reset @a[gamemode=survival] respawnTimer | ||
# update respawn radius to stay inside the world border | ||
execute if score gameTimer variables matches 0..23999 run spreadplayers 0 0 400 1300 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 24000..47999 run spreadplayers 0 0 350 1150 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 48000..71999 run spreadplayers 0 0 300 1000 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 72000..95999 run spreadplayers 0 0 250 850 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 96000..119999 run spreadplayers 0 0 200 700 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 120000..143999 run spreadplayers 0 0 150 550 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 144000..167999 run spreadplayers 0 0 100 400 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 168000..191999 run spreadplayers 0 0 50 250 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 192000..215999 run spreadplayers 0 0 25 150 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 216000.. run spreadplayers 0 0 10 100 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
# Runs every tick. | ||
# update respawn radius to stay inside the world border | ||
execute if score gameTimer variables matches 0..23999 run spreadplayers 0 0 150 1300 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 24000..47999 run spreadplayers 0 0 150 1150 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 48000..71999 run spreadplayers 0 0 150 1000 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 72000..95999 run spreadplayers 0 0 150 850 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 96000..119999 run spreadplayers 0 0 150 700 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 120000..143999 run spreadplayers 0 0 150 550 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 144000..167999 run spreadplayers 0 0 150 400 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 168000..191999 run spreadplayers 0 0 150 250 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 192000..215999 run spreadplayers 0 0 150 150 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
execute if score gameTimer variables matches 216000.. run spreadplayers 0 0 150 100 true @a[gamemode=survival,x=-17,dx=34,y=1,dy=34,z=-17,dz=34] | ||
# increment game timers and run second.mcfunction | ||
execute if score started variables matches 1 run scoreboard players add gameTimer variables 1 | ||
execute if score started variables matches 1 run scoreboard players add gameTimerModSec variables 1 | ||
execute if score gameTimerModSec matches 20 run function usc:second | ||
execute if score gameTimerModSec matches 20 run scoreboard players set gameTimerModSec variables 0 | ||
# handle spectators | ||
scoreboard players enable @a[gamemode=adventure] spectate | ||
scoreboard players enable @a[gamemode=survival] spectate | ||
tellraw @a[scores={spectate=1..}] {"text":"","extra":[{"text":"[USC] Please mute yourself, or leave your team call, or leave the game.","color":"gray"}]} | ||
gamemode spectator @a[scores={spectate=1..}] | ||
scoreboard players set @a[gamemode=spectator] spectate 0 | ||
#TODO remove isSpectating objective and replace with gamemode checks | ||
scoreboard players set @a[gamemode=spectator] isSpectating 1 | ||
scoreboard players set @a[gamemode=!spectator] isSpectating 0 |
Binary file not shown.
Binary file not shown.
Binary file not shown.