Add capacitor / max capacitor values to vehicles

This commit is contained in:
Mazo 2018-05-26 12:49:50 +01:00
parent 8a2896f434
commit 2d2788383c
4 changed files with 24 additions and 1 deletions

View file

@ -2705,6 +2705,7 @@ object GlobalDefinitions {
ant.DeployTime = 1500
ant.UndeployTime = 1500
ant.AutoPilotSpeeds = (18, 6)
ant.MaximumCapacitor = 1500
ant.Packet = utilityConverter
ams.Name = "ams"

View file

@ -47,6 +47,7 @@ class Vehicle(private val vehicleDef : VehicleDefinition) extends PlanetSideServ
private var trunkAccess : Option[PlanetSideGUID] = None
private var jammered : Boolean = false
private var cloaked : Boolean = false
private var capacitor : Int = 0
/**
* Permissions control who gets to access different parts of the vehicle;
@ -147,6 +148,19 @@ class Vehicle(private val vehicleDef : VehicleDefinition) extends PlanetSideServ
Cloaked
}
def Capacitor : Int = capacitor
def Capacitor_=(value: Int) : Int = {
if(value > Definition.MaximumCapacitor) {
capacitor = Definition.MaximumCapacitor
} else if (value < 0) {
capacitor = 0
} else {
capacitor = value
}
Capacitor
}
/**
* Given the index of an entry mounting point, return the infantry-accessible `Seat` associated with it.
* @param mountPoint an index representing the seat position / mounting point

View file

@ -29,6 +29,7 @@ class VehicleDefinition(objectId : Int) extends ObjectDefinition(objectId) {
private var canCloak : Boolean = false
private var canBeOwned : Boolean = true
private var serverVehicleOverrideSpeeds : (Int, Int) = (0, 0)
private var maximumCapacitor : Int = 0
Name = "vehicle"
Packet = VehicleDefinition.converter
@ -114,6 +115,13 @@ class VehicleDefinition(objectId : Int) extends ObjectDefinition(objectId) {
def AutoPilotSpeed1 : Int = serverVehicleOverrideSpeeds._1
def AutoPilotSpeed2 : Int = serverVehicleOverrideSpeeds._2
def MaximumCapacitor : Int = maximumCapacitor
def MaximumCapacitor_=(maxCapacitor: Int) : Int = {
maximumCapacitor = maxCapacitor
MaximumCapacitor
}
}
object VehicleDefinition {

View file

@ -12,7 +12,7 @@ class Building(private val mapId : Int, private val zone : Zone, private val bui
/**
* The mapId is the identifier number used in BuildingInfoUpdateMessage.
* The modelId is the identifier number used in SetEmpireMessage / Facility hacking / PlanetSideAttributeMessage.
*/
*/
private var modelId : Option[Int] = None
private var faction : PlanetSideEmpire.Value = PlanetSideEmpire.NEUTRAL
private var amenities : List[Amenity] = List.empty