public void Update()
{
// Don't do anything until it's time for the next log message.
DateTime now = DateTime.Now;
if (now < nextUpdate) return;
nextUpdate = now + UPDATE_INTERVAL;
// Do we have data available?
if (!FlightGlobals.ready || (FlightGlobals.ActiveVessel == null)) return;
// Find the VesselModule we want.
List<VesselModule> modules = FlightGlobals.ActiveVessel.vesselModules;
VesselModule data = null;
for (int i = 0; i < modules.Count; ++i)
{
if (API_MODULE_CLASS == modules[i].GetType().Name)
{
data = modules[i];
break;
}
}
if (data == null)
{
// No data is available. For example, this will happen if we're
// not in the flight scene, since BetterBurnTime only runs then.
return;
}
else
{
DoStuffWith(data);
}
}