Skip to content

Commit

Permalink
do2.run.active is no longer a boolean. 0 = off, 1 = load, 2 = running.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frustrated-Programmer committed Jun 22, 2024
1 parent 754126e commit dc95805
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
execute unless entity @s[tag=do2.received_shulker] run return 0
execute if score $dungeon do2.run.active matches 1 run return 0
execute if score $dungeon do2.run.active matches 1.. run return 0


data merge block -557 113 1987 {Items:[]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ execute as @a[scores={do2.logs.spam=2..}] run tellraw @s ["",{"text":"[§9B§r]:

# Lock/Unlock Settings room
execute if score $dungeon do2.run.active matches 0 run function do2:scoreboard/config/config_unlock
execute if score $dungeon do2.run.active matches 1 run function do2:scoreboard/config/config_lock
execute if score $dungeon do2.run.active matches 1.. run function do2:scoreboard/config/config_lock

# Check if anything needs to be updated due to Level Controller changes.
# TODO: also update mob names, and amount.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ execute as @a[team=do2.players, scores={do2.run.has_died=1}] run function do2:ev
execute as @e[type=player,scores={do2.utility.deathCount=1..}] run function do2:events/on_player_respawned

# if all players running do2 dead, end game.
execute if score $dungeon do2.run.active matches 1 if score $dungeon do2.run.player_deaths = $dungeon do2.run.players run function do2:events/on_game_end
execute if score $dungeon do2.run.active matches 2 if score $dungeon do2.run.player_deaths = $dungeon do2.run.players run function do2:events/on_game_end

# if no players running do2 but game active for 5 minutes, end game.
execute if score $dungeon do2.run.active matches 1 if score $dungeon do2.run.timeWithNoPlayers matches 300 run function do2:events/on_game_end
execute if score $dungeon do2.run.active matches 2 if score $dungeon do2.run.timeWithNoPlayers matches 300 run function do2:events/on_game_end

# Tango mentioned this and I think we removed it on accident.
# Remove glowing effect from Evokers.
execute if score $dungeon do2.run.active matches 1 as @e[type=minecraft:evoker] if entity @s[nbt={ActiveEffects:[{Id:24}]}] run effect clear @s minecraft:glowing
execute if score $dungeon do2.run.active matches 2 as @e[type=minecraft:evoker] if entity @s[nbt={ActiveEffects:[{Id:24}]}] run effect clear @s minecraft:glowing
# Remove glowing effect from Witches.
execute if score $dungeon do2.run.active matches 1 as @e[type=minecraft:witch] if entity @s[nbt={ActiveEffects:[{Id:24}]}] run effect clear @s minecraft:glowing
execute if score $dungeon do2.run.active matches 2 as @e[type=minecraft:witch] if entity @s[nbt={ActiveEffects:[{Id:24}]}] run effect clear @s minecraft:glowing

# Have vex track players better
execute if score $dungeon do2.config.vexTracking matches 1 run function do2:force_vex_tracking
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# - Start Log -
# Detect which method game ended.
execute as @a[scores={do2.logs.gamestate=1..}] if score $dungeon do2.run.active matches 1 if score $dungeon do2.run.player_deaths = $dungeon do2.run.players run tellraw @s ["",{"text":"§f[§9B§r]: Game Ended. ("},{"text":" ? ","color":"dark_red","hoverEvent":{"action":"show_text","contents":["",{"text":"§rAll "},{"score":{"name":"$dungeon","objective":"do2.run.players"},"color":"aqua"},{"text":" players have died at least once."}]}},{"text":")"}]
execute as @a[scores={do2.logs.gamestate=1..}] if score $dungeon do2.run.active matches 1 if score $dungeon do2.run.timeWithNoPlayers matches 300 run tellraw @s ["",{"text":"§f[§9B§r]: Game Ended. ("},{"text":" ? ","color":"dark_red","hoverEvent":{"action":"show_text","contents":["",{"text":"§rGame has been inactive for too long. §7do.run.empty §rmatches "},{"score":{"name":"$dungeon","objective":"do2.run.timeWithNoPlayers "},"color":"aqua"}]}},{"text":")"}]
execute as @a[scores={do2.logs.gamestate=1..}] if score $dungeon do2.run.active matches 2 if score $dungeon do2.run.player_deaths = $dungeon do2.run.players run tellraw @s ["",{"text":"§f[§9B§r]: Game Ended. ("},{"text":" ? ","color":"dark_red","hoverEvent":{"action":"show_text","contents":["",{"text":"§rAll "},{"score":{"name":"$dungeon","objective":"do2.run.players"},"color":"aqua"},{"text":" players have died at least once."}]}},{"text":")"}]
execute as @a[scores={do2.logs.gamestate=1..}] if score $dungeon do2.run.active matches 2 if score $dungeon do2.run.timeWithNoPlayers matches 300 run tellraw @s ["",{"text":"§f[§9B§r]: Game Ended. ("},{"text":" ? ","color":"dark_red","hoverEvent":{"action":"show_text","contents":["",{"text":"§rGame has been inactive for too long. §7do.run.empty §rmatches "},{"score":{"name":"$dungeon","objective":"do2.run.timeWithNoPlayers "},"color":"aqua"}]}},{"text":")"}]
# - End Log -

# called when no players are RUNNING the dungeon's instance. (all dead, all left)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function do2:scoreboard/dungeon_per_run
scoreboard players set @a[team=do2.players] do2.utility.shouldForceFood 0
scoreboard players add @a[team=do2.players] do2.runs 1
scoreboard players add $dungeon do2.runs 1
scoreboard players set $dungeon do2.run.active 2

#revoke all utility advancements. These are used for additional conditions
advancement revoke @a from do2:utility/root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ advancement revoke @s from do2:visible/cards/cards_root
advancement revoke @s from do2:visible/survival/survival_root
advancement revoke @s from do2:visible/adventuring/adventuring_root

execute if score $dungeon do2.run.active matches 1 unless entity @s[tag=do2.running] run function do2:scoreboard/spectator_per_run
execute if score $dungeon do2.run.active matches 1 unless entity @s[tag=do2.running] run tag @s remove do2.received_shulker
execute if score $dungeon do2.run.active matches 1.. unless entity @s[tag=do2.running] run function do2:scoreboard/spectator_per_run
execute if score $dungeon do2.run.active matches 1.. unless entity @s[tag=do2.running] run tag @s remove do2.received_shulker
function do2:scoreboard/triggers/on_player_join

function do2:voice_chat/check
execute if score @s do2.utility.voiceChat matches 0 run tag @s add do2.tags.audio.enabled
execute unless score @s do2.utility.voiceChat matches 0 run tag @s remove do2.tags.audio.enabled

# If player is in the settings room while game is active, lock the settings room. Ensure player gets TP'ed out
execute if score $dungeon do2.run.active matches 1 run function do2:scoreboard/config/config_lock
execute if score $dungeon do2.run.active matches 1.. run function do2:scoreboard/config/config_lock

# If player is at LOBBY worldspawn when joining, Teleport them rotated properly
execute positioned -547 113 1980 if entity @s[distance=..5] at @s run tp @s ~ ~ ~ 90 0
Expand All @@ -33,4 +33,4 @@ execute positioned -547 113 1980 if entity @s[distance=..5] at @s run tp @s ~ ~
execute positioned -524 103 2167 if entity @s[distance=..10] at @s run tp @s ~ ~ ~ 180 -20

# If game hasn't started. Swap the difficulty, to the user's last used difficulty.
execute unless score $dungeon do2.run.active matches 1 as @p[tag=do2.received_shulker] run function do2:dungeon_setup/preset_difficulty
execute unless score $dungeon do2.run.active matches 1.. as @p[tag=do2.received_shulker] run function do2:dungeon_setup/preset_difficulty
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ execute if score $dungeon do2.utility.currentTick matches 10000000.. run scorebo
execute as @a if score @s do2.utility.advancementOrdering matches 0 run function do2:advancements/grant_visible/all

# track ticks/seconds in the dungeon. Also handles if dungeon is empty.
execute if score $dungeon do2.run.active matches 1 run function do2:dungeon_timer
execute if score $dungeon do2.run.active matches 2 run function do2:dungeon_timer


# For every UNTRACKED item, (item entities not tagged)
Expand Down
4 changes: 2 additions & 2 deletions Brilliance Datapack/data/do2/functions/version.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

# DATAPACK VERSION NUMBER: 0.12.0
# DATAPACK VERSION NUMBER: 0.12.1

tellraw @s ["",{"text":"The §o§n§aBrilliance Datapack§r's version is: [§b0.12.0§r] Check latest version "},{"text":"§o§b§nhere§r","clickEvent":{"action":"open_url","value":"https://github.com/trackedout/Brilliance/blob/main/Brilliance%20Datapack/data/do2/functions/version.mcfunction"}},{"text":"."}]
tellraw @s ["",{"text":"The §o§n§aBrilliance Datapack§r's version is: [§b0.12.1§r] Check latest version "},{"text":"§o§b§nhere§r","clickEvent":{"action":"open_url","value":"https://github.com/trackedout/Brilliance/blob/main/Brilliance%20Datapack/data/do2/functions/version.mcfunction"}},{"text":"."}]

0 comments on commit dc95805

Please sign in to comment.