Example #1
0
        public override void ExposeData()
        {
            base.ExposeData();

            // settings, references first!
            Scribe_References.LookReference(ref TameArea, "TameArea");
            Scribe_Collections.LookList(ref RestrictArea, "AreaRestrictions", LookMode.Reference);
            Scribe_Deep.LookDeep(ref Trigger, "trigger", manager);
            Scribe_Deep.LookDeep(ref Training, "Training");
            Scribe_Values.LookValue(ref ButcherExcess, "ButcherExcess", true);
            Scribe_Values.LookValue(ref ButcherTrained, "ButcherTrained", false);
            Scribe_Values.LookValue(ref RestrictToArea, "RestrictToArea", false);
            Scribe_Values.LookValue(ref TryTameMore, "TryTameMore", false);

            // our current designations
            if (Scribe.mode == LoadSaveMode.PostLoadInit)
            {
                // populate with all designations.
                Designations.AddRange(
                    manager.map.designationManager.DesignationsOfDef(DesignationDefOf.Slaughter)
                    .Where(des => ((Pawn)des.target.Thing).kindDef == Trigger.pawnKind));
                Designations.AddRange(
                    manager.map.designationManager.DesignationsOfDef(DesignationDefOf.Tame)
                    .Where(des => ((Pawn)des.target.Thing).kindDef == Trigger.pawnKind));
            }

            // this is an array of strings as the first (and only) parameter - make sure it doesn't get cast to array of objects for multiple parameters.
            Scribe_Deep.LookDeep(ref _history, "History");
        }
Example #2
0
        public void ExposeData()
        {
            Scribe_References.LookReference(ref this.pawn, "thing");
            Scribe_Defs.LookDef(ref this.manaDef, "manaDef");
            Scribe_Values.LookValue(ref this.manaValue, "manaValue");
            Scribe_Values.LookValue(ref this.whaitingForThinkNode, "whaitingForThinkNode");
            Scribe_Defs.LookDef(ref this.currentAbility, "abilityDef");
            Scribe_Deep.LookDeep(ref this.effectState, "effectState");
            Scribe_Collections.LookList(ref this.currentTargets, "targets", LookMode.Deep);
            Scribe_Collections.LookList(ref this.executionLogs, "executionLogs", LookMode.Deep);
            Scribe_Collections.LookList(ref this.currentMotes, "currentMotes", LookMode.Deep);

            if (Scribe.mode == LoadSaveMode.PostLoadInit)
            {
                if (this.currentTargets != null)
                {
                    foreach (Saveable_Target value in this.currentTargets.ToArray())
                    {
                        if (value.target == null)
                        {
                            this.currentTargets.Remove(value);
                        }
                    }
                }
            }
        }
