mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-07-15 16:34:42 +00:00
allow cavern equipment favorites
This commit is contained in:
parent
7521e360f3
commit
042ddc8c4e
2 changed files with 32 additions and 1 deletions
|
|
@ -407,10 +407,28 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
|
||||||
terminalUsedAction
|
terminalUsedAction
|
||||||
|
|
||||||
case Terminal.InfantryLoadout(exosuit, subtype, holsters, inventory) =>
|
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}")
|
log.info(s"${player.Name} wants to change equipment loadout to their option #${msg.unk1 + 1}")
|
||||||
val originalSuit = player.ExoSuit
|
val originalSuit = player.ExoSuit
|
||||||
val originalSubtype = Loadout.DetermineSubtype(player)
|
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
|
//determine player's next exo-suit
|
||||||
val (nextSuit, nextSubtype) = {
|
val (nextSuit, nextSubtype) = {
|
||||||
lazy val fallbackSuit = if (Players.CertificationToUseExoSuit(player, originalSuit, originalSubtype)) {
|
lazy val fallbackSuit = if (Players.CertificationToUseExoSuit(player, originalSuit, originalSubtype)) {
|
||||||
|
|
|
||||||
|
|
@ -681,6 +681,19 @@ object ContainableBehavior {
|
||||||
entry.obj.isInstanceOf[BoomerTrigger] ||
|
entry.obj.isInstanceOf[BoomerTrigger] ||
|
||||||
(faction != tplayer.Faction && faction != PlanetSideEmpire.NEUTRAL)
|
(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 {
|
object Containable {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue