diff --git a/src/main/scala/net/psforever/actors/session/normal/GeneralLogic.scala b/src/main/scala/net/psforever/actors/session/normal/GeneralLogic.scala index 1eb457f9d..472834d05 100644 --- a/src/main/scala/net/psforever/actors/session/normal/GeneralLogic.scala +++ b/src/main/scala/net/psforever/actors/session/normal/GeneralLogic.scala @@ -51,6 +51,7 @@ import net.psforever.types.{CapacitorStateType, ChatMessageType, Cosmetic, Drive import net.psforever.util.Config import scala.concurrent.duration._ +import scala.util.Success object GeneralLogic { def apply(ops: GeneralOperations): GeneralLogic = { @@ -118,9 +119,16 @@ class GeneralLogic(val ops: GeneralOperations, implicit val context: ActorContex } } ops.fallHeightTracker(pos.z) -// if (isCrouching && !player.Crouching) { -// //dev stuff goes here -// } + if (isCrouching && !player.Crouching) { + //dev stuff goes here + sendResponse(ChatMsg(ChatMessageType.UNK_227, "@NoChat_NoSquad")) + sendResponse(ChatMsg(ChatMessageType.UNK_227, "@InventoryPickupNoRoom")) +// zone.LocalEvents ! LocalServiceMessage( +// "", +// LocalAction.SendResponse(ChatMsg(ChatMessageType.UNK_227, "@InventoryPickupNoRoom")) +// LocalAction.SendResponse(ChatMsg(ChatMessageType.UNK_227, "@InventoryPickupNoRoom")) +// ) + } player.Position = pos player.Velocity = vel player.Orientation = Vector3(player.Orientation.x, pitch, yaw) diff --git a/src/main/scala/net/psforever/actors/session/normal/MountHandlerLogic.scala b/src/main/scala/net/psforever/actors/session/normal/MountHandlerLogic.scala index 211cc48ef..6a7e41a01 100644 --- a/src/main/scala/net/psforever/actors/session/normal/MountHandlerLogic.scala +++ b/src/main/scala/net/psforever/actors/session/normal/MountHandlerLogic.scala @@ -19,7 +19,7 @@ import net.psforever.packet.game.{ChatMsg, DelayedPathMountMsg, DismountVehicleC import net.psforever.services.Service import net.psforever.services.local.{LocalAction, LocalServiceMessage} import net.psforever.services.vehicle.{VehicleAction, VehicleServiceMessage} -import net.psforever.types.{BailType, ChatMessageType, PlanetSideGUID, Vector3} +import net.psforever.types.{BailType, ChatMessageType, DriveState, PlanetSideGUID, Vector3} import scala.concurrent.duration._ @@ -407,7 +407,22 @@ class MountHandlerLogic(val ops: SessionMountHandlers, implicit val context: Act case Mountable.CanNotMount(obj: Mountable, seatNumber) => log.warn(s"MountVehicleMsg: ${tplayer.Name} attempted to mount $obj's seat $seatNumber, but was not allowed") - case Mountable.CanNotDismount(obj, seatNum) => + case Mountable.CanNotDismount(obj: Vehicle, _, BailType.Normal) + if obj.DeploymentState == DriveState.AutoPilot => + sendResponse(ChatMsg(ChatMessageType.UNK_224, "@SA_CannotDismountAtThisTime")) + log.warn(s"DismountVehicleMsg: ${tplayer.Name} can not dismount $obj's when in autopilot") + + case Mountable.CanNotDismount(obj: Vehicle, _, BailType.Bailed) + if obj.DeploymentState == DriveState.AutoPilot => + sendResponse(ChatMsg(ChatMessageType.UNK_224, "@SA_CannotBailAtThisTime")) + log.warn(s"DismountVehicleMsg: ${tplayer.Name} can not bail from $obj's when in autopilot") + + case Mountable.CanNotDismount(obj: Vehicle, seatNum, _) + if obj.isMoving(test = 1f) => + sendResponse(ChatMsg(ChatMessageType.UNK_224, "@TooFastToDismount")) + log.warn(s"DismountVehicleMsg: ${tplayer.Name} attempted to dismount $obj's mount $seatNum, but was moving too fast") + + case Mountable.CanNotDismount(obj, seatNum, _) => log.warn(s"DismountVehicleMsg: ${tplayer.Name} attempted to dismount $obj's mount $seatNum, but was not allowed") } } diff --git a/src/main/scala/net/psforever/actors/session/spectator/MountHandlerLogic.scala b/src/main/scala/net/psforever/actors/session/spectator/MountHandlerLogic.scala index f6c3a4a43..2cf441e0f 100644 --- a/src/main/scala/net/psforever/actors/session/spectator/MountHandlerLogic.scala +++ b/src/main/scala/net/psforever/actors/session/spectator/MountHandlerLogic.scala @@ -203,9 +203,9 @@ class MountHandlerLogic(val ops: SessionMountHandlers, implicit val context: Act case Mountable.CanDismount(obj: PlanetSideGameObject with PlanetSideGameObject with Mountable with FactionAffinity with InGameHistory, seatNum, _) => DismountAction(tplayer, obj, seatNum) - case Mountable.CanDismount(obj: Mountable, _, _) => () + case Mountable.CanDismount(_: Mountable, _, _) => () - case Mountable.CanNotDismount(obj: Vehicle, seatNum) => + case Mountable.CanNotDismount(obj: Vehicle, _, _) => obj.Actor ! Vehicle.Deconstruct() case _ => () diff --git a/src/main/scala/net/psforever/actors/session/support/ChatOperations.scala b/src/main/scala/net/psforever/actors/session/support/ChatOperations.scala index 412a4c343..d33fb870e 100644 --- a/src/main/scala/net/psforever/actors/session/support/ChatOperations.scala +++ b/src/main/scala/net/psforever/actors/session/support/ChatOperations.scala @@ -91,11 +91,13 @@ class ChatOperations( } def commandWatermark(contents: String): Unit = { - val connectionState = + val connectionState = { if (contents.contains("40 80")) 100 else if (contents.contains("120 200")) 25 else 50 + } context.self ! SessionActor.SetConnectionState(connectionState) + context.self ! SessionActor.SendResponse(ChatMsg(ChatMessageType.UNK_227, "@CMT_CULLWATERMARK_success")) } def commandSpeed(message: ChatMsg, contents: String): Unit = { diff --git a/src/main/scala/net/psforever/objects/Vehicles.scala b/src/main/scala/net/psforever/objects/Vehicles.scala index 086d7d04d..462323e64 100644 --- a/src/main/scala/net/psforever/objects/Vehicles.scala +++ b/src/main/scala/net/psforever/objects/Vehicles.scala @@ -10,8 +10,8 @@ import net.psforever.objects.serverobject.transfer.TransferContainer import net.psforever.objects.serverobject.structures.WarpGate import net.psforever.objects.vehicles._ import net.psforever.objects.zones.Zone -import net.psforever.packet.game.{HackMessage, HackState, HackState1, HackState7, TriggeredSound} -import net.psforever.types.{DriveState, PlanetSideEmpire, PlanetSideGUID, Vector3} +import net.psforever.packet.game.{ChatMsg, HackMessage, HackState, HackState1, HackState7, TriggeredSound} +import net.psforever.types.{ChatMessageType, DriveState, PlanetSideEmpire, PlanetSideGUID, Vector3} import net.psforever.services.Service import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage} import net.psforever.services.local.{LocalAction, LocalServiceMessage} @@ -239,6 +239,8 @@ object Vehicles { val zone = target.Zone val zoneid = zone.id val vehicleEvents = zone.VehicleEvents + val localEvents = zone.LocalEvents + val previousOwnerName = target.OwnerName.getOrElse("") vehicleEvents ! VehicleServiceMessage( zoneid, VehicleAction.SendResponse( @@ -292,10 +294,20 @@ object Vehicles { AvatarAction.SetEmpire(Service.defaultPlayerGUID, tGuid, hFaction) ) } - zone.LocalEvents ! LocalServiceMessage( + localEvents ! LocalServiceMessage( zoneid, LocalAction.TriggerSound(hGuid, TriggeredSound.HackVehicle, target.Position, 30, 0.49803925f) ) + if (zone.Players.exists(_.name.equals(previousOwnerName))) { + localEvents ! LocalServiceMessage( + previousOwnerName, + LocalAction.SendResponse(ChatMsg(ChatMessageType.UNK_226, "@JackStolen")) + ) + } + localEvents ! LocalServiceMessage( + hacker.Name, + LocalAction.SendResponse(ChatMsg(ChatMessageType.UNK_226, "@JackVehicleOwned")) + ) // Clean up after specific vehicles, e.g. remove router telepads // If AMS is deployed, swap it to the new faction target.Definition match { diff --git a/src/main/scala/net/psforever/objects/serverobject/mount/Mountable.scala b/src/main/scala/net/psforever/objects/serverobject/mount/Mountable.scala index 3d858c4d6..c797371ac 100644 --- a/src/main/scala/net/psforever/objects/serverobject/mount/Mountable.scala +++ b/src/main/scala/net/psforever/objects/serverobject/mount/Mountable.scala @@ -146,5 +146,5 @@ object Mountable { * @param obj the `Mountable` object * @param seat_num the seat index */ - final case class CanNotDismount(obj: Mountable, seat_num: Int) extends Exchange + final case class CanNotDismount(obj: Mountable, seat_num: Int, bailType: BailType.Value) extends Exchange } diff --git a/src/main/scala/net/psforever/objects/serverobject/mount/MountableBehavior.scala b/src/main/scala/net/psforever/objects/serverobject/mount/MountableBehavior.scala index 1c60938c6..aca66da06 100644 --- a/src/main/scala/net/psforever/objects/serverobject/mount/MountableBehavior.scala +++ b/src/main/scala/net/psforever/objects/serverobject/mount/MountableBehavior.scala @@ -94,7 +94,7 @@ trait MountableBehavior { ) } else { - sender() ! Mountable.MountMessages(user, Mountable.CanNotDismount(obj, seat_number)) + sender() ! Mountable.MountMessages(user, Mountable.CanNotDismount(obj, seat_number, bail_type)) } } diff --git a/src/main/scala/net/psforever/objects/vehicles/control/VehicleControl.scala b/src/main/scala/net/psforever/objects/vehicles/control/VehicleControl.scala index 8a5d48a2e..6821e79a4 100644 --- a/src/main/scala/net/psforever/objects/vehicles/control/VehicleControl.scala +++ b/src/main/scala/net/psforever/objects/vehicles/control/VehicleControl.scala @@ -117,7 +117,8 @@ class VehicleControl(vehicle: Vehicle) case Vehicle.Ownership(Some(player)) => GainOwnership(player) - case Mountable.TryMount(user, mountPoint) if vehicle.DeploymentState == DriveState.AutoPilot => + case Mountable.TryMount(user, mountPoint) + if vehicle.DeploymentState == DriveState.AutoPilot => sender() ! Mountable.MountMessages(user, Mountable.CanNotMount(vehicle, mountPoint)) case msg @ Mountable.TryMount(player, mount_point) => @@ -125,19 +126,23 @@ class VehicleControl(vehicle: Vehicle) mountCleanup(mount_point, player) // Issue 1133. Todo: There may be a better way to address the issue? - case Mountable.TryDismount(user, seat_num, _) if GlobalDefinitions.isFlightVehicle(vehicle.Definition) && + case Mountable.TryDismount(user, seat_num, bailType) if GlobalDefinitions.isFlightVehicle(vehicle.Definition) && (vehicle.History.find { entry => entry.isInstanceOf[SpawningActivity] } match { case Some(entry) if System.currentTimeMillis() - entry.time < 3000L => true case _ => false }) => - sender() ! Mountable.MountMessages(user, Mountable.CanNotDismount(vehicle, seat_num)) + sender() ! Mountable.MountMessages(user, Mountable.CanNotDismount(vehicle, seat_num, bailType)) - case Mountable.TryDismount(user, seat_num, _) if !GlobalDefinitions.isFlightVehicle(vehicle.Definition) && + case Mountable.TryDismount(user, seat_num, bailType) if !GlobalDefinitions.isFlightVehicle(vehicle.Definition) && (vehicle.History.find { entry => entry.isInstanceOf[SpawningActivity] } match { case Some(entry) if System.currentTimeMillis() - entry.time < 8500L => true case _ => false }) => - sender() ! Mountable.MountMessages(user, Mountable.CanNotDismount(vehicle, seat_num)) + sender() ! Mountable.MountMessages(user, Mountable.CanNotDismount(vehicle, seat_num, bailType)) + + case Mountable.TryDismount(user, seat_num, bailType) + if vehicle.DeploymentState == DriveState.AutoPilot => + sender() ! Mountable.MountMessages(user, Mountable.CanNotDismount(vehicle, seat_num, bailType)) case msg @ Mountable.TryDismount(player, seat_num, _) => dismountBehavior.apply(msg)