Example #3
0
        public static Blueprint LoadFromFile(string fileName)
        {
            Blueprint blueprint = new Blueprint();

            try
            {
                Scribe.InitLoading(BlueprintFiles.FilePathForSavedBlueprint(fileName));
                try
                {
                    Scribe_Deep.LookDeep(ref blueprint, "Blueprint", null);
                }
                catch (Exception e)
                {
                    Messages.Message("Error when loading blueprint", MessageSound.RejectInput);
                    Log.Error(e.ToString());
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
            }
            finally
            {
                Scribe.mode = LoadSaveMode.Inactive;
            }
            return(blueprint);
        }
Example #4
0
 public override void ExposeData()
 {
     Scribe_Values.LookValue(ref stripBodies, "stripBodies");
     Scribe_Deep.LookDeep(ref this.targetAnimal, "animalLike", new object[] { animalLabel, animalPredicate, 2, this });
     Scribe_Deep.LookDeep(ref this.targetHumanLike, "humanLike", new object[] { humanLabel, humanPredicate, 1, this });
     Scribe_Deep.LookDeep(ref this.targetMechanoid, "mechanoid", new object[] { mechanoidLabel, mechanoidPredicate, 3, this });
 }
Example #5
0
        public void ExposeData()
        {
            Scribe_Values.LookValue(ref mapSize, "mapSize");
            Scribe_Values.LookValue(ref start, "start");
            Scribe_Values.LookValue(ref dest, "dest");
            Scribe_Values.LookValue(ref peMode, "peMode");
            Scribe_Values.LookValue(ref tpMode, "tpMode");
            Scribe_Values.LookValue(ref tpMaxDanger, "tpMaxDanger");
            Scribe_Values.LookValue(ref tpCanBash, "tpCanBash");
            Scribe_Values.LookValue(ref tpMoveCardinal, "tpMoveCardinal");
            Scribe_Values.LookValue(ref tpMoveDiagonal, "tpMoveDiagonal");
            Scribe_Deep.LookDeep(ref fakeEdificeGrid, "fakeEdificeGrid");
            Scribe_Deep.LookDeep(ref avoidGrid, "avoidGrid");
            Scribe_Deep.LookDeep(ref allowedArea, "allowedArea");

            string compressedString = string.Empty;

            if (Scribe.mode == LoadSaveMode.Saving)
            {
                compressedString = IntArrayToCompressedString(pathGrid);
            }
            Scribe_Values.LookValue(ref compressedString, "pathGrid");
            if (Scribe.mode == LoadSaveMode.LoadingVars)
            {
                pathGrid = CompressedStringToIntArray(compressedString);
            }
        }
Example #6
0
        public override void                ExposeData()
        {
            //Log.Message( string.Format( "Building_Hopper.ExposeData( {0} )", Scribe.mode.ToString() ) );
            base.ExposeData();
            Scribe_Deep.LookDeep <StorageSettings>(ref settings, "settings", new Object[1] {
                this
            });

            /*
             * if( Scribe.mode == LoadSaveMode.ResolvingCrossRefs )
             * {
             *  var parentSettings = GetParentStoreSettings();
             *  if(
             *      ( settings != null )&&
             *      ( parentSettings != null )
             *  )
             *  {
             *      settings.Priority = parentSettings.Priority;
             *  }
             * }
             */
            // Disallow quality
            //settings.filter.allowedQualitiesConfigurable = false;

            // Block default special filters
            //settings.filter.BlockDefaultAcceptanceFilters( GetParentStoreSettings() );
        }
        private void DoExport(string name)
        {
            try
            {
                try
                {
                    Scribe.InitWriting(FilePath(name), "ManagerJobs");
                }
                catch (Exception ex)
                {
                    GenUI.ErrorDialog("ProblemSavingFile".Translate(ex.ToString()));
                    throw;
                }

                ScribeMetaHeaderUtility.WriteMetaHeader();

                _jobStackIO = Manager.For(manager).JobStack;
                Scribe_Deep.LookDeep(ref _jobStackIO, "JobStack");
            }
            catch (Exception ex2)
            {
                Log.Error("Exception while saving jobstack: " + ex2);
            }
            finally
            {
                Scribe.FinalizeWriting();
                Messages.Message("FM.JobsExported".Translate(_jobStackIO.FullStack().Count), MessageSound.Standard);
                Refresh();
            }
        }
Example #8
0
 public override void ExposeData()
 {
     base.ExposeData();
     Scribe_Values.LookValue <int>(ref this.age, "age", 0, false);
     Scribe_Values.LookValue <bool>(ref this.FirstDrop, "FirstDrop", false, false);
     Scribe_Deep.LookDeep <DropPodInfo>(ref this.info, "info", new object[0]);
 }
Example #9
0
        public override void ExposeData()
        {
            base.ExposeData();
            Scribe_Deep.LookDeep <ReadablesManager>(ref this.readablesManager, "readablesManager", new object[0]);
            //        Scribe_Deep.LookDeep<PatronInfo>(ref this.patronInfo, "patronInfo", new object());
            Scribe_Values.LookValue <bool>(ref this.NoPatron, "NoPatron", true, false);
            Scribe_Values.LookValue <bool>(ref this.IsImmune, "IsImmune", false, false);
            Scribe_Values.LookValue <string>(ref this.patronInfo.PatronName, "PatronName", "Emperor", false);


            //        Scribe_Collections.LookList<SoulTrait>(ref this.SoulTraits, "SoulTraits", LookMode.Deep, new object[0]);
            Scribe_Collections.LookList <Pawn>(ref this.OpposingDevotees, "OpposingDevotees", LookMode.Reference, new object[0]);

            Scribe_Values.LookValue <ChaosGods>(ref this.Patron, "Patron", ChaosGods.Undivided, false);

            Scribe_Values.LookValue <PsykerPowerLevel>(ref this.PsykerPowerLevel, "PsykerPowerLevel", PsykerPowerLevel.Rho, false);
            Scribe_Values.LookValue <CulturalToleranceCategory>(ref this.CulturalTolerance, "CulturalTolerance", CulturalToleranceCategory.Neutral, false);

            //        Scribe_Deep.LookDeep<AfflictionProperty>(ref this.PawnAfflictionProps, "PawnAfflictionProps", null);

            Scribe_Deep.LookDeep <SoulTrait>(ref this.DevotionTrait, "DevotionTrait", new object[0]);
            Scribe_Deep.LookDeep <SoulTrait>(ref this.PatronTrait, "PatronTrait", new object[0]);
            Scribe_Deep.LookDeep <SoulTrait>(ref this.CommonSoulTrait, "CommonSoulTrait", new object[0]);
            //   {
            //       CorruptionDefOfs.Devotion,
            //       this.DevotionTrait.SDegree
            //   });

            if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs)
            {
            }
        }
Example #10
0
        public override void PostExposeData()
        {
            base.PostExposeData();
            //            Scribe_Collections.LookDictionary<PsykerPower, Verb_CastWarpPower>(ref this.psykerPowers, "psykerPowers", LookMode.Deep, LookMode.Reference);

            //          Scribe_Collections.LookList<PsykerPower>(ref this.allPowers, "allPowers", LookMode.Deep, new object[]
            //          {
            //              this.psyker,
            //              new object()
            //          });
            //          Scribe_Collections.LookList<PsykerPower>(ref this.temporaryApparelPowers, "temporaryApparelPowers", LookMode.Reference, new object[]
            //          {
            //              this.psyker,
            //              new object()
            //          });
            //       Scribe_Collections.LookList<PsykerPower>(ref this.temporaryWeaponPowers, "temporaryWeaponPowers", LookMode.Reference, new object[0]);
            Scribe_Collections.LookList(ref this.allpsykerPowers, "allpsykerPowers", LookMode.Deep, new object[0]);


            Scribe_Values.LookValue <string>(ref this.patronName, "patronName", "Emperor", false);
            Scribe_Values.LookValue <int>(ref this.TicksToCast, "TicksToCast", 0, false);
            Scribe_Values.LookValue <int>(ref this.TicksToCastMax, "TicksToCastMax", 1, false);
            Scribe_Values.LookValue <float>(ref this.TicksToCastPercentage, "TicksToCastPercentage", 1, false);
            Scribe_Values.LookValue <bool>(ref this.IsActive, "IsActive", false, false);
            Scribe_Values.LookValue <bool>(ref this.ShotFired, "ShotFired", true, false);
            //          Scribe_Deep.LookDeep<Verb_CastWarpPower>(ref this.curVerb, "curVerb", null);
            //          Scribe_TargetInfo.LookTargetInfo(ref this.CurTarget, "CurTarget", null);

            Scribe_Deep.LookDeep <PsykerPowerManager>(ref this.psykerPowerManager, "psykerPowerManager", new object[]
            {
                this
            });
        }
Example #11
0
        public void ExposeData()
        {
            Scribe_Deep.LookDeep(ref _container, "container");

            if (Scribe.mode == LoadSaveMode.LoadingVars)
            {
                Dictionary<string, int> counterDictionary = null;
                Scribe_Fixed.LookDictionary(ref counterDictionary, "thingCounter", LookMode.Value);

                _thingCounter.Clear();
                if (counterDictionary != null)
                {
                    foreach (var pair in counterDictionary)
                    {
                        var thing = _container.Contents.FirstOrDefault(t => t.ThingID == pair.Key);

                        if (thing != null)
                        {
                            _thingCounter.Add(thing, pair.Value);
                        }
                    }
                }
            }
            else if (Scribe.mode == LoadSaveMode.Saving)
            {
                var counterDictionary = _thingCounter.ToDictionary(pair => pair.Key.ThingID, pair => pair.Value);

                Scribe_Fixed.LookDictionary(ref counterDictionary, "thingCounter", LookMode.Value);
            }
        }
Example #12
0
        public override void ExposeData()
        {
            base.ExposeData();

            Scribe_Deep.LookDeep(ref Bill, "Bill");

            // init main product, required by trigger.
            if (MainProduct == null)
            {
                MainProduct = new MainProductTracker(Bill.recipe);
            }

            Scribe_Deep.LookDeep(ref Trigger, "trigger", manager);
            Scribe_Values.LookValue(ref _hasMeaningfulIngredientChoices, "hasMeaningFulIngredientChoices", false);
            Scribe_Values.LookValue(ref _createIngredientBills, "createIngredientBills", true);

            // bill giver tracking is going to error out in cross-map import/export, so create a new one.
            if (Manager.LoadSaveMode == Manager.Modes.Normal)
            {
                Scribe_Deep.LookDeep(ref BillGivers, "BillGivers", this);
            }
            else
            {
                BillGivers = new BillGiverTracker(this);
            }
            Scribe_Values.LookValue(ref restrictToMaxSkill, "maxSkill", false);

            // scribe history in normal load/save only.
            if (Manager.LoadSaveMode == Manager.Modes.Normal)
            {
                Scribe_Deep.LookDeep(ref History, "History");
            }
        }
Example #13
0
        public static void SaveToXML(Blueprint blueprint)
        {
            try
            {
                try
                {
                    Scribe.InitWriting(FullSaveLocation(blueprint.name), "Blueprint");
                }
                catch (Exception ex)
                {
                    GenUI.ErrorDialog("ProblemSavingFile".Translate(ex.ToString()));
                    throw;
                }
                ScribeMetaHeaderUtility.WriteMetaHeader();

                Scribe_Deep.LookDeep(ref blueprint, "Blueprint");
            }
            catch (Exception ex2)
            {
                Log.Error("Exception while saving blueprint: " + ex2);
            }
            finally
            {
                Scribe.FinalizeWriting();
            }

            // set exported flag.
            blueprint.exported = true;
        }
        public override void PostExposeData()
        {
            base.PostExposeData();

            // NOTE: check if not "new object[]{ this });"
            Scribe_Deep.LookDeep(ref slots, "slots", this);
        }
Example #15
0
        public static void SaveHostData(MCMHost host)
        {
            var filePath = HostFilePath(host);

            // Open it for writing
            try
            {
                Scribe.InitWriting(filePath, "ModConfigurationData");
                if (Scribe.mode == LoadSaveMode.Saving)
                {
                    // Write this library version as the one saved with
                    string version = Version.Current.ToString();
                    Scribe_Values.LookValue <string>(ref version, "ccl_version");

                    // Call the worker scribe
                    Scribe_Deep.LookDeep <MCMHost>(ref host, host.key);
                }
            }
            catch (Exception e)
            {
                CCL_Log.Trace(
                    Verbosity.NonFatalErrors,
                    string.Format("Unexpected error scribing data for mod {0}\n{1}", host.Label, e.ToString()),
                    "Mod Configuration Menu");
            }
            finally
            {
                // Finish
                Scribe.FinalizeWriting();
                Scribe.mode = LoadSaveMode.Inactive;
                Messages.Message("ModConfigurationSaved".Translate(host.Label), MessageSound.Standard);
            }
            host.OpenedThisSession = false;
        }
Example #16
0
 public override void ExposeData()
 {
     base.ExposeData();
     Scribe_Deep.LookDeep <Pawn>(ref this.preacher, "preacher", new object[0]);
     Scribe_Values.LookValue <string>(ref this.RoomName, "RoomName", "Temple", false);
     Scribe_Values.LookValue <bool>(ref this.OptionEvening, "OptionEvening", true, false);
     Scribe_Values.LookValue <bool>(ref this.OptionMorning, "OptionMorning", true, false);
 }
 public override void ExposeData()
 {
     base.ExposeData();
     Scribe_Deep.LookDeep <Pawn_SexualityTracker>(ref this.sexuality, "sexuality", new object[]
     {
         this
     });
 }
 /// <summary>
 /// To write and read data (savegame)
 /// </summary>
 public override void ExposeData()
 {
     base.ExposeData();
     // Save and load the storage settings
     Scribe_Deep.LookDeep <StorageSettings>(ref settingsStorage, "settingsStorage", this);
     Scribe_Values.LookValue <TeleporterState>(ref state, "state", TeleporterState.off);
     Scribe_Values.LookValue <int>(ref counterNextCheck, "counterChecking", 60);
 }
Example #19
0
        public override void PostExposeData()
        {
            Scribe_Values.LookValue(ref _beltPhase, "phase");

            Scribe_Deep.LookDeep(ref ItemContainer, "container", this);

            Scribe_Values.LookValue(ref _thingOrigin, "thingOrigin", IntVec3.Invalid);
        }
Example #20
0
        public bool opened = false;                                                 // Whether the pod has opened or not

        public override void ExposeData()
        {
            // Base data to save
            base.ExposeData();
            // Save age ticks to save file
            Scribe_Values.LookValue <int>(ref this.age, "age", 0, false);
            // Save pods content
            Scribe_Deep.LookDeep <DropPodInfo>(ref this.info, "info", new object[0]);
        }
Example #21
0
 public void ExposeData()
 {
     Scribe_Values.LookValue(ref this.completedCycles, "completedCycles");
     Scribe_Values.LookValue(ref this.ticksToFinish, "ticksToFinish");
     Scribe_Deep.LookDeep <ShoppingList>(ref this.shoppingList, "shoppingList", this);
     Scribe_Values.LookValue(ref this.deleted, "deleted");
     Scribe_Deep.LookDeep(ref this.config, "config", this);
     Scribe_Values.LookValue(ref this.moreNeeded, "moreNeeded");
 }
Example #22
0
 public override void ExposeData()
 {
     base.ExposeData();
     Scribe_Deep.LookDeep(ref storage, "storage");
     Scribe_Deep.LookDeep(ref allowances, "allowances");
     Scribe_Values.LookValue(ref vehicleComp.tankLeaking, "tankLeaking");
     Scribe_Values.LookValue(ref _tankHitPos, "tankHitPos");
     Scribe_Values.LookValue(ref despawnAtEdge, "despawnAtEdge");
     Scribe_Values.LookValue(ref mountableComp.lastDrawAsAngle, "lastDrawAsAngle");
 }
Example #23
0
 public void ExposeData()
 {
     Scribe_Values.LookValue(ref this.repeatMode, "repeatMode");
     Scribe_Defs.LookDef(ref this.recipe, "recipe");
     Scribe_Deep.LookDeep(ref this.ingredientsFilter, "fixedIngredientFilter");
     Scribe_Values.LookValue(ref this.cycles, "cycles");
     Scribe_Values.LookValue(ref this.targetCount, "targetCount");
     Scribe_Values.LookValue(ref this.completeAll, "completeAll");
     Scribe_Values.LookValue(ref this.suspended, "suspended");
     Scribe_Values.LookValue <bool>(ref this.setupStage, "setupStage");
 }
Example #24
0
        public override void ExposeData()
        {
            base.ExposeData();
            Scribe_Values.LookValue <int>(ref this.burstCooldownTicksLeft, "burstCooldownTicksLeft", 0, false);
            Scribe_Values.LookValue <bool>(ref this.loaded, "loaded", false, false);

            // Look new variables
            Scribe_Values.LookValue(ref burstWarmupTicksLeft, "burstWarmupTicksLeft", 0);
            Scribe_Values.LookValue(ref isReloading, "isReloading", false);
            Scribe_Deep.LookDeep(ref gun, "gun");
        }
