Skip to content

Commit 89e7a3a

Browse files
committed
Reduce volume checks and print point gain
Reduced the amount of volume checks during the countdown at the start of a game. This commit also changes the chat messages that is displayed at the start of the game to show how many points there are to gain instead of the total point pool size.
1 parent bcdb954 commit 89e7a3a

File tree

6 files changed

+36
-17
lines changed

6 files changed

+36
-17
lines changed

data/stack_attack_arena/functions/round/starting.mcfunction

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
# called by stack_attack_arena:round/timer
55

66
# do a countdown
7-
execute if score @s sat_round_timer matches -3 run function stack_attack_arena:round/timer/3
8-
execute if score @s sat_round_timer matches -2 run function stack_attack_arena:round/timer/2
9-
execute if score @s sat_round_timer matches -1 run function stack_attack_arena:round/timer/1
7+
execute if score @s sat_round_timer matches -3 as @a[tag=sat_in_game,dx=14,dy=255,dz=14] run function stack_attack_arena:round/timer/3
8+
execute if score @s sat_round_timer matches -2 as @a[tag=sat_in_game,dx=14,dy=255,dz=14] run function stack_attack_arena:round/timer/2
9+
execute if score @s sat_round_timer matches -1 as @a[tag=sat_in_game,dx=14,dy=255,dz=14] run function stack_attack_arena:round/timer/1
1010

1111
# end countdown, also set arena state to 2 ("running")
1212
execute if score @s sat_round_timer matches 0 run function stack_attack_arena:round/timer/go

data/stack_attack_arena/functions/round/timer/1.mcfunction

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# called by stack_attack_arena:round/starting
55

66
# title
7-
title @a[tag=sat_in_game,dx=14,dy=255,dz=14] title ["",{"text":"1","color":"red"}]
7+
title @s title ["",{"text":"1","color":"red"}]
88

99
# sound
10-
execute as @a[tag=sat_in_game,dx=14,dy=255,dz=14] positioned ~6.5 ~2 ~6.5 run playsound minecraft:block.note_block.pling voice @s ~ ~ ~ 1 0.6
10+
execute as @s positioned ~6.5 ~2 ~6.5 run playsound minecraft:block.note_block.pling voice @s ~ ~ ~ 1 0.6

data/stack_attack_arena/functions/round/timer/2.mcfunction

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# called by stack_attack_arena:round/starting
55

66
# title
7-
title @a[tag=sat_in_game,dx=14,dy=255,dz=14] title ["",{"text":"2","color":"yellow"}]
7+
title @s title ["",{"text":"2","color":"yellow"}]
88

99
# sound
10-
execute as @a[tag=sat_in_game,dx=14,dy=255,dz=14] positioned ~6.5 ~2 ~6.5 run playsound minecraft:block.note_block.pling voice @s ~ ~ ~ 1 0.6
10+
execute as @s positioned ~6.5 ~2 ~6.5 run playsound minecraft:block.note_block.pling voice @s ~ ~ ~ 1 0.6

data/stack_attack_arena/functions/round/timer/3.mcfunction

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# called by stack_attack_arena:round/starting
55

66
# title
7-
title @a[tag=sat_in_game,dx=14,dy=255,dz=14] title ["",{"text":"3","color":"green"}]
7+
title @s title ["",{"text":"3","color":"green"}]
88

99
# sound
10-
execute as @a[tag=sat_in_game,dx=14,dy=255,dz=14] positioned ~6.5 ~2 ~6.5 run playsound minecraft:block.note_block.pling voice @s ~ ~ ~ 1 0.6
10+
execute as @s positioned ~6.5 ~2 ~6.5 run playsound minecraft:block.note_block.pling voice @s ~ ~ ~ 1 0.6
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Countdown
2+
# @s = players in arenas with sat_arena_state 1, sat_round_timer=0
3+
# at arenas with sat_arena_state 1, sat_round_timer=0
4+
# called by stack_attack_arena:round/timer/go
5+
say ran
6+
# title
7+
title @s title ["",{"text":"GO!","color":"blue"}]
8+
9+
# sound
10+
execute as @s positioned ~6.5 ~2 ~6.5 run playsound minecraft:block.note_block.pling voice @s ~ ~ ~ 1 1.2
11+
12+
# calculate points that might be gained by winning
13+
scoreboard players operation point_gain sat_match_value = match_value sat_match_value
14+
scoreboard players operation point_gain sat_match_value -= @s sat_match_value
15+
16+
# send private chat message
17+
execute if score point_gain sat_match_value matches 2.. run tellraw @s ["",{"text":"["},{"text":"S","color":"yellow"},{"text":"tack ","color":"light_purple"},{"text":"A","color":"blue"},{"text":"ttack","color":"green"},{"text":"] ","color":"none"},{"text":"Ready, Set, Stack! A win will gain you ","color":"green"},{"score":{"name":"point_gain","objective":"sat_match_value"}},{"text":" points!","color":"green"}]
18+
execute if score point_gain sat_match_value matches 1 run tellraw @s ["",{"text":"["},{"text":"S","color":"yellow"},{"text":"tack ","color":"light_purple"},{"text":"A","color":"blue"},{"text":"ttack","color":"green"},{"text":"] ","color":"none"},{"text":"Ready, Set, Stack! A win will gain you ","color":"green"},{"score":{"name":"point_gain","objective":"sat_match_value"}},{"text":" point!","color":"green"}]
19+
execute if score point_gain sat_match_value matches 0 run tellraw @s ["",{"text":"["},{"text":"S","color":"yellow"},{"text":"tack ","color":"light_purple"},{"text":"A","color":"blue"},{"text":"ttack","color":"green"},{"text":"] ","color":"none"},{"text":"Ready, Set, Stack! A win will ","color":"green"},{"text":"not ","color":"none"},{"text":"gain you any points. ","color":"green"}]

data/stack_attack_arena/functions/round/timer/go.mcfunction

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
# @s = arenas with sat_arena_state 1, sat_round_timer=0
33
# at @s
44
# called by stack_attack_arena:round/starting
5+
say go
6+
# calculate point gain potential for tellraw
7+
scoreboard players operation match_value sat_match_value = @s sat_match_value
58

6-
# title
7-
title @a[tag=sat_in_game,dx=14,dy=255,dz=14] title ["",{"text":"GO!","color":"blue"}]
9+
# show announcements
10+
execute as @a[tag=sat_in_game,dx=14,dy=255,dz=14] run function stack_attack_arena:round/timer/announcements
811

9-
# sound
10-
execute as @a[tag=sat_in_game,dx=14,dy=255,dz=14] positioned ~6.5 ~2 ~6.5 run playsound minecraft:block.note_block.pling voice @s ~ ~ ~ 1 1.2
11-
12-
# announce pot size to participating players
13-
execute if score @s sat_match_value matches 2.. run tellraw @a[tag=sat_in_game,dx=14,dy=255,dz=14] ["",{"text":"["},{"text":"S","color":"yellow"},{"text":"tack ","color":"light_purple"},{"text":"A","color":"blue"},{"text":"ttack","color":"green"},{"text":"] ","color":"none"},{"text":"Ready, Set, Stack! There are ","color":"green"},{"score":{"name":"@s","objective":"sat_match_value"}},{"text":" points in the pot!","color":"green"}]
14-
execute if score @s sat_match_value matches 1 run tellraw @a[tag=sat_in_game,dx=14,dy=255,dz=14] ["",{"text":"["},{"text":"S","color":"yellow"},{"text":"tack ","color":"light_purple"},{"text":"A","color":"blue"},{"text":"ttack","color":"green"},{"text":"] ","color":"none"},{"text":"Ready, Set, Stack! There is ","color":"green"},{"score":{"name":"@s","objective":"sat_match_value"}},{"text":" point in the pot!","color":"green"}]
12+
# reset fake players
13+
scoreboard players reset match_value sat_match_value
14+
scoreboard players reset point_gain sat_match_value
1515

1616
# update sat_arena_state
1717
scoreboard players set @s sat_arena_state 2

0 commit comments

Comments
 (0)