mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-04-29 16:25:30 +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
|
* @param suitType the `Enumeration` corresponding to this exo-suit
|
||||||
*/
|
*/
|
||||||
class ExoSuitDefinition(private val suitType : ExoSuitType.Value) {
|
class ExoSuitDefinition(private val suitType : ExoSuitType.Value) {
|
||||||
private var permission : Int = 0 //TODO certification type?
|
protected var permission : Int = 0 //TODO certification type?
|
||||||
private var maxArmor : Int = 0
|
protected var maxArmor : Int = 0
|
||||||
private val holsters : Array[EquipmentSize.Value] = Array.fill[EquipmentSize.Value](5)(EquipmentSize.Blocked)
|
protected val holsters : Array[EquipmentSize.Value] = Array.fill[EquipmentSize.Value](5)(EquipmentSize.Blocked)
|
||||||
private var inventoryScale : InventoryTile = InventoryTile.Tile11 //override with custom InventoryTile
|
protected var inventoryScale : InventoryTile = InventoryTile.Tile11 //override with custom InventoryTile
|
||||||
private var inventoryOffset : Int = 0
|
protected var inventoryOffset : Int = 0
|
||||||
|
|
||||||
def SuitType : ExoSuitType.Value = suitType
|
def SuitType : ExoSuitType.Value = suitType
|
||||||
|
|
||||||
|
|
@ -60,6 +60,45 @@ class ExoSuitDefinition(private val suitType : ExoSuitType.Value) {
|
||||||
EquipmentSize.Blocked
|
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 {
|
object ExoSuitDefinition {
|
||||||
|
|
@ -99,7 +138,7 @@ object ExoSuitDefinition {
|
||||||
Infiltration.Holster(0, EquipmentSize.Pistol)
|
Infiltration.Holster(0, EquipmentSize.Pistol)
|
||||||
Infiltration.Holster(4, EquipmentSize.Melee)
|
Infiltration.Holster(4, EquipmentSize.Melee)
|
||||||
|
|
||||||
final val MAX = ExoSuitDefinition(ExoSuitType.MAX)
|
final val MAX = new SpecialExoSuitDefinition(ExoSuitType.MAX)
|
||||||
MAX.permission = 1
|
MAX.permission = 1
|
||||||
MAX.MaxArmor = 650
|
MAX.MaxArmor = 650
|
||||||
MAX.InventoryScale = InventoryTile.Tile1612
|
MAX.InventoryScale = InventoryTile.Tile1612
|
||||||
|
|
@ -118,11 +157,11 @@ object ExoSuitDefinition {
|
||||||
*/
|
*/
|
||||||
def Select(suit : ExoSuitType.Value) : ExoSuitDefinition = {
|
def Select(suit : ExoSuitType.Value) : ExoSuitDefinition = {
|
||||||
suit match {
|
suit match {
|
||||||
case ExoSuitType.Agile => ExoSuitDefinition.Agile
|
case ExoSuitType.Agile => ExoSuitDefinition.Agile.Use
|
||||||
case ExoSuitType.Infiltration => ExoSuitDefinition.Infiltration
|
case ExoSuitType.Infiltration => ExoSuitDefinition.Infiltration.Use
|
||||||
case ExoSuitType.MAX => ExoSuitDefinition.MAX
|
case ExoSuitType.MAX => ExoSuitDefinition.MAX.Use
|
||||||
case ExoSuitType.Reinforced => ExoSuitDefinition.Reinforced
|
case ExoSuitType.Reinforced => ExoSuitDefinition.Reinforced.Use
|
||||||
case _ => ExoSuitDefinition.Standard
|
case _ => ExoSuitDefinition.Standard.Use
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -278,11 +278,38 @@ object GlobalDefinitions {
|
||||||
|
|
||||||
val flamethrower = ToolDefinition(ObjectClass.flamethrower)
|
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)
|
val nchev_scattercannon = ToolDefinition(ObjectClass.nchev_scattercannon)
|
||||||
|
|
||||||
|
|
@ -1672,18 +1699,42 @@ object GlobalDefinitions {
|
||||||
trhev_dualcycler.FireModes.head.AmmoTypeIndices += 0
|
trhev_dualcycler.FireModes.head.AmmoTypeIndices += 0
|
||||||
trhev_dualcycler.FireModes.head.AmmoSlotIndex = 0
|
trhev_dualcycler.FireModes.head.AmmoSlotIndex = 0
|
||||||
trhev_dualcycler.FireModes.head.Magazine = 200
|
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.Name = "trhev_pounder"
|
||||||
trhev_pounder.Size = EquipmentSize.Max
|
trhev_pounder.Size = EquipmentSize.Max
|
||||||
trhev_pounder.AmmoTypes += pounder_ammo
|
trhev_pounder.AmmoTypes += pounder_ammo
|
||||||
trhev_pounder.FireModes += new FireModeDefinition
|
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.AmmoSlotIndex = 0
|
||||||
trhev_pounder.FireModes.head.Magazine = 30
|
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).AmmoTypeIndices += 0
|
||||||
trhev_pounder.FireModes(1).AmmoSlotIndex = 0
|
trhev_pounder.FireModes(1).AmmoSlotIndex = 0
|
||||||
trhev_pounder.FireModes(1).Magazine = 30
|
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.Name = "trhev_burster"
|
||||||
trhev_burster.Size = EquipmentSize.Max
|
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 maxHealth : Int = 100 //TODO affected by empire benefits, territory benefits, and bops
|
||||||
private var maxStamina : Int = 100 //does anything affect this?
|
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 freeHand : EquipmentSlot = new OffhandEquipmentSlot(EquipmentSize.Inventory)
|
||||||
private val holsters : Array[EquipmentSlot] = Array.fill[EquipmentSlot](5)(new EquipmentSlot)
|
private val holsters : Array[EquipmentSlot] = Array.fill[EquipmentSlot](5)(new EquipmentSlot)
|
||||||
private val inventory : GridInventory = GridInventory()
|
private val inventory : GridInventory = GridInventory()
|
||||||
|
|
@ -127,9 +127,9 @@ class Player(private val core : Avatar) extends PlanetSideGameObject with Factio
|
||||||
Armor
|
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 = {
|
override def Slot(slot : Int) : EquipmentSlot = {
|
||||||
if(inventory.Offset <= slot && slot <= inventory.LastIndex) {
|
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 LastDrawnSlot : Int = lastDrawnSlot
|
||||||
|
|
||||||
def ExoSuit : ExoSuitType.Value = exosuit
|
def ExoSuit : ExoSuitType.Value = exosuit.SuitType
|
||||||
|
|
||||||
def ExoSuit_=(suit : ExoSuitType.Value) : Unit = {
|
def ExoSuit_=(suit : ExoSuitType.Value) : Unit = {
|
||||||
exosuit = suit
|
exosuit = ExoSuitDefinition.Select(suit)
|
||||||
|
ChangeSpecialAbility()
|
||||||
}
|
}
|
||||||
|
|
||||||
def LoadLoadout(line : Int) : Option[Loadout] = core.LoadLoadout(line)
|
def LoadLoadout(line : Int) : Option[Loadout] = core.LoadLoadout(line)
|
||||||
|
|
@ -322,6 +323,81 @@ class Player(private val core : Avatar) extends PlanetSideGameObject with Factio
|
||||||
Cloaked
|
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 : Option[PlanetSideGUID] = backpackAccess
|
||||||
|
|
||||||
def AccessingBackpack_=(guid : PlanetSideGUID) : Option[PlanetSideGUID] = {
|
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 FireMode : FireModeDefinition = toolDef.FireModes(fireModeIndex)
|
||||||
|
|
||||||
def NextFireMode : FireModeDefinition = {
|
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
|
AmmoSlot.Chamber = FireMode.Chamber
|
||||||
FireMode
|
FireMode
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ class ToolDefinition(objectId : Int) extends EquipmentDefinition(objectId) {
|
||||||
def AmmoTypes : mutable.ListBuffer[AmmoBoxDefinition] = ammoTypes
|
def AmmoTypes : mutable.ListBuffer[AmmoBoxDefinition] = ammoTypes
|
||||||
|
|
||||||
def FireModes : mutable.ListBuffer[FireModeDefinition] = fireModes
|
def FireModes : mutable.ListBuffer[FireModeDefinition] = fireModes
|
||||||
|
|
||||||
|
def NextFireModeIndex(index : Int) : Int = index + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
object ToolDefinition {
|
object ToolDefinition {
|
||||||
|
|
|
||||||
|
|
@ -700,13 +700,18 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
order match {
|
order match {
|
||||||
case Terminal.BuyExosuit(exosuit, subtype) => //refresh armor points
|
case Terminal.BuyExosuit(exosuit, subtype) => //refresh armor points
|
||||||
if(tplayer.ExoSuit == exosuit) {
|
if(tplayer.ExoSuit == exosuit) {
|
||||||
if(Loadout.DetermineSubtype(tplayer) != subtype) {
|
if(exosuit == ExoSuitType.MAX) {
|
||||||
//special case: MAX suit switching to a different MAX suit; we need to change the main weapon
|
//special MAX case - clear any special state
|
||||||
sendResponse(ArmorChangedMessage(tplayer.GUID, exosuit, subtype))
|
player.UsingSpecial = SpecialExoSuitDefinition.Mode.Normal
|
||||||
avatarService ! AvatarServiceMessage(player.Continent, AvatarAction.ArmorChanged(tplayer.GUID, exosuit, subtype))
|
player.ExoSuit = exosuit
|
||||||
val arms = tplayer.Slot(0).Equipment.get
|
if(Loadout.DetermineSubtype(tplayer) != subtype) {
|
||||||
val putTask = PutEquipmentInSlot(tplayer, Tool(GlobalDefinitions.MAXArms(subtype, tplayer.Faction)), 0)
|
//special MAX case - suit switching to a different MAX suit; we need to change the main weapon
|
||||||
taskResolver ! DelayedObjectHeld(tplayer, 0, List(TaskResolver.GiveTask(putTask.task, putTask.subs :+ RemoveEquipmentFromSlot(tplayer, arms, 0))))
|
sendResponse(ArmorChangedMessage(tplayer.GUID, exosuit, subtype))
|
||||||
|
avatarService ! AvatarServiceMessage(player.Continent, AvatarAction.ArmorChanged(tplayer.GUID, exosuit, subtype))
|
||||||
|
val arms = tplayer.Slot(0).Equipment.get
|
||||||
|
val putTask = PutEquipmentInSlot(tplayer, Tool(GlobalDefinitions.MAXArms(subtype, tplayer.Faction)), 0)
|
||||||
|
taskResolver ! DelayedObjectHeld(tplayer, 0, List(TaskResolver.GiveTask(putTask.task, putTask.subs :+ RemoveEquipmentFromSlot(tplayer, arms, 0))))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//outside of the MAX condition above, we should seldom reach this point through conventional methods
|
//outside of the MAX condition above, we should seldom reach this point through conventional methods
|
||||||
tplayer.Armor = tplayer.MaxArmor
|
tplayer.Armor = tplayer.MaxArmor
|
||||||
|
|
@ -714,7 +719,8 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
avatarService ! AvatarServiceMessage(tplayer.Continent, AvatarAction.PlanetsideAttribute(tplayer.GUID, 4, tplayer.Armor))
|
avatarService ! AvatarServiceMessage(tplayer.Continent, AvatarAction.PlanetsideAttribute(tplayer.GUID, 4, tplayer.Armor))
|
||||||
sendResponse(ItemTransactionResultMessage(msg.terminal_guid, TransactionType.Buy, true))
|
sendResponse(ItemTransactionResultMessage(msg.terminal_guid, TransactionType.Buy, true))
|
||||||
}
|
}
|
||||||
else { //load a complete new exo-suit and shuffle the inventory around
|
else {
|
||||||
|
//load a complete new exo-suit and shuffle the inventory around
|
||||||
val originalSuit = tplayer.ExoSuit
|
val originalSuit = tplayer.ExoSuit
|
||||||
//save inventory before it gets cleared (empty holsters)
|
//save inventory before it gets cleared (empty holsters)
|
||||||
val dropPred = DropPredicate(tplayer)
|
val dropPred = DropPredicate(tplayer)
|
||||||
|
|
@ -749,6 +755,8 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
normalWeapons
|
normalWeapons
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
tplayer.DrawnSlot = Player.HandsDownSlot
|
||||||
|
sendResponse(ObjectHeldMessage(tplayer.GUID, Player.HandsDownSlot, true))
|
||||||
avatarService ! AvatarServiceMessage(tplayer.Continent, AvatarAction.ObjectHeld(tplayer.GUID, Player.HandsDownSlot))
|
avatarService ! AvatarServiceMessage(tplayer.Continent, AvatarAction.ObjectHeld(tplayer.GUID, Player.HandsDownSlot))
|
||||||
beforeHolsters
|
beforeHolsters
|
||||||
}
|
}
|
||||||
|
|
@ -839,6 +847,11 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
//TODO optimizations against replacing Equipment with the exact same Equipment and potentially for recycling existing Equipment
|
//TODO optimizations against replacing Equipment with the exact same Equipment and potentially for recycling existing Equipment
|
||||||
log.info(s"$tplayer wants to change equipment loadout to their option #${msg.unk1 + 1}")
|
log.info(s"$tplayer wants to change equipment loadout to their option #${msg.unk1 + 1}")
|
||||||
sendResponse(ItemTransactionResultMessage(msg.terminal_guid, TransactionType.Loadout, true))
|
sendResponse(ItemTransactionResultMessage(msg.terminal_guid, TransactionType.Loadout, true))
|
||||||
|
//ensure arm is down
|
||||||
|
tplayer.DrawnSlot = Player.HandsDownSlot
|
||||||
|
sendResponse(ObjectHeldMessage(tplayer.GUID, Player.HandsDownSlot, true))
|
||||||
|
avatarService ! AvatarServiceMessage(tplayer.Continent, AvatarAction.ObjectHeld(tplayer.GUID, Player.HandsDownSlot))
|
||||||
|
//load
|
||||||
val dropPred = DropPredicate(tplayer)
|
val dropPred = DropPredicate(tplayer)
|
||||||
val (dropHolsters, beforeHolsters) = clearHolsters(tplayer.Holsters().iterator).partition(dropPred)
|
val (dropHolsters, beforeHolsters) = clearHolsters(tplayer.Holsters().iterator).partition(dropPred)
|
||||||
val (dropInventory, beforeInventory) = tplayer.Inventory.Clear().partition(dropPred)
|
val (dropInventory, beforeInventory) = tplayer.Inventory.Clear().partition(dropPred)
|
||||||
|
|
@ -1473,7 +1486,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
//TODO begin temp player character auto-loading; remove later
|
//TODO begin temp player character auto-loading; remove later
|
||||||
import net.psforever.objects.GlobalDefinitions._
|
import net.psforever.objects.GlobalDefinitions._
|
||||||
import net.psforever.types.CertificationType._
|
import net.psforever.types.CertificationType._
|
||||||
avatar = Avatar("TestCharacter"+sessionId.toString, PlanetSideEmpire.VS, CharacterGender.Female, 41, 1)
|
avatar = Avatar("TestCharacter"+sessionId.toString, PlanetSideEmpire.TR, CharacterGender.Female, 41, 1)
|
||||||
avatar.Certifications += StandardAssault
|
avatar.Certifications += StandardAssault
|
||||||
avatar.Certifications += MediumAssault
|
avatar.Certifications += MediumAssault
|
||||||
avatar.Certifications += StandardExoSuit
|
avatar.Certifications += StandardExoSuit
|
||||||
|
|
@ -1579,6 +1592,9 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
//load active players in zone
|
//load active players in zone
|
||||||
continent.LivePlayers.filterNot(_.GUID == player.GUID).foreach(char => {
|
continent.LivePlayers.filterNot(_.GUID == player.GUID).foreach(char => {
|
||||||
sendResponse(ObjectCreateMessage(ObjectClass.avatar, char.GUID, char.Definition.Packet.ConstructorData(char).get))
|
sendResponse(ObjectCreateMessage(ObjectClass.avatar, char.GUID, char.Definition.Packet.ConstructorData(char).get))
|
||||||
|
if(char.UsingSpecial == SpecialExoSuitDefinition.Mode.Anchored) {
|
||||||
|
sendResponse(PlanetsideAttributeMessage(char.GUID, 19, 1))
|
||||||
|
}
|
||||||
})
|
})
|
||||||
//load corpses in zone
|
//load corpses in zone
|
||||||
continent.Corpses.foreach { TurnPlayerIntoCorpse }
|
continent.Corpses.foreach { TurnPlayerIntoCorpse }
|
||||||
|
|
@ -2132,16 +2148,22 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
}
|
}
|
||||||
|
|
||||||
case msg @ ObjectHeldMessage(avatar_guid, held_holsters, unk1) =>
|
case msg @ ObjectHeldMessage(avatar_guid, held_holsters, unk1) =>
|
||||||
log.info("ObjectHeld: " + msg)
|
log.info(s"ObjectHeld: $msg")
|
||||||
val before = player.DrawnSlot
|
val before = player.DrawnSlot
|
||||||
//TODO remove this kludge; explore how to stop BuyExoSuit(Max) sending a tardy ObjectHeldMessage(me, 255)
|
if(before != held_holsters) {
|
||||||
if(player.ExoSuit != ExoSuitType.MAX && (player.DrawnSlot = held_holsters) != before) {
|
if(player.ExoSuit == ExoSuitType.MAX && held_holsters != 0) {
|
||||||
avatarService ! AvatarServiceMessage(player.Continent, AvatarAction.ObjectHeld(player.GUID, player.LastDrawnSlot))
|
log.info(s"ObjectHeld: $player is denied changing hands to $held_holsters as a MAX")
|
||||||
if(player.VisibleSlots.contains(held_holsters)) {
|
player.DrawnSlot = 0
|
||||||
usingMedicalTerminal match {
|
sendResponse(ObjectHeldMessage(avatar_guid, 0, true))
|
||||||
case Some(term_guid) =>
|
}
|
||||||
StopUsingProximityUnit(continent.GUID(term_guid).get.asInstanceOf[ProximityTerminal])
|
else if((player.DrawnSlot = held_holsters) != before) {
|
||||||
case None => ;
|
avatarService ! AvatarServiceMessage(player.Continent, AvatarAction.ObjectHeld(player.GUID, player.LastDrawnSlot))
|
||||||
|
if(player.VisibleSlots.contains(held_holsters)) {
|
||||||
|
usingMedicalTerminal match {
|
||||||
|
case Some(term_guid) =>
|
||||||
|
StopUsingProximityUnit(continent.GUID(term_guid).get.asInstanceOf[ProximityTerminal])
|
||||||
|
case None => ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2513,6 +2535,51 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
case msg @ GenericObjectStateMsg(object_guid, unk1) =>
|
case msg @ GenericObjectStateMsg(object_guid, unk1) =>
|
||||||
log.info("GenericObjectState: " + msg)
|
log.info("GenericObjectState: " + msg)
|
||||||
|
|
||||||
|
case msg @ GenericActionMessage(action) =>
|
||||||
|
log.info(s"GenericAction: $msg")
|
||||||
|
val (toolOpt, definition) = player.Slot(0).Equipment match {
|
||||||
|
case Some(tool : Tool) =>
|
||||||
|
(Some(tool), tool.Definition)
|
||||||
|
case _ =>
|
||||||
|
(None, GlobalDefinitions.bullet_9mm)
|
||||||
|
}
|
||||||
|
if(action == 15) { //max deployment
|
||||||
|
log.info(s"GenericObject: $player is anchored")
|
||||||
|
player.UsingSpecial = SpecialExoSuitDefinition.Mode.Anchored
|
||||||
|
avatarService ! AvatarServiceMessage(continent.Id, AvatarAction.PlanetsideAttribute(player.GUID, 19, 1))
|
||||||
|
definition match {
|
||||||
|
case GlobalDefinitions.trhev_dualcycler | GlobalDefinitions.trhev_burster =>
|
||||||
|
val tool = toolOpt.get
|
||||||
|
tool.ToFireMode = 1
|
||||||
|
sendResponse(ChangeFireModeMessage(tool.GUID, 1))
|
||||||
|
case GlobalDefinitions.trhev_pounder =>
|
||||||
|
val tool = toolOpt.get
|
||||||
|
val convertFireModeIndex = if(tool.FireModeIndex == 0) { 1 } else { 4 }
|
||||||
|
tool.ToFireMode = convertFireModeIndex
|
||||||
|
sendResponse(ChangeFireModeMessage(tool.GUID, convertFireModeIndex))
|
||||||
|
case _ =>
|
||||||
|
log.info(s"GenericObject: $player is MAS with an unexpected weapon - ${definition.Name}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(action == 16) {
|
||||||
|
log.info(s"GenericObject: $player has released the anchors")
|
||||||
|
player.UsingSpecial = SpecialExoSuitDefinition.Mode.Normal
|
||||||
|
avatarService ! AvatarServiceMessage(continent.Id, AvatarAction.PlanetsideAttribute(player.GUID, 19, 0))
|
||||||
|
definition match {
|
||||||
|
case GlobalDefinitions.trhev_dualcycler | GlobalDefinitions.trhev_burster =>
|
||||||
|
val tool = toolOpt.get
|
||||||
|
tool.ToFireMode = 0
|
||||||
|
sendResponse(ChangeFireModeMessage(tool.GUID, 0))
|
||||||
|
case GlobalDefinitions.trhev_pounder =>
|
||||||
|
val tool = toolOpt.get
|
||||||
|
val convertFireModeIndex = if(tool.FireModeIndex == 1) { 0 } else { 3 }
|
||||||
|
tool.ToFireMode = convertFireModeIndex
|
||||||
|
sendResponse(ChangeFireModeMessage(tool.GUID, convertFireModeIndex))
|
||||||
|
case _ =>
|
||||||
|
log.info(s"GenericObject: $player is MAS with an unexpected weapon - ${definition.Name}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case msg @ ItemTransactionMessage(terminal_guid, _, _, _, _, _) =>
|
case msg @ ItemTransactionMessage(terminal_guid, _, _, _, _, _) =>
|
||||||
log.info("ItemTransaction: " + msg)
|
log.info("ItemTransaction: " + msg)
|
||||||
continent.GUID(terminal_guid) match {
|
continent.GUID(terminal_guid) match {
|
||||||
|
|
@ -4108,7 +4175,8 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
* Other players in the same zone must be made aware that the player has stopped as well.<br>
|
* Other players in the same zone must be made aware that the player has stopped as well.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* Things whose configuration should not be changed:<br>
|
* Things whose configuration should not be changed:<br>
|
||||||
* - if the player is seated
|
* - if the player is seated<br>
|
||||||
|
* - if anchored
|
||||||
*/
|
*/
|
||||||
def PlayerActionsToCancel() : Unit = {
|
def PlayerActionsToCancel() : Unit = {
|
||||||
progressBarUpdate.cancel
|
progressBarUpdate.cancel
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ object Zones {
|
||||||
super.Init(context)
|
super.Init(context)
|
||||||
|
|
||||||
import net.psforever.types.PlanetSideEmpire
|
import net.psforever.types.PlanetSideEmpire
|
||||||
Building(2).get.Faction = PlanetSideEmpire.VS
|
Building(2).get.Faction = PlanetSideEmpire.TR
|
||||||
Building(2).get.ModelId = 20
|
Building(2).get.ModelId = 20
|
||||||
Building(38).get.ModelId = 0
|
Building(38).get.ModelId = 0
|
||||||
Building(42).get.ModelId = 0
|
Building(42).get.ModelId = 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue