class for door variants

This commit is contained in:
minjaesong
2022-07-28 20:29:58 +09:00
parent 99a60716b8
commit 48443a9c11
2 changed files with 52 additions and 11 deletions

View File

@@ -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<IngamePlayer>().filter { it.uuid == actorThatInstalledThisFixture }.ifEmpty {
INGAME.actorContainerInactive.filterIsInstance<IngamePlayer>().filter { it.uuid == actorThatInstalledThisFixture }

View File

@@ -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
)
}
}