mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-10-27 04:26:27 -04:00
properly switch pose to walking when walk speed is super slow.
This commit is contained in:
+5
-2
@@ -26,6 +26,7 @@ import com.cobblemon.mod.common.api.spawning.fishing.FishingSpawnCause.Companion
|
||||
import com.cobblemon.mod.common.api.tags.CobblemonItemTags
|
||||
import com.cobblemon.mod.common.battles.BattleRegistry
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
import com.cobblemon.mod.common.entity.pokemon.ai.PokemonMoveControl
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.pokemon.activestate.ActivePokemonState
|
||||
import com.cobblemon.mod.common.pokemon.activestate.SentOutState
|
||||
@@ -244,11 +245,13 @@ class PokemonServerDelegate : PokemonSideDelegate {
|
||||
entity.entityData.set(PokemonEntity.ASPECTS, trackedAspects)
|
||||
entity.entityData.set(PokemonEntity.LABEL_LEVEL, entity.pokemon.level)
|
||||
|
||||
// Slow mons can travel less than the distance check each tick so steering somewhere counts too.
|
||||
val travelling = entity.controllingPassenger == null && (entity.moveControl as? PokemonMoveControl)?.isTravelling == true
|
||||
if (entity.getCurrentPoseType() in PoseType.FLYING_POSES) {
|
||||
entity.entityData.set(PokemonEntity.MOVING, entity.isPokemonFlying)
|
||||
entity.entityData.set(PokemonEntity.MOVING, entity.isPokemonFlying || travelling)
|
||||
}
|
||||
else {
|
||||
entity.entityData.set(PokemonEntity.MOVING, entity.isPokemonWalking)
|
||||
entity.entityData.set(PokemonEntity.MOVING, entity.isPokemonWalking || travelling)
|
||||
}
|
||||
|
||||
entity.entityData.set(PokemonEntity.FRIENDSHIP, entity.pokemon.friendship)
|
||||
|
||||
+4
@@ -85,6 +85,9 @@ class PokemonMoveControl(val pokemonEntity: PokemonEntity) : MoveControl(pokemon
|
||||
private val speedEase = InertialEase(SPEED_BLEND_SECONDS)
|
||||
// What steering asked for this tick, null when it isn't steering
|
||||
private var steerGoal: SteerGoal? = null
|
||||
/** True while steering somewhere this tick, however slowly. Used for the walk and fly poses */
|
||||
var isTravelling = false
|
||||
private set
|
||||
|
||||
private class SteerGoal(
|
||||
val yaw: Float,
|
||||
@@ -421,6 +424,7 @@ class PokemonMoveControl(val pokemonEntity: PokemonEntity) : MoveControl(pokemon
|
||||
*/
|
||||
private fun updateMotion() {
|
||||
val goal = steerGoal
|
||||
isTravelling = goal != null && !pokemonEntity.isDeadOrDying
|
||||
val heading = pokemonEntity.heading
|
||||
val turnTarget = pokemonEntity.stationaryTurnTarget
|
||||
if (goal == null && turnTarget != null) {
|
||||
|
||||
Reference in New Issue
Block a user