mirror of
https://github.com/rmroc451/TweaksAndThings.git
synced 2025-12-16 17:29:37 -06:00
Compare commits
2 Commits
v1.2.1_Exp
...
v1.2.3_Exp
| Author | SHA1 | Date | |
|---|---|---|---|
| 7552422b6e | |||
| 58dc7efac0 |
@@ -2,6 +2,6 @@
|
||||
<PropertyGroup>
|
||||
<MajorVersion>1</MajorVersion>
|
||||
<MinorVersion>2</MinorVersion>
|
||||
<PatchVersion>1</PatchVersion>
|
||||
<PatchVersion>3</PatchVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -4,13 +4,17 @@
|
||||
"name": "RMROC451's Tweaks and Things",
|
||||
"version": "$(AssemblyVersion)",
|
||||
"requires": [
|
||||
{
|
||||
"id": "railroader",
|
||||
"notBefore": "2024.6"
|
||||
},
|
||||
{
|
||||
"id": "railloader",
|
||||
"notBefore": "1.9.6.8"
|
||||
"notBefore": "1.9.6.14"
|
||||
},
|
||||
{
|
||||
"id": "Zamu.StrangeCustoms",
|
||||
"notBefore": "1.10.24358.413"
|
||||
"notBefore": "1.10.25017.313"
|
||||
}
|
||||
],
|
||||
"assemblies": [ "RMROC451.TweaksAndThings" ],
|
||||
|
||||
@@ -109,8 +109,7 @@ public static class Car_Extensions
|
||||
{
|
||||
Vector3 position = car.GetMotionSnapshot().Position;
|
||||
Vector3 center = WorldTransformer.WorldToGame(position);
|
||||
Rect rect = new Rect(new Vector2(center.x - 30f, center.z - 30f), Vector2.one * 30f * 2f);
|
||||
var cars = tc.CarIdsInRect(rect);
|
||||
var cars = tc.CarIdsInRadius(center, 60f);
|
||||
Log.Information($"{nameof(HuntingForCabeeseNearCar)} => {cars.Count()}");
|
||||
List<(string carId, float distance)> source =
|
||||
cars
|
||||
|
||||
@@ -22,20 +22,20 @@ internal class CarPickable_HandleShowContextMenu_Patch
|
||||
|
||||
bool buttonsHaveCost = tweaksAndThings.EndGearHelpersRequirePayment();
|
||||
ContextMenu shared = ContextMenu.Shared;
|
||||
shared.AddButton(ContextMenuQuadrant.Unused2, $"{(car.EnumerateCoupled().Any(c => c.HandbrakeApplied()) ? "Release " : "Set ")} Consist", SpriteName.Handbrake, delegate
|
||||
shared.AddButton(ContextMenuQuadrant.Unused1, $"{(car.EnumerateCoupled().Any(c => c.HandbrakeApplied()) ? "Release " : "Set ")} Consist", SpriteName.Handbrake, delegate
|
||||
{
|
||||
CarInspector_PopulateCarPanel_Patch.MrocConsistHelper(car, MrocHelperType.Handbrake, buttonsHaveCost);
|
||||
});
|
||||
|
||||
if (car.EnumerateCoupled().Any(c => c.EndAirSystemIssue()))
|
||||
{
|
||||
shared.AddButton(ContextMenuQuadrant.Unused2, $"Air Up Consist", SpriteName.Select, delegate
|
||||
shared.AddButton(ContextMenuQuadrant.Unused1, $"Air Up Consist", SpriteName.Select, delegate
|
||||
{
|
||||
CarInspector_PopulateCarPanel_Patch.MrocConsistHelper(car, MrocHelperType.GladhandAndAnglecock, buttonsHaveCost);
|
||||
});
|
||||
}
|
||||
|
||||
if (car.EnumerateCoupled().Any(c => c.SupportsBleed()))
|
||||
if (!car.EnumerateCoupled().Any(c => !c.SupportsBleed()))
|
||||
{
|
||||
shared.AddButton(ContextMenuQuadrant.Unused2, $"Bleed Consist", SpriteName.Bleed, delegate
|
||||
{
|
||||
@@ -47,7 +47,7 @@ internal class CarPickable_HandleShowContextMenu_Patch
|
||||
{
|
||||
CameraSelector.shared.FollowCar(car);
|
||||
});
|
||||
|
||||
shared.radius = 200f;
|
||||
shared.BuildItemAngles();
|
||||
shared.StartCoroutine(shared.AnimateButtonsShown());
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ internal class CarPrototypeLibrary_LoadForId_Patch
|
||||
[HarmonyPatchCategory("RMROC451TweaksAndThings")]
|
||||
internal class OpsController_AnnounceCoalescedPayments_Patch
|
||||
{
|
||||
static Dictionary<string, (bool spotted, bool filling)> CrewCarDict = [];
|
||||
static Dictionary<string, (bool spotted, bool filling)> CrewCarDict = new();
|
||||
|
||||
public static (bool spotted, bool filling) CrewCarStatus(Car car)
|
||||
{
|
||||
bool found = CrewCarDict.TryGetValue(car.id, out (bool spotted, bool filling) val);
|
||||
@@ -61,12 +62,13 @@ internal class OpsController_AnnounceCoalescedPayments_Patch
|
||||
}
|
||||
|
||||
static GameDateTime dateTime = TimeWeather.Now;
|
||||
static readonly IEnumerable<Type> refillLocations = [
|
||||
static readonly IEnumerable<Type> refillLocations =
|
||||
new List<Type>() {
|
||||
typeof(PassengerStop),
|
||||
typeof(SimplePassengerStop),
|
||||
typeof(TeamTrack),
|
||||
typeof(RepairTrack)
|
||||
];
|
||||
};
|
||||
|
||||
public static Load CrewHoursLoad()
|
||||
{
|
||||
@@ -116,7 +118,7 @@ internal class OpsController_AnnounceCoalescedPayments_Patch
|
||||
//Log.Information($"{nameof(OpsController_AnnounceCoalescedPayments_Patch)} => Caboose Helper => PassengerStops => {string.Join(",", passengerStops)}");
|
||||
|
||||
var cabeese = passengerStops
|
||||
.SelectMany(t => t.TrackSpans?.Select(s => (tc.CarsOnSpan(s) ?? []).Where(c => c.IsCaboose()))?.SelectMany(c => c?.Select(c2 => (t, c2))));
|
||||
.SelectMany(t => t.TrackSpans?.Select(s => (tc.CarsOnSpan(s) ?? Enumerable.Empty<Car>()).Where(c => c.IsCaboose()))?.SelectMany(c => c?.Select(c2 => (t, c2))));
|
||||
//Log.Information($"{nameof(OpsController_AnnounceCoalescedPayments_Patch)} => Caboose Helper => PassengerStops Cabeese => {string.Join(",", cabeese?.Select(c => $"{c.t} : {c.c2}") ?? [])}");
|
||||
|
||||
CrewCarDict = CrewCarDict.Where(kvp => cabeese.Select(c => c.c2.id).Contains(kvp.Key)).ToDictionary(k => k.Key, v => v.Value);
|
||||
|
||||
@@ -34,7 +34,7 @@ internal class TagController_UpdateTag_Patch
|
||||
private static void ProceedWithPostFix(Car car, TagCallout tagCallout)
|
||||
{
|
||||
tagCallout.callout.Title = string.Format(tagTitleFormat, "{0}", car.DisplayName);
|
||||
List<string> tags = [];
|
||||
List<string> tags = new();
|
||||
|
||||
if (OpsController_AnnounceCoalescedPayments_Patch.CrewCarStatus(car).spotted) tags.Add("+");
|
||||
if (car.HasHotbox) tags.Add(TextSprites.Hotbox);
|
||||
|
||||
20
TweaksAndThings/Patches/WedgeImage_OnPopulateMesh.cs
Normal file
20
TweaksAndThings/Patches/WedgeImage_OnPopulateMesh.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using HarmonyLib;
|
||||
using Railloader;
|
||||
using UI.ContextMenu;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace RMROC451.TweaksAndThings.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(WedgeImage))]
|
||||
[HarmonyPatch(nameof(WedgeImage.OnPopulateMesh), typeof(VertexHelper))]
|
||||
[HarmonyPatchCategory("RMROC451TweaksAndThings")]
|
||||
internal class WedgeImage_OnPopulateMesh_Patch
|
||||
{
|
||||
private static void Postfix(VertexHelper vh)
|
||||
{
|
||||
TweaksAndThingsPlugin tweaksAndThings = SingletonPluginBase<TweaksAndThingsPlugin>.Shared;
|
||||
if (!tweaksAndThings.IsEnabled) return;
|
||||
|
||||
vh.Clear(); //clear the image backgrounds for now.
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user