mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-07-16 08:55:18 +00:00
players in seats have their mounted information shortened in a more straightforward, less fault-prone way; stamina recharge command shortened
This commit is contained in:
parent
6907a3a7e1
commit
5337f37363
6 changed files with 24 additions and 30 deletions
|
|
@ -1606,11 +1606,7 @@ class AvatarActor(
|
||||||
Behaviors.same
|
Behaviors.same
|
||||||
|
|
||||||
case RestoreStamina(stamina) =>
|
case RestoreStamina(stamina) =>
|
||||||
tryRestoreStaminaForSession(stamina) match {
|
tryRestoreStaminaForSession(stamina).collect { actuallyRestoreStamina(stamina, _) }
|
||||||
case Some(sess) =>
|
|
||||||
actuallyRestoreStamina(stamina, sess)
|
|
||||||
case _ => ;
|
|
||||||
}
|
|
||||||
Behaviors.same
|
Behaviors.same
|
||||||
|
|
||||||
case RestoreStaminaPeriodically(stamina) =>
|
case RestoreStaminaPeriodically(stamina) =>
|
||||||
|
|
@ -1871,11 +1867,7 @@ class AvatarActor(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
// if we need to start stamina regeneration
|
// if we need to start stamina regeneration
|
||||||
tryRestoreStaminaForSession(stamina = 1) match {
|
tryRestoreStaminaForSession(stamina = 1).collect { _ => defaultStaminaRegen(initialDelay = 0.5f seconds) }
|
||||||
case Some(_) =>
|
|
||||||
defaultStaminaRegen(initialDelay = 0.5f seconds)
|
|
||||||
case _ => ;
|
|
||||||
}
|
|
||||||
replyTo ! AvatarLoginResponse(avatar)
|
replyTo ! AvatarLoginResponse(avatar)
|
||||||
case Failure(e) =>
|
case Failure(e) =>
|
||||||
log.error(e)("db failure")
|
log.error(e)("db failure")
|
||||||
|
|
@ -1965,11 +1957,7 @@ class AvatarActor(
|
||||||
}
|
}
|
||||||
|
|
||||||
def restoreStaminaPeriodically(stamina: Int): Unit = {
|
def restoreStaminaPeriodically(stamina: Int): Unit = {
|
||||||
tryRestoreStaminaForSession(stamina) match {
|
tryRestoreStaminaForSession(stamina).collect { actuallyRestoreStaminaIfStationary(stamina, _) }
|
||||||
case Some(sess) =>
|
|
||||||
actuallyRestoreStaminaIfStationary(stamina, sess)
|
|
||||||
case _ => ;
|
|
||||||
}
|
|
||||||
startIfStoppedStaminaRegen(initialDelay = 0.5f seconds)
|
startIfStoppedStaminaRegen(initialDelay = 0.5f seconds)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import net.psforever.objects.sourcing.PlayerSource
|
||||||
import net.psforever.objects.vital.collision.CollisionReason
|
import net.psforever.objects.vital.collision.CollisionReason
|
||||||
import net.psforever.objects.vital.environment.EnvironmentReason
|
import net.psforever.objects.vital.environment.EnvironmentReason
|
||||||
import net.psforever.objects.vital.etc.{PainboxReason, SuicideReason}
|
import net.psforever.objects.vital.etc.{PainboxReason, SuicideReason}
|
||||||
import net.psforever.objects.vital.interaction.{DamageInteraction, DamageResult}
|
import net.psforever.objects.vital.interaction.{Adversarial, DamageInteraction, DamageResult}
|
||||||
import net.psforever.services.hart.ShuttleState
|
import net.psforever.services.hart.ShuttleState
|
||||||
import net.psforever.packet.PlanetSideGamePacket
|
import net.psforever.packet.PlanetSideGamePacket
|
||||||
|
|
||||||
|
|
@ -1033,21 +1033,23 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
|
||||||
)
|
)
|
||||||
//TODO other methods of death?
|
//TODO other methods of death?
|
||||||
val pentry = PlayerSource(target)
|
val pentry = PlayerSource(target)
|
||||||
(cause.adversarial match {
|
cause
|
||||||
case out @ Some(_) =>
|
.adversarial
|
||||||
out
|
.collect { case out @ Adversarial(attacker, _, _) if attacker != PlayerSource.Nobody => out }
|
||||||
case _ =>
|
.orElse {
|
||||||
target.LastDamage.collect {
|
target.LastDamage.collect {
|
||||||
case attack if System.currentTimeMillis() - attack.interaction.hitTime < (10 seconds).toMillis =>
|
case attack if System.currentTimeMillis() - attack.interaction.hitTime < (10 seconds).toMillis =>
|
||||||
attack.adversarial
|
attack
|
||||||
|
.adversarial
|
||||||
|
.collect { case out @ Adversarial(attacker, _, _) if attacker != PlayerSource.Nobody => out }
|
||||||
}.flatten
|
}.flatten
|
||||||
}) match {
|
} match {
|
||||||
case Some(adversarial) =>
|
case Some(adversarial) =>
|
||||||
events ! AvatarServiceMessage(
|
events ! AvatarServiceMessage(
|
||||||
zoneChannel,
|
zoneChannel,
|
||||||
AvatarAction.DestroyDisplay(adversarial.attacker, pentry, adversarial.implement)
|
AvatarAction.DestroyDisplay(adversarial.attacker, pentry, adversarial.implement)
|
||||||
)
|
)
|
||||||
case None =>
|
case _ =>
|
||||||
events ! AvatarServiceMessage(zoneChannel, AvatarAction.DestroyDisplay(pentry, pentry, 0))
|
events ! AvatarServiceMessage(zoneChannel, AvatarAction.DestroyDisplay(pentry, pentry, 0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,9 @@ object AmenitySource {
|
||||||
)
|
)
|
||||||
amenity.copy(occupants = obj match {
|
amenity.copy(occupants = obj match {
|
||||||
case o: Mountable =>
|
case o: Mountable =>
|
||||||
o.Seats.values.flatMap { _.occupants }.map { p => PlayerSource.inSeat(p, o, amenity) }.toList
|
o.Seats
|
||||||
|
.collect { case (num, seat) if seat.isOccupied => (num, seat.occupants.head) }
|
||||||
|
.map { case (num, p) => PlayerSource.inSeat(p, amenity, num) }.toList
|
||||||
case _ =>
|
case _ =>
|
||||||
Nil
|
Nil
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -109,17 +109,17 @@ object PlayerSource {
|
||||||
* even if this function is entirely for the purpose of establishing that the player is an occupant of the mountable entity.<br>
|
* even if this function is entirely for the purpose of establishing that the player is an occupant of the mountable entity.<br>
|
||||||
* Don't think too much about it.
|
* Don't think too much about it.
|
||||||
* @param player player
|
* @param player player
|
||||||
* @param mount mountable entity in which the player should be seated
|
|
||||||
* @param source a `SourceEntry` for the aforementioned mountable entity
|
* @param source a `SourceEntry` for the aforementioned mountable entity
|
||||||
|
* @param seatNumber the attributed seating index in which the player is mounted in `source`
|
||||||
* @return a `PlayerSource` entity
|
* @return a `PlayerSource` entity
|
||||||
*/
|
*/
|
||||||
def inSeat(player: Player, mount: Mountable, source: SourceEntry): PlayerSource = {
|
def inSeat(player: Player, source: SourceEntry, seatNumber: Int): PlayerSource = {
|
||||||
val exosuit = player.ExoSuit
|
val exosuit = player.ExoSuit
|
||||||
val faction = player.Faction
|
val faction = player.Faction
|
||||||
PlayerSource(
|
PlayerSource(
|
||||||
player.Definition,
|
player.Definition,
|
||||||
exosuit,
|
exosuit,
|
||||||
Some((source, mount.PassengerInSeat(player).get)),
|
Some((source, seatNumber)),
|
||||||
player.Health,
|
player.Health,
|
||||||
player.Armor,
|
player.Armor,
|
||||||
player.Position,
|
player.Position,
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,9 @@ object TurretSource {
|
||||||
)
|
)
|
||||||
turret.copy(occupants = obj match {
|
turret.copy(occupants = obj match {
|
||||||
case o: Mountable =>
|
case o: Mountable =>
|
||||||
o.Seats.values.flatMap { _.occupants }.map { p => PlayerSource.inSeat(p, o, turret) }.toList
|
o.Seats
|
||||||
|
.collect { case (num, seat) if seat.isOccupied => (num, seat.occupants.head) }
|
||||||
|
.map { case (num, p) => PlayerSource.inSeat(p, turret, num) }.toList
|
||||||
case _ =>
|
case _ =>
|
||||||
Nil
|
Nil
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,9 @@ object VehicleSource {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
vehicle.copy(occupants = {
|
vehicle.copy(occupants = {
|
||||||
obj.Seats.values.map { seat =>
|
obj.Seats.map { case (seatNumber, seat) =>
|
||||||
seat.occupant match {
|
seat.occupant match {
|
||||||
case Some(p) => PlayerSource.inSeat(p, obj, vehicle) //shallow
|
case Some(p) => PlayerSource.inSeat(p, vehicle, seatNumber) //shallow
|
||||||
case _ => PlayerSource.Nobody
|
case _ => PlayerSource.Nobody
|
||||||
}
|
}
|
||||||
}.toList
|
}.toList
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue