fixed a bug where signal emitter wouldn't work after save reload

This commit is contained in:
minjaesong
2022-01-24 13:00:52 +09:00
parent ee8da4df84
commit a213cba5ef
6 changed files with 12 additions and 83 deletions

View File

@@ -469,9 +469,9 @@ object WorldSimulator {
* @return List of FixtureBases, safe to cast into Electric
*/
private fun wiresimGetSourceBlocks(): List<FixtureBase> =
INGAME.actorContainerActive.filter {
it is FixtureBase && it is Electric && it.inUpdateRange(world) && it.wireEmitterTypes.isNotEmpty()
} as List<FixtureBase>
INGAME.actorContainerActive.filterIsInstance<FixtureBase>().filter {
it is Electric && it.inUpdateRange(world) && it.wireEmitterTypes.isNotEmpty()
}
private val wireSimMarked = HashSet<Long>()
private val wireSimPoints = Queue<WireGraphCursor>()

View File

@@ -855,9 +855,8 @@ object IngameRenderer : Disposable {
shaderBlendGlow.dispose()
shaderAlphaDither.dispose()
try {
fboRGBexport.dispose()
}
try { fboRGBexport.dispose() }
catch (e: GdxRuntimeException) {}
catch (e: UninitializedPropertyAccessException) {}
catch (e: Throwable) { e.printStackTrace(System.out) }
}

View File

@@ -676,7 +676,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
}
private var updateAkku = 0f
private var autosaveTimer = 0f
internal var autosaveTimer = 0f
override fun render(`_`: Float) {
// Q&D solution for LoadScreen and Ingame, where while LoadScreen is working, Ingame now no longer has GL Context

View File

@@ -30,7 +30,6 @@ class FixtureLogicSignalEmitter : FixtureBase, Electric {
}
CommonResourcePool.loadAll()
density = 1400.0
setHitboxDimension(TILE_SIZE, TILE_SIZE, 0, -1)
@@ -38,9 +37,14 @@ class FixtureLogicSignalEmitter : FixtureBase, Electric {
sprite!!.setRowsAndFrames(1, 1)
actorValue[AVKey.BASEMASS] = MASS
}
override fun update(delta: Float) {
// the values does not get preserved on save reload??
wireEmitterTypes["digital_bit"] = 0
wireEmission[0] = Vector2(1.0, 0.0)
super.update(delta)
}
override fun dispose() { }

View File

@@ -1,6 +1,5 @@
package net.torvald.terrarum.modulebasegame.ui
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
@@ -122,6 +121,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
screen = 0
full.handler.unlockToggle()
full.unlockTransition()
(INGAME as TerrarumIngame).autosaveTimer = 0f
}
}