mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-15 16:34:39 +00:00
Miscellaneous Fixes (#760)
* suicide can pull outdated damage entry when no other option is available; occupied seats need to be collected * kicking one player does not kick all players anymore * augmenting persistence when using KAM packets to include avatar release condition as well as initial login
This commit is contained in:
parent
51d46d86d3
commit
8c34a55530
3 changed files with 27 additions and 15 deletions
|
|
@ -265,7 +265,7 @@ class SessionActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], con
|
||||||
var zoneReload: Boolean = false
|
var zoneReload: Boolean = false
|
||||||
var interimUngunnedVehicle: Option[PlanetSideGUID] = None
|
var interimUngunnedVehicle: Option[PlanetSideGUID] = None
|
||||||
var interimUngunnedVehicleSeat: Option[Int] = None
|
var interimUngunnedVehicleSeat: Option[Int] = None
|
||||||
var keepAliveFunc: () => Unit = NormalKeepAlive
|
var keepAliveFunc: () => Unit = KeepAlivePersistenceInitial
|
||||||
var setAvatar: Boolean = false
|
var setAvatar: Boolean = false
|
||||||
var turnCounterFunc: PlanetSideGUID => Unit = TurnCounterDuringInterim
|
var turnCounterFunc: PlanetSideGUID => Unit = TurnCounterDuringInterim
|
||||||
|
|
||||||
|
|
@ -1321,7 +1321,7 @@ class SessionActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], con
|
||||||
* These correspond to the message `NewPlayerLoaded` for the case of "dying" or the latter zone switching case,
|
* These correspond to the message `NewPlayerLoaded` for the case of "dying" or the latter zone switching case,
|
||||||
* and `PlayerLoaded` for "deconstruction."
|
* and `PlayerLoaded` for "deconstruction."
|
||||||
* In the latter case, the user must wait for the zone to be recognized as loaded for the server
|
* In the latter case, the user must wait for the zone to be recognized as loaded for the server
|
||||||
* and this is performed through the send LoadMapMessage, receive BeginZoningMessage exchange
|
* and this is performed through the send `LoadMapMessage`, receive `BeginZoningMessage` exchange.
|
||||||
* The user's player should have already been registered into the new zone
|
* The user's player should have already been registered into the new zone
|
||||||
* and is at some stage of being added to the zone in which they will have control agency in that zone.
|
* and is at some stage of being added to the zone in which they will have control agency in that zone.
|
||||||
* Whether or not the zone is loaded in the earlier case depends on the destination with respect to the current location.
|
* Whether or not the zone is loaded in the earlier case depends on the destination with respect to the current location.
|
||||||
|
|
@ -1379,6 +1379,12 @@ class SessionActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], con
|
||||||
self,
|
self,
|
||||||
SetCurrentAvatar(tplayer, max_attempts, attempt + max_attempts / 3)
|
SetCurrentAvatar(tplayer, max_attempts, attempt + max_attempts / 3)
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
keepAliveFunc = GetMountableAndSeat(None, player, continent) match {
|
||||||
|
case (Some(v: Vehicle), Some(seatNumber))
|
||||||
|
if seatNumber > 0 && v.WeaponControlledFromSeat(seatNumber).isEmpty => KeepAlivePersistence
|
||||||
|
case _ => NormalKeepAlive
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//if not the condition above, player has started playing normally
|
//if not the condition above, player has started playing normally
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2455,11 +2461,10 @@ class SessionActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], con
|
||||||
*/
|
*/
|
||||||
def HandleMountMessages(tplayer: Player, reply: Mountable.Exchange): Unit = {
|
def HandleMountMessages(tplayer: Player, reply: Mountable.Exchange): Unit = {
|
||||||
reply match {
|
reply match {
|
||||||
case Mountable.CanMount(obj: ImplantTerminalMech, seat_number, mount_point) =>
|
case Mountable.CanMount(obj: ImplantTerminalMech, seat_number, _) =>
|
||||||
CancelZoningProcessWithDescriptiveReason("cancel_use")
|
CancelZoningProcessWithDescriptiveReason("cancel_use")
|
||||||
CancelAllProximityUnits()
|
CancelAllProximityUnits()
|
||||||
MountingAction(tplayer, obj, seat_number)
|
MountingAction(tplayer, obj, seat_number)
|
||||||
// the player will receive no messages consistently except the KeepAliveMessage echo
|
|
||||||
keepAliveFunc = KeepAlivePersistence
|
keepAliveFunc = KeepAlivePersistence
|
||||||
|
|
||||||
case Mountable.CanMount(obj: Vehicle, seat_number, _)
|
case Mountable.CanMount(obj: Vehicle, seat_number, _)
|
||||||
|
|
@ -2467,7 +2472,6 @@ class SessionActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], con
|
||||||
CancelZoningProcessWithDescriptiveReason("cancel_mount")
|
CancelZoningProcessWithDescriptiveReason("cancel_mount")
|
||||||
CancelAllProximityUnits()
|
CancelAllProximityUnits()
|
||||||
MountingAction(tplayer, obj, seat_number)
|
MountingAction(tplayer, obj, seat_number)
|
||||||
// the player will receive no messages consistently except the KeepAliveMessage echo
|
|
||||||
keepAliveFunc = KeepAlivePersistence
|
keepAliveFunc = KeepAlivePersistence
|
||||||
|
|
||||||
case Mountable.CanMount(obj: Vehicle, seat_number, _) =>
|
case Mountable.CanMount(obj: Vehicle, seat_number, _) =>
|
||||||
|
|
@ -2491,14 +2495,13 @@ class SessionActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], con
|
||||||
obj.Cloaked = tplayer.Cloaked
|
obj.Cloaked = tplayer.Cloaked
|
||||||
}
|
}
|
||||||
} else if (obj.WeaponControlledFromSeat(seat_number).isEmpty) {
|
} else if (obj.WeaponControlledFromSeat(seat_number).isEmpty) {
|
||||||
// the player will receive no messages consistently except the KeepAliveMessage echo
|
|
||||||
keepAliveFunc = KeepAlivePersistence
|
keepAliveFunc = KeepAlivePersistence
|
||||||
}
|
}
|
||||||
AccessContainer(obj)
|
AccessContainer(obj)
|
||||||
UpdateWeaponAtSeatPosition(obj, seat_number)
|
UpdateWeaponAtSeatPosition(obj, seat_number)
|
||||||
MountingAction(tplayer, obj, seat_number)
|
MountingAction(tplayer, obj, seat_number)
|
||||||
|
|
||||||
case Mountable.CanMount(obj: FacilityTurret, seat_number, mount_point) =>
|
case Mountable.CanMount(obj: FacilityTurret, seat_number, _) =>
|
||||||
CancelZoningProcessWithDescriptiveReason("cancel_mount")
|
CancelZoningProcessWithDescriptiveReason("cancel_mount")
|
||||||
if (!obj.isUpgrading) {
|
if (!obj.isUpgrading) {
|
||||||
log.info(s"${player.Name} mounts ${obj.Definition.Name}")
|
log.info(s"${player.Name} mounts ${obj.Definition.Name}")
|
||||||
|
|
@ -2508,20 +2511,17 @@ class SessionActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], con
|
||||||
sendResponse(PlanetsideAttributeMessage(obj.GUID, 0, obj.Health))
|
sendResponse(PlanetsideAttributeMessage(obj.GUID, 0, obj.Health))
|
||||||
UpdateWeaponAtSeatPosition(obj, seat_number)
|
UpdateWeaponAtSeatPosition(obj, seat_number)
|
||||||
MountingAction(tplayer, obj, seat_number)
|
MountingAction(tplayer, obj, seat_number)
|
||||||
// the player will receive no messages consistently except the KeepAliveMessage echo
|
|
||||||
keepAliveFunc = KeepAlivePersistence
|
|
||||||
} else {
|
} else {
|
||||||
log.warn(
|
log.warn(
|
||||||
s"MountVehicleMsg: ${tplayer.Name} wants to mount turret ${obj.GUID.guid}, but needs to wait until it finishes updating"
|
s"MountVehicleMsg: ${tplayer.Name} wants to mount turret ${obj.GUID.guid}, but needs to wait until it finishes updating"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
case Mountable.CanMount(obj: PlanetSideGameObject with WeaponTurret, seat_number, mount_point) =>
|
case Mountable.CanMount(obj: PlanetSideGameObject with WeaponTurret, seat_number, _) =>
|
||||||
CancelZoningProcessWithDescriptiveReason("cancel_mount")
|
CancelZoningProcessWithDescriptiveReason("cancel_mount")
|
||||||
sendResponse(PlanetsideAttributeMessage(obj.GUID, 0, obj.Health))
|
sendResponse(PlanetsideAttributeMessage(obj.GUID, 0, obj.Health))
|
||||||
UpdateWeaponAtSeatPosition(obj, seat_number)
|
UpdateWeaponAtSeatPosition(obj, seat_number)
|
||||||
MountingAction(tplayer, obj, seat_number)
|
MountingAction(tplayer, obj, seat_number)
|
||||||
// the player will receive no messages consistently except the KeepAliveMessage echo
|
|
||||||
keepAliveFunc = KeepAlivePersistence
|
keepAliveFunc = KeepAlivePersistence
|
||||||
|
|
||||||
case Mountable.CanMount(obj: Mountable, _, _) =>
|
case Mountable.CanMount(obj: Mountable, _, _) =>
|
||||||
|
|
@ -2792,8 +2792,8 @@ class SessionActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], con
|
||||||
//seat number (first field) seems to be correct if passenger is kicked manually by driver
|
//seat number (first field) seems to be correct if passenger is kicked manually by driver
|
||||||
//but always seems to return 4 if user is kicked by mount permissions changing
|
//but always seems to return 4 if user is kicked by mount permissions changing
|
||||||
sendResponse(DismountVehicleMsg(guid, BailType.Kicked, wasKickedByDriver))
|
sendResponse(DismountVehicleMsg(guid, BailType.Kicked, wasKickedByDriver))
|
||||||
player.VehicleSeated = None
|
|
||||||
if (tplayer_guid == guid) {
|
if (tplayer_guid == guid) {
|
||||||
|
log.info(s"{${player.Name} has been kicked from ${player.Sex.possessive} ride!")
|
||||||
continent.GUID(vehicle_guid) match {
|
continent.GUID(vehicle_guid) match {
|
||||||
case Some(obj: Vehicle) =>
|
case Some(obj: Vehicle) =>
|
||||||
UnaccessContainer(obj)
|
UnaccessContainer(obj)
|
||||||
|
|
@ -9300,6 +9300,7 @@ class SessionActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], con
|
||||||
* @param zone na
|
* @param zone na
|
||||||
*/
|
*/
|
||||||
def HandleReleaseAvatar(tplayer: Player, zone: Zone): Unit = {
|
def HandleReleaseAvatar(tplayer: Player, zone: Zone): Unit = {
|
||||||
|
keepAliveFunc = KeepAlivePersistence
|
||||||
tplayer.Release
|
tplayer.Release
|
||||||
tplayer.VehicleSeated match {
|
tplayer.VehicleSeated match {
|
||||||
case None =>
|
case None =>
|
||||||
|
|
@ -9396,7 +9397,7 @@ class SessionActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], con
|
||||||
* The atypical response to receiving a `KeepAliveMessage` packet from the client.<br>
|
* The atypical response to receiving a `KeepAliveMessage` packet from the client.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* `KeepAliveMessage` packets are the primary vehicle for persistence due to client reporting
|
* `KeepAliveMessage` packets are the primary vehicle for persistence due to client reporting
|
||||||
* in the case where the player's avatar is riding in a vehicle in a mount with no vehicle.
|
* in the case where the player's avatar is riding in a vehicle in a mount with no weapon to control.
|
||||||
* @see `KeepAliveMessage`
|
* @see `KeepAliveMessage`
|
||||||
* @see `keepAliveFunc`
|
* @see `keepAliveFunc`
|
||||||
* @see `turnCounterFunc`
|
* @see `turnCounterFunc`
|
||||||
|
|
@ -9408,6 +9409,17 @@ class SessionActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], con
|
||||||
turnCounterFunc(player.GUID)
|
turnCounterFunc(player.GUID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A really atypical response to receiving a `KeepAliveMessage` packet from the client
|
||||||
|
* that applies only during the character select portion and part of the first zone load activity.
|
||||||
|
*/
|
||||||
|
def KeepAlivePersistenceInitial(): Unit = {
|
||||||
|
persist()
|
||||||
|
if (player != null && player.HasGUID) {
|
||||||
|
keepAliveFunc = KeepAlivePersistence
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def AdministrativeKick(tplayer: Player) = {
|
def AdministrativeKick(tplayer: Player) = {
|
||||||
log.warn(s"${tplayer.Name} has been kicked by ${player.Name}")
|
log.warn(s"${tplayer.Name} has been kicked by ${player.Name}")
|
||||||
tplayer.death_by = -1
|
tplayer.death_by = -1
|
||||||
|
|
|
||||||
|
|
@ -777,7 +777,7 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
|
||||||
target.LastDamage match {
|
target.LastDamage match {
|
||||||
case Some(attack) if System.currentTimeMillis() - attack.interaction.hitTime < (10 seconds).toMillis =>
|
case Some(attack) if System.currentTimeMillis() - attack.interaction.hitTime < (10 seconds).toMillis =>
|
||||||
attack.adversarial
|
attack.adversarial
|
||||||
case None =>
|
case _ =>
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}) match {
|
}) match {
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ trait DamageableVehicle
|
||||||
if (aggravated) {
|
if (aggravated) {
|
||||||
val msg = VehicleAction.SendResponse(Service.defaultPlayerGUID, DamageWithPositionMessage(totalDamage, Vector3.Zero))
|
val msg = VehicleAction.SendResponse(Service.defaultPlayerGUID, DamageWithPositionMessage(totalDamage, Vector3.Zero))
|
||||||
obj.Seats.values
|
obj.Seats.values
|
||||||
.map { case seat if seat.occupant.nonEmpty => seat.occupant.get.Name }
|
.collect { case seat if seat.occupant.nonEmpty => seat.occupant.get.Name }
|
||||||
.foreach { channel =>
|
.foreach { channel =>
|
||||||
events ! VehicleServiceMessage(channel, msg)
|
events ! VehicleServiceMessage(channel, msg)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue