fixed a bug where wire graphs would not laid down correctly

This commit is contained in:
minjaesong
2021-08-07 16:23:42 +09:00
parent 4112dc333f
commit e4542af75c
7 changed files with 73 additions and 3 deletions

View File

@@ -40,7 +40,7 @@ abstract class Actor(val renderOrder: RenderOrder) : Comparable<Actor>, Runnable
* Valid RefID is equal to or greater than 16777216.
* @return Reference ID. (16777216-0x7FFF_FFFF)
*/
open var referenceID: ActorID = Terrarum.generateUniqueReferenceID(renderOrder) // once this was nullable without initialiser. If you're going to revert to that, add the reason why this should be nullable.
open var referenceID: ActorID = Terrarum.generateUniqueReferenceID(renderOrder) // in old time this was nullable without initialiser. If you're going to revert to that, add the reason why this should be nullable.
var actorValue = ActorValue(this) // FIXME cyclic reference on GSON
@Volatile var flagDespawn = false

View File

@@ -0,0 +1,49 @@
package net.torvald.terrarum.gameactors
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.CommonResourcePool
import net.torvald.terrarum.ReferencingRanges
import net.torvald.terrarum.Terrarum
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
class BlockMarkerActor : ActorWithBody(Actor.RenderOrder.OVERLAY, physProp = PhysProperties.MOBILE_OBJECT) {
override var referenceID: ActorID = 1048575 // custom refID
override val hitbox = Hitbox(0.0, 0.0, 16.0, 16.0)
var color = Color.YELLOW
var shape = 0
private val blockMarkings: TextureRegionPack
get() = CommonResourcePool.getAsTextureRegionPack("blockmarkings_common")
init {
this.referenceID = ReferencingRanges.ACTORS_OVERLAY.last
this.isVisible = false
}
override fun drawBody(batch: SpriteBatch) {
if (isVisible) {
batch.color = color
batch.draw(blockMarkings.get(shape, 0), hitbox.startX.toFloat(), hitbox.startY.toFloat())
}
}
override fun drawGlow(batch: SpriteBatch) { }
override fun dispose() {
}
override fun update(delta: Float) {
if (isVisible) {
hitbox.setPosition(
Terrarum.mouseTileX * 16.0,
Terrarum.mouseTileY * 16.0
)
}
}
override fun onActorValueChange(key: String, value: Any?) { }
}