private static void ProcessObject(List <PlanetSideObject> identifiableObjects, MapObject entry, ref int id, int?mapId, bool isTopLevel = false) { if (!_objectsWithGuids.Contains(entry.ObjectType)) { return; } Console.WriteLine($"Processing {entry.ObjectType}"); // Load the relevant *.lst files for this object var(peHiddens, peEdits, pseRelativeObjects) = LSTReader.ReadLSTFile(_planetsideModReadyFolder, entry.ObjectType, entry.LstType); // Get the root mesh for this object var uberData = _ubrData.First(x => x.Value.Entries.Select(y => y.Name).Contains(entry.ObjectType, StringComparer.OrdinalIgnoreCase)); var objectRotationDegrees = MathFunctions.PS1RotationToDegrees(entry.HorizontalRotation); var objectRotationRadians = MathFunctions.DegreesToRadians(objectRotationDegrees); var entryObject = new PlanetSideObject { Id = id, ObjectName = entry.ObjectName, ObjectType = entry.ObjectType, AbsX = entry.HorizontalPosition, AbsY = entry.VerticalPosition, AbsZ = entry.HeightPosition, YawDegrees = objectRotationDegrees, MapID = mapId, IsChildObject = !isTopLevel }; identifiableObjects.Add(entryObject); id++; var parentRotationClockwise = MathFunctions.CounterClockwiseToClockwiseRotation(entry.HorizontalRotation); // Get the sub-entities from the UBR file that would have a GUID within this object var baseMesh = UBRReader.GetMeshSystem(entry.ObjectType, uberData.Value); foreach (var meshItem in baseMesh.PortalSystem.MeshItems) { // If it's not an entity that would be assigned a GUID we don't care about it and should skip it if (!_objectsWithGuids.Contains(meshItem.AssetName, StringComparer.OrdinalIgnoreCase)) { continue; } // If a line is in the pe_hidden list it should be removed from the game world e.g. Neti pad_landing is removed where the BFR building now exists if (peHiddens.Any(x => x.InstanceName == meshItem.InstanceName)) { continue; } var(rotX, rotY) = MathFunctions.RotateXY(meshItem.Transform[12], meshItem.Transform[13], objectRotationRadians); var meshItemYaw = MathFunctions.TransformToRotationDegrees(meshItem.Transform); // Convert from CCW to CW and apply 180 degree offset var yaw = parentRotationClockwise + (360 - (180 - meshItemYaw)); identifiableObjects.Add(new PlanetSideObject { Id = id, ObjectName = meshItem.AssetName, ObjectType = meshItem.AssetName, Owner = entryObject.Id, AbsX = entry.HorizontalPosition + rotX, AbsY = entry.VerticalPosition + rotY, AbsZ = entry.HeightPosition + meshItem.Transform[14], YawDegrees = MathFunctions.NormalizeDegrees((int)yaw), IsChildObject = true }); id++; } ProcessLSTPeEdits(peEdits, identifiableObjects, objectRotationRadians, baseX: entry.HorizontalPosition, baseY: entry.VerticalPosition, baseZ: entry.HeightPosition, ownerId: entryObject.Id, id: ref id); ProcessLSTPseRelativeObjects(pseRelativeObjects, identifiableObjects, ownerObject: entryObject, id: ref id); }