mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-16 00:44:43 +00:00
If I only knew the codebase and that MountedIn was already a thing -.-
This commit is contained in:
parent
962904b3d9
commit
0cb9746cbb
1 changed files with 3 additions and 14 deletions
|
|
@ -963,30 +963,19 @@ class SessionData(
|
||||||
log.debug(s"$pkt")
|
log.debug(s"$pkt")
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is for excluding cargo vehicles from attempting to charge their shield while mounted in a carrier vehicle.
|
|
||||||
// As per issue 1126, this would cause the client of the cargo vehicle occupant(s) to disconnect
|
|
||||||
def handleGetCargoVehicles(vehicle: Vehicle): List[Vehicle] = {
|
|
||||||
val mountedVehicle = vehicle.MountedIn.flatMap { mountedGUID =>
|
|
||||||
continent.GUID(mountedGUID.guid).collect { case mountedVehicle: Vehicle => mountedVehicle }
|
|
||||||
}.toList
|
|
||||||
mountedVehicle
|
|
||||||
}
|
|
||||||
|
|
||||||
def handleIsCargoVehicle(vehicle: Vehicle): Boolean = {
|
|
||||||
handleGetCargoVehicles(vehicle).nonEmpty
|
|
||||||
}
|
|
||||||
|
|
||||||
def handleFacilityBenefitShieldChargeRequest(pkt: FacilityBenefitShieldChargeRequestMessage): Unit = {
|
def handleFacilityBenefitShieldChargeRequest(pkt: FacilityBenefitShieldChargeRequestMessage): Unit = {
|
||||||
val FacilityBenefitShieldChargeRequestMessage(_) = pkt
|
val FacilityBenefitShieldChargeRequestMessage(_) = pkt
|
||||||
val vehicleGuid = player.VehicleSeated
|
val vehicleGuid = player.VehicleSeated
|
||||||
continent
|
continent
|
||||||
.GUID(vehicleGuid)
|
.GUID(vehicleGuid)
|
||||||
.foreach {
|
.foreach {
|
||||||
case obj: Vehicle if !obj.Destroyed && !handleIsCargoVehicle(obj) => // vehicle will try to charge even if destroyed
|
case obj: Vehicle if !obj.Destroyed && obj.MountedIn.isEmpty => // vehicle will try to charge even if destroyed & cargo vehicles need to be excluded
|
||||||
obj.Actor ! CommonMessages.ChargeShields(
|
obj.Actor ! CommonMessages.ChargeShields(
|
||||||
15,
|
15,
|
||||||
Some(continent.blockMap.sector(obj).buildingList.maxBy(_.Definition.SOIRadius))
|
Some(continent.blockMap.sector(obj).buildingList.maxBy(_.Definition.SOIRadius))
|
||||||
)
|
)
|
||||||
|
case obj: Vehicle if obj.MountedIn.nonEmpty =>
|
||||||
|
false
|
||||||
case _ if vehicleGuid.nonEmpty =>
|
case _ if vehicleGuid.nonEmpty =>
|
||||||
log.warn(
|
log.warn(
|
||||||
s"FacilityBenefitShieldChargeRequest: ${player.Name} can not find vehicle ${vehicleGuid.get.guid} in zone ${continent.id}"
|
s"FacilityBenefitShieldChargeRequest: ${player.Name} can not find vehicle ${vehicleGuid.get.guid} in zone ${continent.id}"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue