mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-04-29 16:25:30 +00:00
Merge pull request #1147 from Resaec/gm_capturebase_turret_kick
GM command capturebase kicks players from turrets
This commit is contained in:
commit
93c3463985
4 changed files with 47 additions and 15 deletions
|
|
@ -5,6 +5,9 @@ import akka.actor.typed.{ActorRef, Behavior, PostStop, SupervisorStrategy}
|
||||||
import akka.actor.typed.receptionist.Receptionist
|
import akka.actor.typed.receptionist.Receptionist
|
||||||
import akka.actor.typed.scaladsl.{ActorContext, Behaviors, StashBuffer}
|
import akka.actor.typed.scaladsl.{ActorContext, Behaviors, StashBuffer}
|
||||||
import akka.actor.typed.scaladsl.adapter._
|
import akka.actor.typed.scaladsl.adapter._
|
||||||
|
import net.psforever.actors.zone.ZoneActor
|
||||||
|
import net.psforever.objects.sourcing.PlayerSource
|
||||||
|
import net.psforever.services.local.{LocalAction, LocalServiceMessage}
|
||||||
|
|
||||||
import scala.collection.mutable
|
import scala.collection.mutable
|
||||||
import scala.concurrent.ExecutionContextExecutor
|
import scala.concurrent.ExecutionContextExecutor
|
||||||
|
|
@ -483,8 +486,21 @@ class ChatActor(
|
||||||
)
|
)
|
||||||
buildings foreach { building =>
|
buildings foreach { building =>
|
||||||
// TODO implement timer
|
// TODO implement timer
|
||||||
|
|
||||||
|
val terminal = building.CaptureTerminal.get
|
||||||
|
|
||||||
building.Actor ! BuildingActor.SetFaction(faction)
|
building.Actor ! BuildingActor.SetFaction(faction)
|
||||||
|
building.Actor ! BuildingActor.AmenityStateChange(terminal, Some(false))
|
||||||
|
|
||||||
|
// clear any previous hack via "resecure"
|
||||||
|
if (building.CaptureTerminalIsHacked) {
|
||||||
|
building.Zone.LocalEvents ! LocalServiceMessage(terminal.Zone.id,LocalAction.ResecureCaptureTerminal(terminal, PlayerSource.Nobody))
|
||||||
|
}
|
||||||
|
|
||||||
|
// push any updates this might cause to clients
|
||||||
|
building.Zone.actor ! ZoneActor.ZoneMapUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
case (_, Some(0), _, None, _) =>
|
case (_, Some(0), _, None, _) =>
|
||||||
sessionActor ! SessionActor.SendResponse(
|
sessionActor ! SessionActor.SendResponse(
|
||||||
ChatMsg(
|
ChatMsg(
|
||||||
|
|
|
||||||
|
|
@ -258,17 +258,17 @@ class SessionMountHandlers(
|
||||||
case Mountable.CanDismount(obj: Mountable, _, _) =>
|
case Mountable.CanDismount(obj: Mountable, _, _) =>
|
||||||
log.warn(s"DismountVehicleMsg: $obj is some dismountable object but nothing will happen for ${player.Name}")
|
log.warn(s"DismountVehicleMsg: $obj is some dismountable object but nothing will happen for ${player.Name}")
|
||||||
|
|
||||||
case Mountable.CanNotMount(obj: Vehicle, mountPoint) =>
|
case Mountable.CanNotMount(obj: Vehicle, seatNumber) =>
|
||||||
log.warn(s"MountVehicleMsg: ${tplayer.Name} attempted to mount $obj's mount $mountPoint, but was not allowed")
|
log.warn(s"MountVehicleMsg: ${tplayer.Name} attempted to mount $obj's seat $seatNumber, but was not allowed")
|
||||||
obj.GetSeatFromMountPoint(mountPoint).collect {
|
obj.GetSeatFromMountPoint(seatNumber).collect {
|
||||||
case seatNum if obj.SeatPermissionGroup(seatNum).contains(AccessPermissionGroup.Driver) =>
|
case seatNum if obj.SeatPermissionGroup(seatNum).contains(AccessPermissionGroup.Driver) =>
|
||||||
sendResponse(
|
sendResponse(
|
||||||
ChatMsg(ChatMessageType.CMT_OPEN, wideContents=false, recipient="", "You are not the driver of this vehicle.", note=None)
|
ChatMsg(ChatMessageType.CMT_OPEN, wideContents=false, recipient="", "You are not the driver of this vehicle.", note=None)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
case Mountable.CanNotMount(obj: Mountable, mountPoint) =>
|
case Mountable.CanNotMount(obj: Mountable, seatNumber) =>
|
||||||
log.warn(s"MountVehicleMsg: ${tplayer.Name} attempted to mount $obj's mount $mountPoint, but was not allowed")
|
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, seatNum) =>
|
||||||
log.warn(s"DismountVehicleMsg: ${tplayer.Name} attempted to dismount $obj's mount $seatNum, but was not allowed")
|
log.warn(s"DismountVehicleMsg: ${tplayer.Name} attempted to dismount $obj's mount $seatNum, but was not allowed")
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright (c) 2021 PSForever
|
// Copyright (c) 2021 PSForever
|
||||||
package net.psforever.objects.serverobject.mount
|
package net.psforever.objects.serverobject.mount
|
||||||
|
|
||||||
|
import net.psforever.objects.Player
|
||||||
import net.psforever.types.BailType
|
import net.psforever.types.BailType
|
||||||
|
|
||||||
trait MountableSpace[A <: MountableEntity] {
|
trait MountableSpace[A <: MountableEntity] {
|
||||||
|
|
@ -92,6 +93,10 @@ trait MountableSpace[A <: MountableEntity] {
|
||||||
case Some(p) if testToUnmount(p) =>
|
case Some(p) if testToUnmount(p) =>
|
||||||
_occupant = None
|
_occupant = None
|
||||||
p.BailProtection = bailable && (bailType == BailType.Bailed || bailType == BailType.Kicked)
|
p.BailProtection = bailable && (bailType == BailType.Bailed || bailType == BailType.Kicked)
|
||||||
|
p match {
|
||||||
|
case player: Player =>
|
||||||
|
player.VehicleSeated = None
|
||||||
|
}
|
||||||
None
|
None
|
||||||
case _ =>
|
case _ =>
|
||||||
occupant
|
occupant
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,27 @@ trait CaptureTerminalAwareBehavior {
|
||||||
case true => ; // CC is resecured
|
case true => ; // CC is resecured
|
||||||
case false => // CC is hacked
|
case false => // CC is hacked
|
||||||
// Remove seated occupants for mountables
|
// Remove seated occupants for mountables
|
||||||
if (CaptureTerminalAwareObject.isInstanceOf[Mountable]) {
|
CaptureTerminalAwareObject match {
|
||||||
CaptureTerminalAwareObject.asInstanceOf[Mountable].Seats.filter(x => x._2.isOccupied).foreach(x => {
|
case mountable: Mountable =>
|
||||||
val (seat_num, seat) = x
|
|
||||||
val user = seat.occupant.get
|
val guid = mountable.GUID
|
||||||
CaptureTerminalAwareObject.Zone.VehicleEvents ! VehicleServiceMessage(
|
val zone = mountable.Zone
|
||||||
CaptureTerminalAwareObject.Zone.id,
|
val zoneId = zone.id
|
||||||
VehicleAction.KickPassenger(user.GUID, seat_num, true, CaptureTerminalAwareObject.GUID)
|
val events = zone.VehicleEvents
|
||||||
)
|
|
||||||
seat.unmount(user)
|
mountable.Seats.values.zipWithIndex.foreach {
|
||||||
})
|
case (seat, seat_num) =>
|
||||||
|
seat.occupant match {
|
||||||
|
case Some(player) =>
|
||||||
|
seat.unmount(player)
|
||||||
|
player.VehicleSeated = None
|
||||||
|
if (player.HasGUID) {
|
||||||
|
events ! VehicleServiceMessage(zoneId, VehicleAction.KickPassenger(player.GUID, seat_num, true, guid))
|
||||||
|
}
|
||||||
|
case None => ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case _ =>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue