mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-16 05:24:06 +09:00
first working instance of wire signal source block
This commit is contained in:
@@ -9,6 +9,7 @@ import net.torvald.terrarum.blockproperties.Fluid
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.gamecontroller.KeyToggler
|
||||
import net.torvald.terrarum.gameitem.ItemID
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame.Companion.inUpdateRange
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.FixtureBase
|
||||
import net.torvald.terrarum.worlddrawer.BlocksDrawer
|
||||
@@ -452,28 +453,18 @@ object WorldSimulator {
|
||||
|
||||
private val wiresimOverscan = 60
|
||||
|
||||
/*private fun wiresimGetSourceBlocks(): List<Q> {
|
||||
val ret = ArrayList<Q>()
|
||||
|
||||
val for_y_start = (WorldCamera.y.toFloat() / TILE_SIZE).floorInt()
|
||||
val for_y_end = for_y_start + BlocksDrawer.tilesInVertical - 1
|
||||
|
||||
val for_x_start = (WorldCamera.x.toFloat() / TILE_SIZE).floorInt()
|
||||
val for_x_end = for_x_start + BlocksDrawer.tilesInHorizontal - 1
|
||||
|
||||
val fixtures = Terrarum.ingame!!.actorContainer.filterIsInstance<FixtureBase>()
|
||||
|
||||
for (y in for_y_start - wiresimOverscan..for_y_end + wiresimOverscan) {
|
||||
for (x in for_x_start - wiresimOverscan..for_x_end + wiresimOverscan) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return ret
|
||||
}*/
|
||||
private fun wiresimGetSourceBlocks(): List<FixtureBase> =
|
||||
Terrarum.ingame!!.actorContainerActive.filter {
|
||||
it is FixtureBase && it.inUpdateRange(world) && it.wireEmitterType.isNotBlank()
|
||||
} as List<FixtureBase>
|
||||
|
||||
private fun simulateWires(delta: Float) {
|
||||
//val sourceBlocks = wiresimGetSourceBlocks()
|
||||
wiresimGetSourceBlocks().let { sources ->
|
||||
// signal-emitting fixtures must set emitState of its own tiles via update()
|
||||
sources.forEach {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum class WireConStatus { THRU, END, BRANCH }
|
||||
|
||||
Reference in New Issue
Block a user