-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Large update to the level controller. Still WIP
- Loading branch information
1 parent
03fa662
commit 02010e0
Showing
29 changed files
with
364 additions
and
138 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
1 change: 0 additions & 1 deletion
1
Brilliance Datapack/data/do2/functions/dungeon_setup/summon/ravagers.mcfunction
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,4 +1,3 @@ | ||
# - Make sure we don't have duplicates - | ||
kill @e[type=ravager] | ||
|
||
schedule function do2:dungeon_setup/summon/summon_ravagers 3t |
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
20 changes: 20 additions & 0 deletions
20
...ck/data/do2/functions/level_controller/add_mob_names/add_numbered_ravager_name.mcfunction
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,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 |
28 changes: 28 additions & 0 deletions
28
...ack/data/do2/functions/level_controller/add_mob_names/add_ravager_name_to_list.mcfunction
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,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 |
2 changes: 2 additions & 0 deletions
2
...iance Datapack/data/do2/functions/level_controller/add_mob_names/ravager_names.mcfunction
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,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 |
17 changes: 17 additions & 0 deletions
17
...Datapack/data/do2/functions/level_controller/array_manipulation/get_from_index.mcfunction
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,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 |
24 changes: 24 additions & 0 deletions
24
...apack/data/do2/functions/level_controller/array_manipulation/splice_from_index.mcfunction
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,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 |
5 changes: 5 additions & 0 deletions
5
...ata/do2/functions/level_controller/array_manipulation/splice_from_index_helper.mcfunction
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,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 |
21 changes: 21 additions & 0 deletions
21
Brilliance Datapack/data/do2/functions/level_controller/generate_mobs.mcfunction
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,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 | ||
|
28 changes: 0 additions & 28 deletions
28
... Datapack/data/do2/functions/level_controller/generate_mobs/generate_a_ravager.mcfunction
This file was deleted.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
...ack/data/do2/functions/level_controller/generate_mobs/generate_enough_ravagers.mcfunction
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,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 |
8 changes: 0 additions & 8 deletions
8
...apack/data/do2/functions/level_controller/generate_mobs/get_from_random_number.mcfunction
This file was deleted.
Oops, something went wrong.
19 changes: 11 additions & 8 deletions
19
Brilliance Datapack/data/do2/functions/level_controller/generate_mobs/l1z1.mcfunction
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
22 changes: 13 additions & 9 deletions
22
Brilliance Datapack/data/do2/functions/level_controller/generate_mobs/l1z2.mcfunction
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,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 |
Oops, something went wrong.