mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-12 15:04:39 +00:00
repairs to corpse removal task; postStop for vehicle deconstruction; previously unhandled condition for MoveItemMessage logic
This commit is contained in:
parent
3a9058bee9
commit
4e0085eb20
3 changed files with 35 additions and 27 deletions
|
|
@ -304,7 +304,6 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
|
|
||||||
case AvatarResponse.ObjectDelete(item_guid, unk) =>
|
case AvatarResponse.ObjectDelete(item_guid, unk) =>
|
||||||
if(tplayer_guid != guid) {
|
if(tplayer_guid != guid) {
|
||||||
log.info(s"Made to delete item $item_guid")
|
|
||||||
sendResponse(ObjectDeleteMessage(item_guid, unk))
|
sendResponse(ObjectDeleteMessage(item_guid, unk))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2119,7 +2118,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
vehicleService ! VehicleServiceMessage(s"${obj.Actor}", VehicleAction.UnstowEquipment(player.GUID, item_guid))
|
vehicleService ! VehicleServiceMessage(s"${obj.Actor}", VehicleAction.UnstowEquipment(player.GUID, item_guid))
|
||||||
//TODO visible slot verification, in the case of BFR arms
|
//TODO visible slot verification, in the case of BFR arms
|
||||||
case _ => ;
|
case _ => ;
|
||||||
//TODO something?
|
//TODO something?
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -2132,6 +2131,9 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
if(destination.VisibleSlots.contains(dest)) {
|
if(destination.VisibleSlots.contains(dest)) {
|
||||||
avatarService ! AvatarServiceMessage(player.Continent, AvatarAction.EquipmentInHand(destination_guid, dest, item))
|
avatarService ! AvatarServiceMessage(player.Continent, AvatarAction.EquipmentInHand(destination_guid, dest, item))
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
avatarService ! AvatarServiceMessage(continent.Id, AvatarAction.ObjectDelete(player.GUID, item.GUID))
|
||||||
|
}
|
||||||
case _ => ;
|
case _ => ;
|
||||||
//TODO something?
|
//TODO something?
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ class CorpseRemovalActor extends Actor {
|
||||||
|
|
||||||
override def postStop() = {
|
override def postStop() = {
|
||||||
//Cart Master: See you on Thursday.
|
//Cart Master: See you on Thursday.
|
||||||
|
super.postStop()
|
||||||
burial.cancel
|
burial.cancel
|
||||||
decomposition.cancel
|
decomposition.cancel
|
||||||
|
|
||||||
|
|
@ -80,45 +81,41 @@ class CorpseRemovalActor extends Actor {
|
||||||
CorpseRemovalActor.recursiveFindCorpse(corpses.iterator, targets.head) match {
|
CorpseRemovalActor.recursiveFindCorpse(corpses.iterator, targets.head) match {
|
||||||
case None => ;
|
case None => ;
|
||||||
case Some(index) =>
|
case Some(index) =>
|
||||||
if(index == 0) {
|
|
||||||
burial.cancel
|
|
||||||
}
|
|
||||||
decomposition.cancel
|
decomposition.cancel
|
||||||
|
BurialTask(corpses(index))
|
||||||
buriedCorpses = buriedCorpses :+ corpses(index)
|
buriedCorpses = buriedCorpses :+ corpses(index)
|
||||||
corpses = corpses.take(index) ++ corpses.drop(index+1)
|
corpses = corpses.take(index) ++ corpses.drop(index+1)
|
||||||
if(index == 0) {
|
|
||||||
RetimeFirstTask()
|
|
||||||
}
|
|
||||||
import scala.concurrent.ExecutionContext.Implicits.global
|
import scala.concurrent.ExecutionContext.Implicits.global
|
||||||
decomposition = context.system.scheduler.scheduleOnce(500 milliseconds, self, CorpseRemovalActor.TryDelete())
|
decomposition = context.system.scheduler.scheduleOnce(500 milliseconds, self, CorpseRemovalActor.TryDelete())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.debug(s"multiple target corpses submitted for early cleanup: $targets")
|
log.debug(s"multiple target corpses submitted for early cleanup: $targets")
|
||||||
burial.cancel
|
|
||||||
decomposition.cancel
|
decomposition.cancel
|
||||||
//cumbersome partition
|
//cumbersome partition
|
||||||
//a - find targets from corpses
|
//a - find targets from corpses
|
||||||
buriedCorpses = buriedCorpses ++ (for {
|
val locatedTargets = for {
|
||||||
a <- targets
|
a <- targets
|
||||||
b <- corpses
|
b <- corpses
|
||||||
if b.corpse == a &&
|
if b.corpse == a &&
|
||||||
b.corpse.Continent.equals(a.Continent) &&
|
b.corpse.Continent.equals(a.Continent) &&
|
||||||
b.corpse.HasGUID && a.HasGUID && b.corpse.GUID == a.GUID
|
b.corpse.HasGUID && a.HasGUID && b.corpse.GUID == a.GUID
|
||||||
} yield b)
|
} yield b
|
||||||
|
locatedTargets.foreach { BurialTask }
|
||||||
|
buriedCorpses = locatedTargets ++ buriedCorpses
|
||||||
//b - corpses after the found targets are removed (note: cull any non-GUID entries while at it)
|
//b - corpses after the found targets are removed (note: cull any non-GUID entries while at it)
|
||||||
corpses = (for {
|
corpses = (for {
|
||||||
a <- targets
|
a <- locatedTargets.map { _.corpse }
|
||||||
b <- corpses
|
b <- corpses
|
||||||
if b.corpse.HasGUID && a.HasGUID &&
|
if b.corpse.HasGUID && a.HasGUID &&
|
||||||
(b.corpse != a ||
|
(b.corpse != a ||
|
||||||
!b.corpse.Continent.equals(a.Continent) ||
|
!b.corpse.Continent.equals(a.Continent) ||
|
||||||
!b.corpse.HasGUID || !a.HasGUID || b.corpse.GUID != a.GUID)
|
!b.corpse.HasGUID || !a.HasGUID || b.corpse.GUID != a.GUID)
|
||||||
} yield b).sortBy(_.timeAlive)
|
} yield b).sortBy(_.timeAlive)
|
||||||
|
import scala.concurrent.ExecutionContext.Implicits.global
|
||||||
|
decomposition = context.system.scheduler.scheduleOnce(500 milliseconds, self, CorpseRemovalActor.TryDelete())
|
||||||
}
|
}
|
||||||
RetimeFirstTask()
|
RetimeFirstTask()
|
||||||
import scala.concurrent.ExecutionContext.Implicits.global
|
|
||||||
decomposition = context.system.scheduler.scheduleOnce(500 milliseconds, self, CorpseRemovalActor.TryDelete())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case CorpseRemovalActor.StartDelete() =>
|
case CorpseRemovalActor.StartDelete() =>
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,12 @@ class DeconstructionActor extends Actor {
|
||||||
super.postStop()
|
super.postStop()
|
||||||
scrappingProcess.cancel
|
scrappingProcess.cancel
|
||||||
heapEmptyProcess.cancel
|
heapEmptyProcess.cancel
|
||||||
|
|
||||||
|
vehicles.foreach(entry => {
|
||||||
|
RetirementTask(entry)
|
||||||
|
DestructionTask(entry)
|
||||||
|
})
|
||||||
|
vehicleScrapHeap.foreach { DestructionTask }
|
||||||
}
|
}
|
||||||
|
|
||||||
def receive : Receive = {
|
def receive : Receive = {
|
||||||
|
|
@ -89,12 +95,7 @@ class DeconstructionActor extends Actor {
|
||||||
val (vehiclesToScrap, vehiclesRemain) = PartitionEntries(vehicles, now)
|
val (vehiclesToScrap, vehiclesRemain) = PartitionEntries(vehicles, now)
|
||||||
vehicles = vehiclesRemain //entries from original list before partition
|
vehicles = vehiclesRemain //entries from original list before partition
|
||||||
vehicleScrapHeap = vehicleScrapHeap ++ vehiclesToScrap //may include existing entries
|
vehicleScrapHeap = vehicleScrapHeap ++ vehiclesToScrap //may include existing entries
|
||||||
vehiclesToScrap.foreach(entry => {
|
vehiclesToScrap.foreach { RetirementTask }
|
||||||
val vehicle = entry.vehicle
|
|
||||||
val zone = entry.zone
|
|
||||||
zone.Transport ! Zone.Vehicle.Despawn(vehicle)
|
|
||||||
context.parent ! DeconstructionActor.DeleteVehicle(vehicle.GUID, zone.Id) //call up to the main event system
|
|
||||||
})
|
|
||||||
if(vehiclesRemain.nonEmpty) {
|
if(vehiclesRemain.nonEmpty) {
|
||||||
val short_timeout : FiniteDuration = math.max(1, DeconstructionActor.timeout_time - (now - vehiclesRemain.head.time)) nanoseconds
|
val short_timeout : FiniteDuration = math.max(1, DeconstructionActor.timeout_time - (now - vehiclesRemain.head.time)) nanoseconds
|
||||||
import scala.concurrent.ExecutionContext.Implicits.global
|
import scala.concurrent.ExecutionContext.Implicits.global
|
||||||
|
|
@ -109,13 +110,7 @@ class DeconstructionActor extends Actor {
|
||||||
heapEmptyProcess.cancel
|
heapEmptyProcess.cancel
|
||||||
val (vehiclesToScrap, vehiclesRemain) = vehicleScrapHeap.partition(entry => !entry.zone.Vehicles.contains(entry.vehicle))
|
val (vehiclesToScrap, vehiclesRemain) = vehicleScrapHeap.partition(entry => !entry.zone.Vehicles.contains(entry.vehicle))
|
||||||
vehicleScrapHeap = vehiclesRemain
|
vehicleScrapHeap = vehiclesRemain
|
||||||
vehiclesToScrap.foreach(entry => {
|
vehiclesToScrap.foreach { DestructionTask }
|
||||||
val vehicle = entry.vehicle
|
|
||||||
val zone = entry.zone
|
|
||||||
vehicle.Position = Vector3.Zero //somewhere it will not disturb anything
|
|
||||||
taskResolver ! DeconstructionTask(vehicle, zone)
|
|
||||||
})
|
|
||||||
|
|
||||||
if(vehiclesRemain.nonEmpty) {
|
if(vehiclesRemain.nonEmpty) {
|
||||||
import scala.concurrent.ExecutionContext.Implicits.global
|
import scala.concurrent.ExecutionContext.Implicits.global
|
||||||
heapEmptyProcess = context.system.scheduler.scheduleOnce(500 milliseconds, self, DeconstructionActor.TryDeleteVehicle())
|
heapEmptyProcess = context.system.scheduler.scheduleOnce(500 milliseconds, self, DeconstructionActor.TryDeleteVehicle())
|
||||||
|
|
@ -127,6 +122,20 @@ class DeconstructionActor extends Actor {
|
||||||
case _ => ;
|
case _ => ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def RetirementTask(entry : DeconstructionActor.VehicleEntry) : Unit = {
|
||||||
|
val vehicle = entry.vehicle
|
||||||
|
val zone = entry.zone
|
||||||
|
zone.Transport ! Zone.Vehicle.Despawn(vehicle)
|
||||||
|
context.parent ! DeconstructionActor.DeleteVehicle(vehicle.GUID, zone.Id) //call up to the main event system
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a middleman `Task` intended to return error messages to the `DeconstructionActor`.
|
* Construct a middleman `Task` intended to return error messages to the `DeconstructionActor`.
|
||||||
* @param vehicle the `Vehicle` object
|
* @param vehicle the `Vehicle` object
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue