door retains its apparance after load; autodoor is permissible for all IngamePlayers

This commit is contained in:
minjaesong
2023-05-22 01:25:14 +09:00
parent 3ba7ddd30e
commit f12bf553ff

View File

@@ -145,8 +145,10 @@ open class FixtureSwingingDoorBase : FixtureBase {
nameFun = customNameFun 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 // define light/shadebox
// TODO: redefine when opened to left/right
(if (isOpacityActuallyLuminosity) lightBoxList else shadeBoxList)[0].light = opacity (if (isOpacityActuallyLuminosity) lightBoxList else shadeBoxList)[0].light = opacity
} }
@@ -336,20 +338,20 @@ open class FixtureSwingingDoorBase : FixtureBase {
} }
// automatic opening/closing // automatic opening/closing
else if (doorStateTimer > doorHoldLength[doorState]!!) { else if (doorStateTimer > doorHoldLength[doorState]!!) {
val actors = INGAME.actorContainerActive.filterIsInstance<ActorWithBody>() // val actors = INGAME.actorContainerActive.filterIsInstance<ActorWithBody>()
// auto opening and closing // auto opening and closing
// TODO make this work with "player_alies" faction, not just a player // 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) // 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 // val installer: IngamePlayer? = if (actorThatInstalledThisFixture == null) null
else INGAME.actorContainerActive.filterIsInstance<IngamePlayer>().filter { it.uuid == actorThatInstalledThisFixture }.ifEmpty { // else INGAME.actorContainerActive.filterIsInstance<IngamePlayer>().filter { it.uuid == actorThatInstalledThisFixture }.ifEmpty {
INGAME.actorContainerInactive.filterIsInstance<IngamePlayer>().filter { it.uuid == actorThatInstalledThisFixture } // INGAME.actorContainerInactive.filterIsInstance<IngamePlayer>().filter { it.uuid == actorThatInstalledThisFixture }
}.getOrNull(0) // }.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 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 the door is owned by null, restrict access to ActorHumanoid and actors with "intelligent" actor value set up
if (actorThatInstalledThisFixture == null || installer != null) { if (true) {//actorThatInstalledThisFixture == null || installer != null) {
val amicableActors: List<ActorWithBody> = ArrayList( /*val amicableActors: List<ActorWithBody> = ArrayList(
if (actorThatInstalledThisFixture == null) if (actorThatInstalledThisFixture == null)
actors.filterIsInstance<ActorHumanoid>() union actors.filter { it.actorValue.getAsBoolean("intelligent") == true } actors.filterIsInstance<ActorHumanoid>() union actors.filter { it.actorValue.getAsBoolean("intelligent") == true }
else { else {
@@ -367,7 +369,11 @@ open class FixtureSwingingDoorBase : FixtureBase {
}.filter { }.filter {
// filter amicableActors so that ones standing near the door remain // filter amicableActors so that ones standing near the door remain
this.hitbox.containsHitbox(INGAME.world.width * TILE_SIZED, it.hitbox) this.hitbox.containsHitbox(INGAME.world.width * TILE_SIZED, it.hitbox)
} }*/
val amicableActors = INGAME.actorContainerActive.filterIsInstance<IngamePlayer>()
var nobodyIsThere = true var nobodyIsThere = true
val oldState = doorState val oldState = doorState