Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ trait JammableBehavior {
case _ =>
true
}) {
StartJammeredSound(obj, dur)
StartJammeredStatus(obj, dur)
StartJammeredSound(obj, dur)
}
case None =>
}
Expand Down
16 changes: 10 additions & 6 deletions src/main/scala/net/psforever/objects/zones/Zone.scala
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,16 @@ class Zone(val id: String, val map: ZoneMap, zoneNumber: Int) {
if (actor == null && guid.Pools.values.foldLeft(0)(_ + _.Count) == 0) {
import org.fusesource.jansi.Ansi.Color.RED
import org.fusesource.jansi.Ansi.ansi
println(
ansi()
.fgBright(RED)
.a(s"""Caution: replacement of the number pool system for zone $id; function is for testing purposes only""")
.reset()
)

// If the number pool has been replaced for a test don't show this warning, if the zone id contains test we'll assume you know what you're doing.
if (!id.contains("test")) {
println(
ansi()
.fgBright(RED)
.a(s"""Caution: replacement of the number pool system for zone $id; function is for testing purposes only""")
.reset()
)
}
guid = hub
true
} else {
Expand Down
25 changes: 4 additions & 21 deletions src/test/scala/objects/DamageableTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -932,27 +932,10 @@ class DamageableWeaponTurretJammerTest extends ActorTest {

turret.Actor ! Vitality.Damage(applyDamageTo)
val msg12 = vehicleProbe.receiveN(2, 500 milliseconds)
assert(
msg12.head match {
case VehicleServiceMessage(
"test",
VehicleAction.PlanetsideAttribute(Service.defaultPlayerGUID, PlanetSideGUID(2), 27, 1)
) =>
true
case _ => false
}
)
assert(
msg12(1) match {
case VehicleServiceMessage(
"test",
VehicleAction.PlanetsideAttribute(Service.defaultPlayerGUID, PlanetSideGUID(5), 27, 1)
) =>
true
case _ => false
}
)
expectNoMessage(100 milliseconds) // FIXME this is a hack to make it pass

assert(msg12.contains(VehicleServiceMessage("test", VehicleAction.PlanetsideAttribute(Service.defaultPlayerGUID, PlanetSideGUID(2), 27, 1))))
assert(msg12.contains(VehicleServiceMessage("test", VehicleAction.PlanetsideAttribute(Service.defaultPlayerGUID, PlanetSideGUID(5), 27, 1))))

assert(turret.Health == turret.Definition.DefaultHealth)
assert(turret.Jammed)
}
Expand Down
15 changes: 9 additions & 6 deletions src/test/scala/objects/PlayerControlTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ class PlayerControlDeathSeatedTest extends ActorTest {
class PlayerControlInteractWithWaterTest extends ActorTest {
val player1 =
Player(Avatar(0, "TestCharacter1", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute)) //guid=1
player1.Definition.UnderwaterLifespan(suffocation = 3000, recovery = 3000) // Override the default 60s down / 10s recovery so the tests don't take forever to run

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

player1.Definition.UnderwaterLifespan(...)
As with my far far ealiertests involving a singleton classes is evidenced, changing a single source class for one test changes it for every test. All tests involving a drowning player will endure this 3000ms / 3000ms time limit. Given the reliability of actor tests, depending on the order they are implemented, it's possible that a test whose constituent actors may receive less attention than hoped may be affected by these updates times. In other words, it'll drown faster too.
GlobalDefinitions can be like a singleton to all tests in that respect.

val avatarProbe = TestProbe()
val guid = new NumberPoolHub(new MaxNumberSource(15))
val pool = Pool(EnvironmentAttribute.Water, DeepSquare(-1, 10, 10, 0, 0))
Expand Down Expand Up @@ -797,18 +798,20 @@ class PlayerControlInteractWithWaterTest extends ActorTest {
case _ => false
}
)
//player will die in 60s
//detailing these death messages is not necessary

//player will die in 3s (overridden from 60s)
assert(player1.Health == 100)
probe.receiveOne(65 seconds) //wait until our implants deinitialize
assert(player1.Health == 0) //ded
awaitAssert(
assert(player1.Health == 0)
, max = player1.Definition.UnderwaterLifespan(OxygenState.Suffocation) + 3000 milliseconds, interval = 1 second)
}
}
}

class PlayerControlStopInteractWithWaterTest extends ActorTest {
val player1 =
Player(Avatar(0, "TestCharacter1", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute)) //guid=1
player1.Definition.UnderwaterLifespan(suffocation = 3000, recovery = 3000) // Override the default 60s down / 10s recovery so the tests don't take forever to run
val avatarProbe = TestProbe()
val guid = new NumberPoolHub(new MaxNumberSource(15))
val pool = Pool(EnvironmentAttribute.Water, DeepSquare(-1, 10, 10, 0, 0))
Expand Down Expand Up @@ -849,7 +852,7 @@ class PlayerControlStopInteractWithWaterTest extends ActorTest {
case _ => false
}
)
//player would normally die in 60s
//player would normally die in 3s (overridden from 60s)
player1.Position = Vector3.Zero //pool's closed
player1.zoneInteraction() //trigger
val msg_recover = avatarProbe.receiveOne(250 milliseconds)
Expand All @@ -863,7 +866,7 @@ class PlayerControlStopInteractWithWaterTest extends ActorTest {
}
)
assert(player1.Health == 100) //still alive?
probe.expectNoMessage(65 seconds)
probe.expectNoMessage(5 seconds)
assert(player1.Health == 100) //yep, still alive
}
}
Expand Down