Skip to content

Commit

Permalink
Updates for vtol vr 1.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
nebriv committed Jan 24, 2022
1 parent fb99008 commit 5a974a1
Show file tree
Hide file tree
Showing 6 changed files with 23,959 additions and 40 deletions.
2 changes: 1 addition & 1 deletion TacViewDataLogger/TacViewDataLogger.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<OutputPath>bin\Builds\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<WarningLevel>3</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="actorProcessor.cs" />
Expand Down
44 changes: 26 additions & 18 deletions TacViewDataLogger/actorProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,35 @@ public class actorProcessor

public ACMIDataEntry airVehicleDataEntry(Actor actor, ACMIDataEntry entry, bool isRed, float customOffset = 0f)
{
Vector3D coords = support.convertPositionToLatLong_raw(actor.transform.position);
entry.locData = $"{Math.Round(coords.y, 7)} | {Math.Round(coords.x, 7)} | {Math.Round(coords.z, 7)} | {Math.Round(actor.flightInfo.roll, 2)} | {Math.Round(actor.flightInfo.pitch, 2)} | {Math.Round(actor.flightInfo.heading, 2) - customOffset}";
entry._basicTypes = "FixedWing";
entry.callSign = support.GetObjectCallsign(actor, isRed);
entry.name = actor.actorName;
if (actor.currentlyTargetingActor != null)
{
entry.lockedTarget = support.GetObjectID(actor.currentlyTargetingActor);
}
if (actor != null) {
Vector3D coords = support.convertPositionToLatLong_raw(actor.transform.position);
entry.locData = $"{Math.Round(coords.y, 7)} | {Math.Round(coords.x, 7)} | {Math.Round(coords.z, 7)} | {Math.Round(actor.flightInfo.roll, 2)} | {Math.Round(actor.flightInfo.pitch, 2)} | {Math.Round(actor.flightInfo.heading, 2) - customOffset}";
entry._basicTypes = "FixedWing";
entry.callSign = support.GetObjectCallsign(actor, isRed);
entry.name = actor.actorName;
if (actor.currentlyTargetingActor != null)
{
entry.lockedTarget = support.GetObjectID(actor.currentlyTargetingActor);
}

entry.aoa = Math.Round(actor.flightInfo.aoa, 2).ToString();
entry.tas = Math.Round(actor.flightInfo.airspeed, 2).ToString();
entry.ias = AerodynamicsController.fetch.IndicatedAirspeed(actor.flightInfo.airspeed, actor.flightInfo.rb.position).ToString();
entry.altitude = Math.Round(actor.flightInfo.altitudeASL, 2).ToString();
entry.agl = Math.Round(actor.flightInfo.radarAltitude).ToString();
entry.aoa = Math.Round(actor.flightInfo.aoa, 2).ToString();
entry.tas = Math.Round(actor.flightInfo.airspeed, 2).ToString();
entry.ias = AerodynamicsController.fetch.IndicatedAirspeed(actor.flightInfo.airspeed, actor.flightInfo.rb.position).ToString();
entry.altitude = Math.Round(actor.flightInfo.altitudeASL, 2).ToString();
entry.agl = Math.Round(actor.flightInfo.radarAltitude).ToString();

//entry.afterburner = DataGetters.getAfterburners(actor.gameObject);
//entry.radarMode = DataGetters.getRadarState(actor.gameObject);
//entry.fuelWeight = DataGetters.getFuelMass(actor.gameObject);
//entry.afterburner = DataGetters.getAfterburners(actor.gameObject);
//entry.radarMode = DataGetters.getRadarState(actor.gameObject);
//entry.fuelWeight = DataGetters.getFuelMass(actor.gameObject);

return entry;

} else
{
support.WriteErrorLog("Actor is null.");
throw new Exception("Actor is null.");
}

return entry;
}

public ACMIDataEntry playerVehicleDataEntry(Actor actor, ACMIDataEntry entry, bool isRed, float customOffset = 0f)
Expand Down
48 changes: 27 additions & 21 deletions TacViewDataLogger/main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static class Globals

public static string projectName = "VTOL VR Tacview Data Logger";
public static string projectAuthor = "Nebriv,TytanRock";
public static string projectVersion = "v2.5";
public static string projectVersion = "v2.6";

}

Expand Down Expand Up @@ -574,30 +574,34 @@ public void TacViewDataLogACMI()

foreach (var actor in actors)
{
if (actor != null) {
acmiString = "";
support.UpdateID(actor);

acmiString = "";
support.UpdateID(actor);

newEntry = buildDataEntry(actor);
newEntry = buildDataEntry(actor);

// If this is already a tracked actor
if (knownActors.ContainsKey(support.GetObjectID(actor)))
{
oldEntry = knownActors[support.GetObjectID(actor)];
// If this is already a tracked actor
if (knownActors.ContainsKey(support.GetObjectID(actor)))
{
oldEntry = knownActors[support.GetObjectID(actor)];

// Diff the old entry and the new entry. Update the old entry with the new entry.
//acmiString = newEntry.ACMIString();
acmiString = newEntry.ACMIString(oldEntry);
knownActors[support.GetObjectID(actor)] = newEntry;
}
else
{
acmiString = newEntry.ACMIString();
knownActors.Add(support.GetObjectID(actor), newEntry);
}
if ((acmiString != "") && (acmiString.Contains(",")))
// Diff the old entry and the new entry. Update the old entry with the new entry.
//acmiString = newEntry.ACMIString();
acmiString = newEntry.ACMIString(oldEntry);
knownActors[support.GetObjectID(actor)] = newEntry;
}
else
{
acmiString = newEntry.ACMIString();
knownActors.Add(support.GetObjectID(actor), newEntry);
}
if ((acmiString != "") && (acmiString.Contains(",")))
{
dataLog.Append("\n" + acmiString);
}
} else
{
dataLog.Append("\n" + acmiString);
//support.WriteLog("Error - Got a null actor!");
}
}

Expand Down Expand Up @@ -798,6 +802,7 @@ public ACMIDataEntry buildRocketEntry(Rocket rocket, float customOffset = 0f)

public ACMIDataEntry buildDataEntry(Actor actor)
{

entry = new ACMIDataEntry();
entry.objectId = support.GetObjectID(actor);

Expand Down Expand Up @@ -855,6 +860,7 @@ public ACMIDataEntry buildDataEntry(Actor actor)
}

return entry;

}


Expand Down
Loading

0 comments on commit 5a974a1

Please sign in to comment.