From def736194c27e16d164de5f9dd0987f941530544 Mon Sep 17 00:00:00 2001 From: Mazo Date: Mon, 21 May 2018 06:48:18 +0100 Subject: [PATCH] Automatically despawn vehicles capable of flight if the driver bails out as a temporary fix for aircraft floating in the air with no pilot --- pslogin/src/main/scala/WorldSessionActor.scala | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pslogin/src/main/scala/WorldSessionActor.scala b/pslogin/src/main/scala/WorldSessionActor.scala index c792a49aa..3b1ce7b1c 100644 --- a/pslogin/src/main/scala/WorldSessionActor.scala +++ b/pslogin/src/main/scala/WorldSessionActor.scala @@ -2448,6 +2448,14 @@ class WorldSessionActor extends Actor with MDCContextAware { obj.PassengerInSeat(player) match { case Some(seat_num : Int) => obj.Actor ! Mountable.TryDismount(player, seat_num) + + // Deconstruct the vehicle if the driver has bailed out and the vehicle is capable of flight + //todo: implement auto landing procedure if the pilot bails but passengers are still present instead of deconstructing the vehicle + //todo: continue flight path until aircraft crashes if no passengers present (or no passenger seats), then deconstruct. + if(bailType == BailType.Bailed && seat_num == 0 && GlobalDefinitions.isFlightVehicle(obj.asInstanceOf[Vehicle].Definition)) { + vehicleService ! VehicleServiceMessage.DelayedVehicleDeconstruction(obj.asInstanceOf[Vehicle], continent, 0L) // Immediately deconstruct vehicle + } + case None => dismountWarning(s"DismountVehicleMsg: can not find where player $player_guid is seated in mountable $obj_guid") }