mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-28 05:45:10 -06:00
::ianims
This commit is contained in:
parent
ab5e8ef138
commit
e590dd42b6
1 changed files with 30 additions and 0 deletions
|
|
@ -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>
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue