static bool Prefix(Window window) { if (Multiplayer.Client != null && window.GetType() == typeof(Dialog_BeginRitual) && // Doesn't let BeginRitualProxy through (Multiplayer.ExecutingCmds || Multiplayer.Ticking)) { var dialog = (Dialog_BeginRitual)window; dialog.PostOpen(); // Completes initialization var comp = dialog.map.MpComp(); if (comp.ritualSession != null && (comp.ritualSession.data.ritual != dialog.ritual || comp.ritualSession.data.outcome != dialog.outcome)) { Messages.Message("MpAnotherRitualInProgress".Translate(), MessageTypeDefOf.RejectInput, false); return(false); } if (comp.ritualSession == null) { var data = new RitualData { ritual = dialog.ritual, target = dialog.target, obligation = dialog.obligation, outcome = dialog.outcome, extraInfos = dialog.extraInfos, action = dialog.action, ritualLabel = dialog.ritualLabel, confirmText = dialog.confirmText, organizer = dialog.organizer, assignments = MpUtil.ShallowCopy(dialog.assignments, new MpRitualAssignments()) }; comp.CreateRitualSession(data); } if (TickPatch.currentExecutingCmdIssuedBySelf) { comp.ritualSession.OpenWindow(); } return(false); } return(true); }
static bool Prefix(ref Window window) { if (Multiplayer.Client == null || window is not Dialog_StylingStation dialog) { return(true); } // In vanilla, the styling dialog mutates the pawn directly // A dummy pawn taking on the mutations is needed for multiplayer var pawn = new StylingDialog_DummyPawn(); pawn.origPawn = dialog.pawn; pawn.def = dialog.pawn.def; pawn.gender = dialog.pawn.gender; pawn.mapIndexOrState = dialog.pawn.mapIndexOrState; pawn.Name = dialog.pawn.Name; pawn.story = MpUtil.ShallowCopy(dialog.pawn.story, new Pawn_StoryTracker(pawn)); pawn.story.pawn = pawn; pawn.style = MpUtil.ShallowCopy(dialog.pawn.style, new Pawn_StyleTracker(pawn)); pawn.style.pawn = pawn; pawn.apparel = MpUtil.ShallowCopy(dialog.pawn.apparel, new Pawn_ApparelTracker(pawn)); pawn.apparel.pawn = pawn; pawn.apparel.lockedApparel = pawn.apparel.lockedApparel.ToList(); pawn.apparel.wornApparel = MpUtil.ShallowCopy(dialog.pawn.apparel.wornApparel, new ThingOwner <Apparel>()); pawn.apparel.wornApparel.innerList = pawn.apparel.wornApparel.innerList.ToList(); pawn.health = new Pawn_HealthTracker(pawn); pawn.stances = new Pawn_StanceTracker(pawn); pawn.pather = new Pawn_PathFollower(pawn); pawn.roping = new Pawn_RopeTracker(pawn); pawn.mindState = new Pawn_MindState(pawn); window = new Dialog_StylingStation(pawn, dialog.stylingStation); return(Multiplayer.ExecutingCmds && TickPatch.currentExecutingCmdIssuedBySelf || dialog.pawn.CurJob.loadID == SyncMethods.stylingStationJobStartedByMe); }
public static Dialog_StylingStation CreateStylingDialog(Pawn dialogPawn, Thing stylingStation) { // In vanilla, the styling dialog mutates the pawn directly // A dummy pawn taking on the mutations is needed for multiplayer var pawn = new StylingDialog_DummyPawn { origPawn = dialogPawn, def = dialogPawn.def, gender = dialogPawn.gender, mapIndexOrState = dialogPawn.mapIndexOrState, nameInt = dialogPawn.Name }; pawn.story = MpUtil.ShallowCopy(dialogPawn.story, new Pawn_StoryTracker(pawn)); pawn.story.pawn = pawn; pawn.style = MpUtil.ShallowCopy(dialogPawn.style, new Pawn_StyleTracker(pawn)); pawn.style.pawn = pawn; pawn.apparel = MpUtil.ShallowCopy(dialogPawn.apparel, new Pawn_ApparelTracker(pawn)); pawn.apparel.pawn = pawn; pawn.apparel.lockedApparel = pawn.apparel.lockedApparel.ToList(); pawn.apparel.wornApparel = MpUtil.ShallowCopy(dialogPawn.apparel.wornApparel, new ThingOwner <Apparel>()); pawn.apparel.wornApparel.innerList = pawn.apparel.wornApparel.innerList.ToList(); pawn.health = new Pawn_HealthTracker(pawn); pawn.stances = new Pawn_StanceTracker(pawn); pawn.pather = new Pawn_PathFollower(pawn); pawn.roping = new Pawn_RopeTracker(pawn); pawn.mindState = new Pawn_MindState(pawn); pawn.ideo = new Pawn_IdeoTracker(pawn) { ideo = dialogPawn.ideo.ideo }; return(new Dialog_StylingStation(pawn, stylingStation)); }