adding chat and event messages that have been neglected since; these are easy additions

This commit is contained in:
Fate-JH 2024-08-15 00:06:02 -04:00
parent a4b7e77d9d
commit d522a09335
8 changed files with 60 additions and 18 deletions

View file

@ -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)

View file

@ -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")
}
}

View file

@ -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 _ => ()

View file

@ -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 = {

View file

@ -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 {

View file

@ -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
}

View file

@ -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))
}
}

View file

@ -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)