Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Duration getting reset when wrapped inside Orbit #29

Merged
merged 1 commit into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/ContractConfigurator/Parameter/Duration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ protected override void OnUpdate()
}

// Additional check when under a VesselParameterGroup
VesselParameterGroup vpg = Parent as VesselParameterGroup;
VesselParameterGroup vpg = GetParameterGroupHost();
if (vpg != null && vpg.VesselList.Any())
{
completed &= ContractVesselTracker.Instance.GetAssociatedKeys(FlightGlobals.ActiveVessel).
Expand Down
2 changes: 1 addition & 1 deletion source/ContractConfigurator/Parameter/VesselParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ public virtual bool IsIgnoredVesselType(VesselType vesselType)
protected Vessel CurrentVessel()
{
VesselParameterGroup vpg = GetParameterGroupHost();
return vpg == null ? null : vpg.TrackedVessel;
return vpg?.TrackedVessel;
}

protected VesselParameterGroup GetParameterGroupHost()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,11 @@ protected override void OnParameterLoad(ConfigNode node)
protected override void OnUpdate()
{
base.OnUpdate();
if (UnityEngine.Time.fixedTime - lastUpdate > UPDATE_FREQUENCY)
if (Time.fixedTime - lastUpdate > UPDATE_FREQUENCY)
{
lastUpdate = UnityEngine.Time.fixedTime;
CheckVessel(FlightGlobals.ActiveVessel);
Vessel trackedVessel = CurrentVessel() ?? FlightGlobals.ActiveVessel;
CheckVessel(trackedVessel);
}
}

Expand Down
Loading