diff --git a/src/main/scala/net/psforever/actors/session/AvatarActor.scala b/src/main/scala/net/psforever/actors/session/AvatarActor.scala index a5f6bb32..5fa778df 100644 --- a/src/main/scala/net/psforever/actors/session/AvatarActor.scala +++ b/src/main/scala/net/psforever/actors/session/AvatarActor.scala @@ -749,6 +749,7 @@ class AvatarActor( s"${faction}hev_antiaircraft" case _ => obj.Name } + sessionActor ! SessionActor.SendResponse( AvatarVehicleTimerMessage( session.get.player.GUID, diff --git a/src/main/scala/net/psforever/objects/GlobalDefinitions.scala b/src/main/scala/net/psforever/objects/GlobalDefinitions.scala index 29258a9c..1f8415d2 100644 --- a/src/main/scala/net/psforever/objects/GlobalDefinitions.scala +++ b/src/main/scala/net/psforever/objects/GlobalDefinitions.scala @@ -1367,11 +1367,11 @@ object GlobalDefinitions { def MAXArms(subtype: Int, faction: PlanetSideEmpire.Value): ToolDefinition = { if (subtype == 1) { - AI_MAX(faction) - } else if (subtype == 2) { - AV_MAX(faction) - } else if (subtype == 3) { AA_MAX(faction) + } else if (subtype == 2) { + AI_MAX(faction) + } else if (subtype == 3) { + AV_MAX(faction) } else { suppressor // there are no common pool MAX arms } diff --git a/src/main/scala/net/psforever/objects/avatar/DeployableToolbox.scala b/src/main/scala/net/psforever/objects/avatar/DeployableToolbox.scala index 16b27e72..0683284a 100644 --- a/src/main/scala/net/psforever/objects/avatar/DeployableToolbox.scala +++ b/src/main/scala/net/psforever/objects/avatar/DeployableToolbox.scala @@ -29,14 +29,12 @@ class DeployableToolbox { */ private val categoryCounts = DeployableCategory.values.toSeq.map(value => { value -> new DeployableToolbox.Bin }).toMap - categoryCounts(DeployableCategory.Telepads).Max = 1024 /** * a map of bins for keeping track of the quantities of individual deployables * keys: deployable types, values: quantity storage object */ private val deployableCounts = DeployedItem.values.toSeq.map(value => { value -> new DeployableToolbox.Bin }).toMap - deployableCounts(DeployedItem.router_telepad_deployable).Max = 1024 /** * a map of tracked/owned individual deployables @@ -74,7 +72,6 @@ class DeployableToolbox { DeployableToolbox.UpdateMaxCounts(deployableCounts, categoryCounts, certifications) } - /** * Determine if the given deployable can be managed by this toolbox. * @see `Valid` @@ -457,6 +454,11 @@ object DeployableToolbox { ): Unit = { import Certification._ counts.foreach(_._2.Max = 0) + + // Placing telepads does not require ground support + counts(DeployedItem.router_telepad_deployable).Max = 1024 + categories(DeployableCategory.Telepads).Max = 1024 + if (certifications.contains(AdvancedEngineering)) { counts(DeployedItem.boomer).Max = 25 counts(DeployedItem.he_mine).Max = 25 @@ -521,9 +523,5 @@ object DeployableToolbox { counts(DeployedItem.sensor_shield).Max = 20 } } - if (certifications.contains(Certification.GroundSupport)) { - counts(DeployedItem.router_telepad_deployable).Max = 1024 - categories(DeployableCategory.Telepads).Max = 1024 - } } } diff --git a/src/main/scala/net/psforever/objects/loadouts/InfantryLoadout.scala b/src/main/scala/net/psforever/objects/loadouts/InfantryLoadout.scala index 610f4388..c291b042 100644 --- a/src/main/scala/net/psforever/objects/loadouts/InfantryLoadout.scala +++ b/src/main/scala/net/psforever/objects/loadouts/InfantryLoadout.scala @@ -67,12 +67,12 @@ object InfantryLoadout { weapon match { case Some(item) => item.Definition match { + case GlobalDefinitions.trhev_burster | GlobalDefinitions.nchev_sparrow | GlobalDefinitions.vshev_starfire => + 1 case GlobalDefinitions.trhev_dualcycler | GlobalDefinitions.nchev_scattercannon | GlobalDefinitions.vshev_quasar => - 1 - case GlobalDefinitions.trhev_pounder | GlobalDefinitions.nchev_falcon | GlobalDefinitions.vshev_comet => 2 - case GlobalDefinitions.trhev_burster | GlobalDefinitions.nchev_sparrow | GlobalDefinitions.vshev_starfire => + case GlobalDefinitions.trhev_pounder | GlobalDefinitions.nchev_falcon | GlobalDefinitions.vshev_comet => 3 case _ => 0 @@ -99,7 +99,7 @@ object InfantryLoadout { case ExoSuitType.Standard => 0 case ExoSuitType.Agile => 1 case ExoSuitType.Reinforced => 2 - case ExoSuitType.MAX => 3 + subtype //4, 5, 6 + case ExoSuitType.MAX => 3 + subtype // 4, 5, 6 case ExoSuitType.Infiltration => 7 } } diff --git a/src/test/scala/objects/DeployableToolboxTest.scala b/src/test/scala/objects/DeployableToolboxTest.scala index abeeef2a..e608812a 100644 --- a/src/test/scala/objects/DeployableToolboxTest.scala +++ b/src/test/scala/objects/DeployableToolboxTest.scala @@ -246,10 +246,8 @@ class DeployableToolboxTest extends Specification { obj.CountDeployable(DeployedItem.deployable_shield_generator)._2 mustEqual 0 obj.CountDeployable(DeployedItem.router_telepad_deployable)._2 mustEqual 1024 - obj.AddToDeployableQuantities( - CombatEngineering, - Set(CombatEngineering) - ) + obj.UpdateMaxCounts(Set(CombatEngineering)) + obj.CountDeployable(DeployedItem.boomer)._2 mustEqual 20 obj.CountDeployable(DeployedItem.he_mine)._2 mustEqual 20 obj.CountDeployable(DeployedItem.spitfire_turret)._2 mustEqual 10 @@ -266,10 +264,8 @@ class DeployableToolboxTest extends Specification { obj.CountDeployable(DeployedItem.deployable_shield_generator)._2 mustEqual 0 obj.CountDeployable(DeployedItem.router_telepad_deployable)._2 mustEqual 1024 - obj.AddToDeployableQuantities( - FortificationEngineering, - Set(CombatEngineering, FortificationEngineering) - ) + obj.UpdateMaxCounts(Set(CombatEngineering, FortificationEngineering)) + obj.CountDeployable(DeployedItem.boomer)._2 mustEqual 25 obj.CountDeployable(DeployedItem.he_mine)._2 mustEqual 25 obj.CountDeployable(DeployedItem.spitfire_turret)._2 mustEqual 15 @@ -286,10 +282,8 @@ class DeployableToolboxTest extends Specification { obj.CountDeployable(DeployedItem.deployable_shield_generator)._2 mustEqual 0 obj.CountDeployable(DeployedItem.router_telepad_deployable)._2 mustEqual 1024 - obj.AddToDeployableQuantities( - AssaultEngineering, - Set(CombatEngineering, FortificationEngineering, AssaultEngineering) - ) + obj.UpdateMaxCounts(Set(CombatEngineering, FortificationEngineering, AssaultEngineering)) + obj.CountDeployable(DeployedItem.boomer)._2 mustEqual 25 obj.CountDeployable(DeployedItem.he_mine)._2 mustEqual 25 obj.CountDeployable(DeployedItem.spitfire_turret)._2 mustEqual 15 @@ -306,10 +300,8 @@ class DeployableToolboxTest extends Specification { obj.CountDeployable(DeployedItem.deployable_shield_generator)._2 mustEqual 1 obj.CountDeployable(DeployedItem.router_telepad_deployable)._2 mustEqual 1024 - obj.AddToDeployableQuantities( - AssaultEngineering, - Set(CombatEngineering, FortificationEngineering, AssaultEngineering) - ) + obj.UpdateMaxCounts(Set(CombatEngineering, FortificationEngineering, AssaultEngineering)) + obj.CountDeployable(DeployedItem.boomer)._2 mustEqual 25 obj.CountDeployable(DeployedItem.he_mine)._2 mustEqual 25 obj.CountDeployable(DeployedItem.spitfire_turret)._2 mustEqual 15 @@ -326,10 +318,8 @@ class DeployableToolboxTest extends Specification { obj.CountDeployable(DeployedItem.deployable_shield_generator)._2 mustEqual 1 obj.CountDeployable(DeployedItem.router_telepad_deployable)._2 mustEqual 1024 - obj.AddToDeployableQuantities( - AdvancedHacking, - Set(CombatEngineering, FortificationEngineering, AssaultEngineering, AdvancedHacking) - ) + obj.UpdateMaxCounts(Set(CombatEngineering, FortificationEngineering, AssaultEngineering, AdvancedHacking)) + obj.CountDeployable(DeployedItem.boomer)._2 mustEqual 25 obj.CountDeployable(DeployedItem.he_mine)._2 mustEqual 25 obj.CountDeployable(DeployedItem.spitfire_turret)._2 mustEqual 15 @@ -366,10 +356,8 @@ class DeployableToolboxTest extends Specification { obj.CountDeployable(DeployedItem.deployable_shield_generator)._2 mustEqual 0 obj.CountDeployable(DeployedItem.router_telepad_deployable)._2 mustEqual 1024 - obj.AddToDeployableQuantities( - GroundSupport, - Set(GroundSupport) - ) + obj.UpdateMaxCounts(Set(GroundSupport)) + obj.CountDeployable(DeployedItem.boomer)._2 mustEqual 0 obj.CountDeployable(DeployedItem.he_mine)._2 mustEqual 0 obj.CountDeployable(DeployedItem.spitfire_turret)._2 mustEqual 0 @@ -406,10 +394,8 @@ class DeployableToolboxTest extends Specification { obj.CountDeployable(DeployedItem.deployable_shield_generator)._2 mustEqual 0 obj.CountDeployable(DeployedItem.router_telepad_deployable)._2 mustEqual 1024 - obj.AddToDeployableQuantities( - AdvancedEngineering, - Set(CombatEngineering, AdvancedEngineering) - ) + obj.UpdateMaxCounts(Set(CombatEngineering, AdvancedEngineering)) + obj.CountDeployable(DeployedItem.boomer)._2 mustEqual 25 obj.CountDeployable(DeployedItem.he_mine)._2 mustEqual 25 obj.CountDeployable(DeployedItem.spitfire_turret)._2 mustEqual 15 @@ -448,10 +434,8 @@ class DeployableToolboxTest extends Specification { obj.CountDeployable(DeployedItem.deployable_shield_generator)._2 mustEqual 1 obj.CountDeployable(DeployedItem.router_telepad_deployable)._2 mustEqual 1024 - obj.RemoveFromDeployableQuantities( - GroundSupport, - Set(CombatEngineering, AssaultEngineering, FortificationEngineering, AdvancedHacking) - ) + obj.UpdateMaxCounts(Set(CombatEngineering, AssaultEngineering, FortificationEngineering, AdvancedHacking)) + obj.CountDeployable(DeployedItem.boomer)._2 mustEqual 25 obj.CountDeployable(DeployedItem.he_mine)._2 mustEqual 25 obj.CountDeployable(DeployedItem.spitfire_turret)._2 mustEqual 15 @@ -468,10 +452,8 @@ class DeployableToolboxTest extends Specification { obj.CountDeployable(DeployedItem.deployable_shield_generator)._2 mustEqual 1 obj.CountDeployable(DeployedItem.router_telepad_deployable)._2 mustEqual 1024 - obj.RemoveFromDeployableQuantities( - AdvancedHacking, - Set(CombatEngineering, AssaultEngineering, FortificationEngineering) - ) + obj.UpdateMaxCounts(Set(CombatEngineering, AssaultEngineering, FortificationEngineering)) + obj.CountDeployable(DeployedItem.boomer)._2 mustEqual 25 obj.CountDeployable(DeployedItem.he_mine)._2 mustEqual 25 obj.CountDeployable(DeployedItem.spitfire_turret)._2 mustEqual 15 @@ -488,10 +470,8 @@ class DeployableToolboxTest extends Specification { obj.CountDeployable(DeployedItem.deployable_shield_generator)._2 mustEqual 1 obj.CountDeployable(DeployedItem.router_telepad_deployable)._2 mustEqual 1024 - obj.RemoveFromDeployableQuantities( - FortificationEngineering, - Set(CombatEngineering, AssaultEngineering) - ) + obj.UpdateMaxCounts(Set(CombatEngineering, AssaultEngineering)) + obj.CountDeployable(DeployedItem.boomer)._2 mustEqual 20 obj.CountDeployable(DeployedItem.he_mine)._2 mustEqual 20 obj.CountDeployable(DeployedItem.spitfire_turret)._2 mustEqual 10 @@ -508,10 +488,8 @@ class DeployableToolboxTest extends Specification { obj.CountDeployable(DeployedItem.deployable_shield_generator)._2 mustEqual 1 obj.CountDeployable(DeployedItem.router_telepad_deployable)._2 mustEqual 1024 - obj.RemoveFromDeployableQuantities( - AssaultEngineering, - Set(CombatEngineering) - ) + obj.UpdateMaxCounts(Set(CombatEngineering)) + obj.CountDeployable(DeployedItem.boomer)._2 mustEqual 20 obj.CountDeployable(DeployedItem.he_mine)._2 mustEqual 20 obj.CountDeployable(DeployedItem.spitfire_turret)._2 mustEqual 10 @@ -528,10 +506,8 @@ class DeployableToolboxTest extends Specification { obj.CountDeployable(DeployedItem.deployable_shield_generator)._2 mustEqual 0 obj.CountDeployable(DeployedItem.router_telepad_deployable)._2 mustEqual 1024 - obj.RemoveFromDeployableQuantities( - CombatEngineering, - Set() - ) + obj.UpdateMaxCounts(Set()) + obj.CountDeployable(DeployedItem.boomer)._2 mustEqual 0 obj.CountDeployable(DeployedItem.he_mine)._2 mustEqual 0 obj.CountDeployable(DeployedItem.spitfire_turret)._2 mustEqual 0 @@ -568,10 +544,8 @@ class DeployableToolboxTest extends Specification { obj.CountDeployable(DeployedItem.deployable_shield_generator)._2 mustEqual 1 obj.CountDeployable(DeployedItem.router_telepad_deployable)._2 mustEqual 1024 - obj.RemoveFromDeployableQuantities( - AdvancedEngineering, - Set(CombatEngineering) - ) + obj.UpdateMaxCounts(Set(CombatEngineering)) + obj.CountDeployable(DeployedItem.boomer)._2 mustEqual 20 obj.CountDeployable(DeployedItem.he_mine)._2 mustEqual 20 obj.CountDeployable(DeployedItem.spitfire_turret)._2 mustEqual 10 @@ -630,10 +604,8 @@ class DeployableToolboxTest extends Specification { obj.Add(new BoomerDeployable(GlobalDefinitions.boomer)) obj.CountDeployable(DeployedItem.boomer).productIterator.toList mustEqual List(3, 20) - obj.RemoveFromDeployableQuantities( - CombatEngineering, - Set() - ) + obj.UpdateMaxCounts(Set()) + obj.CountDeployable(DeployedItem.boomer).productIterator.toList mustEqual List(3, 0) } @@ -851,7 +823,8 @@ class DeployableToolboxTest extends Specification { obj.Valid(cerebus) mustEqual false obj.CountDeployable(DeployedItem.spitfire_aa).productIterator.toList mustEqual List(0, 0) - obj.AddToDeployableQuantities(AdvancedEngineering, Set(CombatEngineering, AdvancedEngineering)) + obj.UpdateMaxCounts(Set(CombatEngineering, AdvancedEngineering)) + obj.Valid(cerebus) mustEqual true obj.CountDeployable(DeployedItem.spitfire_aa).productIterator.toList mustEqual List(0, 5) } @@ -883,7 +856,8 @@ class DeployableToolboxTest extends Specification { obj.Contains(boomer) mustEqual false //false is being passable obj.Valid(boomer) mustEqual false - obj.AddToDeployableQuantities(CombatEngineering, Set(CombatEngineering)) + obj.UpdateMaxCounts(Set(CombatEngineering)) + obj.CountDeployable(DeployedItem.boomer).productIterator.toList mustEqual List(0, 20) obj.Accept(boomer) mustEqual true obj.Available(boomer) mustEqual true //true is being passable @@ -904,7 +878,8 @@ class DeployableToolboxTest extends Specification { obj.Contains(boomer) mustEqual true obj.Valid(boomer) mustEqual true //true is being passable - obj.RemoveFromDeployableQuantities(CombatEngineering, Set()) + obj.UpdateMaxCounts(Set()) + obj.CountDeployable(DeployedItem.boomer).productIterator.toList mustEqual List(20, 0) obj.Accept(boomer) mustEqual false obj.Available(boomer) mustEqual false diff --git a/src/test/scala/objects/LoadoutTest.scala b/src/test/scala/objects/LoadoutTest.scala index 5de1414c..426741ac 100644 --- a/src/test/scala/objects/LoadoutTest.scala +++ b/src/test/scala/objects/LoadoutTest.scala @@ -109,8 +109,8 @@ class LoadoutTest extends Specification { val ldout4 = Loadout.Create(player, "burster").asInstanceOf[InfantryLoadout] ldout1.subtype mustEqual 0 - ldout2.subtype mustEqual 1 - ldout3.subtype mustEqual 2 + ldout2.subtype mustEqual 2 + ldout3.subtype mustEqual 3 ldout4.subtype mustEqual InfantryLoadout.DetermineSubtype(player) //example } @@ -144,9 +144,9 @@ class LoadoutTest extends Specification { InfantryLoadout.DetermineSubtypeB(ldout1.exosuit, ldout1.subtype) mustEqual 1 InfantryLoadout.DetermineSubtypeB(ldout2.exosuit, ldout2.subtype) mustEqual 2 InfantryLoadout.DetermineSubtypeB(ldout3.exosuit, ldout3.subtype) mustEqual 3 - InfantryLoadout.DetermineSubtypeB(ldout4.exosuit, ldout4.subtype) mustEqual 4 - InfantryLoadout.DetermineSubtypeB(ldout5.exosuit, ldout5.subtype) mustEqual 5 - InfantryLoadout.DetermineSubtypeB(ldout6.exosuit, ldout6.subtype) mustEqual 6 + InfantryLoadout.DetermineSubtypeB(ldout4.exosuit, ldout4.subtype) mustEqual 5 + InfantryLoadout.DetermineSubtypeB(ldout5.exosuit, ldout5.subtype) mustEqual 6 + InfantryLoadout.DetermineSubtypeB(ldout6.exosuit, ldout6.subtype) mustEqual 4 InfantryLoadout.DetermineSubtypeB(ldout7.exosuit, ldout7.subtype) mustEqual 7 } }