mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-01-20 10:34:44 +00:00
Allow Amenities to be removed from AmenityOwner, add IsCtfBase / GetFlagSocket / GetFlag to Building
This commit is contained in:
parent
0534ec6f0c
commit
0a342c3173
|
|
@ -1,6 +1,5 @@
|
|||
package net.psforever.actors.zone
|
||||
|
||||
import akka.actor.Actor
|
||||
import akka.actor.typed.receptionist.Receptionist
|
||||
import akka.actor.typed.scaladsl.{ActorContext, Behaviors, StashBuffer}
|
||||
import akka.actor.typed.{ActorRef, Behavior, SupervisorStrategy}
|
||||
|
|
@ -9,18 +8,16 @@ import net.psforever.actors.commands.NtuCommand
|
|||
import net.psforever.objects.NtuContainer
|
||||
import net.psforever.objects.serverobject.PlanetSideServerObject
|
||||
import net.psforever.objects.serverobject.generator.{Generator, GeneratorControl}
|
||||
import net.psforever.objects.serverobject.hackable.Hackable
|
||||
import net.psforever.objects.serverobject.structures.{Amenity, Building, StructureType, WarpGate}
|
||||
import net.psforever.objects.serverobject.terminals.capture.{CaptureTerminal, CaptureTerminalAware, CaptureTerminalAwareBehavior}
|
||||
import net.psforever.objects.serverobject.turret.{FacilityTurret, FacilityTurretControl}
|
||||
import net.psforever.objects.zones.Zone
|
||||
import net.psforever.persistence
|
||||
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage}
|
||||
import net.psforever.types.{PlanetSideEmpire, PlanetSideGUID, PlanetSideGeneratorState}
|
||||
import net.psforever.util.Database._
|
||||
import net.psforever.services.galaxy.{GalaxyAction, GalaxyServiceMessage}
|
||||
import net.psforever.services.local.{LocalAction, LocalServiceMessage}
|
||||
import net.psforever.services.{InterstellarClusterService, Service, ServiceManager}
|
||||
import net.psforever.types.{PlanetSideEmpire, PlanetSideGUID, PlanetSideGeneratorState}
|
||||
import net.psforever.util.Database._
|
||||
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
import scala.util.{Failure, Success}
|
||||
|
|
|
|||
|
|
@ -18,4 +18,9 @@ abstract class AmenityOwner extends PlanetSideServerObject {
|
|||
obj.Owner = this
|
||||
amenities
|
||||
}
|
||||
|
||||
def RemoveAmenity(obj: Amenity): List[Amenity] = {
|
||||
amenities = amenities.filterNot(x => x == obj)
|
||||
amenities
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import net.psforever.packet.game.BuildingInfoUpdateMessage
|
|||
import net.psforever.types.{PlanetSideEmpire, PlanetSideGUID, PlanetSideGeneratorState, Vector3}
|
||||
import scalax.collection.{Graph, GraphEdge}
|
||||
import akka.actor.typed.scaladsl.adapter._
|
||||
import net.psforever.objects.serverobject.llu.{CaptureFlag, CaptureFlagSocket}
|
||||
import net.psforever.objects.serverobject.terminals.capture.CaptureTerminal
|
||||
|
||||
class Building(
|
||||
|
|
@ -27,10 +28,6 @@ class Building(
|
|||
private val buildingDefinition: BuildingDefinition
|
||||
) extends AmenityOwner {
|
||||
|
||||
/**
|
||||
* The map_id is the identifier number used in BuildingInfoUpdateMessage. This is the index that the building appears in the MPO file starting from index 1
|
||||
* The GUID is the identifier number used in SetEmpireMessage / Facility hacking / PlanetSideAttributeMessage.
|
||||
*/
|
||||
private var faction: PlanetSideEmpire.Value = PlanetSideEmpire.NEUTRAL
|
||||
private var playersInSOI: List[Player] = List.empty
|
||||
private val capitols = List("Thoth", "Voltan", "Neit", "Anguta", "Eisa", "Verica")
|
||||
|
|
@ -43,6 +40,10 @@ class Building(
|
|||
|
||||
def Name: String = name
|
||||
|
||||
/**
|
||||
* The map_id is the identifier number used in BuildingInfoUpdateMessage. This is the index that the building appears in the MPO file starting from index 1
|
||||
* The GUID is the identifier number used in SetEmpireMessage / Facility hacking / PlanetSideAttributeMessage.
|
||||
*/
|
||||
def MapId: Int = map_id
|
||||
|
||||
def IsCapitol: Boolean = capitols.contains(name)
|
||||
|
|
@ -122,6 +123,14 @@ class Building(
|
|||
}
|
||||
}
|
||||
|
||||
def IsCtfBase: Boolean = GetFlagSocket match {
|
||||
case Some(_) => true
|
||||
case _ => false
|
||||
}
|
||||
|
||||
def GetFlagSocket: Option[CaptureFlagSocket] = this.Amenities.find(_.Definition == GlobalDefinitions.llm_socket).asInstanceOf[Option[CaptureFlagSocket]]
|
||||
def GetFlag: Option[CaptureFlag] = this.Amenities.find(_.Definition == GlobalDefinitions.capture_flag).asInstanceOf[Option[CaptureFlag]]
|
||||
|
||||
def HackableAmenities: List[Amenity with Hackable] = {
|
||||
Amenities.filter(x => x.isInstanceOf[Hackable]).map(x => x.asInstanceOf[Amenity with Hackable])
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue