how painbox doors work; moved constant chat system subscriptions; swapped around medical terminal coordinates on home3

This commit is contained in:
FateJH 2020-01-03 20:24:44 -05:00
parent d2ef5a76a4
commit 837e9cb2ff
4 changed files with 47 additions and 25 deletions

View file

@ -11,19 +11,31 @@ import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
class PainboxControl(painbox: Painbox) extends Actor {
//private[this] val log = org.log4s.getLogger(s"Painbox")
private var painboxTick: Cancellable = DefaultCancellable.obj
private var nearestDoor : Door = null
private[this] val log = org.log4s.getLogger(s"Painbox")
var painboxTick: Cancellable = DefaultCancellable.obj
var nearestDoor : Option[Door] = None
def receive : Receive = {
case "startup" =>
painbox.Owner match {
case obj : Building =>
nearestDoor = obj.Amenities
.collect { case door : Door => door }
.minBy(door => Vector3.DistanceSquared(painbox.Position, door.Position))
context.become(Stopped)
case _ => ;
if(painbox.Definition.HasNearestDoorDependency) {
(painbox.Owner match {
case obj : Building =>
obj.Amenities
.collect { case door : Door => door }
.sortBy(door => Vector3.DistanceSquared(painbox.Position, door.Position))
.headOption
case _ =>
None
}) match {
case door @ Some(_) =>
nearestDoor = door
context.become(Stopped)
case _ =>
log.error(s"object #${painbox.GUID.guid} can not find a door that it needed")
}
}
else {
context.become(Stopped)
}
case _ => ;
@ -42,7 +54,7 @@ class PainboxControl(painbox: Painbox) extends Actor {
val guid = painbox.GUID
val owner = painbox.Owner.asInstanceOf[Building]
val faction = owner.Faction
if(faction != PlanetSideEmpire.NEUTRAL && (!painbox.Definition.HasNearestDoorDependency || (painbox.Definition.HasNearestDoorDependency && nearestDoor.Open.nonEmpty))) {
if(faction != PlanetSideEmpire.NEUTRAL && (nearestDoor match { case Some(door) => door.Open.nonEmpty; case _ => true })) {
val events = owner.Zone.AvatarEvents
val damage = painbox.Definition.Damage
val radius = painbox.Definition.Radius * painbox.Definition.Radius

View file

@ -68,6 +68,12 @@ object SOI {
/** Stop sorting players into sois */
final case class Stop()
/**
* Recursively populate each facility's sphere of influence with players.
* @param buildings an iterator of buildings and the radius of its sphere of influence
* @param players a list of players to allocate;
* the list gets shorter as each building is allocated
*/
@tailrec
def Populate(buildings : Iterator[(Building, Int)], players : List[Player]) : Unit = {
if(players.nonEmpty && buildings.hasNext) {

View file

@ -121,7 +121,9 @@ class WorldSessionActor extends Actor
var drawDeloyableIcon : PlanetSideGameObject with Deployable => Unit = RedrawDeployableIcons
var updateSquad : () => Unit = NoSquadUpdates
var recentTeleportAttempt : Long = 0
var lastTerminalOrderFulfillment : Boolean = true /**
var lastTerminalOrderFulfillment : Boolean = true
var shiftPosition : Option[Vector3] = None
/**
* used during zone transfers to maintain reference to seated vehicle (which does not yet exist in the new zone)
* used during intrazone gate transfers, but not in a way distinct from prior zone transfer procedures
* should only be set during the transient period when moving between one spawn point and the next
@ -1033,10 +1035,19 @@ class WorldSessionActor extends Actor
sendResponse(ReplicationStreamMessage(5, Some(6), Vector.empty)) //clear squad list
sendResponse(FriendsResponse(FriendAction.InitializeFriendList, 0, true, true, Nil))
sendResponse(FriendsResponse(FriendAction.InitializeIgnoreList, 0, true, true, Nil))
//the following subscriptions last until character switch/logout
chatService ! Service.Join("local")
chatService ! Service.Join("squad")
chatService ! Service.Join("voice")
chatService ! Service.Join("tell")
chatService ! Service.Join("broadcast")
chatService ! Service.Join("note")
chatService ! Service.Join("gm")
galaxyService ! Service.Join("galaxy") //for galaxy-wide messages
galaxyService ! Service.Join(s"${avatar.faction}") //for hotspots
squadService ! Service.Join(s"${avatar.faction}") //channel will be player.Faction
squadService ! Service.Join(s"${avatar.CharId}") //channel will be player.CharId (in order to work with packets)
//go home
cluster ! InterstellarCluster.GetWorld("home3")
case InterstellarCluster.GiveWorld(zoneId, zone) =>
@ -3061,7 +3072,8 @@ class WorldSessionActor extends Actor
sendResponse(PlanetsideAttributeMessage(PlanetSideGUID(0), 75, 0))
sendResponse(SetCurrentAvatarMessage(guid, 0, 0))
sendResponse(ChatMsg(ChatMessageType.CMT_EXPANSIONS, true, "", "1 on", None)) //CC on //TODO once per respawn?
sendResponse(PlayerStateShiftMessage(ShiftState(1, tplayer.Position, tplayer.Orientation.z)))
sendResponse(PlayerStateShiftMessage(ShiftState(1, shiftPosition.getOrElse(tplayer.Position), tplayer.Orientation.z)))
shiftPosition = None
if(spectator) {
sendResponse(ChatMsg(ChatMessageType.CMT_TOGGLESPECTATORMODE, false, "", "on", None))
}
@ -3279,7 +3291,7 @@ class WorldSessionActor extends Actor
import net.psforever.objects.GlobalDefinitions._
import net.psforever.types.CertificationType._
val faction = PlanetSideEmpire.TR
val faction = PlanetSideEmpire.VS
val avatar = new Avatar(41605313L+sessionId, s"TestCharacter$sessionId", faction, CharacterGender.Female, 41, CharacterVoice.Voice1)
avatar.Certifications += StandardAssault
avatar.Certifications += MediumAssault
@ -3669,15 +3681,6 @@ class WorldSessionActor extends Actor
}
}
continent.VehicleEvents ! VehicleServiceMessage(continent.Id, VehicleAction.UpdateAmsSpawnPoint(continent))
chatService ! Service.Join("local")
chatService ! Service.Join("squad")
chatService ! Service.Join("voice")
chatService ! Service.Join("tell")
chatService ! Service.Join("broadcast")
chatService ! Service.Join("note")
chatService ! Service.Join("gm")
self ! SetCurrentAvatar(player)
case msg @ PlayerStateMessageUpstream(avatar_guid, pos, vel, yaw, pitch, yaw_upper, seq_time, unk3, is_crouching, is_jumping, jump_thrust, is_cloaking, unk5, unk6) =>
@ -9098,6 +9101,7 @@ class WorldSessionActor extends Actor
val respawnTimeMillis = respawnTime * 1000 //ms
deadState = DeadState.RespawnTime
sendResponse(AvatarDeadStateMessage(DeadState.RespawnTime, respawnTimeMillis, respawnTimeMillis, Vector3.Zero, player.Faction, true))
shiftPosition = Some(pos)
val (target, msg) = if(backpack) { //if the player is dead, he is handled as dead infantry, even if he died in a vehicle
//new player is spawning
val newPlayer = RespawnClone(player)

View file

@ -201,8 +201,8 @@ object Map13 {
LocalObject(868, Terminal.Constructor(Vector3(3760.041f, 2809.603f, 94.65012f), order_terminal), owning_building_guid = 2)
LocalObject(869, Terminal.Constructor(Vector3(3763.91f, 2806.405f, 94.65012f), order_terminal), owning_building_guid = 2)
LocalObject(870, Terminal.Constructor(Vector3(3763.931f, 2809.603f, 94.65012f), order_terminal), owning_building_guid = 2)
LocalObject(778, ProximityTerminal.Constructor(Vector3(3617.307f, 2830.855f, 93.34412f), medical_terminal), owning_building_guid = 2)
LocalObject(779, ProximityTerminal.Constructor(Vector3(3617.369f, 2785.151f, 93.34412f), medical_terminal), owning_building_guid = 2)
LocalObject(778, ProximityTerminal.Constructor(Vector3(3617.369f, 2785.151f, 93.34412f), medical_terminal), owning_building_guid = 2)
LocalObject(779, ProximityTerminal.Constructor(Vector3(3617.307f, 2830.855f, 93.34412f), medical_terminal), owning_building_guid = 2)
LocalObject(780, ProximityTerminal.Constructor(Vector3(3758.667f, 2785.151f, 93.34412f), medical_terminal), owning_building_guid = 2)
LocalObject(781, ProximityTerminal.Constructor(Vector3(3758.689f, 2830.855f, 93.34412f), medical_terminal), owning_building_guid = 2)
LocalObject(522, ImplantTerminalMech.Constructor, owning_building_guid = 2)