From 48443a9c1185ffd7806d26974992ba516eaf54fe Mon Sep 17 00:00:00 2001 From: minjaesong Date: Thu, 28 Jul 2022 20:29:58 +0900 Subject: [PATCH] class for door variants --- .../gameactors/FixtureSwingingDoorBase.kt | 10 +--- .../gameactors/FixtureSwingingDoorRosewood.kt | 53 ++++++++++++++++++- 2 files changed, 52 insertions(+), 11 deletions(-) diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSwingingDoorBase.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSwingingDoorBase.kt index 3f991f2d8..eb52cb99b 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSwingingDoorBase.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSwingingDoorBase.kt @@ -178,15 +178,6 @@ open class FixtureSwingingDoorBase : FixtureBase, Luminous { doorCloseQueued = false } - /*override fun forEachBlockbox(action: (Int, Int, Int, Int) -> Unit) { - val xStart = worldBlockPos!!.x - ((tw * 2 - twClosed - 1) / 2) // worldBlockPos.x is where the mouse was, of when the tilewise width was 1. - for (y in worldBlockPos!!.y until worldBlockPos!!.y + blockBox.height) { - for (x in xStart until xStart + blockBox.width) { - action(x, y, x - xStart, y - worldBlockPos!!.y) - } - } - }*/ - override fun placeActorBlocks() { forEachBlockbox { x, y, ox, oy -> printdbg(this, "placeActorBlocks xy=$x,$y oxy=$ox,$oy") @@ -279,6 +270,7 @@ open class FixtureSwingingDoorBase : FixtureBase, Luminous { // auto opening and closing // TODO make this work with "player_alies" faction, not just a player + // TODO auto open from the other side does not work if X-coord is 0 or (world width - 1) val installer: IngamePlayer? = if (actorThatInstalledThisFixture == null) null else INGAME.actorContainerActive.filterIsInstance().filter { it.uuid == actorThatInstalledThisFixture }.ifEmpty { INGAME.actorContainerInactive.filterIsInstance().filter { it.uuid == actorThatInstalledThisFixture } diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSwingingDoorRosewood.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSwingingDoorRosewood.kt index 53cac431e..01c41a568 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSwingingDoorRosewood.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSwingingDoorRosewood.kt @@ -6,8 +6,58 @@ import net.torvald.terrarum.blockproperties.Block /** * Created by minjaesong on 2022-07-28. */ -class FixtureSwingingDoorRosewood : FixtureSwingingDoorBase { +class FixtureSwingingDoorOak : FixtureSwingingDoorBase { + constructor() : super() { + _construct( + 2, + 1, + 3, + BlockCodex[Block.STONE].opacity, + false, + "basegame", + "sprites/fixtures/door_basegame-48.tga", + "fixtures-door_basegame-48.tga", + "DOOR_OAK", + true + ) + } +} +class FixtureSwingingDoorEbony : FixtureSwingingDoorBase { + constructor() : super() { + _construct( + 2, + 1, + 3, + BlockCodex[Block.STONE].opacity, + false, + "basegame", + "sprites/fixtures/door_basegame-49.tga", + "fixtures-door_basegame-49.tga", + "DOOR_EBONY", + true + ) + } +} + +class FixtureSwingingDoorBirch : FixtureSwingingDoorBase { + constructor() : super() { + _construct( + 2, + 1, + 3, + BlockCodex[Block.STONE].opacity, + false, + "basegame", + "sprites/fixtures/door_basegame-50.tga", + "fixtures-door_basegame-50.tga", + "DOOR_BIRCH", + true + ) + } +} + +class FixtureSwingingDoorRosewood : FixtureSwingingDoorBase { constructor() : super() { _construct( 2, @@ -22,5 +72,4 @@ class FixtureSwingingDoorRosewood : FixtureSwingingDoorBase { true ) } - } \ No newline at end of file