From 78eb7906c92c4a079d0aa7afbbceefd069e258dc Mon Sep 17 00:00:00 2001 From: Mazo Date: Mon, 6 May 2019 13:46:55 +0100 Subject: [PATCH] Door closing modifications (#255) * Increase the distance on the door close check to stop doors bouncing open/closed and add a check to make sure the player is alive when holding the door open * Dead players hold doors open, zone is now checked if the player is a backpack instead of the player object itself --- .../main/scala/services/local/support/DoorCloseActor.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/src/main/scala/services/local/support/DoorCloseActor.scala b/common/src/main/scala/services/local/support/DoorCloseActor.scala index 1af1f1fac..46bef0d87 100644 --- a/common/src/main/scala/services/local/support/DoorCloseActor.scala +++ b/common/src/main/scala/services/local/support/DoorCloseActor.scala @@ -38,8 +38,11 @@ class DoorCloseActor() extends Actor { val (doorsToClose2, doorsLeftOpen2) = doorsToClose1.partition(entry => { entry.door.Open match { case Some(player) => - Vector3.MagnitudeSquared(entry.door.Position - player.Position) > 15 + // If the player that opened the door is far enough away, or they're dead / backpacked, close the door + var playerIsBackpackInZone = entry.zone.Corpses.contains(player) + Vector3.MagnitudeSquared(entry.door.Position - player.Position) > 25.5 || playerIsBackpackInZone case None => + // Door should not be open. Mark it to be closed. true } })