Skip to content

Commit

Permalink
Large update to the level controller. Still WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Frustrated-Programmer committed Dec 2, 2024
1 parent 03fa662 commit 02010e0
Show file tree
Hide file tree
Showing 29 changed files with 364 additions and 138 deletions.
8 changes: 2 additions & 6 deletions Brilliance Datapack/TODO.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Other TODO:
- Barrels with items in it, drop their items when level controller swaps around.
- Limit mobs per level to 30 for level controller.
- Add Level 3, Level 4 & Backrooms to level controller mob control.
- Config Info "booklet" needs to be updated with the new force saturation level
- Go into more detail on the Fresh Runs & Balance Changes in the config book.
Expand All @@ -10,16 +10,12 @@
- Track embers DROPPED in dungeon
- Track embers ATTEMPTED to be RELEASED.
- Track treasure DROPPED in dungeon
- Track treasure ATTEMPTED to be RELEASED._
- Track treasure ATTEMPTED to be RELEASED.
- Fresh runs, reset_stat_containers contains a link to the document. Should the doc be moved to a more permanent location OR as a PDF on tracked out's website URL needs to be adjusted.
- Finish the level interface book.
- Need Mob Amount & Names implemented.
- Fish markers have same issue as ravager markers, can be duplicated as it takes several ticks to summon markers so it can attempt to summon 99 of them for multiple ticks letting them stack up.
- Have dropper config book have LINKS to each of the dropper categories.
- Debate adding either `tracked:0b` or `tracked:1b` to egg rewards.
- `tracked:0b` counts the crowns as floor crowns. Makes it easier to find out total crowns this run.
- `tracked:1b` counts the crowns as already tracked crowns.
- **_Currently_**: is `tracked:1b` just so the crowns aren't broken until we discuss this.
- DM each person on the list of players in the credits tab ask them for a short description/saying/quote for their advancement.
- Check credit list to add ALL players to the credits tab.
- Move all HERMITCRAFT items from resourcepack/assets/do2 to resourcepack/assets/hermitcraft
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# - Make sure we don't have duplicates -
kill @e[type=ravager]

schedule function do2:dungeon_setup/summon/summon_ravagers 3t
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ execute if score $dungeon do2.run.active matches 1.. run function do2:scoreboard

# Check if anything needs to be updated due to Level Controller changes.
# TODO: also update mob names, and amount.
execute if score $dungeon do2.run.active matches 0 run function do2:dungeon_setup/test_for_ravagers
execute if score $dungeon do2.run.active matches 0 run function do2:dungeon_setup/test_for_wardens
execute if score $dungeon do2.run.active matches 0 run function do2:dungeon_setup/test_for_other_killers
# TODO: update these tests, after level controller is fixed.
#execute if score $dungeon do2.run.active matches 0 run function do2:dungeon_setup/test_for_ravagers
#execute if score $dungeon do2.run.active matches 0 run function do2:dungeon_setup/test_for_wardens
#execute if score $dungeon do2.run.active matches 0 run function do2:dungeon_setup/test_for_other_killers
execute if score $dungeon do2.run.active matches 0 run function do2:dungeon_setup/test_for_markers

# Count players on the server.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# TODO: Currently only counts ravagers in their ZONE, not across the entire level. Need to fix, and exclude special mobs in the count.
# Count Ravagers
scoreboard objectives add do2.tests.amountOfRavagers dummy
execute store result score $dungeon do2.tests.amountOfRavagers run data get storage do2:mobs mobNames

# Humans count from 1, computers count from 0. Add a fix.
scoreboard players add $dungeon do2.tests.amountOfRavagers 1

# Summon a text_display entity, to convert data into raw text, to store the raw text as a mob name.
summon minecraft:text_display -508 123 1956 {Tags:["ConvertToTextHelper"],text:'[{"text":"Ravager: #"},{"score":{"name":"$dungeon","objective":"do2.tests.amountOfRavagers"}}]'}
data modify storage do2:mobs mobNames append from entity @e[type=minecraft:text_display,tag=ConvertToTextHelper,limit=1] text
scoreboard players add $dungeon do2.utility.mobNamesCount 1

# Cleanup
kill @e[type=minecraft:text_display,tag=ConvertToTextHelper]
scoreboard objectives remove do2.tests.amountOfRavagers
scoreboard players remove $dungeon do2.tests.amountOfRavagers 1

# If there STILL isn't enough mobNames for the amount of names needed, loop this function.
execute if score $dungeon do2.utility.mobNamesCount < $l1z1 do2.config.mc.levelZoneMobCount run function do2:level_controller/add_mob_names/add_numbered_ravager_name
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# If there are no MORE preset names left, add an ID'ed numbered name.
execute unless data storage do2:mobs preset_names[0] run function do2:level_controller/add_mob_names/add_numbered_ravager_name
execute unless data storage do2:mobs preset_names[0] run return 0

# Generate a random number, Min = 0, Max = Amount of names in the list
execute store result score $dungeon do2.utility.randomNumberRange run data get storage do2:mobs preset_names
function do2:random_gen/generate_random_number
# Remove names until do2:tests array[0] becomes the randomly chosen name.
scoreboard objectives add do2.tests.arrayIndex dummy
scoreboard players operation $dungeon do2.tests.arrayIndex = $dungeon do2.utility.randomNum
data modify storage do2:tests array set from storage do2:mobs preset_names
function do2:level_controller/array_manipulation/get_from_index

# add name to the list
data modify storage do2:mobs mobNames append from storage do2:tests array[0]
scoreboard players add $dungeon do2.utility.mobNamesCount 1


# Remove the name as a valid name for future generation this time.
data modify storage do2:tests array set from storage do2:mobs preset_names
data modify storage do2:tests newArray set value []
scoreboard players operation $dungeon do2.tests.arrayIndex = $dungeon do2.utility.randomNum
function do2:level_controller/array_manipulation/splice_from_index
data modify storage do2:mobs preset_names set from storage do2:tests newArray


# If there STILL isn't enough mobNames for the amount of names needed, loop this function.
execute if score $dungeon do2.utility.mobNamesCount < $l1z1 do2.config.mc.levelZoneMobCount run function do2:level_controller/add_mob_names/add_ravager_name_to_list
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
data modify storage do2:mobs preset_names set value ['{"text":"Lasagna"}','{"text":"Laser Beams!"}','{"text":"Meatball"}','{"text":"Snausages"}','{"text":"Greed"}','{"text":"MrsTango"}','{"text":"Beast #002"}','{"text":"Skill Issue"}','{"text":"Nugget"}','{"text":"Taco"}','{"text":"Hugs and Kisses"}','{"text":"Bad Luck. No really...it was bad luck"}','{"text":"Beast #007"}','{"text":"Pumpkin"}','{"text":"Poor Life Choices"}','{"text":"Jellie"}','{"text":"Hot Breath"}','{"text":"Tango\\\'s Cough"}','{"text":"Beast #003"}','{"text":"Unknown Ravager"}','{"text":"Stumbles"}','{"text":"Shracker"}','{"text":"Beast #004"}','{"text":"Froomkins"}','{"text":"big butts and I cannot lie"}','{"text":"Commander Drool"}','{"text":"Jimmy Jingles"}','{"text":"Deadly Blueberries"}','{"text":"Tinkers"}','{"text":"Flubsy Skadeedles"}','{"text":"Waffles"}','{"text":"Ladders"}','{"text":"Doughnuts"}','{"text":"Wubsy"}','{"text":"Munchies"}','{"text":"Miss Management"}','{"text":"Beast #025"}','{"text":"Sir Fluffykins of the Dungeon"}','{"text":"Skadoodles"}','{"text":"Beast #029"}','{"text":"Dunga Dunga Dunga"}','{"text":"Captain Snoodle Pants"}','{"text":"Mr. Poopy Head"}','{"text":"Trolly McTrollface"}']
function do2:level_controller/add_mob_names/add_ravager_name_to_list
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# $dungeon do2.tests.arrayIndex = TARGET INDEX
# do2:tests array = FULL ARRAY
# after running do2:tests array[0] = TARGET VALUE


# CHECK INDEX 0 EXISTS
execute unless data storage do2:tests array[0] run return 0

# REMOVING BEFORE INDEX
execute if score $dungeon do2.tests.arrayIndex matches 1.. run data remove storage do2:tests array[0]
execute if score $dungeon do2.tests.arrayIndex matches 1.. run scoreboard players remove $dungeon do2.tests.arrayIndex 1
# REMOVING AFTER INDEX
execute if score $dungeon do2.tests.arrayIndex matches ..0 if data storage do2:tests array[1] run data remove storage do2:tests array[1]

# CHECK IF REPEAT
execute if score $dungeon do2.tests.arrayIndex matches ..0 if data storage do2:tests array[1] run function do2:level_controller/array_manipulation/get_from_index
execute if score $dungeon do2.tests.arrayIndex matches 1.. run function do2:level_controller/array_manipulation/get_from_index
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# do2:tests array = FULL ARRAY
# do2:tests newArray = NEW ARRAY
# $dungeon do2.tests.arrayIndex = TARGET INDEX
# After completion, newArray will equal array minus the value at TARGET INDEX



# ---- Have we reached the spliced index?

