mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-10 22:14:36 +00:00
fixed timing in tests
This commit is contained in:
parent
4e0085eb20
commit
dab6a4db94
4 changed files with 33 additions and 30 deletions
|
|
@ -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))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2118,7 +2119,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?
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -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?
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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,9 +60,11 @@ 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
|
||||||
corpses = (corpses :+ CorpseRemovalActor.Entry(corpse, zone, time)).sortBy(_.timeAlive)
|
if(!corpses.exists(_.corpse == corpse)) {
|
||||||
if(oldHead != corpses.head) {
|
corpses = (corpses :+ CorpseRemovalActor.Entry(corpse, zone, time)).sortBy(_.timeAlive)
|
||||||
RetimeFirstTask()
|
if(oldHead != corpses.head) {
|
||||||
|
RetimeFirstTask()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -67,25 +67,28 @@ class DeconstructionActor extends Actor {
|
||||||
|
|
||||||
def Processing : Receive = {
|
def Processing : Receive = {
|
||||||
case DeconstructionActor.RequestDeleteVehicle(vehicle, zone, time) =>
|
case DeconstructionActor.RequestDeleteVehicle(vehicle, zone, time) =>
|
||||||
vehicles = vehicles :+ DeconstructionActor.VehicleEntry(vehicle, zone, time)
|
if(!vehicles.exists(_.vehicle == vehicle) && !vehicleScrapHeap.exists(_.vehicle == vehicle)) {
|
||||||
vehicle.Actor ! Vehicle.PrepareForDeletion
|
vehicles = vehicles :+ DeconstructionActor.VehicleEntry(vehicle, zone, time)
|
||||||
//kick everyone out; this is a no-blocking manual form of MountableBehavior ! Mountable.TryDismount
|
vehicle.Actor ! Vehicle.PrepareForDeletion
|
||||||
vehicle.Definition.MountPoints.values.foreach(seat_num => {
|
//kick everyone out; this is a no-blocking manual form of MountableBehavior ! Mountable.TryDismount
|
||||||
val zone_id : String = zone.Id
|
vehicle.Definition.MountPoints.values.foreach(seat_num => {
|
||||||
val seat : Seat = vehicle.Seat(seat_num).get
|
val zone_id : String = zone.Id
|
||||||
seat.Occupant match {
|
val seat : Seat = vehicle.Seat(seat_num).get
|
||||||
case Some(tplayer) =>
|
seat.Occupant match {
|
||||||
seat.Occupant = None
|
case Some(tplayer) =>
|
||||||
tplayer.VehicleSeated = None
|
seat.Occupant = None
|
||||||
if(tplayer.HasGUID) {
|
tplayer.VehicleSeated = None
|
||||||
context.parent ! VehicleServiceMessage(zone_id, VehicleAction.KickPassenger(tplayer.GUID, 4, false, vehicle.GUID))
|
if(tplayer.HasGUID) {
|
||||||
}
|
context.parent ! VehicleServiceMessage(zone_id, VehicleAction.KickPassenger(tplayer.GUID, 4, false, vehicle.GUID))
|
||||||
case None => ;
|
}
|
||||||
|
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() =>
|
case DeconstructionActor.StartDeleteVehicle() =>
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue