Building:

Replaces class object/serverobject/door/Base.scala.  It performs nearly the exact same purpose but now has a list of owned objects called Amenities.  Buildings are now a PlanetSideServerObject (PSSO), which allows them to have accept a *Control Actor and possess FactionAffinity.

FoundationBuilder:
FoundationBuilder : Building :: ServerObjectBuilder : [T <: PlanetSideServerObject]

Amenity:
Most PSSO's now accept Amenity as their parent in class hierarchy.  Flagged PSSO's like Building and Vehicle are, on the other hand, capable of becoming the owner for these Amenity PSSOs, which allows them to inherit the same FactionAffinity.

FactionAffinity:
A trait that connects objects that are intended to communicate PlanetSideEmpire values.

MountableBhevaior:
Split between Mount and Dismount behavior.  Passes appropriate messages to ensure coherent workflows.

Control Actors:
FactionAffinityBehavior and MountableBehavior are PartialFunctions that get processed in series.

VehicleControl:
Distinguished behavior allowed between an operational vehicle and a deactivated one.

WSA:
Tightened up DismountVehicleMsg handling code, since MountableBehavior has been enhanced.

Minor:
Shotgun shell stacking goes from 32 to 16.  Various PSSO classes now have reliable Definition objects.

Tests:
We now have 1012 tests, some of them useful.
This commit is contained in:
FateJH 2018-01-26 15:32:08 -05:00
parent 8c02f8d519
commit eefe4d2e20
56 changed files with 1362 additions and 425 deletions

View file

@ -1,39 +1,44 @@
// Copyright (c) 2017 PSForever
package objects
import akka.actor.ActorRef
import akka.actor.{ActorContext, ActorRef}
import net.psforever.objects.entity.IdentifiableEntity
import net.psforever.objects.equipment.Equipment
import net.psforever.objects.guid.NumberPoolHub
import net.psforever.objects.guid.source.LimitedNumberSource
import net.psforever.objects.serverobject.structures.{Building, FoundationBuilder}
import net.psforever.objects.zones.{Zone, ZoneMap}
import net.psforever.objects.{GlobalDefinitions, Vehicle}
import org.specs2.mutable.Specification
class ZoneTest extends Specification {
def test(a: Int, b : Zone, c : ActorContext) : Building = { Building.NoBuilding }
"ZoneMap" should {
//TODO these are temporary tests as the current ZoneMap is a kludge
"construct" in {
new ZoneMap("map13")
ok
}
"references bases by a positive building id (defaults to 0)" in {
def test(a: Int, b : Zone, c : ActorContext) : Building = { Building.NoBuilding }
val map = new ZoneMap("map13")
map.LocalBases mustEqual 0
map.LocalBases = 10
map.LocalBases mustEqual 10
map.LocalBases = -1
map.LocalBases mustEqual 10
map.LocalBuildings mustEqual Map.empty
map.LocalBuilding(10, FoundationBuilder(test))
map.LocalBuildings.keySet.contains(10) mustEqual true
map.LocalBuilding(-1, FoundationBuilder(test))
map.LocalBuildings.keySet.contains(10) mustEqual true
map.LocalBuildings.keySet.contains(-1) mustEqual false
}
"associates objects to bases (doesn't check numbers)" in {
val map = new ZoneMap("map13")
map.ObjectToBase mustEqual Nil
map.ObjectToBase(1, 2)
map.ObjectToBase mustEqual List((1, 2))
map.ObjectToBase(3, 4)
map.ObjectToBase mustEqual List((1, 2), (3, 4))
map.ObjectToBuilding mustEqual Nil
map.ObjectToBuilding(1, 2)
map.ObjectToBuilding mustEqual Map(1 -> 2)
map.ObjectToBuilding(3, 4)
map.ObjectToBuilding mustEqual Map(1 -> 2, 3 -> 4)
}
"associates doors to door locks (doesn't check numbers)" in {
@ -65,11 +70,10 @@ class ZoneTest extends Specification {
}
val map13 = new ZoneMap("map13")
map13.LocalBases = 10
map13.LocalBuilding(10, FoundationBuilder(test))
class TestObject extends IdentifiableEntity
"Zone" should {
//TODO these are temporary tests as the current Zone is a kludge
"construct" in {
val zone = new Zone("home3", map13, 13)
zone.GUID mustEqual ActorRef.noSender