# --- FALSE:
# copy array[0] into newArray
execute if score $dungeon do2.tests.arrayIndex matches 1.. run data modify storage do2:tests newArray append from storage do2:tests array[0]
# remove array[0]
execute if score $dungeon do2.tests.arrayIndex matches 1.. run data remove storage do2:tests array[0]
execute if score $dungeon do2.tests.arrayIndex matches 1.. run scoreboard players remove $dungeon do2.tests.arrayIndex 1
execute if score $dungeon do2.tests.arrayIndex matches 1.. run function do2:level_controller/array_manipulation/splice_from_index

# --- TRUE:
# remove array[0]
execute if score $dungeon do2.tests.arrayIndex matches ..0 run data remove storage do2:tests array[0]
# append rest of array into newArray
execute if score $dungeon do2.tests.arrayIndex matches ..0 run function do2:level_controller/array_manipulation/splice_from_index_helper
# exit loop
execute if score $dungeon do2.tests.arrayIndex matches ..0 run return 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# append rest of array into newArray
execute unless data storage do2:tests array[0] run return 0
data modify storage do2:tests newArray append from storage do2:tests array[0]
data remove storage do2:tests array[0]
function do2:level_controller/array_manipulation/splice_from_index_helper
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
# Setup
function do2:level_controller/clone_storages
function do2:level_controller/get_mob_count/count_mobs
function do2:level_controller/get_mob_names/get_mob_names



# L1
kill @e[type=ravager,tag=L1Z1]
kill @e[type=ravager,tag=L1Z2]
kill @e[type=ravager,tag=L1Z3]
kill @e[type=ravager,tag=L1Z4]
kill @e[type=ravager,tag=L1Z5]

function do2:level_controller/generate_mobs/l1z1
function do2:level_controller/generate_mobs/l1z2
function do2:level_controller/generate_mobs/l1z3
execute if score $dungeon do2.config.mc.level1Zones matches 0 run function do2:level_controller/generate_mobs/l1z4
execute if score $dungeon do2.config.mc.level1Zones matches 0 run function do2:level_controller/generate_mobs/l1z5


# L2
kill @e[type=ravager,tag=L2Z1]
kill @e[type=ravager,tag=L2Z2]
kill @e[type=ravager,tag=L2Z3]
kill @e[type=ravager,tag=L2Z4]
kill @e[type=ravager,tag=L2Z5]

function do2:level_controller/generate_mobs/l2z1
function do2:level_controller/generate_mobs/l2z2
function do2:level_controller/generate_mobs/l2z3
execute if score $dungeon do2.config.mc.level2Zones matches 0 run function do2:level_controller/generate_mobs/l2z4
execute if score $dungeon do2.config.mc.level2Zones matches 0 run function do2:level_controller/generate_mobs/l2z5

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

# If no more mobs need to be made, return
execute if score $dungeon do2.utility.mobGeneration matches ..0 run return 0

# Summon a ravager
summon minecraft:ravager -500 70 2000 {PersistenceRequired:1b, Invulnerable: 1b, Tags: ["newly_generated_mob","mob_being_worked_on"], Health: 100f, CustomName: '{"text":"NAME-NOT-INCLUDED"}', Fire: -1s}

# Count how many names are in the list.
execute store result score $dungeon do2.utility.mobNamesCount run data get storage do2:mobs mobNames
# Generate a random number, Min = 0, Max = Amount of names in the list
scoreboard players operation $dungeon do2.utility.randomNumberRange = $dungeon do2.utility.mobNamesCount
function do2:random_gen/generate_random_number

# Remove names until do2:tests array[0] becomes the randomly chosen name.
scoreboard objectives add do2.tests.arrayIndex dummy
scoreboard players operation $dungeon do2.tests.arrayIndex = $dungeon do2.utility.randomNum
data modify storage do2:tests array set from storage do2:mobs mobNames
function do2:level_controller/array_manipulation/get_from_index
# Merge the randomly chosen name INTO the mob
data modify entity @e[tag=mob_being_worked_on,limit=1] CustomName set from storage do2:tests array[0]

# Remove the name as a valid name for future generation this time.
data modify storage do2:tests array set from storage do2:mobs mobNames
data modify storage do2:tests newArray set value []
scoreboard players operation $dungeon do2.tests.arrayIndex = $dungeon do2.utility.randomNum
function do2:level_controller/array_manipulation/splice_from_index
data modify storage do2:mobs mobNames set from storage do2:tests newArray

# Note a mob has been generated
tag @e[tag=mob_being_worked_on] remove mob_being_worked_on
scoreboard players remove $dungeon do2.utility.mobGeneration 1

