@@ -12,7 +12,7 @@ dir root {
1212 function on_tick {
1313 execute unless entity @s[tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return 0
1414
15- # Custom pre-tick commands
15+ # Custom pre-tick function
1616 IF (on_pre_tick_function) {
1717 <%%
1818 emit.mcb(on_pre_tick_function)
@@ -29,7 +29,7 @@ dir root {
2929 execute on passengers run tp @s ~ ~ ~ ~ ~
3030 }
3131
32- # Custom post-tick commands
32+ # Custom post-tick function
3333 IF (on_post_tick_function) {
3434 <%%
3535 emit.mcb(on_post_tick_function)
@@ -54,19 +54,19 @@ dir root {
5454 execute on passengers run tp @s ~ ~ ~ ~ ~
5555 }
5656
57- IF (locator.config?.ticking_commands ) {
57+ IF (locator.config?.on_tick_function ) {
5858 <%%
59- emit.mcb(locator.config.ticking_commands )
59+ emit.mcb(locator.config.on_tick_function )
6060 %%>
6161 }
6262 }
63- } ELSE IF (locator.config?.ticking_commands ) {
63+ } ELSE IF (locator.config?.on_tick_function ) {
6464 $execute \
6565 positioned ^$(px) ^$(py) ^$(pz) \
6666 rotated ~$(ry) ~$(rx) \
6767 run block at_locator_<%locator.storage_name%> {
6868 <%%
69- emit.mcb(locator.config.ticking_commands )
69+ emit.mcb(locator.config.on_tick_function )
7070 %%>
7171 }
7272 }
@@ -213,7 +213,7 @@ function summon {
213213 execute if data storage <%temp_storage%> {args:{variant:''}} run return run block if_empty {
214214 # Tell the user that the variant cannot be empty.
215215 tellraw @a <%TELLRAW.ARGUMENT_CANNOT_BE_EMPTY('variant')%>
216- function *<%export_namespace%>/remove/this/without_on_remove_commands
216+ function *<%export_namespace%>/remove/this/without_on_remove_function
217217 }
218218 # Attempt to apply the requested variant.
219219 # We get the success of the `try_apply` function in just in case the user's arguments are *very* wrong.
@@ -226,14 +226,14 @@ function summon {
226226 execute unless score #success <%OBJECTIVES.I()%> matches 1 run return run block invalid_variant {
227227 # Tell the user that the provided variant doesn't exist, remove the rig, and list all available variants for this rig.
228228 tellraw @a <%TELLRAW.INVALID_VARIANT(rig.variants)%>
229- function *<%export_namespace%>/remove/this/without_on_remove_commands
229+ function *<%export_namespace%>/remove/this/without_on_remove_function
230230 }
231231 scoreboard players set #success <%OBJECTIVES.I()%> 1
232232 }
233233 } ELSE {
234234 execute if data storage <%temp_storage%> args.variant run block zzz/variant_arg/no_variants_warning {
235235 tellraw @a <%TELLRAW.NO_VARIANTS()%>
236- function *<%export_namespace%>/remove/this/without_on_remove_commands
236+ function *<%export_namespace%>/remove/this/without_on_remove_function
237237 scoreboard players set #success <%OBJECTIVES.I()%> 0
238238 }
239239 }
@@ -474,11 +474,40 @@ dir remove {
474474 if (on_remove_function) emit.mcb(on_remove_function)
475475 %%>
476476
477- function ./this/without_on_remove_commands
477+ IF (has_entity_locators) {
478+ execute on passengers if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] run block as_data {
479+ REPEAT (Object.values(rig.nodes).filter(node => node.type === 'locator')) as locator {
480+ IF (locator.config?.on_remove_function) {
481+ IF (locator.config.use_entity) {
482+ block as_locator_<%locator.storage_name%> { with entity @s data.locators.<%locator.storage_name%>
483+ $execute as $(uuid) at @s run block locator_<%locator.storage_name%>_on_remove {
484+ <%%
485+ emit.mcb(locator.config.on_remove_function)
486+ %%>
487+ }
488+ }
489+ } ELSE {
490+ block at_locator_<%locator.storage_name%> { with entity @s data.locators.<%locator.storage_name%>
491+ $execute \
492+ positioned ^$(px) ^$(py) ^$(pz) \
493+ rotated ~$(ry) ~$(rx) \
494+ run block locator_<%locator.storage_name%>_on_remove {
495+ <%%
496+ emit.mcb(locator.config.on_remove_function)
497+ %%>
498+ }
499+ }
500+ }
501+ }
502+ }
503+ }
504+ }
505+
506+ function ./this/without_on_remove_function
478507 }
479508
480509 dir this {
481- function without_on_remove_commands {
510+ function without_on_remove_function {
482511 debug assert executed_as_root_entity
483512
484513 IF (has_entity_locators || has_cameras) {
0 commit comments