@@ -308,11 +308,11 @@ dir animations {
308308 IF (BONE_TYPES.includes(node.type)) {
309309 $execute on passengers if entity @s[tag=<%TAGS.PROJECT_NODE_NAMED(export_namespace, node.storage_name)%>] run \
310310 data modify entity @s {} merge from \
311- storage <%project_storage%>/animations <%animation.storage_name%>.$(frame).<%node.type.charAt(0) + '_' + node. storage_name%>
311+ storage <%project_storage%>/animations <%animation.storage_name%>.$(frame).<%node.storage_name%>
312312 } ELSE IF (node.type === 'locator' || node.type === 'camera') {
313313 $execute on passengers if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] run \
314- $data modify entity @s data.uuids_by_name.<%node.type + '_' + node. storage_name%> merge from \
315- storage <%project_storage%>/animations <%animation.storage_name%>.$(frame).<%node.type.charAt(0) + '_' + node. storage_name%>
314+ $data modify entity @s data.uuids_by_name.<%node.storage_name%> merge from \
315+ storage <%project_storage%>/animations <%animation.storage_name%>.$(frame).<%node.storage_name%>
316316 }
317317 }
318318
@@ -376,19 +376,20 @@ dir animations {
376376
377377 if (transform.interpolation === 'pre-post' || isStepInterpolation) {
378378 frameFunc +=
379- `\n$data merge entity $(${node.type + '_' + node. storage_name})%NEWLINE_PATCH%{`
379+ `\n$data merge entity $(${node.storage_name})%NEWLINE_PATCH%{`
380380 + `transformation: ${matrixToNbtFloatArray(transform.matrix).toString()},`
381381 + `start_interpolation: ${isStepInterpolation ? -1 : 0},`
382382 + `interpolation_duration: ${isStepInterpolation ? 0 : interpolation_duration}`
383383 + `}`
384384 } else {
385385 frameFunc +=
386- `\n$data merge entity $(${node.type + '_' + node. storage_name})%NEWLINE_PATCH%{`
386+ `\n$data merge entity $(${node.storage_name})%NEWLINE_PATCH%{`
387387 + `transformation: ${matrixToNbtFloatArray(transform.matrix).toString()},`
388388 + `start_interpolation: 0,`
389389 + `interpolation_duration: ${interpolation_duration}`
390390 + `}`
391391 }
392+
392393 ;hasFunction = true
393394 break
394395 }
@@ -408,7 +409,7 @@ dir animations {
408409 if (transform.function) {
409410 if (node.config?.use_entity) {
410411 frameFunc +=
411- `\n$execute on vehicle unless entity @s[tag=${TAGS.TRANSFORMS_ONLY()}] as $(${node.type + '_' + node. storage_name}) `
412+ `\n$execute on vehicle unless entity @s[tag=${TAGS.TRANSFORMS_ONLY()}] as $(${node.storage_name}) `
412413 + `positioned ^${roundTo(transform.pos[0], 10)} ^${roundTo(transform.pos[1], 10)} ^${roundTo(transform.pos[2], 10)} `
413414 + `rotated ~${roundTo(transform.head_rot[1], 10)} ~${roundTo(transform.head_rot[0], 10)} `
414415 + `${transform.function_execute_condition ? transform.function_execute_condition + ' ' : ''}run `
@@ -548,7 +549,7 @@ function summon {
548549 function *global/gu/get_entity_uuid_string
549550 }
550551 data modify entity @s data.uuids append from storage <%gu_storage%> out
551- data modify entity @s data.uuids_by_name.<%locator.type + '_' + locator. storage_name%> set from storage <%gu_storage%> out
552+ data modify entity @s data.uuids_by_name.<%locator.storage_name%> set from storage <%gu_storage%> out
552553 data modify entity @s data.locators.<%locator.storage_name%>.uuid set from storage <%gu_storage%> out
553554 }
554555
@@ -571,7 +572,7 @@ function summon {
571572 function *global/gu/get_entity_uuid_string
572573 }
573574 data modify entity @s data.uuids append from storage <%gu_storage%> out
574- data modify entity @s data.uuids_by_name.<%camera.type + '_' + camera. storage_name%> set from storage <%gu_storage%> out
575+ data modify entity @s data.uuids_by_name.<%camera.storage_name%> set from storage <%gu_storage%> out
575576 data modify entity @s data.cameras.<%camera.storage_name%>.uuid set from storage <%gu_storage%> out
576577 }
577578
@@ -584,7 +585,7 @@ function summon {
584585 function *global/gu/get_entity_uuid_string
585586
586587 data modify entity @s data.uuids append from storage <%gu_storage%> out
587- data modify entity @s data.uuids_by_name.<%node.type + '_' + node. storage_name%> set from storage <%gu_storage%> out
588+ data modify entity @s data.uuids_by_name.<%node.storage_name%> set from storage <%gu_storage%> out
588589 }
589590 }
590591
@@ -724,6 +725,39 @@ function summon {
724725 }
725726}
726727
728+ function as_node {
729+ #ARGS: {name: string, command: string}
730+ debug assert executed_as_root_entity <%TAGS.PROJECT_ROOT(export_namespace)%>
731+ data remove storage <%temp_storage%> args
732+ $data modify storage <%temp_storage%> args merge value {name:'$(name)', command:'$(command)', uuid:'+MISSING_UUID+'}
733+
734+ IF (debug_mode) {
735+ execute if data storage <%temp_storage%> {args:{name:''}} run return run tellraw @a <%TELLRAW.ARGUMENT_CANNOT_BE_EMPTY('name')%>
736+ execute if data storage <%temp_storage%> {args:{command:''}} run return run tellraw @a <%TELLRAW.ARGUMENT_CANNOT_BE_EMPTY('command')%>
737+ }
738+
739+ execute on passengers if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] run block zzz/as_node/as_data { with storage <%temp_storage%> args
740+ $data modify storage <%temp_storage%> args.uuid set from entity @s data.uuids_by_name.$(name)
741+ IF (debug_mode) {
742+ scoreboard players set #aj.check <%OBJECTIVES.I()%> 0
743+ }
744+ block execute_as_uuid { with storage <%temp_storage%> args
745+ IF (debug_mode) {
746+ # If the function successfully instantiated, the provided command is valid.
747+ scoreboard players set #aj.check <%OBJECTIVES.I()%> 1
748+ }
749+ $execute as $(uuid) run return run $(command)
750+ IF (debug_mode) {
751+ # If the entity with the provided UUID doesn't exist, the node wasn't found.
752+ tellraw @a <%TELLRAW.NODE_ENTITY_NOT_FOUND()%>
753+ }
754+ }
755+ IF (debug_mode) {
756+ execute if score #aj.check <%OBJECTIVES.I()%> matches 0 run tellraw @a <%TELLRAW.NODE_COMMAND_FAILED_TO_EXECUTE()%>
757+ }
758+ }
759+ }
760+
727761IF (has_entity_locators) {
728762 function as_locator {
729763 #ARGS: {name: string, command: string}
0 commit comments