# delete testing items
execute if score $dungeon do2.tests.arrayIndex matches ..0 run data remove storage do2:tests array
execute if score $dungeon do2.tests.arrayIndex matches ..0 run data remove storage do2:tests newArray
scoreboard objectives remove do2.tests.arrayIndex

# If more mobs need to be summoned, run this function again
execute if score $dungeon do2.utility.mobGeneration matches 1.. run function do2:level_controller/generate_mobs/generate_enough_ravagers

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Check for issues
execute if score $l1z1 do2.config.mc.levelZoneMobCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L1Z1's mob count is empty. No mobs will generate in this zone."}]
execute store result score $dungeon do2.utility.mobNamesCount run data get storage do2:mobs level1_zone1
execute if score $dungeon do2.utility.mobNamesCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L1Z1's mob names are empty. Mob's names will be empty."}]
execute if score $dungeon do2.utility.mobNamesCount matches 0 run data modify storage do2:mobs level1_zone1 set value ['{"text":""}']


# Setup
execute store result score $dungeon do2.utility.mobNamesCount run data get storage do2:mobs level1_zone1
scoreboard players operation $dungeon do2.utility.mobGeneration = $l1z1 do2.config.mc.levelZoneMobCount
data modify storage do2:mobs mobNames set from storage do2:mobs level1_zone1

function do2:level_controller/generate_mobs/generate_a_ravager
# - Check for issues -
# Check for mob AMOUNT count
execute if score $l1z1 do2.config.mc.levelZoneMobCount matches ..0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L1Z1's mob count is empty. No mobs will generate in this zone."}]
execute if score $l1z1 do2.config.mc.levelZoneMobCount matches ..0 run scoreboard players set $l1z1 do2.config.mc.levelZoneMobCount 0
# Check for sufficient mob NAMES
execute if score $dungeon do2.utility.mobNamesCount < $l1z1 do2.config.mc.levelZoneMobCount as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: Not enough L1Z1's mob names for L1Z1's mob count. Adding random names to fix."}]
execute if score $dungeon do2.utility.mobNamesCount < $l1z1 do2.config.mc.levelZoneMobCount run function do2:level_controller/add_mob_names/ravager_names

# Generate enough ravagers.
function do2:level_controller/generate_mobs/generate_enough_ravagers

# Finish
execute as @e[tag=newly_generated_mob] run tp @s @e[type=marker,tag=L1Z1,limit=1,sort=random]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# Check for issues
execute if score $l1z2 do2.config.mc.levelZoneMobCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L1Z2's mob count is empty. No mobs will generate in this zone."}]
execute store result score $dungeon do2.utility.mobNamesCount run data get storage do2:mobs level1_zone2
execute if score $dungeon do2.utility.mobNamesCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L1Z2's mob names are empty. Mob's names will be empty."}]
execute if score $dungeon do2.utility.mobNamesCount matches 0 run data modify storage do2:mobs level1_zone2 set value ['{"text":""}']

# Setup
execute store result score $dungeon do2.utility.mobNamesCount run data get storage do2:mobs level1_zone1
scoreboard players operation $dungeon do2.utility.mobGeneration = $l1z2 do2.config.mc.levelZoneMobCount
data modify storage do2:mobs mobNames set from storage do2:mobs level1_zone2

function do2:level_controller/generate_mobs/generate_a_ravager
# - Check for issues -
# Check for mob AMOUNT count
execute if score $l1z2 do2.config.mc.levelZoneMobCount matches ..0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L1Z2's mob count is empty. No mobs will generate in this zone."}]
execute if score $l1z2 do2.config.mc.levelZoneMobCount matches ..0 run scoreboard players set $l1z2 do2.config.mc.levelZoneMobCount 0
# Check for sufficient mob NAMES
execute if score $dungeon do2.utility.mobNamesCount < $l1z2 do2.config.mc.levelZoneMobCount as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: Not enough L1Z2's mob names for L1Z2's mob count. Adding random names to fix."}]
execute if score $dungeon do2.utility.mobNamesCount < $l1z2 do2.config.mc.levelZoneMobCount run function do2:level_controller/add_mob_names/ravager_names

# Generate enough ravagers.
function do2:level_controller/generate_mobs/generate_enough_ravagers

# Finish
execute as @e[tag=newly_generated_mob] run tp @s @e[type=marker,tag=L1Z2,limit=1,sort=random]
execute as @e[tag=newly_generated_mob] run tag @s add L1Z2
execute as @e[tag=newly_generated_mob] run tp @s @e[type=marker,tag=l1z2,limit=1,sort=random]
execute as @e[tag=newly_generated_mob] run tag @s add l1z2
execute as @e[tag=newly_generated_mob] run tag @s remove newly_generated_mob
Loading

0 comments on commit 02010e0

Please sign in to comment.