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:
@@ -10,7 +10,7 @@ using Verse;
|
||||
namespace AIImages
|
||||
{
|
||||
/// <summary>
|
||||
/// Harmony patch to add a gizmo (button) to all colonist pawns
|
||||
/// Harmony patch to add a gizmo (button) to all pawns
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(Pawn), "GetGizmos")]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage(
|
||||
@@ -34,12 +34,8 @@ namespace AIImages
|
||||
yield return gizmo;
|
||||
}
|
||||
|
||||
// Only add button to colonist pawns that are spawned
|
||||
if (
|
||||
__instance.IsColonist
|
||||
&& __instance.Spawned
|
||||
&& __instance.Faction == Faction.OfPlayer
|
||||
)
|
||||
// Add button to all spawned pawns (not just colonists)
|
||||
if (__instance.Spawned)
|
||||
{
|
||||
yield return new Command_Action
|
||||
{
|
||||
|
||||
@@ -272,11 +272,9 @@ namespace AIImages
|
||||
base.WindowUpdate();
|
||||
|
||||
// Проверяем, изменилась ли выбранная пешка
|
||||
Pawn selectedPawn = Find.Selector.SelectedPawns.FirstOrDefault(p =>
|
||||
p.IsColonist && p.Spawned && p.Faction == Faction.OfPlayer
|
||||
);
|
||||
Pawn selectedPawn = Find.Selector.SelectedPawns.FirstOrDefault(p => p.Spawned);
|
||||
|
||||
// Если выбрана новая колонистская пешка, обновляем окно
|
||||
// Если выбрана новая пешка, обновляем окно
|
||||
if (selectedPawn != null && selectedPawn != pawn)
|
||||
{
|
||||
UpdatePawn(selectedPawn);
|
||||
|
||||
Reference in New Issue
Block a user