Rewrote stiles

Added a new ContentAPI function, animationCycles, that returns the exact number of cycles an animation lasts for (useful for forced movement)
Added a new function to Vector objects that allows convertion into Direction objects (useful for transforming locations)
This commit is contained in:
Ceikry
2023-09-04 06:46:10 +00:00
committed by Ryan
parent d4e62c0e96
commit 895c41756a
7 changed files with 177 additions and 109 deletions
+7 -1
View File
@@ -64,6 +64,7 @@ import core.game.world.repository.Repository
import core.game.consumable.*
import core.ServerConstants
import core.api.utils.Vector
import core.cache.def.impl.AnimationDefinition
import core.game.node.entity.player.link.quest.Quest
import core.tools.*
import core.game.world.update.flag.*
@@ -431,7 +432,12 @@ fun resetAnimator(player: Player) {
* @return the number of ticks the given animation lasts for
*/
fun animationDuration(animation: Animation): Int {
return animation.definition.durationTicks
return cyclesToTicks(animation.definition.cycles)
}
fun animationCycles (animation: Int) : Int {
val def = AnimationDefinition.forId(animation)
return def.cycles
}
/**