From 3c8f272d4a5d1db2f6234ae0131ebf1e9f44f41c Mon Sep 17 00:00:00 2001 From: minjaesong Date: Fri, 21 Mar 2025 14:30:32 +0900 Subject: [PATCH] conveyor wip --- .../modulebasegame/gameactors/ActorConveyors.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorConveyors.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorConveyors.kt index 469104092..bcc92257c 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorConveyors.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorConveyors.kt @@ -6,6 +6,7 @@ import net.torvald.terrarum.* import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED import net.torvald.terrarum.gameactors.ActorWithBody import net.torvald.terrarum.modulebasegame.worldgenerator.HALF_PI +import net.torvald.terrarum.modulebasegame.worldgenerator.TWO_PI import java.util.* import kotlin.math.* @@ -81,7 +82,7 @@ class ActorConveyors : ActorWithBody { private val COL_BELT = Color(0x444444ff) private val COL_BELT_TOP = Color(0x666666ff) - private val COL_BELT_ALT = Color(0x888888ff.toInt()) + private val COL_BELT_ALT = Color.MAGENTA//Color(0x888888ff.toInt()) private val COL_BELT_TOP_ALT = Color(0xccccccff.toInt()) } @@ -186,6 +187,17 @@ class ActorConveyors : ActorWithBody { } } + // stripes at the left spindle + // eq: k units/s on straight part == (k / r) rad/s on curve + val k = topSegRemainder + turn // TODO calculate starting angle offset + val angularOffsetStart = di + k + val segmentCount = r / segmentLen + for (i in 0 until segmentCount.toInt()) { + val a1 = angularOffsetStart + segmentLen * i + + drawArcOnWorld(cx1, cy1, r, a1, segmentLen * 0.25, 2f) + } + it.color = COL_BELT_TOP // belt top drawLineOnWorld(btx1, bty1 - 0.5f, btx2, bty2 - 0.5f, 1f)