From bd66709f9bdfabdf0ba5e2ee581a3b9dc0997b94 Mon Sep 17 00:00:00 2001 From: Finn Date: Sat, 23 Nov 2024 21:03:13 -0800 Subject: [PATCH] New curtain who dis --- data/lt/function/main/on_load.mcfunction | 5 ++++- data/lt/function/main/tick_runner.mcfunction | 3 +++ data/lt/function/stage/action/announce.mcfunction | 1 + data/lt/function/stage/action/set_backdrop.mcfunction | 0 .../function/stage/action/toggle_curtain.mcfunction | 1 + .../stage/feature/curtain/break_layer.mcfunction | 11 +++++++++++ .../stage/feature/curtain/create_curtain.mcfunction | 1 + .../function/stage/feature/curtain/on_tick.mcfunction | 11 +++++++++++ .../stage/feature/curtain/place_layer.mcfunction | 11 +++++++++++ .../stage/feature/curtain/setup_curtain.mcfunction | 6 ++++++ data/lt/function/stage/stage_action.mcfunction | 5 +++++ data/lt/function/stage/stage_tick.mcfunction | 7 +++++++ 12 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 data/lt/function/stage/action/announce.mcfunction create mode 100644 data/lt/function/stage/action/set_backdrop.mcfunction create mode 100644 data/lt/function/stage/action/toggle_curtain.mcfunction create mode 100644 data/lt/function/stage/feature/curtain/break_layer.mcfunction create mode 100644 data/lt/function/stage/feature/curtain/create_curtain.mcfunction create mode 100644 data/lt/function/stage/feature/curtain/on_tick.mcfunction create mode 100644 data/lt/function/stage/feature/curtain/place_layer.mcfunction create mode 100644 data/lt/function/stage/feature/curtain/setup_curtain.mcfunction create mode 100644 data/lt/function/stage/stage_action.mcfunction create mode 100644 data/lt/function/stage/stage_tick.mcfunction diff --git a/data/lt/function/main/on_load.mcfunction b/data/lt/function/main/on_load.mcfunction index 1e0a9c1a..c60798fd 100644 --- a/data/lt/function/main/on_load.mcfunction +++ b/data/lt/function/main/on_load.mcfunction @@ -172,4 +172,7 @@ team modify quest.npc.no_collide friendlyFire false scoreboard objectives add mini_disguises.clock dummy # Flying Gegy -scoreboard objectives add turtle_tracker dummy \ No newline at end of file +scoreboard objectives add turtle_tracker dummy +## Stage system variables +scoreboard objectives add stage.global dummy +scoreboard objectives add stage.curtain dummy \ No newline at end of file diff --git a/data/lt/function/main/tick_runner.mcfunction b/data/lt/function/main/tick_runner.mcfunction index a1cb1d63..4f471f37 100644 --- a/data/lt/function/main/tick_runner.mcfunction +++ b/data/lt/function/main/tick_runner.mcfunction @@ -99,3 +99,6 @@ function lt:map/generic/launch_pad/on_tick # Quest System function lt:quest/main/on_tick + +# Stage on_tick +function lt:stage/stage_tick \ No newline at end of file diff --git a/data/lt/function/stage/action/announce.mcfunction b/data/lt/function/stage/action/announce.mcfunction new file mode 100644 index 00000000..3d5453ee --- /dev/null +++ b/data/lt/function/stage/action/announce.mcfunction @@ -0,0 +1 @@ +tellraw @a "announcement!!" \ No newline at end of file diff --git a/data/lt/function/stage/action/set_backdrop.mcfunction b/data/lt/function/stage/action/set_backdrop.mcfunction new file mode 100644 index 00000000..e69de29b diff --git a/data/lt/function/stage/action/toggle_curtain.mcfunction b/data/lt/function/stage/action/toggle_curtain.mcfunction new file mode 100644 index 00000000..e5e767bf --- /dev/null +++ b/data/lt/function/stage/action/toggle_curtain.mcfunction @@ -0,0 +1 @@ +$scoreboard players set state stage.curtain $(action_data) diff --git a/data/lt/function/stage/feature/curtain/break_layer.mcfunction b/data/lt/function/stage/feature/curtain/break_layer.mcfunction new file mode 100644 index 00000000..ad864774 --- /dev/null +++ b/data/lt/function/stage/feature/curtain/break_layer.mcfunction @@ -0,0 +1,11 @@ +## Takes storage data lt:stage/curtain as input +# E.g. {width:33,length:9,x:1,z:0,current_step:0} + +$scoreboard players set evalX stage.curtain $(x) +$scoreboard players set evalZ stage.curtain $(z) + +$execute if score evalX stage.curtain matches 1 run fill ~ ~-$(current_step) ~ ~$(width) ~-$(current_step) ~ air replace ltextras:curtain +$execute if score evalZ stage.curtain matches 1 run fill ~ ~-$(current_step) ~ ~ ~-$(current_step) ~$(width) air replace ltextras:curtain + +## Update step value +execute store result storage lt:stage/curtain current_step int 1 run scoreboard players remove length stage.curtain 1 \ No newline at end of file diff --git a/data/lt/function/stage/feature/curtain/create_curtain.mcfunction b/data/lt/function/stage/feature/curtain/create_curtain.mcfunction new file mode 100644 index 00000000..9e502660 --- /dev/null +++ b/data/lt/function/stage/feature/curtain/create_curtain.mcfunction @@ -0,0 +1 @@ +execute align xyz run summon marker ~ ~ ~ {Tags:["stage.curtain"]} \ No newline at end of file diff --git a/data/lt/function/stage/feature/curtain/on_tick.mcfunction b/data/lt/function/stage/feature/curtain/on_tick.mcfunction new file mode 100644 index 00000000..3f23051b --- /dev/null +++ b/data/lt/function/stage/feature/curtain/on_tick.mcfunction @@ -0,0 +1,11 @@ +# Stop curtain logic once it becomes fully open or closed +execute if score length stage.curtain = max_length stage.curtain if score state stage.curtain matches 1 run scoreboard players set state stage.curtain 0 +execute if score length stage.curtain matches 0 if score state stage.curtain matches -1 run scoreboard players set state stage.curtain 0 + +# Run correct break/place function if state is not 0 +execute if score state stage.curtain matches 1 run function lt:stage/feature/curtain/place_layer with storage lt:stage/curtain +execute if score state stage.curtain matches -1 run function lt:stage/feature/curtain/break_layer with storage lt:stage/curtain + +# Evaluate new length +execute store result score length stage.curtain run data get storage lt:stage/curtain current_step 1 + diff --git a/data/lt/function/stage/feature/curtain/place_layer.mcfunction b/data/lt/function/stage/feature/curtain/place_layer.mcfunction new file mode 100644 index 00000000..e545c7b4 --- /dev/null +++ b/data/lt/function/stage/feature/curtain/place_layer.mcfunction @@ -0,0 +1,11 @@ +## Takes storage data lt:stage/curtain as input +# E.g. {width:33,length:9,x:1,z:0,current_step:0} + +$scoreboard players set evalX stage.curtain $(x) +$scoreboard players set evalZ stage.curtain $(z) + +$execute if score evalX stage.curtain matches 1 run fill ~ ~-$(current_step) ~ ~$(width) ~-$(current_step) ~ ltextras:curtain replace air +$execute if score evalZ stage.curtain matches 1 run fill ~ ~-$(current_step) ~ ~ ~-$(current_step) ~$(width) ltextras:curtain replace air + +## Update step value +execute store result storage lt:stage/curtain current_step int 1 run scoreboard players add length stage.curtain 1 \ No newline at end of file diff --git a/data/lt/function/stage/feature/curtain/setup_curtain.mcfunction b/data/lt/function/stage/feature/curtain/setup_curtain.mcfunction new file mode 100644 index 00000000..792e8156 --- /dev/null +++ b/data/lt/function/stage/feature/curtain/setup_curtain.mcfunction @@ -0,0 +1,6 @@ +scoreboard players set state stage.curtain 0 +scoreboard players set length stage.curtain 0 +scoreboard players set evalX stage.curtain 0 +scoreboard players set evalZ stage.curtain 0 +scoreboard players set max_length stage.curtain 9 +data merge storage lt:stage/curtain {width:33,length:9,x:1,z:0,current_step:0} \ No newline at end of file diff --git a/data/lt/function/stage/stage_action.mcfunction b/data/lt/function/stage/stage_action.mcfunction new file mode 100644 index 00000000..29d9d653 --- /dev/null +++ b/data/lt/function/stage/stage_action.mcfunction @@ -0,0 +1,5 @@ +## Master function for performing/intitiating snlt stage actions +# { action:"", action_data: INT} +## function lt:snlt/stage_action {action_id:"toggle_curtain",action_data:0} + +$execute as @s at @s run function lt:stage/action/$(action_id) {action_data:$(action_data)} \ No newline at end of file diff --git a/data/lt/function/stage/stage_tick.mcfunction b/data/lt/function/stage/stage_tick.mcfunction new file mode 100644 index 00000000..3085f8d7 --- /dev/null +++ b/data/lt/function/stage/stage_tick.mcfunction @@ -0,0 +1,7 @@ +## Main on_tick function for simple stage mechanics +# More complex stage mechanics can have their own on_ticks, which should be ran from here instead of tick_runner + + + +## Run curtain logic only when it is not fully open or closed. +execute unless score curtain_state stage.global matches 0 run execute as @e[type=marker,tag=stage.curtain] at @s run function lt:stage/feature/curtain/on_tick \ No newline at end of file