mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-06 05:30:21 +00:00
TR MAX mode switch and Anchor mode switch fix; MAX will anchor, display to others as anchored, and properly switch between fire modes in both anchored and normal stances
This commit is contained in:
parent
e2dcf998e0
commit
e14f2817d7
7 changed files with 286 additions and 42 deletions
|
|
@ -11,11 +11,11 @@ import net.psforever.types.ExoSuitType
|
|||
* @param suitType the `Enumeration` corresponding to this exo-suit
|
||||
*/
|
||||
class ExoSuitDefinition(private val suitType : ExoSuitType.Value) {
|
||||
private var permission : Int = 0 //TODO certification type?
|
||||
private var maxArmor : Int = 0
|
||||
private val holsters : Array[EquipmentSize.Value] = Array.fill[EquipmentSize.Value](5)(EquipmentSize.Blocked)
|
||||
private var inventoryScale : InventoryTile = InventoryTile.Tile11 //override with custom InventoryTile
|
||||
private var inventoryOffset : Int = 0
|
||||
protected var permission : Int = 0 //TODO certification type?
|
||||
protected var maxArmor : Int = 0
|
||||
protected val holsters : Array[EquipmentSize.Value] = Array.fill[EquipmentSize.Value](5)(EquipmentSize.Blocked)
|
||||
protected var inventoryScale : InventoryTile = InventoryTile.Tile11 //override with custom InventoryTile
|
||||
protected var inventoryOffset : Int = 0
|
||||
|
||||
def SuitType : ExoSuitType.Value = suitType
|
||||
|
||||
|
|
@ -60,6 +60,45 @@ class ExoSuitDefinition(private val suitType : ExoSuitType.Value) {
|
|||
EquipmentSize.Blocked
|
||||
}
|
||||
}
|
||||
|
||||
def Use : ExoSuitDefinition = this
|
||||
}
|
||||
|
||||
class SpecialExoSuitDefinition(private val suitType : ExoSuitType.Value) extends ExoSuitDefinition(suitType) {
|
||||
private var activatedSpecial : SpecialExoSuitDefinition.Mode.Value = SpecialExoSuitDefinition.Mode.Normal
|
||||
|
||||
def UsingSpecial : SpecialExoSuitDefinition.Mode.Value = activatedSpecial
|
||||
|
||||
def UsingSpecial_=(state : SpecialExoSuitDefinition.Mode.Value) : SpecialExoSuitDefinition.Mode.Value = {
|
||||
activatedSpecial = state
|
||||
UsingSpecial
|
||||
}
|
||||
|
||||
override def Use : ExoSuitDefinition = {
|
||||
val obj = new SpecialExoSuitDefinition(SuitType)
|
||||
obj.MaxArmor = MaxArmor
|
||||
obj.InventoryScale = InventoryScale
|
||||
obj.InventoryOffset = InventoryOffset
|
||||
(0 until 5).foreach(index => { obj.Holster(index, Holster(index)) })
|
||||
obj
|
||||
}
|
||||
}
|
||||
|
||||
object SpecialExoSuitDefinition {
|
||||
def apply(suitType : ExoSuitType.Value) : SpecialExoSuitDefinition = {
|
||||
new SpecialExoSuitDefinition(suitType)
|
||||
}
|
||||
|
||||
object Mode extends Enumeration {
|
||||
type Type = Value
|
||||
|
||||
val
|
||||
Normal,
|
||||
Anchored,
|
||||
Overdrive,
|
||||
Shielded
|
||||
= Value
|
||||
}
|
||||
}
|
||||
|
||||
object ExoSuitDefinition {
|
||||
|
|
@ -99,7 +138,7 @@ object ExoSuitDefinition {
|
|||
Infiltration.Holster(0, EquipmentSize.Pistol)
|
||||
Infiltration.Holster(4, EquipmentSize.Melee)
|
||||
|
||||
final val MAX = ExoSuitDefinition(ExoSuitType.MAX)
|
||||
final val MAX = new SpecialExoSuitDefinition(ExoSuitType.MAX)
|
||||
MAX.permission = 1
|
||||
MAX.MaxArmor = 650
|
||||
MAX.InventoryScale = InventoryTile.Tile1612
|
||||
|
|
@ -118,11 +157,11 @@ object ExoSuitDefinition {
|
|||
*/
|
||||
def Select(suit : ExoSuitType.Value) : ExoSuitDefinition = {
|
||||
suit match {
|
||||
case ExoSuitType.Agile => ExoSuitDefinition.Agile
|
||||
case ExoSuitType.Infiltration => ExoSuitDefinition.Infiltration
|
||||
case ExoSuitType.MAX => ExoSuitDefinition.MAX
|
||||
case ExoSuitType.Reinforced => ExoSuitDefinition.Reinforced
|
||||
case _ => ExoSuitDefinition.Standard
|
||||
case ExoSuitType.Agile => ExoSuitDefinition.Agile.Use
|
||||
case ExoSuitType.Infiltration => ExoSuitDefinition.Infiltration.Use
|
||||
case ExoSuitType.MAX => ExoSuitDefinition.MAX.Use
|
||||
case ExoSuitType.Reinforced => ExoSuitDefinition.Reinforced.Use
|
||||
case _ => ExoSuitDefinition.Standard.Use
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,11 +278,38 @@ object GlobalDefinitions {
|
|||
|
||||
val flamethrower = ToolDefinition(ObjectClass.flamethrower)
|
||||
|
||||
val trhev_dualcycler = ToolDefinition(ObjectClass.trhev_dualcycler)
|
||||
val trhev_dualcycler = new ToolDefinition(ObjectClass.trhev_dualcycler) {
|
||||
override def NextFireModeIndex(index : Int) : Int = index
|
||||
}
|
||||
|
||||
val trhev_pounder = ToolDefinition(ObjectClass.trhev_pounder)
|
||||
val trhev_pounder = new ToolDefinition(ObjectClass.trhev_pounder) {
|
||||
override def NextFireModeIndex(index : Int) : Int = {
|
||||
//TODO other modes
|
||||
if(index == 0 || index == 3) {
|
||||
if(index == 0) {
|
||||
3 //3-second fuse
|
||||
}
|
||||
else {
|
||||
0 //explode on contact
|
||||
}
|
||||
}
|
||||
else if(index == 1 || index == 4) {
|
||||
if(index == 1) {
|
||||
4 //3-second fuse, anchored
|
||||
}
|
||||
else {
|
||||
1 //explode on contact, anchored
|
||||
}
|
||||
}
|
||||
else {
|
||||
index
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val trhev_burster = ToolDefinition(ObjectClass.trhev_burster)
|
||||
val trhev_burster = new ToolDefinition(ObjectClass.trhev_burster) {
|
||||
override def NextFireModeIndex(index : Int) : Int = index
|
||||
}
|
||||
|
||||
val nchev_scattercannon = ToolDefinition(ObjectClass.nchev_scattercannon)
|
||||
|
||||
|
|
@ -1672,18 +1699,42 @@ object GlobalDefinitions {
|
|||
trhev_dualcycler.FireModes.head.AmmoTypeIndices += 0
|
||||
trhev_dualcycler.FireModes.head.AmmoSlotIndex = 0
|
||||
trhev_dualcycler.FireModes.head.Magazine = 200
|
||||
trhev_dualcycler.FireModes += new FireModeDefinition //anchored
|
||||
trhev_dualcycler.FireModes(1).AmmoTypeIndices += 0
|
||||
trhev_dualcycler.FireModes(1).AmmoSlotIndex = 0
|
||||
trhev_dualcycler.FireModes(1).Magazine = 200
|
||||
trhev_dualcycler.FireModes += new FireModeDefinition //overdrive?
|
||||
trhev_dualcycler.FireModes(2).AmmoTypeIndices += 0
|
||||
trhev_dualcycler.FireModes(2).AmmoSlotIndex = 0
|
||||
trhev_dualcycler.FireModes(2).Magazine = 200
|
||||
|
||||
trhev_pounder.Name = "trhev_pounder"
|
||||
trhev_pounder.Size = EquipmentSize.Max
|
||||
trhev_pounder.AmmoTypes += pounder_ammo
|
||||
trhev_pounder.FireModes += new FireModeDefinition
|
||||
trhev_pounder.FireModes.head.AmmoTypeIndices += 0
|
||||
trhev_pounder.FireModes.head.AmmoTypeIndices += 0 //explode on contact
|
||||
trhev_pounder.FireModes.head.AmmoSlotIndex = 0
|
||||
trhev_pounder.FireModes.head.Magazine = 30
|
||||
trhev_pounder.FireModes += new FireModeDefinition
|
||||
trhev_pounder.FireModes += new FireModeDefinition //explode on contact, anchored
|
||||
trhev_pounder.FireModes(1).AmmoTypeIndices += 0
|
||||
trhev_pounder.FireModes(1).AmmoSlotIndex = 0
|
||||
trhev_pounder.FireModes(1).Magazine = 30
|
||||
trhev_pounder.FireModes += new FireModeDefinition //explode on contact, overdrive?
|
||||
trhev_pounder.FireModes(2).AmmoTypeIndices += 0
|
||||
trhev_pounder.FireModes(2).AmmoSlotIndex = 0
|
||||
trhev_pounder.FireModes(2).Magazine = 30
|
||||
trhev_pounder.FireModes += new FireModeDefinition //3-second fuse
|
||||
trhev_pounder.FireModes(3).AmmoTypeIndices += 0
|
||||
trhev_pounder.FireModes(3).AmmoSlotIndex = 0
|
||||
trhev_pounder.FireModes(3).Magazine = 30
|
||||
trhev_pounder.FireModes += new FireModeDefinition //3-second fuse, anchored
|
||||
trhev_pounder.FireModes(4).AmmoTypeIndices += 0
|
||||
trhev_pounder.FireModes(4).AmmoSlotIndex = 0
|
||||
trhev_pounder.FireModes(4).Magazine = 30
|
||||
trhev_pounder.FireModes += new FireModeDefinition //3-second fuse, overdrive?
|
||||
trhev_pounder.FireModes(5).AmmoTypeIndices += 0
|
||||
trhev_pounder.FireModes(5).AmmoSlotIndex = 0
|
||||
trhev_pounder.FireModes(5).Magazine = 30
|
||||
|
||||
trhev_burster.Name = "trhev_burster"
|
||||
trhev_burster.Size = EquipmentSize.Max
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class Player(private val core : Avatar) extends PlanetSideGameObject with Factio
|
|||
private var maxHealth : Int = 100 //TODO affected by empire benefits, territory benefits, and bops
|
||||
private var maxStamina : Int = 100 //does anything affect this?
|
||||
|
||||
private var exosuit : ExoSuitType.Value = ExoSuitType.Standard
|
||||
private var exosuit : ExoSuitDefinition = ExoSuitDefinition.Standard
|
||||
private val freeHand : EquipmentSlot = new OffhandEquipmentSlot(EquipmentSize.Inventory)
|
||||
private val holsters : Array[EquipmentSlot] = Array.fill[EquipmentSlot](5)(new EquipmentSlot)
|
||||
private val inventory : GridInventory = GridInventory()
|
||||
|
|
@ -127,9 +127,9 @@ class Player(private val core : Avatar) extends PlanetSideGameObject with Factio
|
|||
Armor
|
||||
}
|
||||
|
||||
def MaxArmor : Int = ExoSuitDefinition.Select(exosuit).MaxArmor
|
||||
def MaxArmor : Int = exosuit.MaxArmor
|
||||
|
||||
def VisibleSlots : Set[Int] = if(exosuit == ExoSuitType.MAX) { Set(0) } else { Set(0,1,2,3,4) }
|
||||
def VisibleSlots : Set[Int] = if(exosuit.SuitType == ExoSuitType.MAX) { Set(0) } else { Set(0,1,2,3,4) }
|
||||
|
||||
override def Slot(slot : Int) : EquipmentSlot = {
|
||||
if(inventory.Offset <= slot && slot <= inventory.LastIndex) {
|
||||
|
|
@ -262,10 +262,11 @@ class Player(private val core : Avatar) extends PlanetSideGameObject with Factio
|
|||
|
||||
def LastDrawnSlot : Int = lastDrawnSlot
|
||||
|
||||
def ExoSuit : ExoSuitType.Value = exosuit
|
||||
def ExoSuit : ExoSuitType.Value = exosuit.SuitType
|
||||
|
||||
def ExoSuit_=(suit : ExoSuitType.Value) : Unit = {
|
||||
exosuit = suit
|
||||
exosuit = ExoSuitDefinition.Select(suit)
|
||||
ChangeSpecialAbility()
|
||||
}
|
||||
|
||||
def LoadLoadout(line : Int) : Option[Loadout] = core.LoadLoadout(line)
|
||||
|
|
@ -322,6 +323,81 @@ class Player(private val core : Avatar) extends PlanetSideGameObject with Factio
|
|||
Cloaked
|
||||
}
|
||||
|
||||
private var usingSpecial : (SpecialExoSuitDefinition.Mode.Value)=>SpecialExoSuitDefinition.Mode.Value = DefaultUsingSpecial
|
||||
|
||||
private var gettingSpecial : ()=>SpecialExoSuitDefinition.Mode.Value = DefaultGettingSpecial
|
||||
|
||||
private def ChangeSpecialAbility() : Unit = {
|
||||
if(ExoSuit == ExoSuitType.MAX) {
|
||||
gettingSpecial = MAXGettingSpecial
|
||||
usingSpecial = Faction match {
|
||||
case PlanetSideEmpire.TR => UsingAnchorsOrOverdrive
|
||||
case PlanetSideEmpire.NC => UsingShield
|
||||
case _ => DefaultUsingSpecial
|
||||
}
|
||||
}
|
||||
else {
|
||||
usingSpecial = DefaultUsingSpecial
|
||||
gettingSpecial = DefaultGettingSpecial
|
||||
}
|
||||
}
|
||||
|
||||
def UsingSpecial : SpecialExoSuitDefinition.Mode.Value = { gettingSpecial() }
|
||||
|
||||
def UsingSpecial_=(state : SpecialExoSuitDefinition.Mode.Value) : SpecialExoSuitDefinition.Mode.Value = usingSpecial(state)
|
||||
|
||||
private def DefaultUsingSpecial(state : SpecialExoSuitDefinition.Mode.Value) : SpecialExoSuitDefinition.Mode.Value = SpecialExoSuitDefinition.Mode.Normal
|
||||
|
||||
private def UsingAnchorsOrOverdrive(state : SpecialExoSuitDefinition.Mode.Value) : SpecialExoSuitDefinition.Mode.Value = {
|
||||
if(ExoSuit == ExoSuitType.MAX && Faction == PlanetSideEmpire.TR) {
|
||||
val curr = UsingSpecial
|
||||
val next = if(curr != SpecialExoSuitDefinition.Mode.Normal) {
|
||||
SpecialExoSuitDefinition.Mode.Normal
|
||||
}
|
||||
else if(curr == SpecialExoSuitDefinition.Mode.Normal) {
|
||||
state
|
||||
}
|
||||
else {
|
||||
SpecialExoSuitDefinition.Mode.Normal
|
||||
}
|
||||
MAXUsingSpecial(next)
|
||||
}
|
||||
else {
|
||||
SpecialExoSuitDefinition.Mode.Normal
|
||||
}
|
||||
}
|
||||
|
||||
private def UsingShield(state : SpecialExoSuitDefinition.Mode.Value) : SpecialExoSuitDefinition.Mode.Value = {
|
||||
if(ExoSuit == ExoSuitType.MAX && Faction == PlanetSideEmpire.NC) {
|
||||
MAXUsingSpecial(state)
|
||||
}
|
||||
else {
|
||||
SpecialExoSuitDefinition.Mode.Normal
|
||||
}
|
||||
}
|
||||
|
||||
private def DefaultGettingSpecial() : SpecialExoSuitDefinition.Mode.Value = SpecialExoSuitDefinition.Mode.Normal
|
||||
|
||||
private def MAXUsingSpecial(state : SpecialExoSuitDefinition.Mode.Value) : SpecialExoSuitDefinition.Mode.Value = exosuit match {
|
||||
case obj : SpecialExoSuitDefinition =>
|
||||
obj.UsingSpecial = state
|
||||
case _ =>
|
||||
SpecialExoSuitDefinition.Mode.Normal
|
||||
}
|
||||
|
||||
private def MAXGettingSpecial() : SpecialExoSuitDefinition.Mode.Value = exosuit match {
|
||||
case obj : SpecialExoSuitDefinition =>
|
||||
obj.UsingSpecial
|
||||
case _ =>
|
||||
SpecialExoSuitDefinition.Mode.Normal
|
||||
}
|
||||
|
||||
def isAnchored : Boolean = ExoSuit == ExoSuitType.MAX && Faction == PlanetSideEmpire.NC && UsingSpecial == SpecialExoSuitDefinition.Mode.Anchored
|
||||
|
||||
def isOverdrived : Boolean = ExoSuit == ExoSuitType.MAX && Faction == PlanetSideEmpire.NC && UsingSpecial == SpecialExoSuitDefinition.Mode.Overdrive
|
||||
|
||||
def isShielded : Boolean = ExoSuit == ExoSuitType.MAX && Faction == PlanetSideEmpire.NC && UsingSpecial == SpecialExoSuitDefinition.Mode.Shielded
|
||||
|
||||
def AccessingBackpack : Option[PlanetSideGUID] = backpackAccess
|
||||
|
||||
def AccessingBackpack_=(guid : PlanetSideGUID) : Option[PlanetSideGUID] = {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,15 @@ class Tool(private val toolDef : ToolDefinition) extends Equipment with FireMode
|
|||
def FireMode : FireModeDefinition = toolDef.FireModes(fireModeIndex)
|
||||
|
||||
def NextFireMode : FireModeDefinition = {
|
||||
FireModeIndex = FireModeIndex + 1
|
||||
FireModeIndex = toolDef.NextFireModeIndex(FireModeIndex)
|
||||
AmmoSlot.Chamber = FireMode.Chamber
|
||||
FireMode
|
||||
}
|
||||
|
||||
def ToFireMode : Int = toolDef.NextFireModeIndex(FireModeIndex)
|
||||
|
||||
def ToFireMode_=(index : Int) : FireModeDefinition = {
|
||||
FireModeIndex = index
|
||||
AmmoSlot.Chamber = FireMode.Chamber
|
||||
FireMode
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ class ToolDefinition(objectId : Int) extends EquipmentDefinition(objectId) {
|
|||
def AmmoTypes : mutable.ListBuffer[AmmoBoxDefinition] = ammoTypes
|
||||
|
||||
def FireModes : mutable.ListBuffer[FireModeDefinition] = fireModes
|
||||
|
||||
def NextFireModeIndex(index : Int) : Int = index + 1
|
||||
}
|
||||
|
||||
object ToolDefinition {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue