mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-19 18:44:45 +00:00
restored commands setbr and setcr; deployables are erased from spectator map; projectiles destruction only just in case
This commit is contained in:
parent
00a76deda0
commit
61c34d040c
|
|
@ -4,28 +4,21 @@ package net.psforever.actors.session.spectator
|
|||
import akka.actor.{ActorContext, typed}
|
||||
import net.psforever.actors.session.AvatarActor
|
||||
import net.psforever.actors.session.support.{GeneralFunctions, GeneralOperations, SessionData}
|
||||
import net.psforever.login.WorldSession.RemoveOldEquipmentFromInventory
|
||||
import net.psforever.objects.{Account, BoomerDeployable, BoomerTrigger, GlobalDefinitions, LivePlayerList, PlanetSideGameObject, Player, TelepadDeployable, Tool, Vehicle}
|
||||
import net.psforever.objects.{Account, GlobalDefinitions, LivePlayerList, PlanetSideGameObject, Player, TelepadDeployable, Tool, Vehicle}
|
||||
import net.psforever.objects.avatar.{Avatar, Implant}
|
||||
import net.psforever.objects.ballistics.Projectile
|
||||
import net.psforever.objects.ce.{Deployable, TelepadLike}
|
||||
import net.psforever.objects.definition.{BasicDefinition, KitDefinition, SpecialExoSuitDefinition}
|
||||
import net.psforever.objects.equipment.Equipment
|
||||
import net.psforever.objects.guid.{GUIDTask, TaskWorkflow}
|
||||
import net.psforever.objects.inventory.Container
|
||||
import net.psforever.objects.serverobject.{CommonMessages, PlanetSideServerObject}
|
||||
import net.psforever.objects.serverobject.CommonMessages
|
||||
import net.psforever.objects.serverobject.doors.Door
|
||||
import net.psforever.objects.sourcing.{PlayerSource, VehicleSource}
|
||||
import net.psforever.objects.vehicles.{Utility, UtilityType}
|
||||
import net.psforever.objects.vehicles.Utility.InternalTelepad
|
||||
import net.psforever.objects.vital.{VehicleDismountActivity, VehicleMountActivity}
|
||||
import net.psforever.objects.zones.{Zone, ZoneProjectile}
|
||||
import net.psforever.objects.zones.ZoneProjectile
|
||||
import net.psforever.packet.PlanetSideGamePacket
|
||||
import net.psforever.packet.game.{ActionCancelMessage, AvatarFirstTimeEventMessage, AvatarImplantMessage, AvatarJumpMessage, BattleplanMessage, BindPlayerMessage, BugReportMessage, ChangeFireModeMessage, ChangeShortcutBankMessage, CharacterCreateRequestMessage, CharacterRequestMessage, ChatMsg, ConnectToWorldRequestMessage, CreateShortcutMessage, DeployObjectMessage, DisplayedAwardMessage, DropItemMessage, EmoteMsg, FacilityBenefitShieldChargeRequestMessage, FriendsRequest, GenericAction, GenericActionMessage, GenericCollisionMsg, GenericObjectActionAtPositionMessage, GenericObjectActionMessage, GenericObjectStateMsg, HitHint, ImplantAction, InvalidTerrainMessage, LootItemMessage, MoveItemMessage, ObjectDeleteMessage, ObjectDetectedMessage, ObjectHeldMessage, PickupItemMessage, PlanetsideAttributeMessage, PlayerStateMessageUpstream, PlayerStateShiftMessage, RequestDestroyMessage, ShiftState, TargetInfo, TargetingImplantRequest, TargetingInfoMessage, TradeMessage, UnuseItemMessage, UseItemMessage, VoiceHostInfo, VoiceHostKill, VoiceHostRequest, ZipLineMessage}
|
||||
import net.psforever.services.RemoverActor
|
||||
import net.psforever.packet.game.{ActionCancelMessage, AvatarFirstTimeEventMessage, AvatarImplantMessage, AvatarJumpMessage, BattleplanMessage, BindPlayerMessage, BugReportMessage, ChangeFireModeMessage, ChangeShortcutBankMessage, CharacterCreateRequestMessage, CharacterRequestMessage, ChatMsg, ConnectToWorldRequestMessage, CreateShortcutMessage, DeployObjectMessage, DisplayedAwardMessage, DropItemMessage, EmoteMsg, FacilityBenefitShieldChargeRequestMessage, FriendsRequest, GenericAction, GenericActionMessage, GenericCollisionMsg, GenericObjectActionAtPositionMessage, GenericObjectActionMessage, GenericObjectStateMsg, HitHint, ImplantAction, InvalidTerrainMessage, LootItemMessage, MoveItemMessage, ObjectDetectedMessage, ObjectHeldMessage, PickupItemMessage, PlanetsideAttributeMessage, PlayerStateMessageUpstream, PlayerStateShiftMessage, RequestDestroyMessage, ShiftState, TargetInfo, TargetingImplantRequest, TargetingInfoMessage, TradeMessage, UnuseItemMessage, UseItemMessage, VoiceHostInfo, VoiceHostKill, VoiceHostRequest, ZipLineMessage}
|
||||
import net.psforever.services.account.AccountPersistenceService
|
||||
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage}
|
||||
import net.psforever.services.local.{LocalAction, LocalServiceMessage}
|
||||
import net.psforever.types.{ChatMessageType, DriveState, ExoSuitType, PlanetSideGUID, Vector3}
|
||||
import net.psforever.util.Config
|
||||
|
||||
|
|
@ -158,18 +151,6 @@ class GeneralLogic(val ops: GeneralOperations, implicit val context: ActorContex
|
|||
}
|
||||
continent.Projectile ! ZoneProjectile.Remove(objectGuid)
|
||||
|
||||
case Some(obj: BoomerTrigger) =>
|
||||
if (findEquipmentToDelete(objectGuid, obj)) {
|
||||
continent.GUID(obj.Companion) match {
|
||||
case Some(boomer: BoomerDeployable) =>
|
||||
boomer.Trigger = None
|
||||
boomer.Actor ! Deployable.Deconstruct()
|
||||
case Some(thing) =>
|
||||
log.warn(s"RequestDestroy: BoomerTrigger object connected to wrong object - $thing")
|
||||
case None => ()
|
||||
}
|
||||
}
|
||||
|
||||
case _ => ()
|
||||
}
|
||||
}
|
||||
|
|
@ -538,78 +519,6 @@ class GeneralLogic(val ops: GeneralOperations, implicit val context: ActorContex
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current `Vehicle` object that the player is riding/driving.
|
||||
* The vehicle must be found solely through use of `player.VehicleSeated`.
|
||||
* @return the vehicle
|
||||
*/
|
||||
private def findLocalVehicle: Option[Vehicle] = {
|
||||
continent.GUID(player.VehicleSeated) match {
|
||||
case Some(obj: Vehicle) => Some(obj)
|
||||
case _ => None
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple object searching algorithm that is limited to containers currently known and accessible by the player.
|
||||
* If all relatively local containers are checked and the object is not found,
|
||||
* the player's locker inventory will be checked, and then
|
||||
* the game environment (items on the ground) will be checked too.
|
||||
* If the target object is discovered, it is removed from its current location and is completely destroyed.
|
||||
* @see `RequestDestroyMessage`
|
||||
* @see `Zone.ItemIs.Where`
|
||||
* @param objectGuid the target object's globally unique identifier;
|
||||
* it is not expected that the object will be unregistered, but it is also not gauranteed
|
||||
* @param obj the target object
|
||||
* @return `true`, if the target object was discovered and removed;
|
||||
* `false`, otherwise
|
||||
*/
|
||||
private def findEquipmentToDelete(objectGuid: PlanetSideGUID, obj: Equipment): Boolean = {
|
||||
val findFunc
|
||||
: PlanetSideServerObject with Container => Option[(PlanetSideServerObject with Container, Option[Int])] =
|
||||
ops.findInLocalContainer(objectGuid)
|
||||
|
||||
findFunc(player)
|
||||
.orElse(ops.accessedContainer match {
|
||||
case Some(parent: PlanetSideServerObject) =>
|
||||
findFunc(parent)
|
||||
case _ =>
|
||||
None
|
||||
})
|
||||
.orElse(findLocalVehicle match {
|
||||
case Some(parent: PlanetSideServerObject) =>
|
||||
findFunc(parent)
|
||||
case _ =>
|
||||
None
|
||||
}) match {
|
||||
case Some((parent, Some(_))) =>
|
||||
obj.Position = Vector3.Zero
|
||||
RemoveOldEquipmentFromInventory(parent)(obj)
|
||||
true
|
||||
case _ if player.avatar.locker.Inventory.Remove(objectGuid) =>
|
||||
sendResponse(ObjectDeleteMessage(objectGuid, 0))
|
||||
true
|
||||
case _ if continent.EquipmentOnGround.contains(obj) =>
|
||||
obj.Position = Vector3.Zero
|
||||
continent.Ground ! Zone.Ground.RemoveItem(objectGuid)
|
||||
continent.AvatarEvents ! AvatarServiceMessage.Ground(RemoverActor.ClearSpecific(List(obj), continent))
|
||||
true
|
||||
case _ =>
|
||||
Zone.EquipmentIs.Where(obj, objectGuid, continent) match {
|
||||
case None =>
|
||||
true
|
||||
case Some(Zone.EquipmentIs.Orphaned()) if obj.HasGUID =>
|
||||
TaskWorkflow.execute(GUIDTask.unregisterEquipment(continent.GUID, obj))
|
||||
true
|
||||
case Some(Zone.EquipmentIs.Orphaned()) =>
|
||||
true
|
||||
case _ =>
|
||||
log.warn(s"RequestDestroy: equipment $obj exists, but ${player.Name} can not reach it to dispose of it")
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A player uses a fully-linked Router teleportation system.
|
||||
* @param router the Router vehicle
|
||||
|
|
@ -636,15 +545,7 @@ class GeneralLogic(val ops: GeneralOperations, implicit val context: ActorContex
|
|||
val dguid = dest.GUID
|
||||
sendResponse(PlayerStateShiftMessage(ShiftState(0, dest.Position, player.Orientation.z)))
|
||||
ops.useRouterTelepadEffect(pguid, sguid, dguid)
|
||||
continent.LocalEvents ! LocalServiceMessage(
|
||||
continent.id,
|
||||
LocalAction.RouterTelepadTransport(pguid, pguid, sguid, dguid)
|
||||
)
|
||||
val vSource = VehicleSource(router)
|
||||
val zoneNumber = continent.Number
|
||||
player.LogActivity(VehicleMountActivity(vSource, PlayerSource(player), zoneNumber))
|
||||
player.Position = dest.Position
|
||||
player.LogActivity(VehicleDismountActivity(vSource, PlayerSource(player), zoneNumber))
|
||||
} else {
|
||||
log.warn(s"UseRouterTelepadSystem: ${player.Name} can not teleport")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,11 +6,13 @@ import akka.actor.ActorRef
|
|||
import net.psforever.actors.session.support.{AvatarHandlerFunctions, ChatFunctions, GalaxyHandlerFunctions, GeneralFunctions, LocalHandlerFunctions, MountHandlerFunctions, SquadHandlerFunctions, TerminalHandlerFunctions, VehicleFunctions, VehicleHandlerFunctions, WeaponAndProjectileFunctions}
|
||||
import net.psforever.actors.zone.ZoneActor
|
||||
import net.psforever.objects.avatar.{BattleRank, CommandRank, DeployableToolbox, FirstTimeEvents, Implant, ProgressDecoration, Shortcut => AvatarShortcut}
|
||||
import net.psforever.objects.ce.Deployable
|
||||
import net.psforever.objects.serverobject.ServerObject
|
||||
import net.psforever.objects.{GlobalDefinitions, Player, Session, SimpleItem, Vehicle}
|
||||
import net.psforever.packet.PlanetSidePacket
|
||||
import net.psforever.packet.game.{ObjectCreateDetailedMessage, ObjectDeleteMessage}
|
||||
import net.psforever.packet.game.{DeployableInfo, DeployableObjectsInfoMessage, DeploymentAction, ObjectCreateDetailedMessage, ObjectDeleteMessage}
|
||||
import net.psforever.packet.game.objectcreate.{ObjectClass, ObjectCreateMessageParent, RibbonBars}
|
||||
import net.psforever.services.Service
|
||||
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage}
|
||||
import net.psforever.services.chat.{ChatService, SpectatorChannel}
|
||||
import net.psforever.services.teamwork.{SquadAction, SquadServiceMessage}
|
||||
|
|
@ -122,6 +124,16 @@ class SpectatorModeLogic(data: SessionData) extends ModeLogic {
|
|||
.collect { case Some(implant) if implant.active =>
|
||||
data.general.avatarActor ! AvatarActor.DeactivateImplant(implant.definition.implantType)
|
||||
}
|
||||
val playerFaction = player.Faction
|
||||
continent
|
||||
.DeployableList
|
||||
.filter(_.Faction == playerFaction)
|
||||
.foreach { obj =>
|
||||
sendResponse(DeployableObjectsInfoMessage(
|
||||
DeploymentAction.Dismiss,
|
||||
DeployableInfo(obj.GUID, Deployable.Icon.apply(obj.Definition.Item), obj.Position, Service.defaultPlayerGUID)
|
||||
))
|
||||
}
|
||||
if (player.silenced) {
|
||||
data.chat.commandIncomingSilence(session, ChatMsg(ChatMessageType.CMT_SILENCE, "player 0"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -911,7 +911,7 @@ class ChatOperations(
|
|||
}
|
||||
(target, rank) match {
|
||||
case (_, Some(rank)) if rank.value <= Config.app.game.maxBattleRank =>
|
||||
context.self ! msgFunc(rank.experience)
|
||||
avatarActor ! msgFunc(rank.experience)
|
||||
true
|
||||
case _ =>
|
||||
false
|
||||
|
|
@ -941,7 +941,7 @@ class ChatOperations(
|
|||
}
|
||||
(target, rank) match {
|
||||
case (_, Some(rank)) =>
|
||||
context.self ! AvatarActor.SetCep(rank.experience)
|
||||
avatarActor ! AvatarActor.SetCep(rank.experience)
|
||||
true
|
||||
case _ =>
|
||||
false
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ import net.psforever.services.Service
|
|||
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage}
|
||||
import net.psforever.types.PlanetSideEmpire
|
||||
|
||||
import scala.annotation.unused
|
||||
|
||||
class BoomerDeployable(cdef: ExplosiveDeployableDefinition)
|
||||
extends ExplosiveDeployable(cdef) {
|
||||
private var trigger: Option[BoomerTrigger] = None
|
||||
|
|
@ -70,8 +72,8 @@ class BoomerDeployableControl(mine: BoomerDeployable)
|
|||
case _ => ;
|
||||
}
|
||||
|
||||
override def loseOwnership(faction: PlanetSideEmpire.Value): Unit = {
|
||||
super.loseOwnership(PlanetSideEmpire.NEUTRAL)
|
||||
def loseOwnership(@unused faction: PlanetSideEmpire.Value): Unit = {
|
||||
super.loseOwnership(mine, PlanetSideEmpire.NEUTRAL)
|
||||
val guid = mine.OwnerGuid
|
||||
mine.AssignOwnership(None)
|
||||
mine.OwnerGuid = guid
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ trait DeployableBehavior {
|
|||
if DeployableObject.OwnerGuid.nonEmpty =>
|
||||
val obj = DeployableObject
|
||||
if (constructed.contains(true)) {
|
||||
loseOwnership(obj.Faction)
|
||||
loseOwnership(obj, obj.Faction)
|
||||
} else {
|
||||
obj.OwnerGuid = None
|
||||
}
|
||||
|
|
@ -98,35 +98,16 @@ trait DeployableBehavior {
|
|||
* Losing ownership involves updating map screen UI, to remove management rights from the now-previous owner,
|
||||
* and may involve concealing the deployable from the map screen for the entirety of the previous owner's faction.
|
||||
* Displaying the deployable on the map screen of another faction may be required.
|
||||
* @param obj na
|
||||
* @param toFaction the faction to which to set the deployable to be visualized on the map and in the game world;
|
||||
* may also affect deployable operation
|
||||
*/
|
||||
def loseOwnership(toFaction: PlanetSideEmpire.Value): Unit = {
|
||||
val obj = DeployableObject
|
||||
val guid = obj.GUID
|
||||
val zone = obj.Zone
|
||||
val localEvents = zone.LocalEvents
|
||||
val originalFaction = obj.Faction
|
||||
val changeFaction = originalFaction != toFaction
|
||||
val info = DeployableInfo(guid, DeployableIcon.Boomer, obj.Position, Service.defaultPlayerGUID)
|
||||
if (changeFaction) {
|
||||
obj.Faction = toFaction
|
||||
//visual tells in regards to ownership by faction
|
||||
zone.AvatarEvents ! AvatarServiceMessage(
|
||||
zone.id,
|
||||
AvatarAction.SetEmpire(Service.defaultPlayerGUID, guid, toFaction)
|
||||
)
|
||||
//remove knowledge by the previous owner's faction
|
||||
localEvents ! LocalServiceMessage(
|
||||
originalFaction.toString,
|
||||
LocalAction.DeployableMapIcon(Service.defaultPlayerGUID, DeploymentAction.Dismiss, info)
|
||||
)
|
||||
//display to the given faction
|
||||
localEvents ! LocalServiceMessage(
|
||||
toFaction.toString,
|
||||
LocalAction.DeployableMapIcon(Service.defaultPlayerGUID, DeploymentAction.Build, info)
|
||||
)
|
||||
}
|
||||
def loseOwnership(obj: Deployable, toFaction: PlanetSideEmpire.Value): Unit = {
|
||||
DeployableBehavior.changeOwership(
|
||||
obj,
|
||||
obj.Faction,
|
||||
DeployableInfo(obj.GUID, Deployable.Icon.apply(obj.Definition.Item), obj.Position, Service.defaultPlayerGUID)
|
||||
)
|
||||
startOwnerlessDecay()
|
||||
}
|
||||
|
||||
|
|
@ -159,27 +140,11 @@ trait DeployableBehavior {
|
|||
val obj = DeployableObject
|
||||
obj.AssignOwnership(player)
|
||||
decay.cancel()
|
||||
|
||||
val guid = obj.GUID
|
||||
val zone = obj.Zone
|
||||
val originalFaction = obj.Faction
|
||||
val info = DeployableInfo(guid, DeployableIcon.Boomer, obj.Position, obj.OwnerGuid.get)
|
||||
if (originalFaction != toFaction) {
|
||||
obj.Faction = toFaction
|
||||
val localEvents = zone.LocalEvents
|
||||
zone.AvatarEvents ! AvatarServiceMessage(
|
||||
zone.id,
|
||||
AvatarAction.SetEmpire(Service.defaultPlayerGUID, guid, toFaction)
|
||||
)
|
||||
localEvents ! LocalServiceMessage(
|
||||
originalFaction.toString,
|
||||
LocalAction.DeployableMapIcon(Service.defaultPlayerGUID, DeploymentAction.Dismiss, info)
|
||||
)
|
||||
localEvents ! LocalServiceMessage(
|
||||
toFaction.toString,
|
||||
LocalAction.DeployableMapIcon(Service.defaultPlayerGUID, DeploymentAction.Build, info)
|
||||
)
|
||||
}
|
||||
DeployableBehavior.changeOwership(
|
||||
obj,
|
||||
toFaction,
|
||||
DeployableInfo(obj.GUID, Deployable.Icon.apply(obj.Definition.Item), obj.Position, obj.OwnerGuid.get)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -318,4 +283,35 @@ object DeployableBehavior {
|
|||
|
||||
/** internal message for progresisng the deconstruction process */
|
||||
private case class FinalizeElimination()
|
||||
|
||||
/**
|
||||
* na
|
||||
* @param obj na
|
||||
* @param toFaction na
|
||||
* @param info na
|
||||
*/
|
||||
def changeOwership(obj: Deployable, toFaction: PlanetSideEmpire.Value, info: DeployableInfo): Unit = {
|
||||
val guid = obj.GUID
|
||||
val zone = obj.Zone
|
||||
val localEvents = zone.LocalEvents
|
||||
val originalFaction = obj.Faction
|
||||
if (originalFaction != toFaction) {
|
||||
obj.Faction = toFaction
|
||||
//visual tells in regards to ownership by faction
|
||||
zone.AvatarEvents ! AvatarServiceMessage(
|
||||
zone.id,
|
||||
AvatarAction.SetEmpire(Service.defaultPlayerGUID, guid, toFaction)
|
||||
)
|
||||
//remove knowledge by the previous owner's faction
|
||||
localEvents ! LocalServiceMessage(
|
||||
originalFaction.toString,
|
||||
LocalAction.DeployableMapIcon(Service.defaultPlayerGUID, DeploymentAction.Dismiss, info)
|
||||
)
|
||||
//display to the given faction
|
||||
localEvents ! LocalServiceMessage(
|
||||
toFaction.toString,
|
||||
LocalAction.DeployableMapIcon(Service.defaultPlayerGUID, DeploymentAction.Build, info)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue