mirror of
https://github.com/rmroc451/TweaksAndThings.git
synced 2025-12-16 17:29:37 -06:00
Patch inspector button recalc based on consist brake || air system changes
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<PropertyGroup Condition="'$(AssemblyVersion)' == '' OR '$(MajorVersion)' != '' OR '$(MinorVersion)' != ''">
|
||||
<MajorVersion Condition="'$(MajorVersion)' == ''">0</MajorVersion>
|
||||
<MinorVersion Condition="'$(MinorVersion)' == ''">1</MinorVersion>
|
||||
<PatchVersion Condition="'$(PatchVersion)' == ''">0</PatchVersion>
|
||||
<PatchVersion Condition="'$(PatchVersion)' == ''">1</PatchVersion>
|
||||
<AssemblyVersion>$(MajorVersion).$(MinorVersion).$(PatchVersion)</AssemblyVersion>
|
||||
<FileVersion>$(AssemblyVersion)</FileVersion>
|
||||
<ProductVersion>$(AssemblyVersion)</ProductVersion>
|
||||
|
||||
@@ -46,17 +46,24 @@ public class CarInspector_PopulateCarPanel_Patch
|
||||
|
||||
builder.HStack(delegate (UIPanelBuilder hstack)
|
||||
{
|
||||
hstack.AddButtonCompact("Handbrakes", delegate
|
||||
var consist = __instance._car.EnumerateCoupled(LogicalEnd.A);
|
||||
|
||||
var buttonName = $"{(consist.Any(c => c.HandbrakeApplied()) ? "Release " : "Set ")} {TextSprites.HandbrakeWheel}";
|
||||
hstack.AddButtonCompact(buttonName, delegate
|
||||
{
|
||||
MrocConsistHelper(__instance._car, MrocHelperType.Handbrake);
|
||||
}).Tooltip("Release Consist Handbrakes", "Iterates over each car in this consist and releases handbrakes.");
|
||||
if (StateManager.IsHost || true)
|
||||
hstack.Rebuild();
|
||||
}).Tooltip(buttonName, $"Iterates over cars in this consist and {(consist.Any(c => c.HandbrakeApplied()) ? "releases" : "sets")} {TextSprites.HandbrakeWheel}.");
|
||||
|
||||
if (consist.Any(c => c.EndAirSystemIssue()))
|
||||
{
|
||||
hstack.AddButtonCompact("Air Lines", delegate
|
||||
hstack.AddButtonCompact("Connect Air Lines", delegate
|
||||
{
|
||||
MrocConsistHelper(__instance._car, MrocHelperType.GladhandAndAnglecock);
|
||||
hstack.Rebuild();
|
||||
}).Tooltip("Connect Consist Air Lines", "Iterates over each car in this consist and connects gladhands and opens anglecocks.");
|
||||
}
|
||||
hstack.RebuildOnInterval(1f);
|
||||
});
|
||||
|
||||
return true;
|
||||
@@ -70,7 +77,14 @@ public class CarInspector_PopulateCarPanel_Patch
|
||||
switch (mrocHelperType)
|
||||
{
|
||||
case MrocHelperType.Handbrake:
|
||||
consist.Do(c => c.SetHandbrake(false));
|
||||
if (consist.Any(c => c.HandbrakeApplied()))
|
||||
{
|
||||
consist.Do(c => c.SetHandbrake(false));
|
||||
} else
|
||||
{
|
||||
TrainController tc = UnityEngine.Object.FindObjectOfType<TrainController>();
|
||||
tc.ApplyHandbrakesAsNeeded(consist.ToList(), PlaceTrainHandbrakes.Automatic);
|
||||
}
|
||||
break;
|
||||
|
||||
case MrocHelperType.GladhandAndAnglecock:
|
||||
|
||||
Reference in New Issue
Block a user