mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-02-13 03:33:37 +00:00
prototyping utility addition to Zones; resolved issue with Avatar registration causing onFailure case to fire on success
This commit is contained in:
parent
402d4c5b3e
commit
0c7c4dc58f
5 changed files with 37 additions and 32 deletions
|
|
@ -7,13 +7,15 @@ import net.psforever.objects.Player
|
|||
import scala.annotation.tailrec
|
||||
|
||||
class IntergalacticCluster(continents : List[Zone]) extends Actor {
|
||||
//private[this] val log = org.log4s.getLogger
|
||||
private[this] val log = org.log4s.getLogger
|
||||
for(continent <- continents) {
|
||||
log.info(s"Built continent ${continent.ZoneId}")
|
||||
continent.Actor //seed context
|
||||
}
|
||||
|
||||
def receive : Receive = {
|
||||
case IntergalacticCluster.GetWorld(zoneId) =>
|
||||
log.info(s"Asked to find $zoneId")
|
||||
findWorldInCluster(continents.iterator, zoneId) match {
|
||||
case Some(continent) =>
|
||||
sender ! IntergalacticCluster.GiveWorld(zoneId, continent)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import net.psforever.objects.Player
|
|||
import net.psforever.objects.entity.IdentifiableEntity
|
||||
import net.psforever.objects.equipment.Equipment
|
||||
import net.psforever.objects.guid.NumberPoolHub
|
||||
import net.psforever.objects.guid.actor.{NumberPoolAccessorActor, NumberPoolActor}
|
||||
import net.psforever.objects.guid.actor.{NumberPoolAccessorActor, NumberPoolActor, Register}
|
||||
import net.psforever.objects.guid.selector.RandomSelector
|
||||
import net.psforever.objects.guid.source.LimitedNumberSource
|
||||
import net.psforever.packet.GamePacket
|
||||
|
|
@ -17,17 +17,20 @@ import scala.collection.mutable.ListBuffer
|
|||
|
||||
class Zone(id : String, zoneNumber : Int, map : String) {
|
||||
private var actor = ActorRef.noSender
|
||||
private var guid : NumberPoolHub = new NumberPoolHub(new LimitedNumberSource(6))
|
||||
private var guid : NumberPoolHub = new NumberPoolHub(new LimitedNumberSource(65536))
|
||||
private var accessor : ActorRef = ActorRef.noSender
|
||||
private var startupUtilities : List[(IdentifiableEntity, Int)] = List()
|
||||
|
||||
def Actor(implicit context : ActorContext) : ActorRef = {
|
||||
if(actor == ActorRef.noSender) {
|
||||
actor = context.actorOf(Props(classOf[ZoneActor], this), s"$id-actor")
|
||||
|
||||
val pool = guid.AddPool("pool", 6 :: Nil)//(400 to 599).toList)
|
||||
val pool = guid.AddPool("pool", (200 to 400).toList)
|
||||
val poolActor = context.actorOf(Props(classOf[NumberPoolActor], pool), name = s"$ZoneId-poolActor")
|
||||
pool.Selector = new RandomSelector
|
||||
accessor = context.actorOf(Props(classOf[NumberPoolAccessorActor], guid, pool, poolActor), s"$ZoneId-accessor")
|
||||
|
||||
startupUtilities.foreach({case ((obj, uid)) => accessor ! Register(obj, uid, actor)})
|
||||
}
|
||||
actor
|
||||
}
|
||||
|
|
@ -53,6 +56,10 @@ class Zone(id : String, zoneNumber : Int, map : String) {
|
|||
|
||||
def EquipmentOnGround : ListBuffer[Equipment] = equipmentOnGround
|
||||
|
||||
def AddUtility(obj : IdentifiableEntity, id : Int) : Unit = {
|
||||
startupUtilities = startupUtilities :+ (obj, id)
|
||||
}
|
||||
|
||||
def ZoneInitialization() : List[GamePacket] = {
|
||||
List.empty[GamePacket]
|
||||
}
|
||||
|
|
@ -63,6 +70,7 @@ class Zone(id : String, zoneNumber : Int, map : String) {
|
|||
}
|
||||
|
||||
object Zone {
|
||||
final def BlankInitFunction() : Unit = { }
|
||||
final def Nowhere : Zone = { Zone("nowhere", 0, "nowhere") } //TODO needs overrides
|
||||
|
||||
final case class DropItemOnGround(item : Equipment, pos : Vector3, orient : Vector3)
|
||||
|
|
|
|||
|
|
@ -142,6 +142,10 @@ object Terminal {
|
|||
*/
|
||||
final case class InfantryLoadout(exosuit : ExoSuitType.Value, subtype : Int = 0, holsters : List[InventoryItem], inventory : List[InventoryItem]) extends Exchange
|
||||
|
||||
def apply(tdef : TerminalDefinition) : Terminal = {
|
||||
new Terminal(tdef)
|
||||
}
|
||||
|
||||
import net.psforever.packet.game.PlanetSideGUID
|
||||
def apply(guid : PlanetSideGUID, tdef : TerminalDefinition) : Terminal = {
|
||||
val obj = new Terminal(tdef)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue