From f12bf553ff70a27d94e62b5847dc206f5a839e7e Mon Sep 17 00:00:00 2001 From: minjaesong Date: Mon, 22 May 2023 01:25:14 +0900 Subject: [PATCH] door retains its apparance after load; autodoor is permissible for all IngamePlayers --- .../gameactors/FixtureSwingingDoorBase.kt | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSwingingDoorBase.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSwingingDoorBase.kt index fc7ba12a8..ee0c24caa 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSwingingDoorBase.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSwingingDoorBase.kt @@ -145,8 +145,10 @@ open class FixtureSwingingDoorBase : FixtureBase { nameFun = customNameFun + // redefine the sprite's appearance when opened to left/right + (sprite!! as SheetSpriteAnimation).currentRow = if (doorState < 0) 2 else doorState + // define light/shadebox - // TODO: redefine when opened to left/right (if (isOpacityActuallyLuminosity) lightBoxList else shadeBoxList)[0].light = opacity } @@ -336,20 +338,20 @@ open class FixtureSwingingDoorBase : FixtureBase { } // automatic opening/closing else if (doorStateTimer > doorHoldLength[doorState]!!) { - val actors = INGAME.actorContainerActive.filterIsInstance() +// val actors = INGAME.actorContainerActive.filterIsInstance() // 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 } - }.getOrNull(0) +// val installer: IngamePlayer? = if (actorThatInstalledThisFixture == null) null +// else INGAME.actorContainerActive.filterIsInstance().filter { it.uuid == actorThatInstalledThisFixture }.ifEmpty { +// INGAME.actorContainerInactive.filterIsInstance().filter { it.uuid == actorThatInstalledThisFixture } +// }.getOrNull(0) // if the door is "owned" by someone, restrict access to its "amicable" (defined using Faction subsystem) actors // if the door is owned by null, restrict access to ActorHumanoid and actors with "intelligent" actor value set up - if (actorThatInstalledThisFixture == null || installer != null) { - val amicableActors: List = ArrayList( + if (true) {//actorThatInstalledThisFixture == null || installer != null) { + /*val amicableActors: List = ArrayList( if (actorThatInstalledThisFixture == null) actors.filterIsInstance() union actors.filter { it.actorValue.getAsBoolean("intelligent") == true } else { @@ -367,7 +369,11 @@ open class FixtureSwingingDoorBase : FixtureBase { }.filter { // filter amicableActors so that ones standing near the door remain this.hitbox.containsHitbox(INGAME.world.width * TILE_SIZED, it.hitbox) - } + }*/ + + + val amicableActors = INGAME.actorContainerActive.filterIsInstance() + var nobodyIsThere = true val oldState = doorState