rebased to master/v-spawn-pad-redo; added ams spawn refresh when vehicle is deconstructed

This commit is contained in:
FateJH 2018-05-05 23:13:28 -04:00
parent e00202e8fb
commit 552206974e
2 changed files with 16 additions and 5 deletions

View file

@ -1300,7 +1300,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
else {
Vector3(0, 0, (z - 90) % 360)
}
pos = if(x >= 330) {
pos = if(x >= 330) { //leaning to the left
pos + Vector3(0, 0, xsin)
}
else {

View file

@ -2,7 +2,7 @@
package services.vehicle.support
import akka.actor.{Actor, ActorRef, Cancellable}
import net.psforever.objects.{DefaultCancellable, Vehicle}
import net.psforever.objects.{DefaultCancellable, GlobalDefinitions, Vehicle}
import net.psforever.objects.guid.TaskResolver
import net.psforever.objects.vehicles.Seat
import net.psforever.objects.zones.Zone
@ -96,9 +96,20 @@ class DeconstructionActor extends Actor {
heapEmptyProcess.cancel
val now : Long = System.nanoTime
val (vehiclesToScrap, vehiclesRemain) = PartitionEntries(vehicles, now)
vehicles = vehiclesRemain //entries from original list before partition
vehicles = vehiclesRemain
vehicleScrapHeap = vehicleScrapHeap ++ vehiclesToScrap //may include existing entries
vehiclesToScrap.foreach { RetirementTask }
vehiclesToScrap.foreach(entry => {
val vehicle = entry.vehicle
val zone = entry.zone
RetirementTask(entry)
if(vehicle.Definition == GlobalDefinitions.ams) {
import net.psforever.types.DriveState
vehicle.DeploymentState = DriveState.Mobile //internally undeployed //TODO this should be temporary?
context.parent ! VehicleServiceMessage.AMSDeploymentChange(zone)
}
taskResolver ! DeconstructionTask(vehicle, zone)
})
if(vehiclesRemain.nonEmpty) {
val short_timeout : FiniteDuration = math.max(1, DeconstructionActor.timeout_time - (now - vehiclesRemain.head.time)) nanoseconds
import scala.concurrent.ExecutionContext.Implicits.global
@ -128,6 +139,7 @@ class DeconstructionActor extends Actor {
def RetirementTask(entry : DeconstructionActor.VehicleEntry) : Unit = {
val vehicle = entry.vehicle
val zone = entry.zone
vehicle.Position = Vector3.Zero //somewhere it will not disturb anything
zone.Transport ! Zone.Vehicle.Despawn(vehicle)
context.parent ! DeconstructionActor.DeleteVehicle(vehicle.GUID, zone.Id) //call up to the main event system
}
@ -135,7 +147,6 @@ class DeconstructionActor extends Actor {
def DestructionTask(entry : DeconstructionActor.VehicleEntry) : Unit = {
val vehicle = entry.vehicle
val zone = entry.zone
vehicle.Position = Vector3.Zero //somewhere it will not disturb anything
taskResolver ! DeconstructionTask(vehicle, zone)
}