Skip to content

Commit

Permalink
New curtain who dis
Browse files Browse the repository at this point in the history
  • Loading branch information
Finn committed Nov 24, 2024
1 parent 5e98a82 commit bd66709
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 1 deletion.
5 changes: 4 additions & 1 deletion data/lt/function/main/on_load.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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
scoreboard objectives add turtle_tracker dummy
## Stage system variables
scoreboard objectives add stage.global dummy
scoreboard objectives add stage.curtain dummy
3 changes: 3 additions & 0 deletions data/lt/function/main/tick_runner.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions data/lt/function/stage/action/announce.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tellraw @a "announcement!!"
Empty file.
1 change: 1 addition & 0 deletions data/lt/function/stage/action/toggle_curtain.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$scoreboard players set state stage.curtain $(action_data)
11 changes: 11 additions & 0 deletions data/lt/function/stage/feature/curtain/break_layer.mcfunction
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
execute align xyz run summon marker ~ ~ ~ {Tags:["stage.curtain"]}
11 changes: 11 additions & 0 deletions data/lt/function/stage/feature/curtain/on_tick.mcfunction
Original file line number Diff line number Diff line change
@@ -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

11 changes: 11 additions & 0 deletions data/lt/function/stage/feature/curtain/place_layer.mcfunction
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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}
5 changes: 5 additions & 0 deletions data/lt/function/stage/stage_action.mcfunction
Original file line number Diff line number Diff line change
@@ -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)}
7 changes: 7 additions & 0 deletions data/lt/function/stage/stage_tick.mcfunction
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bd66709

Please sign in to comment.