Wire up generator state to lattice benefits, fix lattice benefits not updating properly when faction is changed via setFactionTo

This commit is contained in:
Mazo 2021-03-31 23:08:39 +01:00
parent 45b640e85e
commit 3a992c7dde
2 changed files with 11 additions and 9 deletions

View file

@ -197,8 +197,8 @@ class BuildingActor(
case AmenityStateChange(gen: Generator, data) => case AmenityStateChange(gen: Generator, data) =>
if (generatorStateChange(gen, data)) { if (generatorStateChange(gen, data)) {
//update the map // Request all buildings update their map data to refresh lattice linked benefits
galaxyService ! GalaxyServiceMessage(GalaxyAction.MapUpdate(building.infoUpdateMessage())) zone.actor ! ZoneActor.ZoneMapUpdate()
} }
Behaviors.same Behaviors.same
@ -361,7 +361,7 @@ class BuildingActor(
} }
building.Faction = faction building.Faction = faction
alignForceDomeStatus(mapUpdateOnChange = false) alignForceDomeStatus(mapUpdateOnChange = false)
galaxy ! GalaxyServiceMessage(GalaxyAction.MapUpdate(building.infoUpdateMessage())) zone.actor ! ZoneActor.ZoneMapUpdate() // Update entire lattice to show lattice benefits
zone.LocalEvents ! LocalServiceMessage(zone.id, LocalAction.SetEmpire(building.GUID, faction)) zone.LocalEvents ! LocalServiceMessage(zone.id, LocalAction.SetEmpire(building.GUID, faction))
} }
} }

View file

@ -209,9 +209,11 @@ class Building(
// Check this Building is on the lattice first // Check this Building is on the lattice first
zone.Lattice find this match { zone.Lattice find this match {
case Some(_) => case Some(_) =>
// todo: generator destruction state
val subGraph = Zone.Lattice filter ((b: Building) => val subGraph = Zone.Lattice filter ((b: Building) =>
b.Faction == this.Faction && !b.CaptureTerminalIsHacked && b.NtuLevel > 0 b.Faction == this.Faction
&& !b.CaptureTerminalIsHacked
&& b.NtuLevel > 0
&& (b.Generator.isEmpty || b.Generator.get.Condition != PlanetSideGeneratorState.Destroyed)
) )
var stackedBenefit = 0 var stackedBenefit = 0
@ -235,13 +237,13 @@ class Building(
hackingFaction, hackingFaction,
hackTime, hackTime,
if (ntuLevel > 0) Faction else PlanetSideEmpire.NEUTRAL, if (ntuLevel > 0) Faction else PlanetSideEmpire.NEUTRAL,
0, // Field != 0 will cause malformed packet 0, // unk1 Field != 0 will cause malformed packet
None, None, // unk1x
generatorState, generatorState,
spawnTubesNormal, spawnTubesNormal,
forceDomeActive, forceDomeActive,
latticeBenefit, if (generatorState != PlanetSideGeneratorState.Destroyed) latticeBenefit else 0,
48, // cavern benefit if (generatorState != PlanetSideGeneratorState.Destroyed) 48 else 0, // cavern benefit
Nil, // unk4, Nil, // unk4,
0, // unk5 0, // unk5
false, // unk6 false, // unk6