mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-04-26 23:05:27 +00:00
vehicle deployment messages added in, then deployment was fixed to accommodate an explicit caller, and that changed a whole lot of the deployment loop for messages; environmental activity was modified to maointain a more responsible start/stop transition; many many test changes (still an issue with a lot of them)
This commit is contained in:
parent
de93b4c01b
commit
6cbe3288e5
17 changed files with 661 additions and 431 deletions
|
|
@ -16,9 +16,9 @@ import net.psforever.types.{CharacterSex, CharacterVoice, PlanetSideEmpire, Plan
|
|||
import scala.concurrent.duration._
|
||||
|
||||
class InteractsWithZoneEnvironmentTest extends ActorTest {
|
||||
val pool1: Pool = Pool(EnvironmentAttribute.Water, DeepSquare(5, 10, 10, 0, 0))
|
||||
val pool2: Pool = Pool(EnvironmentAttribute.Water, DeepSquare(5, 10, 15, 5, 10))
|
||||
val pool3: Pool = Pool(EnvironmentAttribute.Lava, DeepSquare(5, 15, 10, 10, 5))
|
||||
val pool1: Pool = Pool(EnvironmentAttribute.Water, DeepSquare(3, 2, 2, 0, 0))
|
||||
val pool2: Pool = Pool(EnvironmentAttribute.Water, DeepSquare(3, 4, 2, 2, 0))
|
||||
val pool3: Pool = Pool(EnvironmentAttribute.Lava, DeepSquare(3, 2, 4, 0, 2))
|
||||
val zoneEvents: TestProbe = TestProbe()
|
||||
val testZone: Zone = {
|
||||
val testMap = new ZoneMap(name = "test-map") {
|
||||
|
|
@ -38,27 +38,26 @@ class InteractsWithZoneEnvironmentTest extends ActorTest {
|
|||
val obj = InteractsWithZoneEnvironmentTest.testObject()
|
||||
obj.Zone = testZone
|
||||
obj.Actor = testProbe.ref
|
||||
obj.Position = Vector3(0,0,50)
|
||||
obj.Position = Vector3(10,10,0)
|
||||
|
||||
obj.zoneInteractions()
|
||||
testProbe.expectNoMessage(max = 500 milliseconds)
|
||||
}
|
||||
|
||||
"acknowledge interaction when moved into the critical region of a registered environment object (just once)" in {
|
||||
"acknowledge interaction when moved into the critical region of a registered environment object" in {
|
||||
val testProbe = TestProbe()
|
||||
val obj = InteractsWithZoneEnvironmentTest.testObject()
|
||||
obj.Zone = testZone
|
||||
obj.Actor = testProbe.ref
|
||||
|
||||
obj.Position = Vector3(1,1,2)
|
||||
obj.Position = Vector3(1, 1, 2.7f)
|
||||
obj.zoneInteractions()
|
||||
val msg = testProbe.receiveOne(max = 250 milliseconds)
|
||||
assert(
|
||||
msg match {
|
||||
case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Water, _, _, _) => true
|
||||
case _ => false
|
||||
}
|
||||
)
|
||||
val msg = testProbe.receiveOne(4.seconds)
|
||||
msg match {
|
||||
case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Water, _, _, _) => ()
|
||||
case _ => assert(InteractsWithZoneEnvironmentTest.fail, s"$msg")
|
||||
}
|
||||
|
||||
obj.zoneInteractions()
|
||||
testProbe.expectNoMessage(max = 500 milliseconds)
|
||||
}
|
||||
|
|
@ -69,54 +68,48 @@ class InteractsWithZoneEnvironmentTest extends ActorTest {
|
|||
obj.Zone = testZone
|
||||
obj.Actor = testProbe.ref
|
||||
|
||||
obj.Position = Vector3(1,1,2)
|
||||
obj.Position = Vector3(1, 1, 2.7f)
|
||||
obj.zoneInteractions()
|
||||
val msg1 = testProbe.receiveOne(max = 250 milliseconds)
|
||||
assert(
|
||||
msg1 match {
|
||||
case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Water, _, _, _) => true
|
||||
case _ => false
|
||||
}
|
||||
)
|
||||
val msg1 = testProbe.receiveOne(4.seconds)
|
||||
msg1 match {
|
||||
case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Water, _, _, _) => ()
|
||||
case _ => assert(InteractsWithZoneEnvironmentTest.fail, "")
|
||||
}
|
||||
|
||||
obj.Position = Vector3(1,1,50)
|
||||
obj.Position = Vector3(1,1,5)
|
||||
obj.zoneInteractions()
|
||||
val msg2 = testProbe.receiveOne(max = 250 milliseconds)
|
||||
assert(
|
||||
msg2 match {
|
||||
case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Water, _, _, _) => true
|
||||
case _ => false
|
||||
}
|
||||
)
|
||||
val msg2 = testProbe.receiveOne(4.seconds)
|
||||
msg2 match {
|
||||
case RespondsToZoneEnvironment.StopTimer(EnvironmentAttribute.Water) => ()
|
||||
case _ => assert(InteractsWithZoneEnvironmentTest.fail, "")
|
||||
}
|
||||
|
||||
obj.zoneInteractions()
|
||||
testProbe.expectNoMessage(max = 500 milliseconds)
|
||||
}
|
||||
|
||||
"transition between two different critical regions when the regions that the same attribute" in {
|
||||
"transition between two different critical regions when the regions have the same attribute" in {
|
||||
val testProbe = TestProbe()
|
||||
val obj = InteractsWithZoneEnvironmentTest.testObject()
|
||||
obj.Zone = testZone
|
||||
obj.Actor = testProbe.ref
|
||||
|
||||
obj.Position = Vector3(7,7,2)
|
||||
obj.Position = Vector3(1, 1, 2.7f)
|
||||
obj.zoneInteractions()
|
||||
val msg1 = testProbe.receiveOne(max = 250 milliseconds)
|
||||
assert(
|
||||
msg1 match {
|
||||
case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Water, _, _, _) => true
|
||||
case _ => false
|
||||
}
|
||||
)
|
||||
val msg1 = testProbe.receiveOne(4.seconds)
|
||||
msg1 match {
|
||||
case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Water, _, _, _) => ()
|
||||
case _ => assert(InteractsWithZoneEnvironmentTest.fail, "")
|
||||
}
|
||||
|
||||
obj.Position = Vector3(12,7,2)
|
||||
obj.Position = Vector3(1, 3, 2.7f)
|
||||
obj.zoneInteractions()
|
||||
val msg2 = testProbe.receiveOne(max = 250 milliseconds)
|
||||
assert(
|
||||
msg2 match {
|
||||
case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Water, _, _, _) => true
|
||||
case _ => false
|
||||
}
|
||||
)
|
||||
// val msg2 = testProbe.receiveOne(4.seconds)
|
||||
// msg2 match {
|
||||
// case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Water, _, _, _) => ()
|
||||
// case _ => assert(false, "")
|
||||
// }
|
||||
testProbe.expectNoMessage()
|
||||
}
|
||||
|
||||
"transition between two different critical regions when the regions have different attributes" in {
|
||||
|
|
@ -125,37 +118,33 @@ class InteractsWithZoneEnvironmentTest extends ActorTest {
|
|||
obj.Zone = testZone
|
||||
obj.Actor = testProbe.ref
|
||||
|
||||
obj.Position = Vector3(7,7,2)
|
||||
obj.Position = Vector3(1, 1, 2.7f)
|
||||
obj.zoneInteractions()
|
||||
val msg1 = testProbe.receiveOne(max = 250 milliseconds)
|
||||
assert(
|
||||
msg1 match {
|
||||
case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Water, _, _, _) => true
|
||||
case _ => false
|
||||
}
|
||||
)
|
||||
val msg1 = testProbe.receiveOne(4.seconds)
|
||||
msg1 match {
|
||||
case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Water, _, _, _) => ()
|
||||
case _ => assert(InteractsWithZoneEnvironmentTest.fail, "")
|
||||
}
|
||||
|
||||
obj.Position = Vector3(7,12,2)
|
||||
obj.Position = Vector3(3, 1, 2.7f)
|
||||
obj.zoneInteractions()
|
||||
val msgs = testProbe.receiveN(3, max = 250 milliseconds)
|
||||
assert(
|
||||
msgs.head match {
|
||||
case Vitality.Damage(_) => true
|
||||
case _ => false
|
||||
}
|
||||
)
|
||||
assert(
|
||||
msgs(1) match {
|
||||
case AuraEffectBehavior.StartEffect(Aura.Fire, _) => true
|
||||
case _ => false
|
||||
}
|
||||
)
|
||||
assert(
|
||||
msgs(2) match {
|
||||
case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Lava, _, _, _) => true
|
||||
case _ => false
|
||||
}
|
||||
)
|
||||
val msgs = testProbe.receiveN(4, 4.seconds)
|
||||
msgs.head match {
|
||||
case Vitality.Damage(_) => ()
|
||||
case _ => assert(InteractsWithZoneEnvironmentTest.fail, "")
|
||||
}
|
||||
msgs(1) match {
|
||||
case AuraEffectBehavior.StartEffect(Aura.Fire, _) => ()
|
||||
case _ => assert(InteractsWithZoneEnvironmentTest.fail, "")
|
||||
}
|
||||
msgs(2) match {
|
||||
case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Lava, _, _, _) => ()
|
||||
case _ => assert(InteractsWithZoneEnvironmentTest.fail, "")
|
||||
}
|
||||
msgs(3) match {
|
||||
case RespondsToZoneEnvironment.StopTimer(EnvironmentAttribute.Water) => ()
|
||||
case _ => assert(InteractsWithZoneEnvironmentTest.fail, "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -165,24 +154,21 @@ class InteractsWithZoneEnvironmentTest extends ActorTest {
|
|||
obj.Zone = testZone
|
||||
obj.Actor = testProbe.ref
|
||||
|
||||
obj.Position = Vector3(1,1,2)
|
||||
obj.Position = Vector3(1, 1, 2.7f)
|
||||
obj.zoneInteractions()
|
||||
val msg1 = testProbe.receiveOne(max = 250 milliseconds)
|
||||
assert(
|
||||
msg1 match {
|
||||
case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Water, _, _, _) => true
|
||||
case _ => false
|
||||
}
|
||||
)
|
||||
msg1 match {
|
||||
case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Water, _, _, _) => true
|
||||
case _ => assert(InteractsWithZoneEnvironmentTest.fail, "")
|
||||
}
|
||||
|
||||
obj.allowInteraction = false
|
||||
val msg2 = testProbe.receiveOne(max = 250 milliseconds)
|
||||
assert(
|
||||
msg2 match {
|
||||
case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Water, _, _, _) => true
|
||||
case _ => false
|
||||
}
|
||||
)
|
||||
msg2 match {
|
||||
case RespondsToZoneEnvironment.StopTimer(EnvironmentAttribute.Water) => true
|
||||
case _ => assert(InteractsWithZoneEnvironmentTest.fail, "")
|
||||
}
|
||||
|
||||
obj.zoneInteractions()
|
||||
testProbe.expectNoMessage(max = 500 milliseconds)
|
||||
}
|
||||
|
|
@ -194,22 +180,22 @@ class InteractsWithZoneEnvironmentTest extends ActorTest {
|
|||
obj.Actor = testProbe.ref
|
||||
|
||||
obj.allowInteraction = false
|
||||
obj.Position = Vector3(1,1,2)
|
||||
obj.Position = Vector3(1, 1, 2.7f)
|
||||
obj.zoneInteractions()
|
||||
testProbe.expectNoMessage(max = 500 milliseconds)
|
||||
|
||||
obj.allowInteraction = true
|
||||
val msg1 = testProbe.receiveOne(max = 250 milliseconds)
|
||||
assert(
|
||||
msg1 match {
|
||||
case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Water, _, _, _) => true
|
||||
case _ => false
|
||||
}
|
||||
)
|
||||
msg1 match {
|
||||
case RespondsToZoneEnvironment.Timer(EnvironmentAttribute.Water, _, _, _) => true
|
||||
case _ => assert(InteractsWithZoneEnvironmentTest.fail, "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object InteractsWithZoneEnvironmentTest {
|
||||
val fail: Boolean = false
|
||||
|
||||
def testObject(): PlanetSideServerObject with InteractsWithZone = {
|
||||
val p = new Player(Avatar(1, "test", PlanetSideEmpire.VS, CharacterSex.Male, 1, CharacterVoice.Mute))
|
||||
p.GUID = PlanetSideGUID(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue