re-use old locker entity during cases of player relog to fix registration issues

This commit is contained in:
Jason_DiDonato@yahoo.com 2021-10-31 19:24:21 -04:00
parent 1e5e11be6b
commit 92ada951e5
3 changed files with 11 additions and 5 deletions

View file

@ -366,13 +366,19 @@ class AvatarActor(
result.onComplete { result.onComplete {
case Success((loadouts, implants, certs, locker)) => case Success((loadouts, implants, certs, locker)) =>
val validatedLocker = if (avatar.locker.HasGUID || avatar.locker.Inventory.Size > 0) {
//if locker shows indication of being previously used, this player is rejoining an active session
avatar.locker
} else {
locker
}
avatar = avatar.copy( avatar = avatar.copy(
loadouts = loadouts, loadouts = loadouts,
// make sure we always have the base certifications // make sure we always have the base certifications
certifications = certifications =
certs.map(cert => Certification.withValue(cert.id)).toSet ++ Config.app.game.baseCertifications, certs.map(cert => Certification.withValue(cert.id)).toSet ++ Config.app.game.baseCertifications,
implants = implants.map(implant => Some(Implant(implant.toImplantDefinition))).padTo(3, None), implants = implants.map(implant => Some(Implant(implant.toImplantDefinition))).padTo(3, None),
locker = locker locker = validatedLocker
) )
staminaRegenTimer.cancel() staminaRegenTimer.cancel()

View file

@ -1418,7 +1418,7 @@ class SessionActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], con
//rejoin current avatar/player //rejoin current avatar/player
log.info(s"LoginInfo: player $playerName is alive") log.info(s"LoginInfo: player $playerName is alive")
deadState = DeadState.Alive deadState = DeadState.Alive
session = session.copy(player = p) session = session.copy(player = p, avatar = a)
persist() persist()
setupAvatarFunc = AvatarRejoin setupAvatarFunc = AvatarRejoin
avatarActor ! AvatarActor.ReplaceAvatar(a) avatarActor ! AvatarActor.ReplaceAvatar(a)
@ -1428,7 +1428,7 @@ class SessionActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], con
//convert player to a corpse (unless in vehicle); automatic recall to closest spawn point //convert player to a corpse (unless in vehicle); automatic recall to closest spawn point
log.info(s"LoginInfo: player $playerName is dead") log.info(s"LoginInfo: player $playerName is dead")
deadState = DeadState.Dead deadState = DeadState.Dead
session = session.copy(player = p) session = session.copy(player = p, avatar = a)
persist() persist()
player.Zone = inZone player.Zone = inZone
HandleReleaseAvatar(p, inZone) HandleReleaseAvatar(p, inZone)
@ -1449,7 +1449,7 @@ class SessionActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], con
tplayer.Release //for proper respawn tplayer.Release //for proper respawn
tplayer.Zone = inZone tplayer.Zone = inZone
tplayer tplayer
} }, avatar = a
) )
avatarActor ! AvatarActor.ReplaceAvatar(a) avatarActor ! AvatarActor.ReplaceAvatar(a)
avatarActor ! AvatarActor.LoginAvatar(context.self) avatarActor ! AvatarActor.LoginAvatar(context.self)

View file

@ -8,7 +8,7 @@ import net.psforever.types.{PlanetSideEmpire, PlanetSideGUID}
/** /**
* A wrapper class that allows a player-facing locker component * A wrapper class that allows a player-facing locker component
* to be treated standard `Equipment` object in the player's fifth (sixth) slot. * to be treated like a standard `Equipment` object in the player's fifth (sixth) slot.
* (The opposite is not true - the equipment does not get treated as a locker component.) * (The opposite is not true - the equipment does not get treated as a locker component.)
* During packet conversion and registration and general access in terms of holsters or "equipment slots", * During packet conversion and registration and general access in terms of holsters or "equipment slots",
* the component may be be treated the same as other existing objects at the same level. * the component may be be treated the same as other existing objects at the same level.