diff --git a/1.4/Assemblies/CrossPromotion.dll b/1.4/Assemblies/CrossPromotion.dll index 781d8fc..4ee4da4 100644 Binary files a/1.4/Assemblies/CrossPromotion.dll and b/1.4/Assemblies/CrossPromotion.dll differ diff --git a/1.5/Assemblies/CrossPromotion.dll b/1.5/Assemblies/CrossPromotion.dll new file mode 100644 index 0000000..86b1db1 Binary files /dev/null and b/1.5/Assemblies/CrossPromotion.dll differ diff --git a/1.5/Assemblies/ReverseCommands.dll b/1.5/Assemblies/ReverseCommands.dll new file mode 100644 index 0000000..f0f0afd Binary files /dev/null and b/1.5/Assemblies/ReverseCommands.dll differ diff --git a/About/About.xml b/About/About.xml index c67706c..cd72640 100644 --- a/About/About.xml +++ b/About/About.xml @@ -1,24 +1,27 @@ - + - Reverse Commands - Andreas Pardeike - -
  • 1.0
  • -
  • 1.1
  • -
  • 1.2
  • -
  • 1.3
  • -
  • 1.4
  • -
    - -
  • - brrainz.harmony - Harmony - steam://url/CommunityFilePage/2009463077 - https://github.com/pardeike/HarmonyRimWorld/releases/latest -
  • -
    - brrainz.reversecommands - Reverses the context menu so you can select something to interact with, followed by an action and the colonist that should execute that action. No need to select colonists first and much less scrolling through the map. + Reverse Commands + Andreas Pardeike + +
  • 1.0
  • +
  • 1.1
  • +
  • 1.2
  • +
  • 1.3
  • +
  • 1.4
  • +
  • 1.5
  • +
    + +
  • + brrainz.harmony + Harmony + steam://url/CommunityFilePage/2009463077 + https://github.com/pardeike/HarmonyRimWorld/releases/latest +
  • +
    + brrainz.reversecommands + 2.3.1.0 + 858744731 + Reverses the context menu so you can select something to interact with, followed by an action and the colonist that should execute that action. No need to select colonists first and much less scrolling through the map. Powered by Harmony Patch Library @@ -26,4 +29,4 @@ Andreas Pardeike Email: andreas@pardeike.net Steam: pardeike Twitter: @pardeike -
    + \ No newline at end of file diff --git a/About/Manifest.xml b/About/Manifest.xml index 429aae9..e9e709d 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,13 +1,14 @@  net.pardeike.rimworld.mod.reversecommands - 2.3.0.0 + 2.3.1.0
  • 1.0.0
  • 1.1.0
  • 1.2.0
  • 1.3.0
  • 1.4.0
  • +
  • 1.5.0
  • diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..78ddc1b --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,11 @@ + + + + Reverse Commands + ReverseCommands + https://github.com/pardeike/ReverseCommands + 2.3.1.0 + {7B65D4DA-B570-401B-A0C3-EECCDC285677} + + + diff --git a/LoadFolders.xml b/LoadFolders.xml index 9931509..29b34a7 100644 --- a/LoadFolders.xml +++ b/LoadFolders.xml @@ -11,4 +11,8 @@
  • /
  • 1.4
  • + +
  • /
  • +
  • 1.5
  • +
    \ No newline at end of file diff --git a/Source/FloatMenuColonists.cs b/Source/FloatMenuColonists.cs index 93c5ca8..f2cee86 100644 --- a/Source/FloatMenuColonists.cs +++ b/Source/FloatMenuColonists.cs @@ -38,15 +38,9 @@ public override void PostClose() } } - public class FloatMenuOptionPawn : FloatMenuOption + public class FloatMenuOptionPawn(Pawn pawn, Action action, MenuOptionPriority priority, Action mouseOverAction) : FloatMenuOption("", action, priority, mouseOverAction, null, 0, null, null) { - public Pawn pawn; - - public FloatMenuOptionPawn(Pawn pawn, Action action, MenuOptionPriority priority, Action mouseOverAction) - : base("", action, priority, mouseOverAction, null, 0, null, null) - { - this.pawn = pawn; - } + public Pawn pawn = pawn; public override bool DoGUI(Rect rect, bool colonistOrdering, FloatMenu floatMenu) { diff --git a/Source/FloatMenuLabels.cs b/Source/FloatMenuLabels.cs index 4b192b6..b0be45e 100644 --- a/Source/FloatMenuLabels.cs +++ b/Source/FloatMenuLabels.cs @@ -15,11 +15,8 @@ public FloatMenuLabels(List options) : base(options, null, fals } } - public class FloatMenuOptionNoClose : FloatMenuOption + public class FloatMenuOptionNoClose(string label, Action action) : FloatMenuOption(label, action, MenuOptionPriority.Default, null, null, 0, null, null) { - public FloatMenuOptionNoClose(string label, Action action) - : base(label, action, MenuOptionPriority.Default, null, null, 0, null, null) { } - public override bool DoGUI(Rect rect, bool colonistOrdering, FloatMenu floatMenu) { _ = base.DoGUI(rect, colonistOrdering, floatMenu); diff --git a/Source/Main.cs b/Source/Main.cs index 7a8303d..203518a 100644 --- a/Source/Main.cs +++ b/Source/Main.cs @@ -48,7 +48,7 @@ public static void Prefix() if (PathInfo.current != null) { var path = PathInfo.GetPath(PathInfo.current); - if (path != null) path.DrawPath(null); + path?.DrawPath(null); } PathInfo.current = null; } @@ -59,10 +59,13 @@ class MainTabsRoot_HandleLowPriorityShortcuts_Patch { public static bool Prefix() { - if (WorldRendererUtility.WorldRenderedNow) return true; - if (Event.current.type != EventType.MouseDown) return true; + if (WorldRendererUtility.WorldRenderedNow) + return true; + if (Event.current.type != EventType.MouseDown) + return true; Tools.CloseLabelMenu(true); - if (Event.current.button != 1) return true; + if (Event.current.button != 1) + return true; return !Tools.GetPawnActions().Any(); } } @@ -72,16 +75,20 @@ class Selector_HandleMapClicks_Patch { public static bool Prefix() { - if (WorldRendererUtility.WorldRenderedNow) return true; + if (WorldRendererUtility.WorldRenderedNow) + return true; if (Event.current.isKey && Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape) Tools.CloseLabelMenu(true); - if (Event.current.type != EventType.MouseDown) return true; - if (Event.current.button != 1) return true; + if (Event.current.type != EventType.MouseDown) + return true; + if (Event.current.button != 1) + return true; var labeledPawnActions = Tools.GetPawnActions(); - if (!labeledPawnActions.Any()) return true; + if (!labeledPawnActions.Any()) + return true; var cell = UI.MouseCell(); Find.CurrentMap.mapPawns.FreeColonists.Where(Tools.PawnUsable).Do(pawn => PathInfo.AddInfo(pawn, cell)); diff --git a/Source/PathInfo.cs b/Source/PathInfo.cs index e0806d9..58ba4a4 100644 --- a/Source/PathInfo.cs +++ b/Source/PathInfo.cs @@ -8,14 +8,14 @@ namespace ReverseCommands { - public class PathInfo + public class PathInfo(Pawn pawn, IntVec3 cell) { public static Pawn current; - static readonly Dictionary storage = new Dictionary(); + static readonly Dictionary storage = []; public static List GetPawns() { - return storage.Keys.ToList(); + return [.. storage.Keys]; } public static void AddInfo(Pawn pawn, IntVec3 cell) @@ -26,15 +26,18 @@ public static void AddInfo(Pawn pawn, IntVec3 cell) public static PawnPath GetPath(Pawn pawn) { var val = storage.GetValueSafe(pawn); - if (val == null) return null; + if (val == null) + return null; return val.GetPath(); } public static string GetJobReport(Pawn pawn) { - if (pawn == null) return ""; + if (pawn == null) + return ""; var val = storage.GetValueSafe(pawn); - if (val == null) return ""; + if (val == null) + return ""; return val.GetJobReport(); } @@ -47,34 +50,25 @@ public static void Clear() if (info != null) { var path = info.path; - if (path != null) path.ReleaseToPool(); + path?.ReleaseToPool(); } }); storage.Clear(); } - public Pawn pawn; - public IntVec3 cell; + public Pawn pawn = pawn; + public IntVec3 cell = cell; public PawnPath path; public IntVec3 lastPawnLocation = IntVec3.Invalid; - //public string jobDescription; - //public Job lastJob; - - public PathInfo(Pawn pawn, IntVec3 cell) - { - this.pawn = pawn; - this.cell = cell; - } - public PawnPath GetPath() { var pos = pawn.Position; if (lastPawnLocation != pos) { var traverseParams = TraverseParms.For(pawn, Danger.Deadly, TraverseMode.PassDoors, false); - if (path != null) path.ReleaseToPool(); + path?.ReleaseToPool(); path = pawn.Map.pathFinder.FindPath(pawn.Position, cell, traverseParams, PathEndMode.Touch); lastPawnLocation = pos; } @@ -85,9 +79,11 @@ public string GetJobReport() { var m = Math.Floor(GetPath(pawn).TotalCost * 60f / GenDate.TicksPerHour); var mins = ""; - if (m > 0) mins = ", [" + m + " min]"; + if (m > 0) + mins = ", [" + m + " min]"; var job = pawn.jobs.curJob != null ? (", " + pawn.jobs.curDriver.GetReport()) : ""; - if (job.EndsWith(".", StringComparison.Ordinal)) job = job.Substring(0, job.Length - 1); + if (job.EndsWith(".", StringComparison.Ordinal)) + job = job.Substring(0, job.Length - 1); return pawn.Name.ToStringShort + job + mins; } } diff --git a/Source/ReverseCommands.csproj b/Source/ReverseCommands.csproj index f830bc7..8e38590 100644 --- a/Source/ReverseCommands.csproj +++ b/Source/ReverseCommands.csproj @@ -1,17 +1,25 @@  - {7B65D4DA-B570-401B-A0C3-EECCDC285677} - ReverseCommands - ReverseCommands + $(ModFileName) + $(ModFileName) net472 - 8.0 + latest x64 - ..\1.4\Assemblies\ + ..\1.5\Assemblies\ true false - 2.3.0.0 + $(ModVersion) + $(ModVersion) + $(ModVersion) + $(ModVersion) + $(ModVersion) + Brrainz + Andreas Pardeike Copyright Andreas Pardeike + $(Repository) + $(Repository) + $(ModName) @@ -30,10 +38,16 @@ - - - - + + %(Filename)%(Extension) + + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -67,24 +81,37 @@ - - - echo Postprocessing - where ModBuilder 2> nul | find /i "ModBuilder.exe" - if not errorlevel 1 ( - ModBuilder AssemblyVersion -file "$(MSBuildProjectDirectory)\$(OutputPath)$(AssemblyName).dll" -save "$(MSBuildProjectName)-version" - ModBuilder XMLPut -file "$(MSBuildProjectDirectory)\..\About\Manifest.xml" -xpath /Manifest/version -value "{{$(MSBuildProjectName)-version}}" - ) - if defined INSTALL_MOD ( - "%INSTALL_MOD%" "$(Configuration)" "$(MSBuildProjectDirectory)\..\" "$(MSBuildProjectName)" "1.2 1.3 1.4 About Assemblies" "LoadFolders.xml" - ) - - Brrainz - Andreas Pardeike - - https://github.com/pardeike/ReverseCommands - https://github.com/pardeike/ReverseCommands - Reverse Commands - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + \ No newline at end of file diff --git a/Source/Tools.cs b/Source/Tools.cs index b92106c..dc4f001 100644 --- a/Source/Tools.cs +++ b/Source/Tools.cs @@ -12,7 +12,7 @@ public static class Tools public static FloatMenuLabels labelMenu; public static FloatMenuColonists actionMenu; - public static Dictionary PawnInfo = new Dictionary(); + public static Dictionary PawnInfo = []; public static void CloseLabelMenu(bool sound) { @@ -43,7 +43,7 @@ public static Dictionary> GetPawnActio var dict = result.GetValueSafe(option.Label); if (dict == null) { - dict = new Dictionary(); + dict = []; result[option.Label] = dict; } dict[pawn] = option;