adjusted how the mechanized exo-suit timer asserts itself when in conjunction with prior exo-suit purchase orders

This commit is contained in:
Fate-JH 2023-05-07 01:11:13 -04:00
parent 53178ba1d9
commit 6907a3a7e1

View file

@ -368,8 +368,6 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
case Terminal.InfantryLoadout(exosuit, subtype, holsters, inventory) => case Terminal.InfantryLoadout(exosuit, subtype, holsters, inventory) =>
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 fallbackSubtype = 0
val fallbackSuit = ExoSuitType.Standard
val originalSuit = player.ExoSuit val originalSuit = player.ExoSuit
val originalSubtype = Loadout.DetermineSubtype(player) val originalSubtype = Loadout.DetermineSubtype(player)
//sanitize exo-suit for change //sanitize exo-suit for change
@ -392,29 +390,39 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
}) ++ dropHolsters ++ dropInventory }) ++ dropHolsters ++ dropInventory
//a loadout with a prohibited exo-suit type will result in the fallback exo-suit type //a loadout with a prohibited exo-suit type will result in the fallback exo-suit type
//imposed 5min delay on mechanized exo-suit switches //imposed 5min delay on mechanized exo-suit switches
val (nextSuit, nextSubtype) = val (nextSuit, nextSubtype) = {
if ( lazy val fallbackSuit = if (Players.CertificationToUseExoSuit(player, originalSuit, originalSubtype)) {
Players.CertificationToUseExoSuit(player, exosuit, subtype) && //TODO will we ever need to check for the cooldown status of an original non-MAX exo-suit?
(if (exosuit == ExoSuitType.MAX) { (originalSuit, originalSubtype)
player.ResistArmMotion(PlayerControl.maxRestriction) } else {
val weapon = GlobalDefinitions.MAXArms(subtype, player.Faction) (ExoSuitType.Standard, 0)
player.avatar.purchaseCooldown(weapon) match { }
case Some(_) => false if (Players.CertificationToUseExoSuit(player, exosuit, subtype)) {
case None => if (exosuit == ExoSuitType.MAX) {
val weapon = GlobalDefinitions.MAXArms(subtype, player.Faction)
val cooldown = player.avatar.purchaseCooldown(weapon)
if (originalSubtype == subtype) {
(exosuit, subtype) //same MAX subtype is free
} else if (cooldown.nonEmpty) {
fallbackSuit //different MAX subtype can not have cooldown
} else {
avatarActor ! AvatarActor.UpdatePurchaseTime(weapon) avatarActor ! AvatarActor.UpdatePurchaseTime(weapon)
true (exosuit, subtype) //switching for first time causes cooldown
}
} else {
(exosuit, subtype)
} }
} else { } else {
player.ResistArmMotion(Player.neverRestrict) log.warn(
true s"${player.Name} no longer has permission to wear the exo-suit type $exosuit; will wear ${fallbackSuit._1} instead"
}) )
) { fallbackSuit
(exosuit, subtype) }
}
if (nextSuit == ExoSuitType.MAX) {
player.ResistArmMotion(PlayerControl.maxRestriction)
} else { } else {
log.warn( player.ResistArmMotion(Player.neverRestrict)
s"${player.Name} no longer has permission to wear the exo-suit type $exosuit; will wear $fallbackSuit instead"
)
(fallbackSuit, fallbackSubtype)
} }
//sanitize (incoming) inventory //sanitize (incoming) inventory
//TODO equipment permissions; these loops may be expanded upon in future //TODO equipment permissions; these loops may be expanded upon in future
@ -1288,6 +1296,7 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
suicide() suicide()
} }
//noinspection ScalaUnusedSymbol
def doInteractingWithGantryField( def doInteractingWithGantryField(
obj: PlanetSideServerObject, obj: PlanetSideServerObject,
body: PieceOfEnvironment, body: PieceOfEnvironment,