Skip to content

Commit 1fc507d

Browse files
SnaveSutitgitbutler-client
authored andcommitted
✨ Add tween_paused function
- Implements #382 - Adds `tween_paused`, a function that tweens from the current pose, to the target animation, but does not play the target animation.
1 parent e66de82 commit 1fc507d

7 files changed

Lines changed: 55 additions & 0 deletions

File tree

‎src/systems/datapackCompiler/1.20.4/main.mcb‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,15 @@ IF (has_animations) {
296296
execute on passengers store result entity @s interpolation_duration int 1 run scoreboard players get #this <%OBJECTIVES.I()%>
297297
}
298298

299+
function tween_paused {
300+
# Same as the tween function, except it does not play the animation afterwards
301+
#ARGS: {duration: int, to_frame: int}
302+
debug assert executed_as_root_entity <%TAGS.PROJECT_ROOT(blueprint_id)%>
303+
304+
tag @s add <%TAGS.PAUSE_AFTER_TWEEN()%>
305+
$function ./tween {duration: $(duration), to_frame: $(to_frame)}
306+
}
307+
299308
dir zzz {
300309
function on_tick {
301310
# Tweening logic

‎src/systems/datapackCompiler/1.20.5/main.mcb‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,15 @@ IF (has_animations) {
298298
execute on passengers store result entity @s interpolation_duration int 1 run scoreboard players get #this <%OBJECTIVES.I()%>
299299
}
300300

301+
function tween_paused {
302+
# Same as the tween function, except it does not play the animation afterwards
303+
#ARGS: {duration: int, to_frame: int}
304+
debug assert executed_as_root_entity <%TAGS.PROJECT_ROOT(blueprint_id)%>
305+
306+
tag @s add <%TAGS.PAUSE_AFTER_TWEEN()%>
307+
$function ./tween {duration: $(duration), to_frame: $(to_frame)}
308+
}
309+
301310
dir zzz {
302311
function on_tick {
303312
# Tweening logic

‎src/systems/datapackCompiler/1.21.0/main.mcb‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,15 @@ IF (has_animations) {
298298
execute on passengers store result entity @s interpolation_duration int 1 run scoreboard players get #this <%OBJECTIVES.I()%>
299299
}
300300

301+
function tween_paused {
302+
# Same as the tween function, except it does not play the animation afterwards
303+
#ARGS: {duration: int, to_frame: int}
304+
debug assert executed_as_root_entity <%TAGS.PROJECT_ROOT(blueprint_id)%>
305+
306+
tag @s add <%TAGS.PAUSE_AFTER_TWEEN()%>
307+
$function ./tween {duration: $(duration), to_frame: $(to_frame)}
308+
}
309+
301310
dir zzz {
302311
function on_tick {
303312
# Tweening logic

‎src/systems/datapackCompiler/1.21.2/main.mcb‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,15 @@ IF (has_animations) {
299299
execute on passengers store result entity @s interpolation_duration int 1 run scoreboard players get #this <%OBJECTIVES.I()%>
300300
}
301301

302+
function tween_paused {
303+
# Same as the tween function, except it does not play the animation afterwards
304+
#ARGS: {duration: int, to_frame: int}
305+
debug assert executed_as_root_entity <%TAGS.PROJECT_ROOT(blueprint_id)%>
306+
307+
tag @s add <%TAGS.PAUSE_AFTER_TWEEN()%>
308+
$function ./tween {duration: $(duration), to_frame: $(to_frame)}
309+
}
310+
302311
dir zzz {
303312
function on_tick {
304313
# Tweening logic

‎src/systems/datapackCompiler/1.21.4/main.mcb‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,15 @@ IF (has_animations) {
359359
}
360360
}
361361

362+
function tween_paused {
363+
# Same as the tween function, except it does not play the animation afterwards
364+
#ARGS: {duration: int, to_frame: int}
365+
debug assert executed_as_root_entity <%TAGS.PROJECT_ROOT(blueprint_id)%>
366+
367+
tag @s add <%TAGS.PAUSE_AFTER_TWEEN()%>
368+
$function ./tween {duration: $(duration), to_frame: $(to_frame)}
369+
}
370+
362371
dir zzz {
363372
function on_tick {
364373
# Tweening logic

‎src/systems/datapackCompiler/1.21.5/main.mcb‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,15 @@ IF (has_animations) {
358358
}
359359
}
360360

361+
function tween_paused {
362+
# Same as the tween function, except it does not play the animation afterwards
363+
#ARGS: {duration: int, to_frame: int}
364+
debug assert executed_as_root_entity <%TAGS.PROJECT_ROOT(blueprint_id)%>
365+
366+
tag @s add <%TAGS.PAUSE_AFTER_TWEEN()%>
367+
$function ./tween {duration: $(duration), to_frame: $(to_frame)}
368+
}
369+
361370
dir zzz {
362371
function on_tick {
363372
# Tweening logic

‎src/systems/datapackCompiler/tags.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ namespace TAGS {
189189
export const TRANSFORMS_ONLY = () => 'aj.transforms_only'
190190
export const OUTDATED_RIG_TEXT_DISPLAY = () => 'aj.outdated_rig_text_display'
191191
export const INTERACTING_PLAYER = () => 'aj.interacting_player'
192+
export const PAUSE_AFTER_TWEEN = () => 'aj.pause_after_tween'
192193
}
193194

194195
export default TAGS

0 commit comments

Comments
 (0)