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) =>
if (generatorStateChange(gen, data)) {
//update the map
galaxyService ! GalaxyServiceMessage(GalaxyAction.MapUpdate(building.infoUpdateMessage()))
// Request all buildings update their map data to refresh lattice linked benefits
zone.actor ! ZoneActor.ZoneMapUpdate()
}
Behaviors.same
@ -361,7 +361,7 @@ class BuildingActor(
}
building.Faction = faction
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))
}
}

View file

@ -209,9 +209,11 @@ class Building(
// Check this Building is on the lattice first
zone.Lattice find this match {
case Some(_) =>
// todo: generator destruction state
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
@ -235,13 +237,13 @@ class Building(
hackingFaction,
hackTime,
if (ntuLevel > 0) Faction else PlanetSideEmpire.NEUTRAL,
0, // Field != 0 will cause malformed packet
None,
0, // unk1 Field != 0 will cause malformed packet
None, // unk1x
generatorState,
spawnTubesNormal,
forceDomeActive,
latticeBenefit,
48, // cavern benefit
if (generatorState != PlanetSideGeneratorState.Destroyed) latticeBenefit else 0,
if (generatorState != PlanetSideGeneratorState.Destroyed) 48 else 0, // cavern benefit
Nil, // unk4,
0, // unk5
false, // unk6