Example #25
0
 public void ExposeData()
 {
     Scribe_Deep.LookDeep(ref this.Speed, "lineSpeed");
     Scribe_Deep.LookDeep(ref this.Efficiency, "lineEfficiency");
     Scribe_Deep.LookDeep <OrderStack>(ref this.orderStack, "orderStack", this);
     Scribe_Deep.LookDeep(ref this.upgradeManager, "upgradeManager", this);
     Scribe_Values.LookValue <string>(ref this.label, "lineLabel");
     Scribe_Values.LookValue(ref this.constructionTicks, "constructionTicks");
     Scribe_Values.LookValue(ref this.underConstruction, "underConstruction");
     Scribe_Values.LookValue(ref this.constructionPaused, "constructionPaused");
     Scribe_Deep.LookDeep(ref this.billOfMaterials, "billOfMaterials");
 }
Example #26
0
        public override void ExposeData()
        {
            base.ExposeData();
            Scribe_Deep.LookDeep <StunHandler>(ref this.stunner, "stunner", new object[]
            {
                this
            });

            Scribe_Values.LookValue <bool>(ref this.isInstalled, "isInstalled", false, false);
            Scribe_Values.LookValue <string>(ref this.assignedSlotName, "assignedSlotName");
            Scribe_References.LookReference <ShipWeaponSlot>(ref this.slotToInstall, "slotToInstall");
        }
Example #27
0
 private static void SaveGame(string savePath)
 {
     LongEventHandler.QueueLongEvent(() =>
     {
         string path = savePath + ".rws";
         SafeSaver.Save(path, "savegame", delegate
         {
             ScribeMetaHeaderUtility.WriteMetaHeader();
             Game game = Current.Game;
             Scribe_Deep.LookDeep(ref game, "game");
         });
     }, "Saving Path Data", false, null);
 }
Example #28
0
        public override void ExposeData()
        {
            base.ExposeData();
            Scribe_Values.LookValue <bool>(ref this.shouldUsePower, "shouldUsePower");
            Scribe_Values.LookValue <float>(ref this.totalCharge, "TotalCharge");

            //Scribe_Deep.LookDeep(ref this.backstory, "backstoryManager", new object[] { this });
            //Scribe_Deep.LookDeep(ref this.meta, "meta", new object[] { this });
            Scribe_Deep.LookDeep(ref this.drawManager, "drawManager", new object[] { this });
            Scribe_Deep.LookDeep(ref this.parts, "parts", new object[] { this });
            Scribe_Deep.LookDeep(ref this.work, "work", new object[] { this });
            Scribe_Deep.LookDeep(ref this.utilities, "utilities", new object[] { this });
        }
Example #29
0
        public override void ExposeData()
        {
            base.ExposeData();

            Scribe_Values.LookValue <int>(ref this.fleetID, "fleetID", 0, false);
            Scribe_Values.LookValue <int>(ref this.destinationTile, "destinationTile", 0, false);
            Scribe_Values.LookValue <IntVec3>(ref this.destinationCell, "destinationCell", default(IntVec3), false);
            Scribe_Values.LookValue <TravelingShipArrivalAction>(ref this.arrivalAction, "arrivalAction", TravelingShipArrivalAction.StayOnWorldMap, false);
            Scribe_Values.LookValue <PawnsArriveMode>(ref this.pawnArriveMode, "pawnArriveMode", PawnsArriveMode.Undecided, false);

            Scribe_Values.LookValue <bool>(ref this.leavingForTarget, "leavingForTarget", true, false);
            Scribe_Values.LookValue <bool>(ref this.alreadyLeft, "alreadyLeft", false, false);
            Scribe_Deep.LookDeep <ShipBase>(ref this.containingShip, "containingShip", new object[0]);
        }
Example #30
0
        public new void ExposeData()
        {
            base.ExposeData();
            Scribe_Defs.LookDef <SoulTraitDef>(ref this.SDef, "SDef");
            //           Scribe_Collections.LookList<ThoughtDef>(ref this.NullifiedThoughtsInt, "NullifiedThoughtsInt", LookMode.Deep, new object[0]);
            Scribe_Values.LookValue <int>(ref this.degree, "degree", 0, false);
            Scribe_Deep.LookDeep <SoulTraitDegreeData>(ref this.CurrentSData, "CurrentSData", null, false);

            if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs && this.def == null)
            {
                this.def = DefDatabase <SoulTraitDef> .GetRandom();

                this.degree = PawnGenerator.RandomTraitDegree(this.SDef);
            }
        }