mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-07-16 08:55:18 +00:00
local zone maintains information about weapon fire capability per faction
This commit is contained in:
parent
f74da61fa5
commit
75e3a879fb
2 changed files with 34 additions and 2 deletions
|
|
@ -2158,8 +2158,8 @@ class ZoningOperations(
|
|||
tplayer.avatar = avatar
|
||||
session = session.copy(player = tplayer)
|
||||
//LoadMapMessage causes the client to send BeginZoningMessage, eventually leading to SetCurrentAvatar
|
||||
val weaponsEnabled = !(mapName.equals("map11") || mapName.equals("map12") || mapName.equals("map13"))
|
||||
sendResponse(LoadMapMessage(mapName, id, 40100, 25, weaponsEnabled, map.checksum))
|
||||
//val weaponsEnabled = !(mapName.equals("map11") || mapName.equals("map12") || mapName.equals("map13"))
|
||||
sendResponse(LoadMapMessage(mapName, id, 40100, 25, zone.LiveFireAllowed(tplayer.Faction), map.checksum))
|
||||
if (isAcceptableNextSpawnPoint) {
|
||||
//important! the LoadMapMessage must be processed by the client before the avatar is created
|
||||
player.allowInteraction = true
|
||||
|
|
|
|||
|
|
@ -182,6 +182,12 @@ class Zone(val id: String, val map: ZoneMap, zoneNumber: Int) {
|
|||
*/
|
||||
private var vehicleEvents: ActorRef = Default.Actor
|
||||
|
||||
/**
|
||||
* Is any player permitted to engage in weapons discharge in this zone?
|
||||
*/
|
||||
private var liveFireAllowed: mutable.HashMap[PlanetSideEmpire.Value, Boolean] =
|
||||
mutable.HashMap.from(PlanetSideEmpire.values.map { f => (f, true) })
|
||||
|
||||
/**
|
||||
* When the zone has completed initializing, fulfill this promise.
|
||||
* @see `init(ActorContext)`
|
||||
|
|
@ -593,6 +599,32 @@ class Zone(val id: String, val map: ZoneMap, zoneNumber: Int) {
|
|||
vehicleEvents = bus
|
||||
VehicleEvents
|
||||
}
|
||||
|
||||
def LiveFireAllowed(): Boolean = liveFireAllowed.exists { case (_, v) => v }
|
||||
|
||||
def LiveFireAllowed(faction: PlanetSideEmpire.Value): Boolean = liveFireAllowed.getOrElse(faction, false)
|
||||
|
||||
def UpdateLiveFireAllowed(state: Boolean): List[(PlanetSideEmpire.Value, Boolean, Boolean)] = {
|
||||
val output = liveFireAllowed.map { case (f, v) =>
|
||||
(f, v == state, state)
|
||||
}
|
||||
output.foreach { case (f, _, v) =>
|
||||
liveFireAllowed.update(f, v)
|
||||
}
|
||||
output.toList
|
||||
}
|
||||
|
||||
def UpdateLiveFireAllowed(state: Boolean, faction: PlanetSideEmpire.Value): List[(PlanetSideEmpire.Value, Boolean, Boolean)] = {
|
||||
val output = liveFireAllowed.map { case (f, v) =>
|
||||
if (f == faction) {
|
||||
(f, v == state, state)
|
||||
} else {
|
||||
(f, false, v)
|
||||
}
|
||||
}
|
||||
liveFireAllowed.update(faction, state)
|
||||
output.toList
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue