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
This commit is contained in:
Mazo 2019-05-06 13:46:55 +01:00 committed by Fate-JH
parent 5209f9ec21
commit 78eb7906c9

View file

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