Exemple #1
0
        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);
        }
Exemple #2
0
        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));
        }