if (shipInstance.isDoneCurrentPhase) return GameEvent.InvalidAction("Ships cannot be moved twice")
val moveOrigin = shipInstance.position.location
- val newFacingNormal = (data.newPosition.location - moveOrigin).normal
+ val newFacingNormal = normalDistance(data.newPosition.facing)
val oldFacingNormal = normalDistance(shipInstance.position.facing)
val angleDiff = (oldFacingNormal angleBetween newFacingNormal)
}
}
-operator fun <T> List<T>.times(multiplier: Int): List<T> = if (multiplier <= 0) emptyList()
-else if (multiplier == 1) this
-else this + (this * (multiplier - 1))
-
fun Double.toPercent() = "${(this * 100).roundToInt()}%"
fun smoothMinus1To1(x: Double, exponent: Double = 1.0) = x / (1 + abs(x).pow(exponent)).pow(1 / exponent)