mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-01-20 02:24:45 +00:00
hotspots can also be for neutral flair (#1033)
This commit is contained in:
parent
0b8ff5a4ce
commit
abdbb19af1
|
|
@ -2,7 +2,6 @@
|
||||||
package net.psforever.objects.zones
|
package net.psforever.objects.zones
|
||||||
|
|
||||||
import net.psforever.types.{PlanetSideEmpire, Vector3}
|
import net.psforever.types.{PlanetSideEmpire, Vector3}
|
||||||
|
|
||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -15,9 +14,10 @@ import scala.concurrent.duration._
|
||||||
*/
|
*/
|
||||||
class HotSpotInfo(val DisplayLocation: Vector3) {
|
class HotSpotInfo(val DisplayLocation: Vector3) {
|
||||||
private val activity: Map[PlanetSideEmpire.Value, ActivityReport] = Map(
|
private val activity: Map[PlanetSideEmpire.Value, ActivityReport] = Map(
|
||||||
PlanetSideEmpire.TR -> new ActivityReport(),
|
PlanetSideEmpire.TR -> new ActivityReport(),
|
||||||
PlanetSideEmpire.NC -> new ActivityReport(),
|
PlanetSideEmpire.NC -> new ActivityReport(),
|
||||||
PlanetSideEmpire.VS -> new ActivityReport()
|
PlanetSideEmpire.VS -> new ActivityReport(),
|
||||||
|
PlanetSideEmpire.NEUTRAL -> new ActivityReport()
|
||||||
)
|
)
|
||||||
|
|
||||||
def Activity: Map[PlanetSideEmpire.Value, ActivityReport] = activity
|
def Activity: Map[PlanetSideEmpire.Value, ActivityReport] = activity
|
||||||
|
|
@ -125,7 +125,7 @@ class ActivityReport {
|
||||||
* @return the current report
|
* @return the current report
|
||||||
*/
|
*/
|
||||||
def Report(): ActivityReport = {
|
def Report(): ActivityReport = {
|
||||||
RaiseHeat(1)
|
RaiseHeat(addHeat = 1)
|
||||||
Renew
|
Renew
|
||||||
this
|
this
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import akka.actor.{Actor, ActorRef, Cancellable, Props}
|
||||||
import net.psforever.objects.Default
|
import net.psforever.objects.Default
|
||||||
import net.psforever.types.{PlanetSideEmpire, Vector3}
|
import net.psforever.types.{PlanetSideEmpire, Vector3}
|
||||||
import net.psforever.services.ServiceManager
|
import net.psforever.services.ServiceManager
|
||||||
|
|
||||||
import scala.collection.mutable.ListBuffer
|
import scala.collection.mutable.ListBuffer
|
||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
|
|
||||||
|
|
@ -74,6 +73,15 @@ class ZoneHotSpotProjector(zone: Zone, hotspots: ListBuffer[HotSpotInfo], blanki
|
||||||
|
|
||||||
private[this] val log = org.log4s.getLogger(s"${zone.id.capitalize}HotSpotProjector")
|
private[this] val log = org.log4s.getLogger(s"${zone.id.capitalize}HotSpotProjector")
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether or not the debug command should actually add messages to the log at a debug level.
|
||||||
|
* @see `org.log4s.Debug`
|
||||||
|
* @param msg message to be appended
|
||||||
|
*/
|
||||||
|
private def trace(msg: String): Unit = {
|
||||||
|
//log.trace(msg)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actions that occur before this `Actor` is formally started.
|
* Actions that occur before this `Actor` is formally started.
|
||||||
* Request a hook for the `GalaxyService`.
|
* Request a hook for the `GalaxyService`.
|
||||||
|
|
@ -152,14 +160,14 @@ class ZoneHotSpotProjector(zone: Zone, hotspots: ListBuffer[HotSpotInfo], blanki
|
||||||
blanking = context.system.scheduler.scheduleOnce(blankingDelay, self, ZoneHotSpotProjector.BlankingPhase())
|
blanking = context.system.scheduler.scheduleOnce(blankingDelay, self, ZoneHotSpotProjector.BlankingPhase())
|
||||||
|
|
||||||
case Zone.HotSpot.Conflict(defender, attacker, location) =>
|
case Zone.HotSpot.Conflict(defender, attacker, location) =>
|
||||||
log.trace(s"received information about activity in ${zone.id}@$location")
|
trace(s"received information about activity in ${zone.id}@$location")
|
||||||
val defenderFaction = defender.Faction
|
val defenderFaction = defender.Faction
|
||||||
val attackerFaction = attacker.Faction
|
val attackerFaction = attacker.Faction
|
||||||
val noPriorHotSpots = hotspots.isEmpty
|
val noPriorHotSpots = hotspots.isEmpty
|
||||||
val duration = zone.HotSpotTimeFunction(defender, attacker)
|
val duration = zone.HotSpotTimeFunction(defender, attacker)
|
||||||
if (duration.toNanos > 0) {
|
if (duration.toNanos > 0) {
|
||||||
val hotspot = TryHotSpot(zone.HotSpotCoordinateFunction(location))
|
val hotspot = TryHotSpot(zone.HotSpotCoordinateFunction(location))
|
||||||
log.trace(
|
trace(
|
||||||
s"updating activity status for ${zone.id} hotspot x=${hotspot.DisplayLocation.x} y=${hotspot.DisplayLocation.y}"
|
s"updating activity status for ${zone.id} hotspot x=${hotspot.DisplayLocation.x} y=${hotspot.DisplayLocation.y}"
|
||||||
)
|
)
|
||||||
val noPriorActivity = !(hotspot.ActivityBy(defenderFaction) && hotspot.ActivityBy(attackerFaction))
|
val noPriorActivity = !(hotspot.ActivityBy(defenderFaction) && hotspot.ActivityBy(attackerFaction))
|
||||||
|
|
@ -178,7 +186,7 @@ class ZoneHotSpotProjector(zone: Zone, hotspots: ListBuffer[HotSpotInfo], blanki
|
||||||
}
|
}
|
||||||
|
|
||||||
case Zone.HotSpot.UpdateNow =>
|
case Zone.HotSpot.UpdateNow =>
|
||||||
log.trace(s"asked to update for zone ${zone.id} without a blanking period or new activity")
|
trace(s"asked to update for zone ${zone.id} without a blanking period or new activity")
|
||||||
UpdateHotSpots(PlanetSideEmpire.values, hotspots)
|
UpdateHotSpots(PlanetSideEmpire.values, hotspots)
|
||||||
|
|
||||||
case ZoneHotSpotProjector.BlankingPhase() | Zone.HotSpot.Cleanup() =>
|
case ZoneHotSpotProjector.BlankingPhase() | Zone.HotSpot.Cleanup() =>
|
||||||
|
|
@ -203,7 +211,7 @@ class ZoneHotSpotProjector(zone: Zone, hotspots: ListBuffer[HotSpotInfo], blanki
|
||||||
})
|
})
|
||||||
val newSize = spots.size
|
val newSize = spots.size
|
||||||
val changesOnMap = hotspots.size - newSize
|
val changesOnMap = hotspots.size - newSize
|
||||||
log.trace(s"blanking out $changesOnMap hotspots from zone ${zone.id}; $newSize remain active")
|
trace(s"blanking out $changesOnMap hotspots from zone ${zone.id}; $newSize remain active")
|
||||||
hotspots.clear()
|
hotspots.clear()
|
||||||
hotspots.insertAll(0, spots)
|
hotspots.insertAll(0, spots)
|
||||||
//other hotspots still need to be blanked later
|
//other hotspots still need to be blanked later
|
||||||
|
|
@ -218,7 +226,7 @@ class ZoneHotSpotProjector(zone: Zone, hotspots: ListBuffer[HotSpotInfo], blanki
|
||||||
}
|
}
|
||||||
|
|
||||||
case Zone.HotSpot.ClearAll() =>
|
case Zone.HotSpot.ClearAll() =>
|
||||||
log.trace(s"blanking out all hotspots from zone ${zone.id} immediately")
|
trace(s"blanking out all hotspots from zone ${zone.id} immediately")
|
||||||
blanking.cancel()
|
blanking.cancel()
|
||||||
hotspots.clear()
|
hotspots.clear()
|
||||||
UpdateHotSpots(PlanetSideEmpire.values, Nil)
|
UpdateHotSpots(PlanetSideEmpire.values, Nil)
|
||||||
|
|
@ -259,7 +267,7 @@ class ZoneHotSpotProjector(zone: Zone, hotspots: ListBuffer[HotSpotInfo], blanki
|
||||||
report.Duration = 0L
|
report.Duration = 0L
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.trace(s"new duration remapping function provided; reloading ${hotspots.size} hotspots for one blanking phase")
|
trace(s"new duration remapping function provided; reloading ${hotspots.size} hotspots for one blanking phase")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -277,7 +285,7 @@ class ZoneHotSpotProjector(zone: Zone, hotspots: ListBuffer[HotSpotInfo], blanki
|
||||||
}
|
}
|
||||||
newSpot
|
newSpot
|
||||||
}
|
}
|
||||||
log.trace(s"new coordinate remapping function provided; updating $redoneSpots.size hotspots")
|
trace(s"new coordinate remapping function provided; updating $redoneSpots.size hotspots")
|
||||||
hotspots.clear()
|
hotspots.clear()
|
||||||
hotspots.insertAll(0, redoneSpots)
|
hotspots.insertAll(0, redoneSpots)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue