Fix zipline path data being entirely missing

This commit is contained in:
Mazo 2020-11-30 22:30:13 +00:00
parent babd455753
commit bf240295da
8 changed files with 39924 additions and 3 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@ package net.psforever.objects.serverobject.zipline
import net.psforever.types.Vector3
class ZipLinePath(
case class ZipLinePath(
private val pathId: Integer,
private val isTeleporter: Boolean,
private val zipLinePoints: List[Vector3]

View file

@ -35,6 +35,7 @@ import net.psforever.objects.serverobject.structures.{
}
import net.psforever.objects.serverobject.tube.SpawnTube
import net.psforever.objects.serverobject.turret.{FacilityTurret, FacilityTurretDefinition}
import net.psforever.objects.serverobject.zipline.ZipLinePath
import net.psforever.objects.zones.{MapInfo, Zone, ZoneInfo, ZoneMap}
import net.psforever.types.{PlanetSideEmpire, Vector3}
import net.psforever.util.DefinitionUtil
@ -78,6 +79,18 @@ object Zones {
"IsChildObject"
)(ZoneMapEntity.apply)
private implicit val decodeVector3 : Decoder[Vector3] = Decoder.forProduct3(
"X",
"Y",
"Z"
)(Vector3.apply)
private implicit val decodeZipLinePath: Decoder[ZipLinePath] = Decoder.forProduct3(
"PathId",
"IsTeleporter",
"PathPoints"
)(ZipLinePath.apply)
// monolith, hst, warpgate are ignored for now as the scala code isn't ready to handle them.
// BFR terminals/doors are ignored as top level elements as sanctuaries have them with no associated building. (repair_silo also has this problem, but currently is ignored in the AmenityExtrator project)
// Force domes have GUIDs but are currently classed as separate entities. The dome is controlled by sending GOAM 44 / 48 / 52 to the building GUID
@ -191,15 +204,27 @@ object Zones {
} catch {
case _: FileNotFoundException => Seq()
}
(info, data)
val zplData =
try {
val res = Source.fromResource(s"zonemaps/zpl_${info.value}.json")
val json = res.mkString
res.close()
decode[Seq[ZipLinePath]](json).toOption.get
} catch {
case _: FileNotFoundException => Seq()
}
(info, data, zplData)
}
.map {
case (info, data) =>
case (info, data, zplData) =>
val zoneMap = new ZoneMap(info.value)
zoneMap.checksum = info.checksum
zoneMap.scale = info.scale
zoneMap.zipLinePaths = zplData.toList
// This keeps track of the last used turret weapon guid, as they seem to be arbitrarily assigned at 5000+
val turretWeaponGuid = new AtomicInteger(5000)