trade deal to send objanim to bishop

This commit is contained in:
aidan 2026-08-01 13:04:28 -05:00
parent c578434b81
commit 0290d8684c

View file

@ -1,11 +1,8 @@
package core.game.system.command.sets
import core.api.addScenery
import core.api.animate
import core.api.animateScenery
import core.api.delayScript
import core.api.queueScript
import core.api.sendMessage
import core.api.stopExecuting
import core.game.interaction.QueueStrength
import core.game.node.entity.npc.NPC
@ -106,6 +103,7 @@ class AnimationCommandSet : CommandSet(Privilege.ADMIN) {
}
}
/**
* Reset the player's render animation to default
*/
@ -115,46 +113,5 @@ class AnimationCommandSet : CommandSet(Privilege.ADMIN) {
player.appearance.setAnimations()
player.appearance.sync()
}
/**
* Spawn object with given ID at the player's location and animate it
*/
define("objanim", usage = "::objanim [objectId] [animFrom] [(opt)animTo] [(opt)delay]", description = "Spawns an object and animates it with the provided anim ID. If a second ID is provided, it iterates through the anims.") { player, args ->
if (args.size < 3) {
sendMessage(player, "Usage: ::objanim [objectId] [animFrom] [(opt)animTo] [(opt)delay]")
return@define
}
val objectId = args[1].toIntOrNull()
val animFrom = args[2].toIntOrNull()
var animTo = args.getOrNull(3)?.toIntOrNull()
val delay = args.getOrNull(4)?.toIntOrNull() ?: 3
if (objectId == null || animFrom == null) {
sendMessage(player, "Invalid arguments. Please use numbers.")
return@define
}
// spawn the object
val obj = core.game.node.scenery.Scenery(objectId, player.location)
addScenery(obj)
// set the range if it's just a single anim
if (animTo == null) animTo = animFrom
// loop through the anims if it's a range
sendMessage(player, "Spawned object $objectId, playing anims $animFrom to $animTo.")
queueScript(player, 1, QueueStrength.STRONG) { stage: Int ->
val currentAnimId = animFrom + stage
animateScenery(player, obj, currentAnimId)
sendMessage(player, "Playing object animation $currentAnimId")
if (currentAnimId >= animTo) {
return@queueScript stopExecuting(player)
}
return@queueScript delayScript(player, delay)
}
return@define
}
}
}