mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-04-21 03:45:19 +00:00
adjusted CommonFieldData to support jammering effect flag; fixed tests; made jammering sound and status contingent on state, but made cancelling sound and status always call up
This commit is contained in:
parent
879be93863
commit
6c76997675
33 changed files with 518 additions and 353 deletions
|
|
@ -29,7 +29,7 @@ class AegisShieldGeneratorDataTest extends Specification {
|
|||
basic.data.alternate mustEqual false
|
||||
basic.data.v1 mustEqual true
|
||||
basic.data.v2.isDefined mustEqual false
|
||||
basic.data.v3 mustEqual false
|
||||
basic.data.jammered mustEqual false
|
||||
basic.data.v5.isDefined mustEqual false
|
||||
basic.data.guid mustEqual PlanetSideGUID(2366)
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class CharacterDataTest extends Specification {
|
|||
a.data.bops mustEqual false
|
||||
a.data.v1 mustEqual false
|
||||
a.data.v2.isEmpty mustEqual true
|
||||
a.data.v3 mustEqual false
|
||||
a.data.jammered mustEqual false
|
||||
a.data.v4.isEmpty mustEqual true
|
||||
a.data.v5.isEmpty mustEqual true
|
||||
a.exosuit mustEqual ExoSuitType.Reinforced
|
||||
|
|
@ -162,7 +162,7 @@ class CharacterDataTest extends Specification {
|
|||
a.data.bops mustEqual false
|
||||
a.data.v1 mustEqual false
|
||||
a.data.v2.isEmpty mustEqual true
|
||||
a.data.v3 mustEqual false
|
||||
a.data.jammered mustEqual false
|
||||
a.data.v4.isEmpty mustEqual true
|
||||
a.data.v5.isEmpty mustEqual true
|
||||
a.exosuit mustEqual ExoSuitType.Reinforced
|
||||
|
|
@ -231,7 +231,7 @@ class CharacterDataTest extends Specification {
|
|||
a.data.bops mustEqual false
|
||||
a.data.v1 mustEqual false
|
||||
a.data.v2.isEmpty mustEqual true
|
||||
a.data.v3 mustEqual false
|
||||
a.data.jammered mustEqual false
|
||||
a.data.v4.isEmpty mustEqual true
|
||||
a.data.v5.isEmpty mustEqual true
|
||||
a.exosuit mustEqual ExoSuitType.MAX
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class OneMannedFieldTurretDataTest extends Specification {
|
|||
deploy.alternate mustEqual false
|
||||
deploy.v1 mustEqual true
|
||||
deploy.v2.isEmpty mustEqual true
|
||||
deploy.v3 mustEqual false
|
||||
deploy.jammered mustEqual false
|
||||
deploy.v4.contains(false) mustEqual true
|
||||
deploy.v5.isEmpty mustEqual true
|
||||
deploy.guid mustEqual PlanetSideGUID(2502)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class RemoteProjectileDataTest extends Specification {
|
|||
deploy.alternate mustEqual false
|
||||
deploy.v1 mustEqual true
|
||||
deploy.v2.isEmpty mustEqual true
|
||||
deploy.v3 mustEqual false
|
||||
deploy.jammered mustEqual false
|
||||
deploy.v4.isEmpty mustEqual true
|
||||
deploy.v5.isEmpty mustEqual true
|
||||
deploy.guid mustEqual PlanetSideGUID(0)
|
||||
|
|
@ -63,7 +63,7 @@ class RemoteProjectileDataTest extends Specification {
|
|||
deploy.alternate mustEqual false
|
||||
deploy.v1 mustEqual true
|
||||
deploy.v2.isEmpty mustEqual true
|
||||
deploy.v3 mustEqual false
|
||||
deploy.jammered mustEqual false
|
||||
deploy.v4.isEmpty mustEqual true
|
||||
deploy.v5.isEmpty mustEqual true
|
||||
deploy.guid mustEqual PlanetSideGUID(0)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class SmallTurretDataTest extends Specification {
|
|||
deploy.alternate mustEqual true
|
||||
deploy.v1 mustEqual true
|
||||
deploy.v2.isEmpty mustEqual true
|
||||
deploy.v3 mustEqual false
|
||||
deploy.jammered mustEqual false
|
||||
deploy.v4.contains(false) mustEqual true
|
||||
deploy.v5.isEmpty mustEqual true
|
||||
deploy.guid mustEqual PlanetSideGUID(7742)
|
||||
|
|
@ -61,7 +61,7 @@ class SmallTurretDataTest extends Specification {
|
|||
deploy.alternate mustEqual false
|
||||
deploy.v1 mustEqual true
|
||||
deploy.v2.isEmpty mustEqual true
|
||||
deploy.v3 mustEqual false
|
||||
deploy.jammered mustEqual false
|
||||
deploy.v4.contains(true) mustEqual true
|
||||
deploy.v5.isEmpty mustEqual true
|
||||
deploy.guid mustEqual PlanetSideGUID(8208)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class TRAPDataTest extends Specification {
|
|||
deploy.alternate mustEqual false
|
||||
deploy.v1 mustEqual true
|
||||
deploy.v2.isEmpty mustEqual true
|
||||
deploy.v3 mustEqual false
|
||||
deploy.jammered mustEqual false
|
||||
deploy.v4.contains(true) mustEqual true
|
||||
deploy.v5.isEmpty mustEqual true
|
||||
deploy.guid mustEqual PlanetSideGUID(4748)
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class DetailedCharacterDataTest extends Specification {
|
|||
a.data.bops mustEqual false
|
||||
a.data.v1 mustEqual true
|
||||
a.data.v2.isEmpty mustEqual true
|
||||
a.data.v3 mustEqual false
|
||||
a.data.jammered mustEqual false
|
||||
a.data.v4.isEmpty mustEqual true
|
||||
a.data.v5.isEmpty mustEqual true
|
||||
a.exosuit mustEqual ExoSuitType.Standard
|
||||
|
|
@ -259,7 +259,7 @@ class DetailedCharacterDataTest extends Specification {
|
|||
a.data.bops mustEqual false
|
||||
a.data.v1 mustEqual false
|
||||
a.data.v2.isEmpty mustEqual true
|
||||
a.data.v3 mustEqual false
|
||||
a.data.jammered mustEqual false
|
||||
a.data.v4.isEmpty mustEqual true
|
||||
a.data.v5.isEmpty mustEqual true
|
||||
a.exosuit mustEqual ExoSuitType.Standard
|
||||
|
|
@ -444,7 +444,7 @@ class DetailedCharacterDataTest extends Specification {
|
|||
a.data.bops mustEqual false
|
||||
a.data.v1 mustEqual true
|
||||
a.data.v2.isEmpty mustEqual true
|
||||
a.data.v3 mustEqual false
|
||||
a.data.jammered mustEqual false
|
||||
a.data.v4.isEmpty mustEqual true
|
||||
a.data.v5.isEmpty mustEqual true
|
||||
a.exosuit mustEqual ExoSuitType.MAX
|
||||
|
|
@ -652,7 +652,7 @@ class DetailedCharacterDataTest extends Specification {
|
|||
a.data.bops mustEqual false
|
||||
a.data.v1 mustEqual true
|
||||
a.data.v2.isEmpty mustEqual true
|
||||
a.data.v3 mustEqual false
|
||||
a.data.jammered mustEqual false
|
||||
a.data.v4.isEmpty mustEqual true
|
||||
a.data.v5.isEmpty mustEqual true
|
||||
a.exosuit mustEqual ExoSuitType.Agile
|
||||
|
|
@ -1104,7 +1104,7 @@ class DetailedCharacterDataTest extends Specification {
|
|||
cdata.data.alternate mustEqual false
|
||||
cdata.data.v1 mustEqual true
|
||||
cdata.data.v2.isEmpty mustEqual true
|
||||
cdata.data.v3 mustEqual false
|
||||
cdata.data.jammered mustEqual false
|
||||
cdata.data.v4.isEmpty mustEqual true
|
||||
cdata.data.v5.isEmpty mustEqual true
|
||||
cdata.data.guid mustEqual PlanetSideGUID(0)
|
||||
|
|
@ -1160,7 +1160,7 @@ class DetailedCharacterDataTest extends Specification {
|
|||
a.data.alternate mustEqual false
|
||||
a.data.v1 mustEqual false
|
||||
a.data.v2.isEmpty mustEqual true
|
||||
a.data.v3 mustEqual false
|
||||
a.data.jammered mustEqual false
|
||||
a.data.v4.isEmpty mustEqual true
|
||||
a.data.v5.isEmpty mustEqual true
|
||||
a.exosuit mustEqual ExoSuitType.Standard
|
||||
|
|
@ -1310,7 +1310,7 @@ class DetailedCharacterDataTest extends Specification {
|
|||
a.data.alternate mustEqual false
|
||||
a.data.v1 mustEqual false
|
||||
a.data.v2.isEmpty mustEqual true
|
||||
a.data.v3 mustEqual false
|
||||
a.data.jammered mustEqual false
|
||||
a.data.v4.isEmpty mustEqual true
|
||||
a.data.v5.isEmpty mustEqual true
|
||||
a.exosuit mustEqual ExoSuitType.Standard
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class DetailedConstructionToolDataTest extends Specification {
|
|||
cdata.alternate mustEqual false
|
||||
cdata.v1 mustEqual true
|
||||
cdata.v2.isEmpty mustEqual true
|
||||
cdata.v3 mustEqual false
|
||||
cdata.jammered mustEqual false
|
||||
cdata.v4.isEmpty mustEqual true
|
||||
cdata.v5.isEmpty mustEqual true
|
||||
cdata.guid mustEqual PlanetSideGUID(0)
|
||||
|
|
@ -71,7 +71,7 @@ class DetailedConstructionToolDataTest extends Specification {
|
|||
cdata.alternate mustEqual false
|
||||
cdata.v1 mustEqual true
|
||||
cdata.v2.isEmpty mustEqual true
|
||||
cdata.v3 mustEqual false
|
||||
cdata.jammered mustEqual false
|
||||
cdata.v4.isEmpty mustEqual true
|
||||
cdata.v5.isEmpty mustEqual true
|
||||
cdata.guid mustEqual PlanetSideGUID(0)
|
||||
|
|
@ -111,7 +111,7 @@ class DetailedConstructionToolDataTest extends Specification {
|
|||
cdata.alternate mustEqual false
|
||||
cdata.v1 mustEqual true
|
||||
cdata.v2.isEmpty mustEqual true
|
||||
cdata.v3 mustEqual false
|
||||
cdata.jammered mustEqual false
|
||||
cdata.v4.isEmpty mustEqual true
|
||||
cdata.v5.contains(564) mustEqual true
|
||||
cdata.guid mustEqual PlanetSideGUID(0)
|
||||
|
|
@ -139,7 +139,7 @@ class DetailedConstructionToolDataTest extends Specification {
|
|||
cdata.alternate mustEqual false
|
||||
cdata.v1 mustEqual false
|
||||
cdata.v2.isEmpty mustEqual true
|
||||
cdata.v3 mustEqual false
|
||||
cdata.jammered mustEqual false
|
||||
cdata.v4.isEmpty mustEqual true
|
||||
cdata.v5.isEmpty mustEqual true
|
||||
cdata.guid mustEqual PlanetSideGUID(0)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class MountedVehiclesTest extends Specification {
|
|||
vdata.data.bops mustEqual false
|
||||
vdata.data.alternate mustEqual false
|
||||
vdata.data.v1 mustEqual false
|
||||
vdata.data.v3 mustEqual false
|
||||
vdata.data.jammered mustEqual false
|
||||
vdata.data.v5.isEmpty mustEqual true
|
||||
vdata.data.guid mustEqual PlanetSideGUID(3776)
|
||||
vdata.health mustEqual 255
|
||||
|
|
@ -57,7 +57,7 @@ class MountedVehiclesTest extends Specification {
|
|||
a.data.bops mustEqual false
|
||||
a.data.v1 mustEqual false
|
||||
a.data.v2.isEmpty mustEqual true
|
||||
a.data.v3 mustEqual false
|
||||
a.data.jammered mustEqual false
|
||||
a.data.v4.isEmpty mustEqual true
|
||||
a.data.v5.isEmpty mustEqual true
|
||||
a.exosuit mustEqual ExoSuitType.Agile
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class NonstandardVehiclesTest extends Specification {
|
|||
basic.data.alternate mustEqual false
|
||||
basic.data.v1 mustEqual true
|
||||
basic.data.v2.isDefined mustEqual false
|
||||
basic.data.v3 mustEqual false
|
||||
basic.data.jammered mustEqual false
|
||||
basic.data.v5.isDefined mustEqual false
|
||||
basic.data.guid mustEqual PlanetSideGUID(0)
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ class NormalVehiclesTest extends Specification {
|
|||
vdata.faction mustEqual PlanetSideEmpire.NC
|
||||
vdata.alternate mustEqual false
|
||||
vdata.v1 mustEqual true
|
||||
vdata.v3 mustEqual false
|
||||
vdata.jammered mustEqual false
|
||||
vdata.v5.isEmpty mustEqual true
|
||||
vdata.guid mustEqual PlanetSideGUID(0)
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class UtilityVehiclesTest extends Specification {
|
|||
ant.data.faction mustEqual PlanetSideEmpire.VS
|
||||
ant.data.alternate mustEqual false
|
||||
ant.data.v1 mustEqual true
|
||||
ant.data.v3 mustEqual false
|
||||
ant.data.jammered mustEqual false
|
||||
ant.data.v5.isEmpty mustEqual true
|
||||
ant.data.guid mustEqual PlanetSideGUID(0)
|
||||
ant.driveState mustEqual DriveState.Mobile
|
||||
|
|
@ -59,7 +59,7 @@ class UtilityVehiclesTest extends Specification {
|
|||
ams.data.faction mustEqual PlanetSideEmpire.VS
|
||||
ams.data.alternate mustEqual false
|
||||
ams.data.v1 mustEqual false
|
||||
ams.data.v3 mustEqual false
|
||||
ams.data.jammered mustEqual false
|
||||
ams.data.v5.isEmpty mustEqual true
|
||||
ams.data.guid mustEqual PlanetSideGUID(2885)
|
||||
ams.driveState mustEqual DriveState.Deployed
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
package objects
|
||||
|
||||
import akka.actor.Props
|
||||
import akka.testkit.TestProbe
|
||||
import base.ActorTest
|
||||
import net.psforever.objects._
|
||||
import net.psforever.objects.ballistics.{PlayerSource, Projectile, ProjectileResolution, ResolvedProjectile}
|
||||
|
|
@ -9,9 +10,11 @@ import net.psforever.objects.definition.{SeatDefinition, VehicleDefinition}
|
|||
import net.psforever.objects.serverobject.mount.Mountable
|
||||
import net.psforever.objects.vehicles._
|
||||
import net.psforever.objects.vital.{VehicleShieldCharge, Vitality}
|
||||
import net.psforever.objects.zones.{Zone, ZoneMap}
|
||||
import net.psforever.packet.game.PlanetSideGUID
|
||||
import net.psforever.types._
|
||||
import org.specs2.mutable._
|
||||
import services.vehicle.{VehicleAction, VehicleServiceMessage}
|
||||
|
||||
import scala.concurrent.duration._
|
||||
|
||||
|
|
@ -324,66 +327,82 @@ class VehicleControlStopMountingTest extends ActorTest {
|
|||
val vehicle = Vehicle(GlobalDefinitions.two_man_assault_buggy)
|
||||
vehicle.GUID = PlanetSideGUID(3)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
vehicle.Zone = new Zone("test", new ZoneMap("test"), 0) {
|
||||
VehicleEvents = new TestProbe(system).ref //necessary
|
||||
}
|
||||
vehicle.Weapons(2).Equipment.get.GUID = PlanetSideGUID(4)
|
||||
val probe = new TestProbe(system)
|
||||
|
||||
vehicle.Actor ! Mountable.TryMount(player1, 0)
|
||||
val reply = receiveOne(Duration.create(100, "ms"))
|
||||
vehicle.Actor.tell(Mountable.TryMount(player1, 0), probe.ref)
|
||||
val reply = probe.receiveOne(Duration.create(200, "ms"))
|
||||
assert(reply.isInstanceOf[Mountable.MountMessages])
|
||||
|
||||
vehicle.Actor ! Vehicle.PrepareForDeletion
|
||||
vehicle.Actor ! Mountable.TryMount(player2, 1)
|
||||
expectNoMsg(Duration.create(200, "ms"))
|
||||
vehicle.Actor.tell(Vehicle.PrepareForDeletion(), probe.ref)
|
||||
vehicle.Actor.tell(Mountable.TryMount(player2, 1), probe.ref)
|
||||
probe.expectNoMsg(Duration.create(200, "ms")) //assertion failed: received unexpected message MountMessages(CanMount
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class VehicleControlRestartMountingTest extends ActorTest {
|
||||
val player1 = Player(VehicleTest.avatar1)
|
||||
player1.GUID = PlanetSideGUID(1)
|
||||
val player2 = Player(VehicleTest.avatar2)
|
||||
player2.GUID = PlanetSideGUID(2)
|
||||
val vehicle = Vehicle(GlobalDefinitions.two_man_assault_buggy)
|
||||
vehicle.GUID = PlanetSideGUID(3)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
vehicle.Zone = new Zone("test", new ZoneMap("test"), 0) {
|
||||
VehicleEvents = new TestProbe(system).ref
|
||||
}
|
||||
vehicle.Weapons(2).Equipment.get.GUID = PlanetSideGUID(4)
|
||||
val probe = new TestProbe(system)
|
||||
|
||||
"Vehicle Control" should {
|
||||
"reactivate and resume handling mount messages" in {
|
||||
val player1 = Player(VehicleTest.avatar1)
|
||||
player1.GUID = PlanetSideGUID(1)
|
||||
val player2 = Player(VehicleTest.avatar2)
|
||||
player2.GUID = PlanetSideGUID(2)
|
||||
val vehicle = Vehicle(GlobalDefinitions.two_man_assault_buggy)
|
||||
vehicle.GUID = PlanetSideGUID(3)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
vehicle.Actor.tell(Mountable.TryMount(player1, 0), probe.ref)
|
||||
probe.receiveOne(Duration.create(200, "ms")) //discard
|
||||
vehicle.Actor.tell(Vehicle.PrepareForDeletion(), probe.ref)
|
||||
vehicle.Actor.tell(Mountable.TryMount(player2, 1), probe.ref)
|
||||
probe.expectNoMsg(Duration.create(200, "ms"))
|
||||
|
||||
vehicle.Actor ! Mountable.TryMount(player1, 0)
|
||||
receiveOne(Duration.create(100, "ms")) //discard
|
||||
vehicle.Actor ! Vehicle.PrepareForDeletion
|
||||
vehicle.Actor ! Mountable.TryMount(player2, 1)
|
||||
expectNoMsg(Duration.create(200, "ms"))
|
||||
|
||||
vehicle.Actor ! Vehicle.Reactivate
|
||||
vehicle.Actor ! Mountable.TryMount(player2, 1)
|
||||
val reply = receiveOne(Duration.create(100, "ms"))
|
||||
vehicle.Actor.tell(Vehicle.Reactivate(), probe.ref)
|
||||
vehicle.Actor.tell(Mountable.TryMount(player2, 1), probe.ref)
|
||||
val reply = probe.receiveOne(Duration.create(200, "ms"))
|
||||
assert(reply.isInstanceOf[Mountable.MountMessages])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class VehicleControlAlwaysDismountTest extends ActorTest {
|
||||
val probe = new TestProbe(system)
|
||||
val player1 = Player(VehicleTest.avatar1)
|
||||
player1.GUID = PlanetSideGUID(1)
|
||||
val player2 = Player(VehicleTest.avatar2)
|
||||
player2.GUID = PlanetSideGUID(2)
|
||||
val vehicle = Vehicle(GlobalDefinitions.two_man_assault_buggy)
|
||||
vehicle.GUID = PlanetSideGUID(3)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
vehicle.Zone = new Zone("test", new ZoneMap("test"), 0) {
|
||||
VehicleEvents = new TestProbe(system).ref
|
||||
}
|
||||
vehicle.Weapons(2).Equipment.get.GUID = PlanetSideGUID(4)
|
||||
|
||||
"Vehicle Control" should {
|
||||
"always allow dismount messages" in {
|
||||
val player1 = Player(VehicleTest.avatar1)
|
||||
player1.GUID = PlanetSideGUID(1)
|
||||
val player2 = Player(VehicleTest.avatar2)
|
||||
player2.GUID = PlanetSideGUID(2)
|
||||
val vehicle = Vehicle(GlobalDefinitions.two_man_assault_buggy)
|
||||
vehicle.GUID = PlanetSideGUID(3)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
vehicle.Actor ! Mountable.TryMount(player1, 0)
|
||||
receiveOne(Duration.create(100, "ms")) //discard
|
||||
vehicle.Actor ! Mountable.TryMount(player2, 1)
|
||||
receiveOne(Duration.create(100, "ms")) //discard
|
||||
vehicle.Actor.tell(Mountable.TryMount(player1, 0), probe.ref)
|
||||
probe.receiveOne(Duration.create(100, "ms")) //discard
|
||||
vehicle.Actor.tell(Mountable.TryMount(player2, 1), probe.ref)
|
||||
probe.receiveOne(Duration.create(100, "ms")) //discard
|
||||
|
||||
vehicle.Actor ! Mountable.TryDismount(player2, 1) //player2 requests dismount
|
||||
val reply1 = receiveOne(Duration.create(100, "ms"))
|
||||
vehicle.Actor.tell(Mountable.TryDismount(player2, 1), probe.ref) //player2 requests dismount
|
||||
val reply1 = probe.receiveOne(Duration.create(100, "ms"))
|
||||
assert(reply1.isInstanceOf[Mountable.MountMessages])
|
||||
assert(reply1.asInstanceOf[Mountable.MountMessages].response.isInstanceOf[Mountable.CanDismount]) //player2 dismounts
|
||||
vehicle.Actor ! Vehicle.PrepareForDeletion
|
||||
|
||||
vehicle.Actor ! Mountable.TryDismount(player1, 0) //player1 requests dismount
|
||||
val reply2 = receiveOne(Duration.create(100, "ms"))
|
||||
vehicle.Actor.tell(Vehicle.PrepareForDeletion(), probe.ref)
|
||||
vehicle.Actor.tell(Mountable.TryDismount(player1, 0), probe.ref) //player1 requests dismount
|
||||
val reply2 = probe.receiveOne(Duration.create(100, "ms"))
|
||||
assert(reply2.isInstanceOf[Mountable.MountMessages])
|
||||
assert(reply2.asInstanceOf[Mountable.MountMessages].response.isInstanceOf[Mountable.CanDismount]) //player1 dismounts
|
||||
}
|
||||
|
|
@ -391,8 +410,9 @@ class VehicleControlAlwaysDismountTest extends ActorTest {
|
|||
}
|
||||
|
||||
class VehicleControlMountingBlockedExosuitTest extends ActorTest {
|
||||
val probe = new TestProbe(system)
|
||||
def checkCanNotMount() : Unit = {
|
||||
val reply = receiveOne(Duration.create(100, "ms"))
|
||||
val reply = probe.receiveOne(Duration.create(100, "ms"))
|
||||
reply match {
|
||||
case msg : Mountable.MountMessages =>
|
||||
assert(msg.response.isInstanceOf[Mountable.CanNotMount])
|
||||
|
|
@ -402,7 +422,7 @@ class VehicleControlMountingBlockedExosuitTest extends ActorTest {
|
|||
}
|
||||
|
||||
def checkCanMount() : Unit = {
|
||||
val reply = receiveOne(Duration.create(100, "ms"))
|
||||
val reply = probe.receiveOne(Duration.create(100, "ms"))
|
||||
reply match {
|
||||
case msg : Mountable.MountMessages =>
|
||||
assert(msg.response.isInstanceOf[Mountable.CanMount])
|
||||
|
|
@ -410,49 +430,49 @@ class VehicleControlMountingBlockedExosuitTest extends ActorTest {
|
|||
assert(false)
|
||||
}
|
||||
}
|
||||
val vehicle = Vehicle(GlobalDefinitions.apc_tr)
|
||||
vehicle.GUID = PlanetSideGUID(10)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
|
||||
val player1 = Player(VehicleTest.avatar1)
|
||||
player1.ExoSuit = ExoSuitType.Reinforced
|
||||
player1.GUID = PlanetSideGUID(1)
|
||||
val player2 = Player(VehicleTest.avatar1)
|
||||
player2.ExoSuit = ExoSuitType.MAX
|
||||
player2.GUID = PlanetSideGUID(2)
|
||||
val player3 = Player(VehicleTest.avatar1)
|
||||
player3.ExoSuit = ExoSuitType.Agile
|
||||
player3.GUID = PlanetSideGUID(3)
|
||||
|
||||
"Vehicle Control" should {
|
||||
"block players from sitting if their exo-suit is not allowed by the seat" in {
|
||||
val vehicle = Vehicle(GlobalDefinitions.apc_tr)
|
||||
vehicle.GUID = PlanetSideGUID(10)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
|
||||
val player1 = Player(VehicleTest.avatar1)
|
||||
player1.ExoSuit = ExoSuitType.Reinforced
|
||||
player1.GUID = PlanetSideGUID(1)
|
||||
val player2 = Player(VehicleTest.avatar1)
|
||||
player2.ExoSuit = ExoSuitType.MAX
|
||||
player2.GUID = PlanetSideGUID(2)
|
||||
val player3 = Player(VehicleTest.avatar1)
|
||||
player3.ExoSuit = ExoSuitType.Agile
|
||||
player3.GUID = PlanetSideGUID(3)
|
||||
|
||||
//disallow
|
||||
vehicle.Actor ! Mountable.TryMount(player1, 0) //Reinforced in non-MAX seat
|
||||
vehicle.Actor.tell(Mountable.TryMount(player1, 0), probe.ref) //Reinforced in non-MAX seat
|
||||
checkCanNotMount()
|
||||
vehicle.Actor ! Mountable.TryMount(player2, 0) //MAX in non-Reinforced seat
|
||||
vehicle.Actor.tell(Mountable.TryMount(player2, 0), probe.ref) //MAX in non-Reinforced seat
|
||||
checkCanNotMount()
|
||||
vehicle.Actor ! Mountable.TryMount(player2, 1) //MAX in non-MAX seat
|
||||
vehicle.Actor.tell(Mountable.TryMount(player2, 1), probe.ref) //MAX in non-MAX seat
|
||||
checkCanNotMount()
|
||||
vehicle.Actor ! Mountable.TryMount(player1, 9) //Reinforced in MAX-only seat
|
||||
vehicle.Actor.tell(Mountable.TryMount(player1, 9), probe.ref) //Reinforced in MAX-only seat
|
||||
checkCanNotMount()
|
||||
vehicle.Actor ! Mountable.TryMount(player3, 9) //Agile in MAX-only seat
|
||||
vehicle.Actor.tell(Mountable.TryMount(player3, 9), probe.ref) //Agile in MAX-only seat
|
||||
checkCanNotMount()
|
||||
|
||||
//allow
|
||||
vehicle.Actor ! Mountable.TryMount(player1, 1)
|
||||
vehicle.Actor.tell(Mountable.TryMount(player1, 1), probe.ref)
|
||||
checkCanMount()
|
||||
vehicle.Actor ! Mountable.TryMount(player2, 9)
|
||||
vehicle.Actor.tell(Mountable.TryMount(player2, 9), probe.ref)
|
||||
checkCanMount()
|
||||
vehicle.Actor ! Mountable.TryMount(player3, 0)
|
||||
vehicle.Actor.tell(Mountable.TryMount(player3, 0), probe.ref)
|
||||
checkCanMount()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class VehicleControlMountingBlockedSeatPermissionTest extends ActorTest {
|
||||
val probe = new TestProbe(system)
|
||||
def checkCanNotMount() : Unit = {
|
||||
val reply = receiveOne(Duration.create(100, "ms"))
|
||||
val reply = probe.receiveOne(Duration.create(100, "ms"))
|
||||
reply match {
|
||||
case msg : Mountable.MountMessages =>
|
||||
assert(msg.response.isInstanceOf[Mountable.CanNotMount])
|
||||
|
|
@ -462,7 +482,7 @@ class VehicleControlMountingBlockedSeatPermissionTest extends ActorTest {
|
|||
}
|
||||
|
||||
def checkCanMount() : Unit = {
|
||||
val reply = receiveOne(Duration.create(100, "ms"))
|
||||
val reply = probe.receiveOne(Duration.create(100, "ms"))
|
||||
reply match {
|
||||
case msg : Mountable.MountMessages =>
|
||||
assert(msg.response.isInstanceOf[Mountable.CanMount])
|
||||
|
|
@ -470,32 +490,33 @@ class VehicleControlMountingBlockedSeatPermissionTest extends ActorTest {
|
|||
assert(false)
|
||||
}
|
||||
}
|
||||
val vehicle = Vehicle(GlobalDefinitions.apc_tr)
|
||||
vehicle.GUID = PlanetSideGUID(10)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
|
||||
val player1 = Player(VehicleTest.avatar1)
|
||||
player1.GUID = PlanetSideGUID(1)
|
||||
val player2 = Player(VehicleTest.avatar1)
|
||||
player2.GUID = PlanetSideGUID(2)
|
||||
|
||||
"Vehicle Control" should {
|
||||
//11 June 2018: Group is not supported yet so do not bother testing it
|
||||
"block players from sitting if the seat does not allow it" in {
|
||||
val vehicle = Vehicle(GlobalDefinitions.apc_tr)
|
||||
vehicle.GUID = PlanetSideGUID(10)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
|
||||
val player1 = Player(VehicleTest.avatar1)
|
||||
player1.GUID = PlanetSideGUID(1)
|
||||
val player2 = Player(VehicleTest.avatar1)
|
||||
player2.GUID = PlanetSideGUID(2)
|
||||
|
||||
vehicle.PermissionGroup(2,3) //passenger group -> empire
|
||||
vehicle.Actor ! Mountable.TryMount(player1, 3) //passenger seat
|
||||
vehicle.Actor.tell(Mountable.TryMount(player1, 3), probe.ref) //passenger seat
|
||||
checkCanMount()
|
||||
vehicle.PermissionGroup(2,0) //passenger group -> locked
|
||||
vehicle.Actor ! Mountable.TryMount(player2, 4) //passenger seat
|
||||
vehicle.Actor.tell(Mountable.TryMount(player2, 4), probe.ref) //passenger seat
|
||||
checkCanNotMount()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class VehicleControlMountingDriverSeatTest extends ActorTest {
|
||||
val probe = new TestProbe(system)
|
||||
def checkCanMount() : Unit = {
|
||||
val reply = receiveOne(Duration.create(100, "ms"))
|
||||
val reply = probe.receiveOne(Duration.create(100, "ms"))
|
||||
reply match {
|
||||
case msg : Mountable.MountMessages =>
|
||||
assert(msg.response.isInstanceOf[Mountable.CanMount])
|
||||
|
|
@ -503,19 +524,18 @@ class VehicleControlMountingDriverSeatTest extends ActorTest {
|
|||
assert(false)
|
||||
}
|
||||
}
|
||||
val vehicle = Vehicle(GlobalDefinitions.apc_tr)
|
||||
vehicle.GUID = PlanetSideGUID(10)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
val player1 = Player(VehicleTest.avatar1)
|
||||
player1.GUID = PlanetSideGUID(1)
|
||||
|
||||
"Vehicle Control" should {
|
||||
"allow players to sit in the driver seat, even if it is locked, if the vehicle is unowned" in {
|
||||
val vehicle = Vehicle(GlobalDefinitions.apc_tr)
|
||||
vehicle.GUID = PlanetSideGUID(10)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
val player1 = Player(VehicleTest.avatar1)
|
||||
player1.GUID = PlanetSideGUID(1)
|
||||
|
||||
assert(vehicle.PermissionGroup(0).contains(VehicleLockState.Locked)) //driver group -> locked
|
||||
assert(vehicle.Seats(0).Occupant.isEmpty)
|
||||
assert(vehicle.Owner.isEmpty)
|
||||
vehicle.Actor ! Mountable.TryMount(player1, 0)
|
||||
vehicle.Actor.tell(Mountable.TryMount(player1, 0), probe.ref)
|
||||
checkCanMount()
|
||||
assert(vehicle.Seats(0).Occupant.nonEmpty)
|
||||
}
|
||||
|
|
@ -523,8 +543,9 @@ class VehicleControlMountingDriverSeatTest extends ActorTest {
|
|||
}
|
||||
|
||||
class VehicleControlMountingOwnedLockedDriverSeatTest extends ActorTest {
|
||||
val probe = new TestProbe(system)
|
||||
def checkCanNotMount() : Unit = {
|
||||
val reply = receiveOne(Duration.create(100, "ms"))
|
||||
val reply = probe.receiveOne(Duration.create(100, "ms"))
|
||||
reply match {
|
||||
case msg : Mountable.MountMessages =>
|
||||
assert(msg.response.isInstanceOf[Mountable.CanNotMount])
|
||||
|
|
@ -534,7 +555,7 @@ class VehicleControlMountingOwnedLockedDriverSeatTest extends ActorTest {
|
|||
}
|
||||
|
||||
def checkCanMount() : Unit = {
|
||||
val reply = receiveOne(Duration.create(100, "ms"))
|
||||
val reply = probe.receiveOne(Duration.create(100, "ms"))
|
||||
reply match {
|
||||
case msg : Mountable.MountMessages =>
|
||||
assert(msg.response.isInstanceOf[Mountable.CanMount])
|
||||
|
|
@ -542,30 +563,28 @@ class VehicleControlMountingOwnedLockedDriverSeatTest extends ActorTest {
|
|||
assert(false)
|
||||
}
|
||||
}
|
||||
val vehicle = Vehicle(GlobalDefinitions.apc_tr)
|
||||
vehicle.GUID = PlanetSideGUID(10)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
val player1 = Player(VehicleTest.avatar1)
|
||||
player1.GUID = PlanetSideGUID(1)
|
||||
val player2 = Player(VehicleTest.avatar1)
|
||||
player2.GUID = PlanetSideGUID(2)
|
||||
|
||||
"Vehicle Control" should {
|
||||
"block players that are not the current owner from sitting in the driver seat (locked)" in {
|
||||
val vehicle = Vehicle(GlobalDefinitions.apc_tr)
|
||||
vehicle.GUID = PlanetSideGUID(10)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
|
||||
val player1 = Player(VehicleTest.avatar1)
|
||||
player1.GUID = PlanetSideGUID(1)
|
||||
val player2 = Player(VehicleTest.avatar1)
|
||||
player2.GUID = PlanetSideGUID(2)
|
||||
|
||||
assert(vehicle.PermissionGroup(0).contains(VehicleLockState.Locked)) //driver group -> locked
|
||||
assert(vehicle.Seats(0).Occupant.isEmpty)
|
||||
vehicle.Owner = player1.GUID
|
||||
|
||||
vehicle.Actor ! Mountable.TryMount(player1, 0)
|
||||
vehicle.Actor.tell(Mountable.TryMount(player1, 0), probe.ref)
|
||||
checkCanMount()
|
||||
assert(vehicle.Seats(0).Occupant.nonEmpty)
|
||||
vehicle.Actor ! Mountable.TryDismount(player1, 0)
|
||||
receiveOne(Duration.create(100, "ms")) //discard
|
||||
vehicle.Actor.tell(Mountable.TryDismount(player1, 0), probe.ref)
|
||||
probe.receiveOne(Duration.create(100, "ms")) //discard
|
||||
assert(vehicle.Seats(0).Occupant.isEmpty)
|
||||
|
||||
vehicle.Actor ! Mountable.TryMount(player2, 0)
|
||||
vehicle.Actor.tell(Mountable.TryMount(player2, 0), probe.ref)
|
||||
checkCanNotMount()
|
||||
assert(vehicle.Seats(0).Occupant.isEmpty)
|
||||
}
|
||||
|
|
@ -573,8 +592,9 @@ class VehicleControlMountingOwnedLockedDriverSeatTest extends ActorTest {
|
|||
}
|
||||
|
||||
class VehicleControlMountingOwnedUnlockedDriverSeatTest extends ActorTest {
|
||||
val probe = new TestProbe(system)
|
||||
def checkCanMount() : Unit = {
|
||||
val reply = receiveOne(Duration.create(100, "ms"))
|
||||
val reply = probe.receiveOne(Duration.create(100, "ms"))
|
||||
reply match {
|
||||
case msg : Mountable.MountMessages =>
|
||||
assert(msg.response.isInstanceOf[Mountable.CanMount])
|
||||
|
|
@ -582,31 +602,29 @@ class VehicleControlMountingOwnedUnlockedDriverSeatTest extends ActorTest {
|
|||
assert(false)
|
||||
}
|
||||
}
|
||||
val vehicle = Vehicle(GlobalDefinitions.apc_tr)
|
||||
vehicle.GUID = PlanetSideGUID(10)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
val player1 = Player(VehicleTest.avatar1)
|
||||
player1.GUID = PlanetSideGUID(1)
|
||||
val player2 = Player(VehicleTest.avatar1)
|
||||
player2.GUID = PlanetSideGUID(2)
|
||||
|
||||
"Vehicle Control" should {
|
||||
"allow players that are not the current owner to sit in the driver seat (empire)" in {
|
||||
val vehicle = Vehicle(GlobalDefinitions.apc_tr)
|
||||
vehicle.GUID = PlanetSideGUID(10)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
|
||||
val player1 = Player(VehicleTest.avatar1)
|
||||
player1.GUID = PlanetSideGUID(1)
|
||||
val player2 = Player(VehicleTest.avatar1)
|
||||
player2.GUID = PlanetSideGUID(2)
|
||||
|
||||
vehicle.PermissionGroup(0,3) //passenger group -> empire
|
||||
assert(vehicle.PermissionGroup(0).contains(VehicleLockState.Empire)) //driver group -> empire
|
||||
assert(vehicle.Seats(0).Occupant.isEmpty)
|
||||
vehicle.Owner = player1.GUID //owner set
|
||||
|
||||
vehicle.Actor ! Mountable.TryMount(player1, 0)
|
||||
vehicle.Actor.tell(Mountable.TryMount(player1, 0), probe.ref)
|
||||
checkCanMount()
|
||||
assert(vehicle.Seats(0).Occupant.nonEmpty)
|
||||
vehicle.Actor ! Mountable.TryDismount(player1, 0)
|
||||
receiveOne(Duration.create(100, "ms")) //discard
|
||||
vehicle.Actor.tell(Mountable.TryDismount(player1, 0), probe.ref)
|
||||
probe.receiveOne(Duration.create(100, "ms")) //discard
|
||||
assert(vehicle.Seats(0).Occupant.isEmpty)
|
||||
|
||||
vehicle.Actor ! Mountable.TryMount(player2, 0)
|
||||
vehicle.Actor.tell(Mountable.TryMount(player2, 0), probe.ref)
|
||||
checkCanMount()
|
||||
assert(vehicle.Seats(0).Occupant.nonEmpty)
|
||||
}
|
||||
|
|
@ -614,26 +632,37 @@ class VehicleControlMountingOwnedUnlockedDriverSeatTest extends ActorTest {
|
|||
}
|
||||
|
||||
class VehicleControlShieldsChargingTest extends ActorTest {
|
||||
val probe = new TestProbe(system)
|
||||
val vehicle = Vehicle(GlobalDefinitions.fury)
|
||||
vehicle.GUID = PlanetSideGUID(10)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
vehicle.Zone = new Zone("test", new ZoneMap("test"), 0) {
|
||||
VehicleEvents = probe.ref
|
||||
}
|
||||
|
||||
"charge vehicle shields" in {
|
||||
assert(vehicle.Shields == 0)
|
||||
assert(!vehicle.History.exists({p => p.isInstanceOf[VehicleShieldCharge]}))
|
||||
vehicle.Actor ! Vehicle.ChargeShields(15)
|
||||
|
||||
val msg = receiveOne(500 milliseconds)
|
||||
assert(msg.isInstanceOf[Vehicle.UpdateShieldsCharge])
|
||||
vehicle.Actor ! Vehicle.ChargeShields(15)
|
||||
val msg = probe.receiveOne(500 milliseconds)
|
||||
assert(msg match {
|
||||
case VehicleServiceMessage(_, VehicleAction.PlanetsideAttribute(_, PlanetSideGUID(10), 68, 15)) => true
|
||||
case _ => false
|
||||
})
|
||||
assert(vehicle.Shields == 15)
|
||||
assert(vehicle.History.exists({p => p.isInstanceOf[VehicleShieldCharge]}))
|
||||
}
|
||||
}
|
||||
|
||||
class VehicleControlShieldsNotChargingVehicleDeadTest extends ActorTest {
|
||||
val probe = new TestProbe(system)
|
||||
val vehicle = Vehicle(GlobalDefinitions.fury)
|
||||
vehicle.GUID = PlanetSideGUID(10)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
vehicle.Zone = new Zone("test", new ZoneMap("test"), 0) {
|
||||
VehicleEvents = probe.ref
|
||||
}
|
||||
|
||||
"not charge vehicle shields if the vehicle is destroyed" in {
|
||||
assert(vehicle.Health > 0)
|
||||
|
|
@ -641,18 +670,22 @@ class VehicleControlShieldsNotChargingVehicleDeadTest extends ActorTest {
|
|||
assert(vehicle.Health == 0)
|
||||
assert(vehicle.Shields == 0)
|
||||
assert(!vehicle.History.exists({p => p.isInstanceOf[VehicleShieldCharge]}))
|
||||
vehicle.Actor ! Vehicle.ChargeShields(15)
|
||||
vehicle.Actor.tell(Vehicle.ChargeShields(15), probe.ref)
|
||||
|
||||
expectNoMsg(1 seconds)
|
||||
probe.expectNoMsg(1 seconds)
|
||||
assert(vehicle.Shields == 0)
|
||||
assert(!vehicle.History.exists({p => p.isInstanceOf[VehicleShieldCharge]}))
|
||||
}
|
||||
}
|
||||
|
||||
class VehicleControlShieldsNotChargingVehicleShieldsFullTest extends ActorTest {
|
||||
val probe = new TestProbe(system)
|
||||
val vehicle = Vehicle(GlobalDefinitions.fury)
|
||||
vehicle.GUID = PlanetSideGUID(10)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
vehicle.Zone = new Zone("test", new ZoneMap("test"), 0) {
|
||||
VehicleEvents = probe.ref
|
||||
}
|
||||
|
||||
"not charge vehicle shields if the vehicle is destroyed" in {
|
||||
assert(vehicle.Shields == 0)
|
||||
|
|
@ -661,54 +694,67 @@ class VehicleControlShieldsNotChargingVehicleShieldsFullTest extends ActorTest {
|
|||
assert(!vehicle.History.exists({p => p.isInstanceOf[VehicleShieldCharge]}))
|
||||
vehicle.Actor ! Vehicle.ChargeShields(15)
|
||||
|
||||
expectNoMsg(1 seconds)
|
||||
probe.expectNoMsg(1 seconds)
|
||||
assert(!vehicle.History.exists({p => p.isInstanceOf[VehicleShieldCharge]}))
|
||||
}
|
||||
}
|
||||
|
||||
class VehicleControlShieldsNotChargingTooEarlyTest extends ActorTest {
|
||||
val probe = new TestProbe(system)
|
||||
val vehicle = Vehicle(GlobalDefinitions.fury)
|
||||
vehicle.GUID = PlanetSideGUID(10)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
vehicle.Zone = new Zone("test", new ZoneMap("test"), 0) {
|
||||
VehicleEvents = probe.ref
|
||||
}
|
||||
|
||||
"charge vehicle shields" in {
|
||||
assert(vehicle.Shields == 0)
|
||||
vehicle.Actor ! Vehicle.ChargeShields(15)
|
||||
|
||||
val msg = receiveOne(200 milliseconds)
|
||||
assert(msg.isInstanceOf[Vehicle.UpdateShieldsCharge])
|
||||
vehicle.Actor ! Vehicle.ChargeShields(15)
|
||||
val msg = probe.receiveOne(200 milliseconds)
|
||||
//assert(msg.isInstanceOf[Vehicle.UpdateShieldsCharge])
|
||||
assert(msg match {
|
||||
case VehicleServiceMessage(_, VehicleAction.PlanetsideAttribute(_, PlanetSideGUID(10), 68, 15)) => true
|
||||
case _ => false
|
||||
})
|
||||
assert(vehicle.Shields == 15)
|
||||
vehicle.Actor ! Vehicle.ChargeShields(15)
|
||||
|
||||
expectNoMsg(200 milliseconds)
|
||||
vehicle.Actor ! Vehicle.ChargeShields(15)
|
||||
probe.expectNoMsg(200 milliseconds)
|
||||
assert(vehicle.Shields == 15)
|
||||
}
|
||||
}
|
||||
|
||||
class VehicleControlShieldsNotChargingDamagedTest extends ActorTest {
|
||||
val vehicle = Vehicle(GlobalDefinitions.fury)
|
||||
vehicle.GUID = PlanetSideGUID(10)
|
||||
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
//
|
||||
val beamer_wep = Tool(GlobalDefinitions.beamer)
|
||||
val p_source = PlayerSource( Player(Avatar("TestTarget", PlanetSideEmpire.NC, CharacterGender.Female, 1, CharacterVoice.Mute)) )
|
||||
val projectile = Projectile(beamer_wep.Projectile, GlobalDefinitions.beamer, beamer_wep.FireMode, p_source, GlobalDefinitions.beamer.ObjectId, Vector3.Zero, Vector3.Zero)
|
||||
val fury_dm = Vehicle(GlobalDefinitions.fury).DamageModel
|
||||
val obj = ResolvedProjectile(ProjectileResolution.Hit, projectile, p_source, fury_dm, Vector3(1.2f, 3.4f, 5.6f), System.nanoTime)
|
||||
|
||||
"not charge vehicle shields if recently damaged" in {
|
||||
assert(vehicle.Shields == 0)
|
||||
vehicle.Actor ! Vitality.Damage({case v : Vehicle => v.History(obj); obj })
|
||||
|
||||
val msg = receiveOne(200 milliseconds)
|
||||
assert(msg.isInstanceOf[Vitality.DamageResolution])
|
||||
assert(vehicle.Shields == 0)
|
||||
vehicle.Actor ! Vehicle.ChargeShields(15)
|
||||
|
||||
expectNoMsg(200 milliseconds)
|
||||
assert(vehicle.Shields == 0)
|
||||
}
|
||||
}
|
||||
//TODO implement message protocol for zone startup completion
|
||||
//class VehicleControlShieldsNotChargingDamagedTest extends ActorTest {
|
||||
// val probe = new TestProbe(system)
|
||||
// val vehicle = Vehicle(GlobalDefinitions.fury)
|
||||
// vehicle.GUID = PlanetSideGUID(10)
|
||||
// vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
|
||||
// vehicle.Zone = new Zone("test", new ZoneMap("test"), 0) {
|
||||
// VehicleEvents = probe.ref
|
||||
// }
|
||||
// //
|
||||
// val beamer_wep = Tool(GlobalDefinitions.beamer)
|
||||
// val p_source = PlayerSource( Player(Avatar("TestTarget", PlanetSideEmpire.NC, CharacterGender.Female, 1, CharacterVoice.Mute)) )
|
||||
// val projectile = Projectile(beamer_wep.Projectile, GlobalDefinitions.beamer, beamer_wep.FireMode, p_source, GlobalDefinitions.beamer.ObjectId, Vector3.Zero, Vector3.Zero)
|
||||
// val fury_dm = Vehicle(GlobalDefinitions.fury).DamageModel
|
||||
// val obj = ResolvedProjectile(ProjectileResolution.Hit, projectile, p_source, fury_dm, Vector3(1.2f, 3.4f, 5.6f), System.nanoTime)
|
||||
//
|
||||
// "not charge vehicle shields if recently damaged" in {
|
||||
// assert(vehicle.Shields == 0)
|
||||
// vehicle.Actor.tell(Vitality.Damage({case v : Vehicle => v.History(obj); obj }), probe.ref)
|
||||
//
|
||||
// val msg = probe.receiveOne(200 milliseconds)
|
||||
// assert(msg.isInstanceOf[Vitality.DamageResolution])
|
||||
// assert(vehicle.Shields == 0)
|
||||
// vehicle.Actor.tell(Vehicle.ChargeShields(15), probe.ref)
|
||||
//
|
||||
// probe.expectNoMsg(200 milliseconds)
|
||||
// assert(vehicle.Shields == 0)
|
||||
// }
|
||||
//}
|
||||
|
||||
object VehicleTest {
|
||||
import net.psforever.objects.Avatar
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue