Gating Fixes (#254)

* rescheduling of passenger gating summons to increase chances of detecting passengers joining same zone; short-circuit new spawn requests and new warp gate requests while a previous request is already being processed

* changing respawn delays for warp gate spawn points

* adjusting how warp gates store broadcast data and how broadcast gates are declared in packets; activating TR sanctuary warp gates and making Solsar warp gates broadcast for the TR

* changes to vehicle disowning and what happens to an AMS when it is unloaded
This commit is contained in:
Fate-JH 2019-04-21 08:23:12 -04:00 committed by GitHub
parent 6399963e68
commit 5209f9ec21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 223 additions and 94 deletions

View file

@ -1039,14 +1039,12 @@ object GlobalDefinitions {
val warpgate : ObjectDefinition with SpawnPointDefinition = new ObjectDefinition(993) with SpawnPointDefinition
warpgate.Name = "warpgate"
warpgate.UseRadius = 301.8713f
warpgate.Delay = 10
warpgate.VehicleAllowance = true
warpgate.SpecificPointFunc = SpawnPoint.Gate
val hst : ObjectDefinition with SpawnPointDefinition = new ObjectDefinition(402) with SpawnPointDefinition
hst.Name = "hst"
hst.UseRadius = 20.4810f
hst.Delay = 10
hst.VehicleAllowance = true
hst.NoWarp += dropship
hst.NoWarp += galaxy_gunship
@ -1062,7 +1060,6 @@ object GlobalDefinitions {
val warpgate_cavern : ObjectDefinition with SpawnPointDefinition = new ObjectDefinition(994) with SpawnPointDefinition
warpgate_cavern.Name = "warpgate_cavern"
warpgate_cavern.UseRadius = 55.0522f
warpgate_cavern.Delay = 10
warpgate_cavern.VehicleAllowance = true
warpgate_cavern.SpecificPointFunc = SpawnPoint.Gate

View file

@ -9,11 +9,15 @@ import net.psforever.objects.zones.Zone
import net.psforever.packet.game.{Additional1, Additional2, Additional3, PlanetSideGeneratorState}
import net.psforever.types.{PlanetSideEmpire, Vector3}
import scala.collection.mutable
class WarpGate(building_guid : Int, map_id : Int, zone : Zone, buildingDefinition : ObjectDefinition with SpawnPointDefinition)
extends Building(building_guid, map_id, zone, StructureType.WarpGate, buildingDefinition)
with SpawnPoint {
/** can this building be used as an active warp gate */
private var active : Boolean = true
private var broadcast : Boolean = false
/** what faction views this warp gate as a broadcast gate */
private var broadcast : mutable.Set[PlanetSideEmpire.Value] = mutable.Set.empty[PlanetSideEmpire.Value]
override def Info : (
Int,
@ -48,18 +52,105 @@ class WarpGate(building_guid : Int, map_id : Int, zone : Zone, buildingDefinitio
)
}
/**
* If a warp gate is active, it can be used to transport faction-affiliated forces between other gates.
* For transportation of faction-opposed forces, use broadcast logic for that faction.
* @return `true`, if the warp gate can be used for transport;
* `false`, otherwise
*/
def Active : Boolean = active
/**
* Control whether a warp gate is usable for transporting faction-affiliated forces between other gates.
* @param state `true`, to activate the gate;
* `false`, otherwise
* @return `true`, if the gate is active;
* `false`, otherwise
*/
def Active_=(state : Boolean) : Boolean = {
active = state
Active
}
def Broadcast : Boolean = Active && broadcast
/**
* Determine whether any faction interacts with this warp gate as "broadcast."
* The gate must be active first.
* @return `true`, if some faction sees this warp gate as a "broadcast gate";
* `false`, otherwise
*/
def Broadcast : Boolean = Active && broadcast.nonEmpty
def Broadcast_=(cast : Boolean) : Boolean = {
broadcast = cast
Broadcast
/**
* Determine whether a specific faction interacts with this warp gate as "broadcast."
* The warp gate being `NEUTRAL` should allow for any polled faction to interact.
* The gate must be active first.
* @return `true`, if the given faction interacts with this warp gate as a "broadcast gate";
* `false`, otherwise
*/
def Broadcast(faction : PlanetSideEmpire.Value) : Boolean = {
Active && (broadcast.contains(faction) || broadcast.contains(PlanetSideEmpire.NEUTRAL))
}
/**
* Toggle whether the warp gate's faction-affiliated force interacts with this warp gate as "broadcast."
* Other "broadcast" associations are not affected.
* The gate must be active first.
* @param bcast `true`, if the faction-affiliated force interacts with this gate as broadcast;
* `false`, if not
* @return the set of all factions who interact with this warp gate as "broadcast"
*/
def Broadcast_=(bcast : Boolean) : Set[PlanetSideEmpire.Value] = {
if(Active) {
if(bcast) {
broadcast += Faction
}
else {
broadcast -= Faction
}
}
broadcast.toSet
}
/**
* Which factions interact with this warp gate as "broadcast?"
* @return the set of all factions who interact with this warp gate as "broadcast"
*/
def BroadcastFor : Set[PlanetSideEmpire.Value] = broadcast.toSet
/**
* Allow a faction to interact with a given warp gate as "broadcast" if it is active.
* @param bcast the faction
* @return the set of all factions who interact with this warp gate as "broadcast"
*/
def BroadcastFor_=(bcast : PlanetSideEmpire.Value) : Set[PlanetSideEmpire.Value] = {
(broadcast += bcast).toSet
}
/**
* Allow some factions to interact with a given warp gate as "broadcast" if it is active.
* @param bcast the factions
* @return the set of all factions who interact with this warp gate as "broadcast"
*/
def BroadcastFor_=(bcast : Set[PlanetSideEmpire.Value]) : Set[PlanetSideEmpire.Value] = {
(broadcast ++= bcast).toSet
}
/**
* Disallow a faction to interact with a given warp gate as "broadcast."
* @param bcast the faction
* @return the set of all factions who interact with this warp gate as "broadcast"
*/
def StopBroadcastFor_=(bcast : PlanetSideEmpire.Value) : Set[PlanetSideEmpire.Value] = {
(broadcast -= bcast).toSet
}
/**
* Disallow some factions to interact with a given warp gate as "broadcast."
* @param bcast the factions
* @return the set of all factions who interact with this warp gate as "broadcast"
*/
def StopBroadcastFor_=(bcast : Set[PlanetSideEmpire.Value]) : Set[PlanetSideEmpire.Value] = {
(broadcast --= bcast).toSet
}
def Owner : PlanetSideServerObject = this

View file

@ -6,28 +6,26 @@ import scodec.Codec
import scodec.codecs._
/**
* Promotes a warpgate's "broadcast" functionality.<br>
* Dispatched by the server to promote a warp gate's broadcast functionality.<br>
* <br>
* Change the map name of a warpgate into "Broadcast" when the proper state is set.
* If a proper warpgate is not designated, nothing happens.
* If not set, the map name of the warpgate will default to whatever is normally written on the map.
* The map designation of geowarps is not affected by this packet.<br>
* <br>
* Exploration:<br>
* I believe these `Boolean` values actually indicate some measure of warpgate operation.
* Geowarps, for example, though their appearance does not change, recieve this packet.
* Moreover, they can operate as a receiving-end broadcast gate.
* @param continent_id the zone
* @param building_id the warp gate (see `BuildingInfoUpdateMessage`)
* @param unk1 na
* @param unk2 na
* @param broadcast if true, the gate replaces its destination text with "Broadcast"
* Changes the map name of a warp gate into "Broadcast"
* and allow a given faction to access the gate's intercontinental transport functionality to/from that gate,
* even if the gate is not properly owned.
* If an actual warp gate is not designated, nothing happens.
* If not set, the map name of the warp gate will default to whatever is normally written on the map.
* The map designation of geowarps is not affected by this packet.
* @see `BuildingInfoUpdateMessage`
* @param zone_id the zone ordinal number
* @param building_id the warp gate map id
* @param tr players belonging to the Terran Republic interact with this warp gate as a "broadcast gate"
* @param nc players belonging to the New Conglomerate interact with this warp gate as a "broadcast gate"
* @param vs players belonging to the Vanu Sovereignty interact with this warp gate as a "broadcast gate"
*/
final case class BroadcastWarpgateUpdateMessage(continent_id : Int,
final case class BroadcastWarpgateUpdateMessage(zone_id : Int,
building_id : Int,
unk1 : Boolean,
unk2 : Boolean,
broadcast : Boolean)
tr : Boolean,
nc : Boolean,
vs : Boolean)
extends PlanetSideGamePacket {
type Packet = BroadcastWarpgateUpdateMessage
def opcode = GamePacketOpcode.BroadcastWarpgateUpdateMessage
@ -36,10 +34,10 @@ final case class BroadcastWarpgateUpdateMessage(continent_id : Int,
object BroadcastWarpgateUpdateMessage extends Marshallable[BroadcastWarpgateUpdateMessage] {
implicit val codec : Codec[BroadcastWarpgateUpdateMessage] = (
("continent_id" | uint16L) ::
("zone_id" | uint16L) ::
("building_id" | uint16L) ::
("unk1" | bool) ::
("unk2" | bool) ::
("broadcast" | bool)
("tr" | bool) ::
("nc" | bool) ::
("vs" | bool)
).as[BroadcastWarpgateUpdateMessage]
}