Amend mounting tests

This commit is contained in:
Mazo 2021-02-02 21:59:46 +00:00
parent 3f1003c51e
commit b4fb0cf855
2 changed files with 19 additions and 6 deletions

View file

@ -276,6 +276,9 @@ class VehicleControl(vehicle: Vehicle)
PrepareForDeletion()
context.become(ReadyToDelete)
case VehicleControl.AssignOwnership(player) =>
vehicle.AssignOwnership(player)
case _ => ;
}
@ -860,6 +863,8 @@ object VehicleControl {
private case class Deletion()
final case class AssignOwnership(player: Option[Player])
/**
* Determine if a given activity entry would invalidate the act of charging vehicle shields this tick.
* @param now the current time (in nanoseconds)

View file

@ -348,6 +348,11 @@ class VehicleControlMountingBlockedExosuitTest extends ActorTest {
vehicle.GUID = PlanetSideGUID(10)
vehicle.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle), "vehicle-test")
val vehicle2 = Vehicle(GlobalDefinitions.lightning)
vehicle2.Faction = PlanetSideEmpire.TR
vehicle2.GUID = PlanetSideGUID(11)
vehicle2.Actor = system.actorOf(Props(classOf[VehicleControl], vehicle2), "vehicle2-test")
val player1 = Player(VehicleTest.avatar1)
player1.ExoSuit = ExoSuitType.Reinforced
player1.GUID = PlanetSideGUID(1)
@ -359,9 +364,9 @@ class VehicleControlMountingBlockedExosuitTest extends ActorTest {
player3.GUID = PlanetSideGUID(3)
"Vehicle Control" should {
"block players from sitting if their exo-suit is not allowed by the seat" in {
//disallow
vehicle.Actor.tell(Mountable.TryMount(player1, 0), probe.ref) //Reinforced in non-MAX seat
"block players from sitting if their exo-suit is not allowed by the seat - apc_tr" in {
// disallow
vehicle2.Actor.tell(Mountable.TryMount(player1, 0), probe.ref) // Reinforced in non-reinforced seat
checkCanNotMount()
vehicle.Actor.tell(Mountable.TryMount(player2, 0), probe.ref) //MAX in non-Reinforced seat
checkCanNotMount()
@ -373,11 +378,14 @@ class VehicleControlMountingBlockedExosuitTest extends ActorTest {
checkCanNotMount()
//allow
vehicle.Actor.tell(Mountable.TryMount(player1, 1), probe.ref)
vehicle.Actor.tell(Mountable.TryMount(player1, 0), probe.ref) // Reinforced in driver seat allowing all except MAX
checkCanMount()
vehicle.Actor.tell(Mountable.TryMount(player2, 9), probe.ref)
vehicle.Actor.tell(VehicleControl.AssignOwnership(None), probe.ref) // Reset ownership to allow further driver seat mounting tests
vehicle.Actor.tell(Mountable.TryMount(player1, 1), probe.ref) // Reinforced in passenger seat allowing all except MAX
checkCanMount()
vehicle.Actor.tell(Mountable.TryMount(player3, 0), probe.ref)
vehicle.Actor.tell(Mountable.TryMount(player2, 9), probe.ref) // MAX in MAX-only seat
checkCanMount()
vehicle.Actor.tell(Mountable.TryMount(player3, 0), probe.ref) // Agile in driver seat allowing all except MAX
checkCanMount()
}
}