mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
fixture ghost is working again
This commit is contained in:
@@ -160,8 +160,8 @@ open class IngameInstance(val batch: SpriteBatch, val isMultiplayer: Boolean = f
|
||||
|
||||
// add blockmarking_actor into the actorlist
|
||||
(CommonResourcePool.get("blockmarking_actor") as BlockMarkerActor).let {
|
||||
it.isVisible = false // make sure the actor is invisible on new instance
|
||||
if (actorContainerActive.searchFor(it.referenceID) { it.referenceID } != null) actorContainerActive.add(it)
|
||||
forceRemoveActor(it)
|
||||
forceAddActor(it)
|
||||
}
|
||||
|
||||
gameInitialised = true
|
||||
@@ -191,6 +191,8 @@ open class IngameInstance(val batch: SpriteBatch, val isMultiplayer: Boolean = f
|
||||
printdbg(this, "dispose called by")
|
||||
printStackTrace(this)
|
||||
|
||||
blockMarkingActor.isVisible = false
|
||||
|
||||
actorContainerActive.forEach { it.dispose() }
|
||||
actorContainerInactive.forEach { it.dispose() }
|
||||
world.dispose()
|
||||
|
||||
@@ -10,6 +10,9 @@ import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
import kotlin.math.floor
|
||||
|
||||
/**
|
||||
* Used as construction markers and fixture ghost images
|
||||
*/
|
||||
class BlockMarkerActor : ActorWithBody(Actor.RenderOrder.OVERLAY, physProp = PhysProperties.MOBILE_OBJECT) {
|
||||
|
||||
private val defaultSize = 16.0
|
||||
|
||||
@@ -384,6 +384,6 @@ fun mouseInInteractableRangeTools(actor: ActorWithBody, item: GameItem?, reachMu
|
||||
|
||||
if (dist <= minOf(toolDistMax, distMax).sqr()) return action() else return false
|
||||
}
|
||||
fun IntRange.pickRandom() = HQRNG().nextInt(this.endInclusive - this.start + 1) + this.start // count() on 200 million entries? Se on vitun hyvää idea
|
||||
fun IntRange.pickRandom() = HQRNG().nextInt(this.last - this.first + 1) + this.first // count() on 200 million entries? Se on vitun hyvää idea
|
||||
fun IntArray.pickRandom(): Int = this[HQRNG().nextInt(this.size)]
|
||||
fun DoubleArray.pickRandom(): Double = this[HQRNG().nextInt(this.size)]
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.badlogic.gdx.utils.GdxRuntimeException
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.App.measureDebugTime
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZEF
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
@@ -617,7 +618,9 @@ object IngameRenderer : Disposable {
|
||||
|
||||
batch.inUse {
|
||||
moveCameraToWorldCoord()
|
||||
actors?.forEach { it.drawBody(batch) }
|
||||
actors?.forEach {
|
||||
it.drawBody(batch)
|
||||
}
|
||||
}
|
||||
|
||||
setCameraPosition(0f, 0f)
|
||||
|
||||
@@ -889,7 +889,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
)
|
||||
}
|
||||
|
||||
private val maxRenderableWires = ReferencingRanges.ACTORS_WIRES.endInclusive - ReferencingRanges.ACTORS_WIRES.first + 1
|
||||
private val maxRenderableWires = ReferencingRanges.ACTORS_WIRES.last - ReferencingRanges.ACTORS_WIRES.first + 1
|
||||
private val wireActorsContainer = Array(maxRenderableWires) { WireActor(ReferencingRanges.ACTORS_WIRES.first + it).let {
|
||||
forceAddActor(it)
|
||||
/*^let*/ it
|
||||
|
||||
Reference in New Issue
Block a user