Some fixes
authorTheSaminator <TheSaminator@users.noreply.github.com>
Mon, 23 May 2022 20:17:59 +0000 (16:17 -0400)
committerTheSaminator <TheSaminator@users.noreply.github.com>
Mon, 23 May 2022 20:17:59 +0000 (16:17 -0400)
src/commonMain/kotlin/starshipfights/game/game_ability.kt
src/commonMain/kotlin/starshipfights/game/util.kt

index 727771a8a09b0e1fa6f1a32f541df3ec75c48c09..1c32be677cf1ca883f9ff1ac7d37a5c1c2c108bf 100644 (file)
@@ -236,7 +236,7 @@ sealed class PlayerAbilityType {
                        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)
                        
index 7a042804f3c3a26a19aca84e7f1573b169dcb0b3..2e6869627796715e5a5234216b3a449caa0f2b61 100644 (file)
@@ -37,10 +37,6 @@ inline fun <T> pollFlow(intervalMs: Long = 50, crossinline poll: () -> T) = flow
        }
 }
 
-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)