Skip to content

Commit

Permalink
Asset upload, minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nebriv committed Jun 20, 2020
1 parent e08c137 commit 090501e
Show file tree
Hide file tree
Showing 56 changed files with 818,270 additions and 27 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ StyleCopReport.xml
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
Expand Down
40 changes: 38 additions & 2 deletions TacViewDataLogger/actorProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Harmony;
using System;
using UnityEngine;

namespace TacViewDataLogger
Expand Down Expand Up @@ -196,7 +197,42 @@ public ACMIDataEntry missileDataEntry(Actor actor, ACMIDataEntry entry, float cu
float roll = VectorUtils.SignedAngle(Vector3.up, toDirection, Vector3.Cross(Vector3.up, forward));

entry.locData = $"{Math.Round(coords.y,7)} | {Math.Round(coords.x,7)} | {Math.Round(coords.z,7)} | {Math.Round(roll, 2)} | {Math.Round(pitch, 2)} | {Math.Round(headingNum, 2) - customOffset}";
entry._basicTypes = "Missile";

Missile missile = Traverse.Create(actor).Field("missile").GetValue() as Missile;

if (missile != null)
{
if (missile.guidanceMode == Missile.GuidanceModes.AntiRad)
{
entry._basicTypes = "Missile";
}
else if (missile.guidanceMode == Missile.GuidanceModes.Bomb)
{
entry._basicTypes = "Bomb";
}
else if (missile.guidanceMode == Missile.GuidanceModes.GPS)
{
entry._basicTypes = "Missile";
}
else if (missile.guidanceMode == Missile.GuidanceModes.Heat)
{
entry._basicTypes = "Missile";
}
else if (missile.guidanceMode == Missile.GuidanceModes.Optical)
{
entry._basicTypes = "Missile";
}
else if (missile.guidanceMode == Missile.GuidanceModes.Radar)
{
entry._basicTypes = "Missile";
}
else
{
entry._basicTypes = "Missile";
}
}


entry.name = actor.actorName;
entry.callSign = actor.actorName;
return entry;
Expand Down
46 changes: 24 additions & 22 deletions TacViewDataLogger/main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private void Start()

System.IO.Directory.CreateDirectory("TacViewDataLogs");

support.WriteLog("TacView Data Logger Loaded. Waiting for Scene Start!");
support.WriteLog($"TacView Data Logger {Globals.projectVersion} Loaded. Waiting for Scene Start!");

SceneManager.sceneLoaded += SceneLoaded;
SceneReloaded += ResetLogger;
Expand Down Expand Up @@ -148,7 +148,6 @@ private void SceneLoaded(Scene arg0, LoadSceneMode arg1)
}



if (runlogger)
{
if (arg0.buildIndex != 7 && arg0.buildIndex != 11)
Expand All @@ -158,6 +157,15 @@ private void SceneLoaded(Scene arg0, LoadSceneMode arg1)
}
}

[HarmonyPatch(typeof(VTMapManager), "RestartCurrentScenario")]
class Patch
{
static void Postfix(VTMapManager __instance)
{
if (TacViewDataLogger.SceneReloaded != null)
TacViewDataLogger.SceneReloaded.Invoke();
}
}

void manageSamplingRate()
{
Expand Down Expand Up @@ -371,6 +379,20 @@ private IEnumerator WaitForScenario()
getAirports();
}

}
public void ResetLogger()
{
runlogger = false;
writeStringTask();
elapsedSeconds = 0f;
nextActionTime = 0.0f;
period = 0.5f;
knownActors = new Dictionary<String, ACMIDataEntry>();

support.WriteLog("Scene end detected. Stopping TacView Recorder");

StartCoroutine(WaitForScenario());

}

public void objectiveBegin(MissionObjective obj)
Expand Down Expand Up @@ -497,21 +519,6 @@ public void writeStringTask()
}


public void ResetLogger()
{
runlogger = false;
writeStringTask();
elapsedSeconds = 0f;
nextActionTime = 0.0f;
period = 0.5f;
knownActors = new Dictionary<String, ACMIDataEntry>();

support.WriteLog("Scene end detected. Stopping TacView Recorder");

StartCoroutine(WaitForScenario());

}

public void TacViewDataLogACMI()
{
actors = TargetManager.instance.allActors;
Expand Down Expand Up @@ -644,10 +651,6 @@ public ACMIDataEntry buildFlareEntry(CMFlare flare)
return entry;
}





public ACMIDataEntry buildBulletEntry(Bullet bullet)
{
entry = new ACMIDataEntry();
Expand All @@ -662,7 +665,6 @@ public ACMIDataEntry buildBulletEntry(Bullet bullet)
return entry;
}


public ACMIDataEntry buildDataEntry(Actor actor)
{
entry = new ACMIDataEntry();
Expand Down
4 changes: 2 additions & 2 deletions TacViewDataLogger/tacviewAcmi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,8 @@ public string ACMIString(ACMIDataEntry oldEntry = null)

public string ACMIStringOld(ACMIDataEntry oldEntry = null)
{
// This is no longer used currently. The comparison function is too expensive due to the reflection/recursion to be called on every actor, on every scene.

string outputString = "";
if (oldEntry != null)
{
Expand All @@ -1448,8 +1450,6 @@ public string ACMIStringOld(ACMIDataEntry oldEntry = null)
outputString = $"{objectId}{data}";
}

outputString = "jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj";

}
else
{
Expand Down
Loading

0 comments on commit 090501e

Please sign in to comment.