Update PawnGizmoPatch to add a gizmo button to all spawned pawns instead of just colonists. Modify Window_AIImage to handle selection of any spawned pawn, enhancing functionality and usability across the AIImages mod.
All checks were successful
SonarQube Analysis / Build and analyze (push) Successful in 1m38s
All checks were successful
SonarQube Analysis / Build and analyze (push) Successful in 1m38s
This commit is contained in:
Binary file not shown.
@@ -10,7 +10,7 @@ using Verse;
|
|||||||
namespace AIImages
|
namespace AIImages
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Harmony patch to add a gizmo (button) to all colonist pawns
|
/// Harmony patch to add a gizmo (button) to all pawns
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HarmonyPatch(typeof(Pawn), "GetGizmos")]
|
[HarmonyPatch(typeof(Pawn), "GetGizmos")]
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage(
|
[System.Diagnostics.CodeAnalysis.SuppressMessage(
|
||||||
@@ -34,12 +34,8 @@ namespace AIImages
|
|||||||
yield return gizmo;
|
yield return gizmo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only add button to colonist pawns that are spawned
|
// Add button to all spawned pawns (not just colonists)
|
||||||
if (
|
if (__instance.Spawned)
|
||||||
__instance.IsColonist
|
|
||||||
&& __instance.Spawned
|
|
||||||
&& __instance.Faction == Faction.OfPlayer
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
yield return new Command_Action
|
yield return new Command_Action
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -272,11 +272,9 @@ namespace AIImages
|
|||||||
base.WindowUpdate();
|
base.WindowUpdate();
|
||||||
|
|
||||||
// Проверяем, изменилась ли выбранная пешка
|
// Проверяем, изменилась ли выбранная пешка
|
||||||
Pawn selectedPawn = Find.Selector.SelectedPawns.FirstOrDefault(p =>
|
Pawn selectedPawn = Find.Selector.SelectedPawns.FirstOrDefault(p => p.Spawned);
|
||||||
p.IsColonist && p.Spawned && p.Faction == Faction.OfPlayer
|
|
||||||
);
|
|
||||||
|
|
||||||
// Если выбрана новая колонистская пешка, обновляем окно
|
// Если выбрана новая пешка, обновляем окно
|
||||||
if (selectedPawn != null && selectedPawn != pawn)
|
if (selectedPawn != null && selectedPawn != pawn)
|
||||||
{
|
{
|
||||||
UpdatePawn(selectedPawn);
|
UpdatePawn(selectedPawn);
|
||||||
|
|||||||
Reference in New Issue
Block a user