示例#1
0
 public void Add(MultiTarget type, string path)
 {
     foreach (var multiType in type)
     {
         Add(multiType.First, multiType.Second + "/" + path);
     }
 }
示例#2
0
 public static SyncField[] FieldMultiTarget(MultiTarget targetType, string fieldName)
 {
     return(targetType.Select(type => Field(type.First, type.Second, fieldName)).ToArray());
 }
示例#3
0
 public static SyncMethod[] MethodMultiTarget(MultiTarget targetType, string methodName, SyncType[] argTypes = null)
 {
     return(targetType.Select(type => Method(type.First, type.Second, methodName, argTypes)).ToArray());
 }
        public static void Init()
        {
            SyncMedCare                   = Sync.Field(typeof(Pawn), "playerSettings", "medCare");
            SyncSelfTend                  = Sync.Field(typeof(Pawn), "playerSettings", "selfTend");
            SyncHostilityResponse         = Sync.Field(typeof(Pawn), "playerSettings", "hostilityResponse");
            SyncFollowDrafted             = Sync.Field(typeof(Pawn), "playerSettings", "followDrafted");
            SyncFollowFieldwork           = Sync.Field(typeof(Pawn), "playerSettings", "followFieldwork");
            SyncInteractionMode           = Sync.Field(typeof(Pawn), "guest", "interactionMode");
            SyncSlaveInteractionMode      = Sync.Field(typeof(Pawn), nameof(Pawn.guest), nameof(Pawn_GuestTracker.slaveInteractionMode));
            SyncIdeoForConversion         = Sync.Field(typeof(Pawn), nameof(Pawn.guest), nameof(Pawn_GuestTracker.ideoForConversion));
            SyncBeCarried                 = Sync.Field(typeof(Pawn), "health", "beCarriedByCaravanIfSick");
            SyncPsychicEntropyLimit       = Sync.Field(typeof(Pawn), "psychicEntropy", "limitEntropyAmount");
            SyncPsychicEntropyTargetFocus = Sync.Field(typeof(Pawn), "psychicEntropy", "targetPsyfocus").SetBufferChanges();

            SyncUseWorkPriorities = Sync.Field(null, "Verse.Current/Game/playSettings", "useWorkPriorities").PostApply(UseWorkPriorities_PostApply);
            SyncAutoHomeArea      = Sync.Field(null, "Verse.Current/Game/playSettings", "autoHomeArea");
            SyncAutoRebuild       = Sync.Field(null, "Verse.Current/Game/playSettings", "autoRebuild");

            SyncDefaultCare = Sync.Fields(
                null,
                "Verse.Current/Game/playSettings",
                nameof(PlaySettings.defaultCareForColonyHumanlike),
                nameof(PlaySettings.defaultCareForColonyPrisoner),
                nameof(PlaySettings.defaultCareForColonySlave),
                nameof(PlaySettings.defaultCareForColonyAnimal),
                nameof(PlaySettings.defaultCareForNeutralAnimal),
                nameof(PlaySettings.defaultCareForNeutralFaction),
                nameof(PlaySettings.defaultCareForHostileFaction)
                ).SetBufferChanges();

            SyncQuestDismissed          = Sync.Field(typeof(Quest), nameof(Quest.dismissed));
            SyncFactionAcceptRoyalFavor = Sync.Field(typeof(Faction), nameof(Faction.allowRoyalFavorRewards));
            SyncFactionAcceptGoodwill   = Sync.Field(typeof(Faction), nameof(Faction.allowGoodwillRewards));

            var thingFilterTarget = new MultiTarget()
            {
                { SyncThingFilters.ThingFilterTarget, "Filter" }
            };

            SyncThingFilterHitPoints = Sync.FieldMultiTarget(thingFilterTarget, "AllowedHitPointsPercents").SetBufferChanges();
            SyncThingFilterQuality   = Sync.FieldMultiTarget(thingFilterTarget, "AllowedQualityLevels").SetBufferChanges();

            SyncBillSuspended          = Sync.Field(typeof(Bill), "suspended");
            SyncIngredientSearchRadius = Sync.Field(typeof(Bill), "ingredientSearchRadius").SetBufferChanges();
            SyncBillSkillRange         = Sync.Field(typeof(Bill), "allowedSkillRange").SetBufferChanges();

            SyncBillIncludeZone         = Sync.Field(typeof(Bill_Production), "includeFromZone");
            SyncBillIncludeHpRange      = Sync.Field(typeof(Bill_Production), "hpRange").SetBufferChanges();
            SyncBillIncludeQualityRange = Sync.Field(typeof(Bill_Production), "qualityRange").SetBufferChanges();
            SyncBillPawnRestriction     = Sync.Field(typeof(Bill), "pawnRestriction");

            SyncZoneLabel = Sync.Field(typeof(Zone), "label");

            SyncBillProduction = Sync.Fields(
                typeof(Bill_Production),
                null,
                "repeatMode",
                "repeatCount",
                "targetCount",
                "pauseWhenSatisfied",
                "unpauseWhenYouHave"
                );

            SyncBillIncludeCriteria = Sync.Fields(
                typeof(Bill_Production),
                null,
                "includeEquipped",
                "includeTainted",
                "limitToAllowedStuff"
                );

            SyncDrugPolicyEntry = Sync.Fields(
                typeof(DrugPolicy),
                "entriesInt/[]",
                "allowedForAddiction",
                "allowedForJoy",
                "allowScheduled",
                "takeToInventory"
                );

            SyncDrugPolicyEntryBuffered = Sync.Fields(
                typeof(DrugPolicy),
                "entriesInt/[]",
                "daysFrequency",
                "onlyIfMoodBelow",
                "onlyIfJoyBelow"
                ).SetBufferChanges();

            // This depends on the order of AutoSlaughterManager.configs being the same on all clients
            // The array is initialized using DefDatabase<ThingDef>.AllDefs which shouldn't cause problems though
            SyncAutoSlaughter = Sync.Fields(
                typeof(AutoSlaughterManager),
                "configs/[]",
                "maxTotal",
                "maxMales",
                "maxMalesYoung",
                "maxFemales",
                "maxFemalesYoung",
                "allowSlaughterPregnant"
                ).PostApply(Autoslaughter_PostApply);

            SyncTradeableCount = Sync.Field(typeof(MpTransferableReference), "CountToTransfer").SetBufferChanges().PostApply(TransferableCount_PostApply);

            // 1
            SyncBillPaused = Sync.Field(typeof(Bill_Production), nameof(Bill_Production.paused)).SetBufferChanges().SetVersion(1);

            // 2
            SyncOutfitLabel          = Sync.Field(typeof(Outfit), "label").SetBufferChanges().SetVersion(2);
            SyncDrugPolicyLabel      = Sync.Field(typeof(DrugPolicy), "label").SetBufferChanges().SetVersion(2);
            SyncFoodRestrictionLabel = Sync.Field(typeof(FoodRestriction), "label").SetBufferChanges().SetVersion(2);

            SyncStorytellerDef           = Sync.Field(typeof(Storyteller), "def").SetHostOnly().PostApply(StorytellerDef_Post).SetVersion(2);
            SyncStorytellerDifficultyDef = Sync.Field(typeof(Storyteller), "difficultyDef").SetHostOnly().PostApply(StorytellerDifficultyDef_Post).SetVersion(2);
            SyncStorytellerDifficulty    = Sync.Field(typeof(Storyteller), "difficulty").ExposeValue().SetHostOnly().PostApply(StorytellerDifficulty_Post).SetVersion(2);

            SyncDryadCaste = Sync.Field(typeof(CompTreeConnection), nameof(CompTreeConnection.desiredMode));
            SyncDesiredTreeConnectionStrength = Sync.Field(typeof(CompTreeConnection), nameof(CompTreeConnection.desiredConnectionStrength));

            SyncAnimalPenAutocut = Sync.Field(typeof(CompAnimalPenMarker), nameof(CompAnimalPenMarker.autoCut));

            SyncNeuralSuperchargerMode = Sync.Field(typeof(CompNeuralSupercharger), nameof(CompNeuralSupercharger.autoUseMode));
        }