Skip to content

Commit

Permalink
Synced dev mode add/remove power in Vanilla Factions Expanded - Ancie…
Browse files Browse the repository at this point in the history
…nts (#420)
  • Loading branch information
SokyranTheDragon authored Jan 25, 2024
1 parent 4b8040b commit 5738cfa
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Source/Mods/VanillaFactionsAncients.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ public VanillaFactionsAncients(ModContentPack mod)
var type = AccessTools.TypeByName("VFEAncients.Operation");
operationPodField = AccessTools.FieldRefAccess<ThingComp>(type, "Pod");

// Dev add/remove power from pawn (edit mode)
type = AccessTools.TypeByName("VFEAncients.ITab_Pawn_Powers");
MP.RegisterSyncDelegateLambda(type, "DoEmptyRect", 2)
.SetContext(SyncContext.MapSelected).SetDebugOnly();
MP.RegisterSyncDelegateLambda(type, "DoPowerIcon", 0)
.SetContext(SyncContext.MapSelected).SetDebugOnly();

LongEventHandler.ExecuteWhenFinished(LatePatch);
}

Expand Down Expand Up @@ -89,6 +96,12 @@ private static void SyncDialogChoosePower(SyncWorker sync, ref Window window)
window = Find.WindowStack.windows.FirstOrDefault(x => x.GetType() == choosePowerDialogType);
}

// Only needed in cases object needs to be created (shouldConstruct), but we don't care about any data inside of it
[MpCompatSyncWorker("VFEAncients.ITab_Pawn_Powers", shouldConstruct = true)]
private static void NoSync(SyncWorker sync, ref object obj)
{
}

#endregion

#region Dialog
Expand Down Expand Up @@ -135,7 +148,7 @@ private static IEnumerable<CodeInstruction> ReplaceButtons(IEnumerable<CodeInstr

yield return ci;
}

if (!anythingPatched) Log.Warning("Failed to sync choose power for Vanilla Factions Ancients");
}

Expand Down

0 comments on commit 5738cfa

Please sign in to comment.