PSF-BotServer/src/test/scala/service/HartTimerTest.scala
Fate-JH 71ab35ecab
Hart (#723)
* initial OrbitalShuttleTimeMsg packet and tests; new objects to support HART shuttle transport system

* master was stale

* grouped scheduling for timing orbital shuttle activity

* door lock controls for HART shuttle lifecycle, and specifically for the doors that lead into the shuttle boarding hallway

* separation of the door from the door unlocking logic, which now has to be provided if performed by an outside source; a door that is locked either by bolt, HART routine, or other reason, can now be shut immediately; message when HART is not docked with a corresponding entry hallway door

* better degree of door logic control; all shuttle-related messages have been moved to LocalService; careful managing of 'original state' for the shuttle's cycle

* modification of seat mounting and cargo mounting support entities to expand functionality

* absolutely very little to do with the feature of this branch and a lot to do with yak-shaving; long story short, class inheritance is greatly modified and mountable seats can now accept multiple players if initialized properly

* a lot has changed: distribution of MountableBehavior, mount point information is more complex, vehicles convert differently, the routine of the shuttle timer is initialized differently; you can now successfully utilize the HART shuttle to drop into a zone

* swap of shutle from pad to pad control; tests and comments

* eject players from HART gantry hallway as if passengers dismounting from seat when not boarding through the use of environmental geometry; HART system uses duration from config settings to set scheduler

* rebase to curious master; repairs to vector rotation calculations; regression of mountable changes involving seats with occupancy greater than 1; orbital shuttle as a unique vehicle and amenity; corrected dismount offsets and offset calculations; weird angle of nc hart a building has been properly accommodated; hart events have prerequisite animation states

* rebase with master; looks like rebase with merged_master, which is also a commit

* lots of tests (though not nearly enough); checking the permission group of a shuttle seat no longer creates that seat

* fixing explosions

* fixed the persistence monitor service potentially using non-printable unicode in actor names

* can not use a droppod to gain access to one's own sanctuary

* removed hart facility update that causing open bay doors and beeping

* PR review changes

* fix for aggravation issues
2021-03-23 09:44:10 -04:00

57 lines
1.9 KiB
Scala

// Copyright (c) 2021 PSForever
package service
import akka.actor.Props
import akka.testkit.TestProbe
import base.ActorTest
import net.psforever.objects.zones.{Zone, ZoneMap}
import net.psforever.services.hart.HartTimer
import net.psforever.types.PlanetSideGUID
import scala.concurrent.duration._
class HartTimerNotScheduled extends ActorTest {
"HartTimer" should {
val catchall = new TestProbe(system).ref
val zone = new Zone("test", new ZoneMap("test"), 0) {
override def SetupNumberPools() = {}
override def AvatarEvents = catchall
override def LocalEvents = catchall
override def VehicleEvents = catchall
override def Activity = catchall
}
val timer = system.actorOf(Props(classOf[HartTimer], zone), "hart-timer")
"not do anything if paired before having a schedule set" in {
val probe = new TestProbe(system)
timer ! HartTimer.PairWith(zone, PlanetSideGUID(1), PlanetSideGUID(2), probe.ref)
probe.expectNoMessage(max = 3 seconds)
}
}
}
class HartTimerInitializedPairingScheduled extends ActorTest {
"HartTimer" should {
val catchall = new TestProbe(system).ref
val zone = new Zone("test", new ZoneMap("test"), 0) {
override def SetupNumberPools() = {}
override def AvatarEvents = catchall
override def LocalEvents = catchall
override def VehicleEvents = catchall
override def Activity = catchall
}
val timer = system.actorOf(Props(classOf[HartTimer], zone), "hart-timer")
"perform some initialization when paired" in {
val probe = new TestProbe(system)
timer ! HartTimer.SetEventDurations("test", 55000, 10000)
timer ! HartTimer.PairWith(zone, PlanetSideGUID(1), PlanetSideGUID(2), probe.ref)
probe.receiveOne(1 seconds) match {
case HartTimer.ShuttleDocked("test") => assert(true)
case _ => assert(false)
}
}
}
}
object HartTimerTest { /* initially left empty */ }