fixed timing in tests

This commit is contained in:
FateJH 2018-05-06 21:25:14 -04:00
parent 4e0085eb20
commit dab6a4db94
4 changed files with 33 additions and 30 deletions

View file

@ -304,6 +304,7 @@ 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))
} }
@ -2131,9 +2132,6 @@ 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?
} }

View file

@ -51,7 +51,7 @@ class CorpseRemovalActor extends Actor {
def Processing : Receive = { def Processing : Receive = {
case CorpseRemovalActor.AddCorpse(corpse, zone, time) => case CorpseRemovalActor.AddCorpse(corpse, zone, time) =>
if(corpse.isBackpack) { if(corpse.isBackpack && !buriedCorpses.exists(_.corpse == corpse)) {
if(corpses.isEmpty) { if(corpses.isEmpty) {
//we were the only entry so the event must be started from scratch //we were the only entry so the event must be started from scratch
corpses = List(CorpseRemovalActor.Entry(corpse, zone, time)) corpses = List(CorpseRemovalActor.Entry(corpse, zone, time))
@ -60,12 +60,14 @@ class CorpseRemovalActor extends Actor {
else { else {
//unknown number of entries; append, sort, then re-time tasking //unknown number of entries; append, sort, then re-time tasking
val oldHead = corpses.head val oldHead = corpses.head
if(!corpses.exists(_.corpse == corpse)) {
corpses = (corpses :+ CorpseRemovalActor.Entry(corpse, zone, time)).sortBy(_.timeAlive) corpses = (corpses :+ CorpseRemovalActor.Entry(corpse, zone, time)).sortBy(_.timeAlive)
if(oldHead != corpses.head) { if(oldHead != corpses.head) {
RetimeFirstTask() RetimeFirstTask()
} }
} }
} }
}
else { else {
//Cart Master: 'Ere. He says he's not dead! //Cart Master: 'Ere. He says he's not dead!
log.warn(s"$corpse does not qualify as a corpse; ignored queueing request") log.warn(s"$corpse does not qualify as a corpse; ignored queueing request")
@ -103,7 +105,7 @@ class CorpseRemovalActor extends Actor {
} yield b } yield b
locatedTargets.foreach { BurialTask } locatedTargets.foreach { BurialTask }
buriedCorpses = locatedTargets ++ buriedCorpses 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 (cull any non-GUID entries while at it)
corpses = (for { corpses = (for {
a <- locatedTargets.map { _.corpse } a <- locatedTargets.map { _.corpse }
b <- corpses b <- corpses

View file

@ -67,6 +67,7 @@ class DeconstructionActor extends Actor {
def Processing : Receive = { def Processing : Receive = {
case DeconstructionActor.RequestDeleteVehicle(vehicle, zone, time) => case DeconstructionActor.RequestDeleteVehicle(vehicle, zone, time) =>
if(!vehicles.exists(_.vehicle == vehicle) && !vehicleScrapHeap.exists(_.vehicle == vehicle)) {
vehicles = vehicles :+ DeconstructionActor.VehicleEntry(vehicle, zone, time) vehicles = vehicles :+ DeconstructionActor.VehicleEntry(vehicle, zone, time)
vehicle.Actor ! Vehicle.PrepareForDeletion vehicle.Actor ! Vehicle.PrepareForDeletion
//kick everyone out; this is a no-blocking manual form of MountableBehavior ! Mountable.TryDismount //kick everyone out; this is a no-blocking manual form of MountableBehavior ! Mountable.TryDismount
@ -83,10 +84,12 @@ class DeconstructionActor extends Actor {
case None => ; case None => ;
} }
}) })
if(vehicles.size == 1) { //we were the only entry so the event must be started from scratch if(vehicles.size == 1) {
//we were the only entry so the event must be started from scratch
import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.ExecutionContext.Implicits.global
scrappingProcess = context.system.scheduler.scheduleOnce(DeconstructionActor.timeout, self, DeconstructionActor.StartDeleteVehicle()) scrappingProcess = context.system.scheduler.scheduleOnce(DeconstructionActor.timeout, self, DeconstructionActor.StartDeleteVehicle())
} }
}
case DeconstructionActor.StartDeleteVehicle() => case DeconstructionActor.StartDeleteVehicle() =>
scrappingProcess.cancel scrappingProcess.cancel

View file

@ -329,7 +329,7 @@ class AvatarReleaseTest extends ActorTest {
assert(reply2msg.replyMessage.isInstanceOf[AvatarResponse.ObjectDelete]) assert(reply2msg.replyMessage.isInstanceOf[AvatarResponse.ObjectDelete])
assert(reply2msg.replyMessage.asInstanceOf[AvatarResponse.ObjectDelete].item_guid == guid) assert(reply2msg.replyMessage.asInstanceOf[AvatarResponse.ObjectDelete].item_guid == guid)
expectNoMsg(200 milliseconds) expectNoMsg(1000 milliseconds)
assert(zone.Corpses.isEmpty) assert(zone.Corpses.isEmpty)
assert(!obj.HasGUID) assert(!obj.HasGUID)
} }
@ -379,7 +379,7 @@ class AvatarReleaseEarly1Test extends ActorTest {
assert(reply2msg.replyMessage.isInstanceOf[AvatarResponse.ObjectDelete]) assert(reply2msg.replyMessage.isInstanceOf[AvatarResponse.ObjectDelete])
assert(reply2msg.replyMessage.asInstanceOf[AvatarResponse.ObjectDelete].item_guid == guid) assert(reply2msg.replyMessage.asInstanceOf[AvatarResponse.ObjectDelete].item_guid == guid)
expectNoMsg(200 milliseconds) expectNoMsg(600 milliseconds)
assert(zone.Corpses.isEmpty) assert(zone.Corpses.isEmpty)
assert(!obj.HasGUID) assert(!obj.HasGUID)
} }
@ -430,7 +430,7 @@ class AvatarReleaseEarly2Test extends ActorTest {
assert(reply2msg.replyMessage.isInstanceOf[AvatarResponse.ObjectDelete]) assert(reply2msg.replyMessage.isInstanceOf[AvatarResponse.ObjectDelete])
assert(reply2msg.replyMessage.asInstanceOf[AvatarResponse.ObjectDelete].item_guid == guid) assert(reply2msg.replyMessage.asInstanceOf[AvatarResponse.ObjectDelete].item_guid == guid)
expectNoMsg(200 milliseconds) expectNoMsg(600 milliseconds)
assert(zone.Corpses.isEmpty) assert(zone.Corpses.isEmpty)
assert(!obj.HasGUID) assert(!obj.HasGUID)
} }