adjusted condition and weather

This commit is contained in:
ScrawnyRonnie 2025-07-22 12:28:54 -04:00 committed by Fate-JH
parent 32287149c7
commit 30ff8d738f
3 changed files with 44 additions and 6 deletions

View file

@ -514,11 +514,11 @@ game {
# will be dispatched to all players. Players of the owning faction will receive a chat warning (if in
# the same zone) and the map will flash the alert level over the facility until it changes
# Wiki says 25-30
yellow = 1
yellow = 20
# Wiki says 30-60
orange = 2
orange = 30
# Wiki says 60+
red = 3
red = 60
}
}

View file

@ -20,7 +20,7 @@ import net.psforever.objects.serverobject.turret.auto.AutomatedTurret
import net.psforever.objects.sourcing.{PlayerSource, SourceEntry, VehicleSource}
import net.psforever.objects.vital.{InGameHistory, IncarnationActivity, ReconstructionActivity, SpawningActivity}
import net.psforever.objects.zones.blockmap.BlockMapEntity
import net.psforever.packet.game.{CampaignStatistic, ChangeFireStateMessage_Start, HackState7, MailMessage, ObjectDetectedMessage, SessionStatistic, TriggeredSound}
import net.psforever.packet.game.{CampaignStatistic, ChangeFireStateMessage_Start, HackState7, MailMessage, ObjectDetectedMessage, SessionStatistic, TriggeredSound, WeatherMessage, CloudInfo, StormInfo}
import net.psforever.services.chat.DefaultChannel
import scala.concurrent.duration._
@ -2531,6 +2531,19 @@ class ZoningOperations(
sessionLogic.general.toggleTeleportSystem(obj, TelepadLike.AppraiseTeleportationSystem(obj, continent))
}
}
//make weather happen
sendResponse(WeatherMessage(List(),List(
StormInfo(Vector3(0.1f, 0.15f, 0.0f), 240, 217),
StormInfo(Vector3(0.5f, 0.11f, 0.0f), 240, 215),
StormInfo(Vector3(0.15f, 0.4f, 0.0f), 249, 215),
StormInfo(Vector3(0.15f, 0.87f, 0.0f), 240, 215),
StormInfo(Vector3(0.3f, 0.65f, 0.0f), 240, 215),
StormInfo(Vector3(0.5f, 0.475f, 0.0f), 245, 215),
StormInfo(Vector3(0.725f, 0.38f, 0.0f), 243, 215),
StormInfo(Vector3(0.9f, 0.57f, 0.0f), 244, 215),
StormInfo(Vector3(0.9f, 0.9f, 0.0f), 243, 215),
StormInfo(Vector3(0.1f, 0.2f, 0.0f), 241, 215),
StormInfo(Vector3(0.95f, 0.2f, 0.0f), 241, 215))))
//begin looking for conditions to set the avatar
context.system.scheduler.scheduleOnce(delay = 250 millisecond, context.self, SessionActor.SetCurrentAvatar(player, 200))
}
@ -2641,6 +2654,19 @@ class ZoningOperations(
log.debug(s"AvatarRejoin: ${player.Name} - $guid -> $data")
}
setupAvatarFunc = AvatarCreate
//make weather happen
sendResponse(WeatherMessage(List(),List(
StormInfo(Vector3(0.1f, 0.15f, 0.0f), 240, 217),
StormInfo(Vector3(0.5f, 0.11f, 0.0f), 240, 215),
StormInfo(Vector3(0.15f, 0.4f, 0.0f), 249, 215),
StormInfo(Vector3(0.15f, 0.87f, 0.0f), 240, 215),
StormInfo(Vector3(0.3f, 0.65f, 0.0f), 240, 215),
StormInfo(Vector3(0.5f, 0.475f, 0.0f), 245, 215),
StormInfo(Vector3(0.725f, 0.38f, 0.0f), 243, 215),
StormInfo(Vector3(0.9f, 0.57f, 0.0f), 244, 215),
StormInfo(Vector3(0.9f, 0.9f, 0.0f), 243, 215),
StormInfo(Vector3(0.1f, 0.2f, 0.0f), 241, 215),
StormInfo(Vector3(0.95f, 0.2f, 0.0f), 241, 215))))
//begin looking for conditions to set the avatar
context.system.scheduler.scheduleOnce(delay = 750 millisecond, context.self, SessionActor.SetCurrentAvatar(player, 200))
}

View file

@ -28,6 +28,7 @@ final case class MajorFacilityHackParticipation(building: Building) extends Faci
private var hotSpotLayersOverTime: Seq[List[HotSpotInfo]] = Seq[List[HotSpotInfo]]()
var lastEnemyCount: List[Player] = List.empty
var alertTimeMillis: Long = 0L
def TryUpdate(): Unit = {
val list = building.PlayersInSOI
@ -44,10 +45,21 @@ final case class MajorFacilityHackParticipation(building: Building) extends Faci
building.Zone.blockMap.sector(building).corpseList
.filter(p => Vector3.DistanceSquared(building.Position.xy, p.Position.xy) < building.Definition.SOIRadius * building.Definition.SOIRadius)
//alert defenders (actually goes to all clients) of population change for base alerts
if (Math.abs(enemies.length - lastEnemyCount.length) >= 1) {
//straight away if higher alert, delay if pop decreases enough to lower alert
if ((enemies.length >= Config.app.game.alert.yellow && lastEnemyCount.length < Config.app.game.alert.yellow) ||
(enemies.length >= Config.app.game.alert.orange && lastEnemyCount.length < Config.app.game.alert.orange) ||
(enemies.length >= Config.app.game.alert.red && lastEnemyCount.length < Config.app.game.alert.red) ||
(enemies.length < Config.app.game.alert.yellow && lastEnemyCount.length >= Config.app.game.alert.yellow &&
now - alertTimeMillis > 30000L && Math.abs(enemies.length - lastEnemyCount.length) >= 3) ||
(enemies.length < Config.app.game.alert.orange && lastEnemyCount.length >= Config.app.game.alert.orange &&
now - alertTimeMillis > 30000L && Math.abs(enemies.length - lastEnemyCount.length) >= 3) ||
(enemies.length < Config.app.game.alert.red && lastEnemyCount.length >= Config.app.game.alert.red &&
now - alertTimeMillis > 30000L && Math.abs(enemies.length - lastEnemyCount.length) >= 3))
{
building.Actor ! BuildingActor.DensityLevelUpdate(building)
alertTimeMillis = now
lastEnemyCount = enemies
}
lastEnemyCount = enemies
building.CaptureTerminal
.map(_.HackedBy)
.collect {