mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-07 14:10:25 +00:00
Hacking fixes (#253)
* Remove QoL change to show faction colours on hacked objects as unfortunately it causes side effects like doors opening for the hacker but saying the door is locked * Only send map updates if the resecured object is a capture terminal * Centralise logic to check if a Capture Terminal is hacked for a Building object * Fix hacking a terminal where the base CC has been hacked and add a bit of extra logging for possible edge cases * Clear all hacks from hacked amenities when the CC is resecured * Fix AMS terminals being broken * Clear amenity hacks when CC is both hacked and resecured
This commit is contained in:
parent
6c68bda97c
commit
473d4d14c5
4 changed files with 81 additions and 64 deletions
|
|
@ -39,6 +39,14 @@ class Building(private val building_guid : Int, private val map_id : Int, privat
|
|||
amenities
|
||||
}
|
||||
|
||||
def CaptureConsoleIsHacked : Boolean = {
|
||||
Amenities.filter(x => x.Definition == GlobalDefinitions.capture_terminal).headOption.asInstanceOf[Option[CaptureTerminal]] match {
|
||||
case Some(obj: CaptureTerminal) =>
|
||||
obj.HackedBy.isDefined
|
||||
case None => false
|
||||
}
|
||||
}
|
||||
|
||||
def Zone : Zone = zone
|
||||
|
||||
def Info : (
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ package services.local
|
|||
import akka.actor.{Actor, ActorRef, Props}
|
||||
import net.psforever.objects.ce.Deployable
|
||||
import net.psforever.objects.serverobject.resourcesilo.ResourceSilo
|
||||
import net.psforever.objects.serverobject.structures.Building
|
||||
import net.psforever.objects.serverobject.structures.{Amenity, Building}
|
||||
import net.psforever.objects.serverobject.terminals.{CaptureTerminal, ProximityUnit, Terminal}
|
||||
import net.psforever.objects.zones.{InterstellarCluster, Zone}
|
||||
import net.psforever.objects._
|
||||
|
|
@ -18,6 +18,7 @@ import services.{GenericEventBus, RemoverActor, Service, ServiceManager}
|
|||
import scala.util.Success
|
||||
import scala.concurrent.duration._
|
||||
import akka.pattern.ask
|
||||
import net.psforever.objects.serverobject.hackable.Hackable
|
||||
import net.psforever.objects.vehicles.{Utility, UtilityType}
|
||||
import services.ServiceManager.Lookup
|
||||
import services.support.SupportActor
|
||||
|
|
@ -95,6 +96,12 @@ class LocalService extends Actor {
|
|||
hackClearer ! HackClearActor.ObjectIsResecured(target)
|
||||
case LocalAction.HackCaptureTerminal(player_guid, zone, target, unk1, unk2, isResecured) =>
|
||||
|
||||
// When a CC is hacked (or resecured) all amenities for the base should be unhacked
|
||||
val hackableAmenities = target.Owner.asInstanceOf[Building].Amenities.filter(x => x.isInstanceOf[Hackable]).map(x => x.asInstanceOf[Amenity with Hackable])
|
||||
hackableAmenities.foreach(amenity =>
|
||||
if(amenity.HackedBy.isDefined) { hackClearer ! HackClearActor.ObjectIsResecured(amenity) }
|
||||
)
|
||||
|
||||
if(isResecured){
|
||||
hackCapturer ! HackCaptureActor.ClearHack(target, zone)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,8 @@ class HackCaptureActor extends Actor {
|
|||
|
||||
case HackCaptureActor.ClearHack(target, _) =>
|
||||
hackedObjects = hackedObjects.filterNot(x => x.target == target)
|
||||
target.Owner.Actor ! Building.SendMapUpdate(all_clients = true)
|
||||
|
||||
if(target.isInstanceOf[CaptureTerminal]) { target.Owner.Actor ! Building.SendMapUpdate(all_clients = true) }
|
||||
|
||||
// Restart the timer in case the object we just removed was the next one scheduled
|
||||
RestartTimer()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue