This commit is contained in:
psyopcutie 2026-07-20 19:56:21 +02:00
parent ab5e8ef138
commit e590dd42b6

View file

@ -1,7 +1,9 @@
package core.game.system.command.sets
import core.api.animate
import core.api.animateInterface
import core.api.delayScript
import core.api.openInterface
import core.api.queueScript
import core.api.stopExecuting
import core.game.interaction.QueueStrength
@ -84,6 +86,34 @@ class AnimationCommandSet : CommandSet(Privilege.ADMIN) {
}
}
/** Cycles animations on an interface child. */
define("ianims", Privilege.ADMIN, "::ianims <Interface ID> <Child ID> <From Animation ID> <To Animation ID> <(opt) Duration>", "Cycles animations on an interface child.") { player, args ->
if (args.size !in 4..6) {
reject(player, "Syntax error: ::ianims <Interface ID> <Child ID> <From Animation ID> <To Animation ID> <(opt) Duration>")
}
val interfaceId = args[1].toInt()
val childId = args[2].toInt()
val animationFrom = args[3].toInt()
val animationTo = args.getOrNull(4)?.toInt() ?: animationFrom
val animationDelay = (args.getOrNull(5) ?: "3").toInt()
var animationId = animationFrom
openInterface(player, interfaceId)
queueScript(player, 1, QueueStrength.SOFT) {
animateInterface(player, interfaceId, childId, animationId)
notify(player, "Playing interface animation $animationId on $interfaceId:$childId")
if (animationId == animationTo) {
return@queueScript stopExecuting(player)
}
animationId++
return@queueScript delayScript(player, animationDelay)
}
}
/**
* Force the player to loop animation <Animation ID>
*/