mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-19 18:44:45 +00:00
allow cavern equipment favorites
This commit is contained in:
parent
7521e360f3
commit
042ddc8c4e
|
|
@ -407,10 +407,28 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
|
|||
terminalUsedAction
|
||||
|
||||
case Terminal.InfantryLoadout(exosuit, subtype, holsters, inventory) =>
|
||||
import net.psforever.objects.serverobject.structures.Building
|
||||
log.info(s"${player.Name} wants to change equipment loadout to their option #${msg.unk1 + 1}")
|
||||
val originalSuit = player.ExoSuit
|
||||
val originalSubtype = Loadout.DetermineSubtype(player)
|
||||
val dropPred = ContainableBehavior.DropPredicate(player)
|
||||
val terminalOpt: Option[Terminal] =
|
||||
player.Zone.GUID(msg.terminal_guid).collect {
|
||||
case t: Terminal => t
|
||||
}
|
||||
val hasCavernEquipmentBenefit: Boolean =
|
||||
terminalOpt.exists { terminal =>
|
||||
terminal.Owner match {
|
||||
case fac: Building =>
|
||||
fac.hasCavernLockBenefit && player.Faction == fac.Faction
|
||||
case _ =>
|
||||
false
|
||||
}
|
||||
}
|
||||
val dropPred =
|
||||
if (hasCavernEquipmentBenefit)
|
||||
ContainableBehavior.DropPredicateEquipmentBenefit(player)
|
||||
else
|
||||
ContainableBehavior.DropPredicate(player)
|
||||
//determine player's next exo-suit
|
||||
val (nextSuit, nextSubtype) = {
|
||||
lazy val fallbackSuit = if (Players.CertificationToUseExoSuit(player, originalSuit, originalSubtype)) {
|
||||
|
|
|
|||
|
|
@ -681,6 +681,19 @@ object ContainableBehavior {
|
|||
entry.obj.isInstanceOf[BoomerTrigger] ||
|
||||
(faction != tplayer.Faction && faction != PlanetSideEmpire.NEUTRAL)
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as above except the terminal used is from a facility that has cavern equipment benefit
|
||||
* so allow cavern equipment to be kept
|
||||
*/
|
||||
def DropPredicateEquipmentBenefit(tplayer: Player): InventoryItem => Boolean =
|
||||
entry => {
|
||||
val objDef = entry.obj.Definition
|
||||
val faction = GlobalDefinitions.isFactionEquipment(objDef)
|
||||
objDef == GlobalDefinitions.router_telepad ||
|
||||
entry.obj.isInstanceOf[BoomerTrigger] ||
|
||||
(faction != tplayer.Faction && faction != PlanetSideEmpire.NEUTRAL)
|
||||
}
|
||||
}
|
||||
|
||||
object Containable {
|
||||
|
|
|
|||
Loading…
Reference in a new issue