Anguta, Ceryshen, the Anguta Watchower, and Anguta's two bunkers have had their amenities wired together, excluding the door locks being connected to doors. Modified how things like spectator status, fly status and speed persist.

This commit is contained in:
FateJH 2018-03-10 21:18:27 -05:00
parent bd76d28564
commit 001f9a40e9
13 changed files with 490 additions and 175 deletions

View file

@ -509,6 +509,8 @@ object GlobalDefinitions {
val vehicle_terminal_combined = new VehicleTerminalCombinedDefinition
val spawn_terminal = new SpawnTerminalDefinition
val spawn_pad = new VehicleSpawnPadDefinition
val mb_locker = new LockerDefinition
@ -643,7 +645,7 @@ object GlobalDefinitions {
* @param faction the faction
* @return the `ToolDefinition` for the launcher
*/
def AntiVehicular(faction : PlanetSideEmpire.Value) : ToolDefinition = {
def AntiVehicularLauncher(faction : PlanetSideEmpire.Value) : ToolDefinition = {
faction match {
case PlanetSideEmpire.TR => striker
case PlanetSideEmpire.NC => hunterseeker

View file

@ -62,7 +62,6 @@ class Player(private val name : String,
private var backpackAccess : Option[PlanetSideGUID] = None
private var admin : Boolean = false
private var spectator : Boolean = false
private var vehicleSeated : Option[PlanetSideGUID] = None
private var vehicleOwned : Option[PlanetSideGUID] = None
@ -526,8 +525,6 @@ class Player(private val name : String,
def Admin : Boolean = admin
def Spectator : Boolean = spectator
def VehicleSeated : Option[PlanetSideGUID] = vehicleSeated
def VehicleSeated_=(guid : PlanetSideGUID) : Option[PlanetSideGUID] = VehicleSeated_=(Some(guid))
@ -616,11 +613,6 @@ object Player {
player
}
def Spectate(player : Player, isSpectator : Boolean) : Player = {
player.spectator = isSpectator
player
}
def Release(player : Player) : Player = {
if(player.Release) {
val obj = new Player(player.Name, player.Faction, player.Sex, player.Voice, player.Head)

View file

@ -18,7 +18,7 @@ import net.psforever.objects.guid.NumberPoolHub
* a closed number space, which is also the `Zone`.
* It utilizes those qualities of the enclosing region to construct the entity within that region.<br>
* <br>
* Example: `ServerObjectBuilder(n, function)`
* Example: `ServerObjectBuilder(n, function)`<br>
* Example: `new ServerBuilderObject[A](n, function)`, where `function` is a `(Int,Context)=>A`
* @see `ZoneMap`
* @see `Zone.Init`
@ -28,7 +28,7 @@ import net.psforever.objects.guid.NumberPoolHub
* can be inferred from the output of `constructor`
*/
class ServerObjectBuilder[A <: PlanetSideServerObject](private val id : Int,
private val constructor : (Int, ActorContext) => A
private val constructor : ServerObjectBuilder.ConstructorType[A]
) {
/**
* Instantiate and configure the given server object.
@ -49,6 +49,8 @@ class ServerObjectBuilder[A <: PlanetSideServerObject](private val id : Int,
}
object ServerObjectBuilder {
type ConstructorType[A <: PlanetSideServerObject] = (Int, ActorContext)=>A
/**
* Overloaded constructor.
* @param id the unqiue id that will be assigned to this entity
@ -56,7 +58,7 @@ object ServerObjectBuilder {
* @tparam A any object that extends from PlanetSideServerObject that will be produced by this class
* @return a `ServerObjectBuilder` object
*/
def apply[A <: PlanetSideServerObject](id : Int, constructor : (Int, ActorContext) => A) : ServerObjectBuilder[A] = {
def apply[A <: PlanetSideServerObject](id : Int, constructor : ConstructorType[A]) : ServerObjectBuilder[A] = {
new ServerObjectBuilder[A](id, constructor)
}
}

View file

@ -8,12 +8,17 @@ import net.psforever.objects.zones.Zone
import net.psforever.packet.game.PlanetSideGUID
import net.psforever.types.PlanetSideEmpire
class Building(private val id : Int, private val zone : Zone) extends PlanetSideServerObject {
class Building(private val mapId : Int, private val zone : Zone) extends PlanetSideServerObject {
/**
* The mapId is the identifier number used in BuildingInfoUpdateMessage.
* The modelId is the identifier number used in SetEmpireMessage.
*/
private var modelId : Option[Int] = None
private var faction : PlanetSideEmpire.Value = PlanetSideEmpire.NEUTRAL
private var amenities : List[Amenity] = List.empty
GUID = PlanetSideGUID(0)
def Id : Int = id
def Id : Int = mapId
def Faction : PlanetSideEmpire.Value = faction
@ -32,6 +37,15 @@ class Building(private val id : Int, private val zone : Zone) extends PlanetSide
def Zone : Zone = zone
def ModelId : Int = modelId.getOrElse(Id)
def ModelId_=(id : Int) : Int = ModelId_=(Some(id))
def ModelId_=(id : Option[Int]) : Int = {
modelId = id
ModelId
}
def Definition: ObjectDefinition = Building.BuildingDefinition
}

View file

@ -0,0 +1,15 @@
// Copyright (c) 2017 PSForever
package net.psforever.objects.serverobject.terminals
import net.psforever.objects.Player
import net.psforever.packet.game.ItemTransactionMessage
/**
* The definition for any `Terminal` that is of a type "spawn_terminal."
* A "spawn_terminal" is somewhat like the `matrix_terminalc` of an advanced mobile spawn unit, but inside of facilities.
*/
class SpawnTerminalDefinition extends TerminalDefinition(812) {
Name = "spawn_terminal"
override def Buy(player : Player, msg : ItemTransactionMessage) : Terminal.Exchange = Terminal.NoDeal()
}

View file

@ -13,22 +13,24 @@ object SpawnTube {
new SpawnTube(tubeDef)
}
// import akka.actor.ActorContext
// import net.psforever.types.Vector3
// /**
// * Instantiate an configure a `SpawnTube` object
// * @param pos the position (used to determine spawn point)
// * @param orient the orientation (used to indicate spawn direction)
// * @param id the unique id that will be assigned to this entity
// * @param context a context to allow the object to properly set up `ActorSystem` functionality
// * @return the `SpawnTube` object
// */
// def Constructor(pos : Vector3, orient : Vector3)(id : Int, context : ActorContext) : SpawnTube = {
// import net.psforever.objects.GlobalDefinitions
//
// val obj = SpawnTube(GlobalDefinitions.ams_respawn_tube)
// obj.Position = pos
// obj.Orientation = orient
// obj
// }
import akka.actor.ActorContext
import net.psforever.types.Vector3
/**
* Instantiate an configure a `SpawnTube` object
* @param pos the position (used to determine spawn point)
* @param orient the orientation (used to indicate spawn direction)
* @param id the unique id that will be assigned to this entity
* @param context a context to allow the object to properly set up `ActorSystem` functionality
* @return the `SpawnTube` object
*/
def Constructor(pos : Vector3, orient : Vector3)(id : Int, context : ActorContext) : SpawnTube = {
import akka.actor.Props
import net.psforever.objects.GlobalDefinitions
val obj = SpawnTube(GlobalDefinitions.ams_respawn_tube)
obj.Position = pos
obj.Orientation = orient
obj.Actor = context.actorOf(Props(classOf[SpawnTubeControl], obj), s"${GlobalDefinitions.ams_respawn_tube.Name}_$id")
obj
}
}

View file

@ -44,8 +44,8 @@ class Zone(private val zoneId : String, zoneMap : ZoneMap, zoneNumber : Int) {
private var accessor : ActorRef = ActorRef.noSender
/** The basic support structure for the globally unique number system used by this `Zone`. */
private var guid : NumberPoolHub = new NumberPoolHub(new LimitedNumberSource(65536))
guid.AddPool("environment", (0 to 2000).toList)
guid.AddPool("dynamic", (2001 to 10000).toList).Selector = new RandomSelector //TODO unlump pools later; do not make too big
guid.AddPool("environment", (0 to 3000).toList) //TODO tailer ro suit requirements of zone
guid.AddPool("dynamic", (3001 to 10000).toList).Selector = new RandomSelector //TODO unlump pools later; do not make too big
/** A synchronized `List` of items (`Equipment`) dropped by players on the ground and can be collected again. */
private val equipmentOnGround : ListBuffer[Equipment] = ListBuffer[Equipment]()
/** Used by the `Zone` to coordinate `Equipment` dropping and collection requests. */
@ -66,7 +66,12 @@ class Zone(private val zoneId : String, zoneMap : ZoneMap, zoneNumber : Int) {
* First, the `Actor`-driven aspect of the globally unique identifier system for this `Zone` is finalized.
* Second, all supporting `Actor` agents are created, e.g., `ground`.
* Third, the `ZoneMap` server objects are loaded and constructed within that aforementioned system.
* To avoid being called more than once, there is a test whether the `accessor` for the globally unique identifier system has been changed.
* To avoid being called more than once, there is a test whether the `accessor` for the globally unique identifier system has been changed.<br>
* <br>
* Execution of this operation should be fail-safe.
* The chances of failure should be mitigated or skipped.
* An testing routine should be run after the fact on the results of the process.
* @see `ZoneActor.ZoneSetupCheck`
* @param context a reference to an `ActorContext` necessary for `Props`
*/
def Init(implicit context : ActorContext) : Unit = {
@ -76,9 +81,7 @@ class Zone(private val zoneId : String, zoneMap : ZoneMap, zoneNumber : Int) {
ground = context.actorOf(Props(classOf[ZoneGroundActor], equipmentOnGround), s"$Id-ground")
transport = context.actorOf(Props(classOf[ZoneVehicleActor], this), s"$Id-vehicles")
Map.LocalObjects.foreach({ builderObject =>
builderObject.Build
})
Map.LocalObjects.foreach({ builderObject => builderObject.Build })
MakeBuildings(context)
AssignAmenities()
}

View file

@ -29,9 +29,9 @@ class ZoneActor(zone : Zone) extends Actor {
val validateObject : (Int, (PlanetSideGameObject)=>Boolean, String) => Boolean = ValidateObject(guid, slog)
//check base to object associations
map.ObjectToBuilding.foreach({ case((object_guid, base_id)) =>
if(zone.Building(base_id).isEmpty) {
slog.error(s"expected a building at id #$base_id")
map.ObjectToBuilding.foreach({ case((object_guid, building_id)) =>
if(zone.Building(building_id).isEmpty) {
slog.error(s"expected a building at id #$building_id")
}
if(guid(object_guid).isEmpty) {
slog.error(s"expected object id $object_guid to exist, but it did not")
@ -85,8 +85,8 @@ object ZoneActor {
}
}
catch {
case _ : Exception =>
elog.error(s"expected a $description at id $object_guid but no object is initialized")
case e : Exception =>
elog.error(s"expected a $description at id $object_guid but no object is initialized - $e")
false
}
}

View file

@ -2,7 +2,7 @@
package net.psforever.objects.zones
import net.psforever.objects.serverobject.structures.FoundationBuilder
import net.psforever.objects.serverobject.ServerObjectBuilder
import net.psforever.objects.serverobject.{PlanetSideServerObject, ServerObjectBuilder}
/**
* The fixed instantiation and relation of a series of server objects.<br>
@ -44,10 +44,15 @@ class ZoneMap(private val name : String) {
/**
* Append the builder for a server object to the list of builders known to this `ZoneMap`.
* @param obj the builder for a server object
* @param id the unique id that will be assigned to this entity
* @param constructor the logic that initializes the emitted entity
* @return the current number of builders
*/
def LocalObject(obj : ServerObjectBuilder[_]) : Unit = {
localObjects = localObjects :+ obj
def LocalObject[A <: PlanetSideServerObject](id : Int, constructor : ServerObjectBuilder.ConstructorType[A]) : Int = {
if(id > 0) {
localObjects = localObjects :+ ServerObjectBuilder[A](id, constructor)
}
localObjects.size
}
def LocalBuildings : Map[Int, FoundationBuilder] = buildings

View file

@ -247,13 +247,4 @@ class PlayerTest extends Specification {
Player.Administrate(obj, false)
obj.Admin mustEqual false
}
"spectate" in {
val obj = new Player("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, 5)
obj.Spectator mustEqual false
Player.Spectate(obj, true)
obj.Spectator mustEqual true
Player.Spectate(obj, false)
obj.Spectator mustEqual false
}
}