wire branching traversal itself works, but fetches wrong signal status

This commit is contained in:
minjaesong
2021-08-12 11:38:48 +09:00
parent 884c129837
commit a6d082fb7d
6 changed files with 96 additions and 76 deletions

View File

@@ -589,6 +589,8 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
if (!paused) {
//hypothetical_input_capturing_function_if_you_finally_decided_to_forgo_gdx_input_processor_and_implement_your_own_to_synchronise_everything()
WorldSimulator.resetForThisFrame()
///////////////////////////
@@ -635,13 +637,12 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
// world click events (e.g. opening the UI that a fixture has) must go here
ingameController.update(delta)
if (!paused) {
printdbg(this, "Clear tile change queues")
/*if (!paused) {
// completely consume block change queues because why not
terrainChangeQueue.clear()
wallChangeQueue.clear()
wireChangeQueue.clear()
}
}*/
////////////////////////
@@ -876,13 +877,13 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
}
}
if (it is CuedByTerrainChange) {
/*if (it is CuedByTerrainChange) {
printdbg(this, "actor is CuedByTerrainChange: ${terrainChangeQueue}")
terrainChangeQueue.forEach { cue ->
printdbg(this, "Ingame actors terrainChangeCue: ${cue}")
it.updateForWorldChange(cue)
}
}
}*/
}
}
actorNowPlaying?.update(delta)

View File

@@ -145,18 +145,8 @@ open class FixtureBase(
this.isVisible = false
}
/**
* Fired by world's BlockChanged event (fired when blocks are placed/removed).
* The flooding check must run on every frame. use updateSelf() for that.
*
* E.g. if a fixture block that is inside of BlockBox is missing, destroy and drop self.
*/
override fun updateForWorldChange(cue: IngameInstance.BlockChangeQueueItem) {
printdbg(this, "updateForWorldChange ${nameFun()}")
// check for marker blocks.
// if at least one of them is missing, destroy all the markers and drop self as an item
// you need to implement Dropped Item first to satisfyingly implement this function
override fun update(delta: Float) {
super.update(delta)
val posX = worldBlockPos!!.x
val posY = worldBlockPos!!.y
@@ -182,9 +172,10 @@ open class FixtureBase(
}
// TODO drop self as an item (instance of DroppedItem)
}
}
}
interface CuedByTerrainChange {
@@ -194,7 +185,7 @@ interface CuedByTerrainChange {
*
* E.g. if a fixture block that is inside of BlockBox is missing, destroy and drop self.
*/
fun updateForWorldChange(cue: IngameInstance.BlockChangeQueueItem)
//fun updateForWorldChange(cue: IngameInstance.BlockChangeQueueItem)
}
/**