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) =>
if(tplayer_guid != guid) {
log.info(s"Made to delete item $item_guid")
sendResponse(ObjectDeleteMessage(item_guid, unk))
}
@ -2118,7 +2119,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
vehicleService ! VehicleServiceMessage(s"${obj.Actor}", VehicleAction.UnstowEquipment(player.GUID, item_guid))
//TODO visible slot verification, in the case of BFR arms
case _ => ;
//TODO something?
//TODO something?
}
}
@ -2131,9 +2132,6 @@ class WorldSessionActor extends Actor with MDCContextAware {
if(destination.VisibleSlots.contains(dest)) {
avatarService ! AvatarServiceMessage(player.Continent, AvatarAction.EquipmentInHand(destination_guid, dest, item))
}
else {
avatarService ! AvatarServiceMessage(continent.Id, AvatarAction.ObjectDelete(player.GUID, item.GUID))
}
case _ => ;
//TODO something?
}

View file

@ -51,7 +51,7 @@ class CorpseRemovalActor extends Actor {
def Processing : Receive = {
case CorpseRemovalActor.AddCorpse(corpse, zone, time) =>
if(corpse.isBackpack) {
if(corpse.isBackpack && !buriedCorpses.exists(_.corpse == corpse)) {
if(corpses.isEmpty) {
//we were the only entry so the event must be started from scratch
corpses = List(CorpseRemovalActor.Entry(corpse, zone, time))
@ -60,9 +60,11 @@ class CorpseRemovalActor extends Actor {
else {
//unknown number of entries; append, sort, then re-time tasking
val oldHead = corpses.head
corpses = (corpses :+ CorpseRemovalActor.Entry(corpse, zone, time)).sortBy(_.timeAlive)
if(oldHead != corpses.head) {
RetimeFirstTask()
if(!corpses.exists(_.corpse == corpse)) {
corpses = (corpses :+ CorpseRemovalActor.Entry(corpse, zone, time)).sortBy(_.timeAlive)
if(oldHead != corpses.head) {
RetimeFirstTask()
}
}
}
}
@ -103,7 +105,7 @@ class CorpseRemovalActor extends Actor {
} 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 (cull any non-GUID entries while at it)
corpses = (for {
a <- locatedTargets.map { _.corpse }
b <- corpses

View file

@ -67,25 +67,28 @@ class DeconstructionActor extends Actor {
def Processing : Receive = {
case DeconstructionActor.RequestDeleteVehicle(vehicle, zone, time) =>
vehicles = vehicles :+ DeconstructionActor.VehicleEntry(vehicle, zone, time)
vehicle.Actor ! Vehicle.PrepareForDeletion
//kick everyone out; this is a no-blocking manual form of MountableBehavior ! Mountable.TryDismount
vehicle.Definition.MountPoints.values.foreach(seat_num => {
val zone_id : String = zone.Id
val seat : Seat = vehicle.Seat(seat_num).get
seat.Occupant match {
case Some(tplayer) =>
seat.Occupant = None
tplayer.VehicleSeated = None
if(tplayer.HasGUID) {
context.parent ! VehicleServiceMessage(zone_id, VehicleAction.KickPassenger(tplayer.GUID, 4, false, vehicle.GUID))
}
case None => ;
if(!vehicles.exists(_.vehicle == vehicle) && !vehicleScrapHeap.exists(_.vehicle == vehicle)) {
vehicles = vehicles :+ DeconstructionActor.VehicleEntry(vehicle, zone, time)
vehicle.Actor ! Vehicle.PrepareForDeletion
//kick everyone out; this is a no-blocking manual form of MountableBehavior ! Mountable.TryDismount
vehicle.Definition.MountPoints.values.foreach(seat_num => {
val zone_id : String = zone.Id
val seat : Seat = vehicle.Seat(seat_num).get
seat.Occupant match {
case Some(tplayer) =>
seat.Occupant = None
tplayer.VehicleSeated = None
if(tplayer.HasGUID) {
context.parent ! VehicleServiceMessage(zone_id, VehicleAction.KickPassenger(tplayer.GUID, 4, false, vehicle.GUID))
}
case None => ;
}
})
if(vehicles.size == 1) {
//we were the only entry so the event must be started from scratch
import scala.concurrent.ExecutionContext.Implicits.global
scrappingProcess = context.system.scheduler.scheduleOnce(DeconstructionActor.timeout, self, DeconstructionActor.StartDeleteVehicle())
}
})
if(vehicles.size == 1) { //we were the only entry so the event must be started from scratch
import scala.concurrent.ExecutionContext.Implicits.global
scrappingProcess = context.system.scheduler.scheduleOnce(DeconstructionActor.timeout, self, DeconstructionActor.StartDeleteVehicle())
}
case DeconstructionActor.StartDeleteVehicle() =>

View file

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