From fd9d36c7ac385f2c4c78f16cb715e46955e5e055 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Mon, 10 Jun 2019 01:40:10 +0900 Subject: [PATCH] new block: scaffolding (does not fall yet) --- assets/mods/basegame/blocks/272.tga | 3 +++ assets/mods/basegame/blocks/blocks.csv | 4 ++++ .../terrarum/gameactors/ActorWBMovable.kt | 20 +++++++------------ .../modulebasegame/gameitems/BlockBase.kt | 1 + 4 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 assets/mods/basegame/blocks/272.tga diff --git a/assets/mods/basegame/blocks/272.tga b/assets/mods/basegame/blocks/272.tga new file mode 100644 index 000000000..b7827c185 --- /dev/null +++ b/assets/mods/basegame/blocks/272.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dad862c9dee71133be3e3e87aa1fa370c52c52da8ed1cf489b63c3c67b82d9aa +size 1068 diff --git a/assets/mods/basegame/blocks/blocks.csv b/assets/mods/basegame/blocks/blocks.csv index 7c58d4c87..9824e8134 100644 --- a/assets/mods/basegame/blocks/blocks.csv +++ b/assets/mods/basegame/blocks/blocks.csv @@ -98,6 +98,10 @@ "256";"256";"BLOCK_LANTERN_IRON_REGULAR";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"FXTR";"0";"0";"0";"0";"0";"0";"16";"1.0000";"0.6372";"0.0000";"0.0000";"N/A";"N/A" "257";"257";"BLOCK_SUNSTONE";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"ROCK";"1";"0";"0";"0";"2";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A" "258";"258";"BLOCK_DAYLIGHT_CAPACITOR";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"0";"0";"3";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A" +"272";"272";"BLOCK_SCAFFOLDING_NORMAL";"0.0";"0.0";"0.0";"0.0";"1";"N/A";"WOOD";"0";"1";"0";"1";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" +"273";"273";"BLOCK_SCAFFOLDING_EBONY";"0.0";"0.0";"0.0";"0.0";"1";"N/A";"WOOD";"0";"1";"0";"1";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"" +"274";"274";"BLOCK_SCAFFOLDING_BIRCH";"0.0";"0.0";"0.0";"0.0";"1";"N/A";"WOOD";"0";"1";"0";"1";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"" +"275";"275";"BLOCK_SCAFFOLDING_BLOODROSE";"0.0";"0.0";"0.0";"0.0";"1";"N/A";"WOOD";"0";"1";"0";"1";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"" "4091";"0";"ACTORBLOCK_NO_COLLISION";"0.0";"0.0";"0.0";"0.0";"1";"1";"NULL";"0";"0";"0";"0";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" "4092";"0";"ACTORBLOCK_FULL_COLLISION";"0.0";"0.0";"0.0";"0.0";"1";"1";"NULL";"0";"0";"0";"0";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" "4093";"0";"ACTORBLOCK_ALLOW_MOVE_DOWN";"0.0";"0.0";"0.0";"0.0";"1";"1";"NULL";"0";"1";"0";"0";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" diff --git a/src/net/torvald/terrarum/gameactors/ActorWBMovable.kt b/src/net/torvald/terrarum/gameactors/ActorWBMovable.kt index bb5d020eb..c2ec9ab0f 100644 --- a/src/net/torvald/terrarum/gameactors/ActorWBMovable.kt +++ b/src/net/torvald/terrarum/gameactors/ActorWBMovable.kt @@ -1365,25 +1365,17 @@ open class ActorWBMovable(renderOrder: RenderOrder, val immobileBody: Boolean = if (KeyToggler.isOn(Input.Keys.F9)) { val blockMark = AppLoader.resourcePool.getAsTextureRegionPack("blockmarkings_common").get(0, 0) - batch.color = Color.MAGENTA - for (y in 0 until intTilewiseHitbox.height.toInt()) { - for (x in 0 until intTilewiseHitbox.width.toInt()) { + batch.color = HITBOX_COLOURS[0] + for (y in 0..intTilewiseHitbox.height.toInt()) { + for (x in 0..intTilewiseHitbox.width.toInt()) { batch.draw(blockMark, (intTilewiseHitbox.startX.toFloat() + x) * TILE_SIZEF, - (intTilewiseHitbox.startY.toFloat() * y) * TILE_SIZEF + (intTilewiseHitbox.startY.toFloat() + y) * TILE_SIZEF ) } } - batch.color = Color.YELLOW - for (y in 0 until hIntTilewiseHitbox.height.toInt()) { - for (x in 0 until hIntTilewiseHitbox.width.toInt()) { - batch.draw(blockMark, - (hIntTilewiseHitbox.startX.toFloat() + x) * TILE_SIZEF, - (hIntTilewiseHitbox.startY.toFloat() * y) * TILE_SIZEF - ) - } - } + //println(intTilewiseHitbox) } } @@ -1653,6 +1645,8 @@ open class ActorWBMovable(renderOrder: RenderOrder, val immobileBody: Boolean = private fun clampCeil(x: Double, ceil: Double): Double { return if (Math.abs(x) > ceil) ceil else x } + + @Transient private val HITBOX_COLOURS = arrayOf(Color(0xFF00FF88.toInt()), Color(0xFFFF0088.toInt())) } // gameplay-related actorvalue macros diff --git a/src/net/torvald/terrarum/modulebasegame/gameitems/BlockBase.kt b/src/net/torvald/terrarum/modulebasegame/gameitems/BlockBase.kt index a5a8d4668..22079644d 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameitems/BlockBase.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameitems/BlockBase.kt @@ -28,6 +28,7 @@ object BlockBase { // check for collision with actors (BLOCK only) // FIXME properly fix the collision detection: it OVERRIDES the tiki-torches which should not happen AT ALL // FIXME (h)IntTilewiseHitbox is badly defined + // FIXME actually it's this code: not recognising hitbox's starting point correctly. Use F9 for visualisation if (gameItem.inventoryCategory == GameItem.Category.BLOCK) { var ret1 = true ingame.actorContainerActive.forEach {