Skip to content

Commit

Permalink
DP | Music system test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nik0-0 committed Aug 30, 2024
1 parent 82cd2c3 commit 64d7bc5
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 4 deletions.
2 changes: 1 addition & 1 deletion nnb_main/data/nnb_main/functions/__load__.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ function nnb_main:c_sb {"sc_name":"nn_possesion"}
function nnb_main:c_sb {"sc_name":"nn_possesion_min"}
function nnb_main:c_sb {"sc_name":"nn_possesion_sec"}
function nnb_main:c_sb {"sc_name":"nn_possesion_msec"}
function nnb_main:c_sb {"sc_name":"nn_possesion"}
function nnb_main:c_sb {"sc_name":"nn_possession_effect"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
scoreboard players add tick nn_lobbymusic 1
execute if score tick nn_lobbymusic => max nn_lobbymusic run scoreboard players add track_number 1
scoreboard players set __found_case__ __variable__ 0
execute store result storage nnb_main:__storage__ switch_key int 1 run scoreboard players get track_number nn_lobbymusic
function nnb_main:__private__/switch_case/0/select with storage nnb_main:__storage__
execute unless score __found_case__ __variable__ matches 1 run function nnb_main:__private__/switch_case/0/default
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
scoreboard players set max nn_lobbymusic 2180
execute at @e[tag=lobby_music] run playsound vibecraft:bee_lobby master @a[distance=..1000.0] ~ ~ ~ 0.2 1
scoreboard players set __found_case__ __variable__ 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
scoreboard players set max nn_lobbymusic 3000
execute at @e[tag=lobby_music] run playsound vibecraft:delta_lobby master @a[distance=..1000.0] ~ ~ ~ 0.2 1
scoreboard players set __found_case__ __variable__ 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scoreboard players set track_number nn_lobbymusic 0
scoreboard players set max nn_lobbymusic 10
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$function nnb_main:__private__/switch_case/0/$(switch_key)
1 change: 1 addition & 0 deletions nnb_main/data/nnb_main/functions/lobby_music.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
execute if score phase nn_lobby matches 1 run function nnb_main:__private__/if_else/0
1 change: 1 addition & 0 deletions nnb_main/data/nnb_main/functions/root.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
function nnb_main:lobby_music
43 changes: 40 additions & 3 deletions nnb_main/main.jmc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Text.tellraw(@a, "Core Scripts Loaded");

function c_sb() { $scoreboard objectives add $(sc_name) dummy; }
// Create basic scoreboards

// Lobby related
Expand All @@ -12,7 +12,7 @@ c_sb(sc_name="nn_possesion");
c_sb(sc_name="nn_possesion_min");
c_sb(sc_name="nn_possesion_sec");
c_sb(sc_name="nn_possesion_msec");
c_sb(sc_name="nn_possession_effect);
c_sb(sc_name="nn_possession_effect");



Expand All @@ -27,7 +27,44 @@ root();

// Root function to create scoreboards if not created already
function root() {
//Manage music system
lobby_music();

}


function c_sb() { $scoreboard objectives add $(sc_name) dummy; }














// lobby music manager
function lobby_music() {

if (nn_lobby:phase = 1) {
scoreboard players add tick nn_lobbymusic 1;
if (nn_lobbymusic:tick => nn_lobbymusic:max) {scoreboard players add track_number 1;}

switch (nn_lobbymusic:track_number) {
case 1:
scoreboard players set max nn_lobbymusic 2180;
execute at @e[tag=lobby_music] run playsound vibecraft:bee_lobby master @a[distance=..1000.0] ~ ~ ~ 0.2 1;
case 2:
scoreboard players set max nn_lobbymusic 3000;
execute at @e[tag=lobby_music] run playsound vibecraft:delta_lobby master @a[distance=..1000.0] ~ ~ ~ 0.2 1;
default:
scoreboard players set track_number nn_lobbymusic 0;
scoreboard players set max nn_lobbymusic 10;
}

}
}

0 comments on commit 64d7bc5

Please sign in to comment.