public virtual void ExposeData() { Scribe_Defs.Look(ref def, "def"); if (def.HasThingIDNumber) { string value = ThingID; Scribe_Values.Look(ref value, "id"); ThingID = value; } Scribe_Values.Look <sbyte>(ref mapIndexOrState, "map", -1); if (Scribe.mode == LoadSaveMode.LoadingVars && mapIndexOrState >= 0) { mapIndexOrState = -1; } Scribe_Values.Look(ref positionInt, "pos", IntVec3.Invalid); Scribe_Values.Look(ref rotationInt, "rot", Rot4.North); if (def.useHitPoints) { Scribe_Values.Look(ref hitPointsInt, "health", -1); } bool flag = def.tradeability != 0 && def.category == ThingCategory.Item; if (def.stackLimit > 1 || flag) { Scribe_Values.Look(ref stackCount, "stackCount", 0, forceSave: true); } Scribe_Defs.Look(ref stuffInt, "stuff"); string facID = ((factionInt != null) ? factionInt.GetUniqueLoadID() : "null"); Scribe_Values.Look(ref facID, "faction", "null"); if (Scribe.mode == LoadSaveMode.LoadingVars || Scribe.mode == LoadSaveMode.ResolvingCrossRefs || Scribe.mode == LoadSaveMode.PostLoadInit) { if (facID == "null") { factionInt = null; } else if (Find.World != null && Find.FactionManager != null) { factionInt = Find.FactionManager.AllFactions.FirstOrDefault((Faction fa) => fa.GetUniqueLoadID() == facID); } } Scribe_Collections.Look(ref questTags, "questTags", LookMode.Value); BackCompatibility.PostExposeData(this); }
public virtual void ExposeData() { Scribe_Defs.Look <ThingDef>(ref this.def, "def"); if (this.def.HasThingIDNumber) { string thingID = this.ThingID; Scribe_Values.Look(ref thingID, "id", null, false); this.ThingID = thingID; } Scribe_Values.Look <sbyte>(ref this.mapIndexOrState, "map", (sbyte)(-1), false); if (Scribe.mode == LoadSaveMode.LoadingVars && this.mapIndexOrState >= 0) { this.mapIndexOrState = -1; } Scribe_Values.Look <IntVec3>(ref this.positionInt, "pos", IntVec3.Invalid, false); Scribe_Values.Look <Rot4>(ref this.rotationInt, "rot", Rot4.North, false); if (this.def.useHitPoints) { Scribe_Values.Look <int>(ref this.hitPointsInt, "health", -1, false); } bool flag = this.def.tradeability != 0 && this.def.category == ThingCategory.Item; if (this.def.stackLimit > 1 || flag) { Scribe_Values.Look <int>(ref this.stackCount, "stackCount", 0, true); } Scribe_Defs.Look <ThingDef>(ref this.stuffInt, "stuff"); string facID = (this.factionInt == null) ? "null" : this.factionInt.GetUniqueLoadID(); Scribe_Values.Look(ref facID, "faction", "null", false); if (Scribe.mode != LoadSaveMode.LoadingVars && Scribe.mode != LoadSaveMode.ResolvingCrossRefs && Scribe.mode != LoadSaveMode.PostLoadInit) { return; } if (facID == "null") { this.factionInt = null; } else if (Find.World != null && Find.FactionManager != null) { this.factionInt = Find.FactionManager.AllFactions.FirstOrDefault((Faction fa) => fa.GetUniqueLoadID() == facID); } }
public override void ExposeData() { base.ExposeData(); Scribe_Values.Look(ref radius, "radius", 0f); Scribe_Defs.Look(ref damType, "damType"); Scribe_Values.Look(ref damAmount, "damAmount", 0); Scribe_Values.Look(ref armorPenetration, "armorPenetration", 0f); Scribe_References.Look(ref instigator, "instigator"); Scribe_Defs.Look(ref weapon, "weapon"); Scribe_Defs.Look(ref projectile, "projectile"); Scribe_References.Look(ref intendedTarget, "intendedTarget"); Scribe_Values.Look(ref applyDamageToExplosionCellsNeighbors, "applyDamageToExplosionCellsNeighbors", defaultValue: false); Scribe_Defs.Look(ref preExplosionSpawnThingDef, "preExplosionSpawnThingDef"); Scribe_Values.Look(ref preExplosionSpawnChance, "preExplosionSpawnChance", 0f); Scribe_Values.Look(ref preExplosionSpawnThingCount, "preExplosionSpawnThingCount", 1); Scribe_Defs.Look(ref postExplosionSpawnThingDef, "postExplosionSpawnThingDef"); Scribe_Values.Look(ref postExplosionSpawnChance, "postExplosionSpawnChance", 0f); Scribe_Values.Look(ref postExplosionSpawnThingCount, "postExplosionSpawnThingCount", 1); Scribe_Values.Look(ref chanceToStartFire, "chanceToStartFire", 0f); Scribe_Values.Look(ref damageFalloff, "dealMoreDamageAtCenter", defaultValue: false); Scribe_Values.Look(ref needLOSToCell1, "needLOSToCell1"); Scribe_Values.Look(ref needLOSToCell2, "needLOSToCell2"); Scribe_Values.Look(ref startTick, "startTick", 0); Scribe_Collections.Look(ref cellsToAffect, "cellsToAffect", LookMode.Value); Scribe_Collections.Look(ref damagedThings, "damagedThings", LookMode.Reference); Scribe_Collections.Look(ref ignoredThings, "ignoredThings", LookMode.Reference); Scribe_Collections.Look(ref addedCellsAffectedOnlyByDamage, "addedCellsAffectedOnlyByDamage", LookMode.Value); if (Scribe.mode != LoadSaveMode.PostLoadInit) { return; } if (damagedThings != null) { damagedThings.RemoveAll((Thing x) => x == null); } if (ignoredThings != null) { ignoredThings.RemoveAll((Thing x) => x == null); } }
public virtual void ExposeData() { Scribe_Values.Look(ref ticksAbs, "ticksAbs", 0); Scribe_Values.Look(ref logID, "logID", 0); Scribe_Defs.Look(ref def, "def"); }
public void ExposeData() { Scribe_Values.Look <IntVec3>(ref this.prioritizedCell, "prioritizedCell", default(IntVec3), false); Scribe_Defs.Look <WorkTypeDef>(ref this.prioritizedWorkType, "prioritizedWorkType"); Scribe_Values.Look <int>(ref this.prioritizeTick, "prioritizeTick", 0, false); }
public override void ExposeData() { base.ExposeData(); Scribe_Defs.Look <HediffDef>(ref this.lastInjury, "lastInjury"); Scribe_Values.Look <bool>(ref this.isFreshInt, "isFresh", false, false); }
public void ExposeData() { Scribe_Defs.Look <HediffDef>(ref this.hediffDef, "hediffDef"); Scribe_Defs.Look <HediffDef>(ref this.source, "source"); Scribe_Values.Look <float>(ref this.immunity, "immunity", 0f, false); }
public static void Look <T>(ref List <T> list, bool saveDestroyedThings, string label, LookMode lookMode = LookMode.Undefined, params object[] ctorArgs) { if (lookMode == LookMode.Undefined) { if (ParseHelper.HandlesType(typeof(T))) { lookMode = LookMode.Value; } else if (typeof(T) == typeof(LocalTargetInfo)) { lookMode = LookMode.LocalTargetInfo; } else if (typeof(T) == typeof(TargetInfo)) { lookMode = LookMode.TargetInfo; } else if (typeof(T) == typeof(GlobalTargetInfo)) { lookMode = LookMode.GlobalTargetInfo; } else if (typeof(Def).IsAssignableFrom(typeof(T))) { lookMode = LookMode.Def; } else if (typeof(T) == typeof(BodyPartRecord)) { lookMode = LookMode.BodyPart; } else { if (!typeof(IExposable).IsAssignableFrom(typeof(T)) || typeof(ILoadReferenceable).IsAssignableFrom(typeof(T))) { Log.Error("LookList call with a list of " + typeof(T) + " must have lookMode set explicitly.", false); return; } lookMode = LookMode.Deep; } } if (Scribe.EnterNode(label)) { try { if (Scribe.mode == LoadSaveMode.Saving) { if (list == null) { Scribe.saver.WriteAttribute("IsNull", "True"); } else { foreach (T current in list) { if (lookMode == LookMode.Value) { T t = current; Scribe_Values.Look <T>(ref t, "li", default(T), true); } else if (lookMode == LookMode.LocalTargetInfo) { LocalTargetInfo localTargetInfo = (LocalTargetInfo)((object)current); Scribe_TargetInfo.Look(ref localTargetInfo, saveDestroyedThings, "li"); } else if (lookMode == LookMode.TargetInfo) { TargetInfo targetInfo = (TargetInfo)((object)current); Scribe_TargetInfo.Look(ref targetInfo, saveDestroyedThings, "li"); } else if (lookMode == LookMode.GlobalTargetInfo) { GlobalTargetInfo globalTargetInfo = (GlobalTargetInfo)((object)current); Scribe_TargetInfo.Look(ref globalTargetInfo, saveDestroyedThings, "li"); } else if (lookMode == LookMode.Def) { Def def = (Def)((object)current); Scribe_Defs.Look <Def>(ref def, "li"); } else if (lookMode == LookMode.BodyPart) { BodyPartRecord bodyPartRecord = (BodyPartRecord)((object)current); Scribe_BodyParts.Look(ref bodyPartRecord, "li", null); } else if (lookMode == LookMode.Deep) { T t2 = current; Scribe_Deep.Look <T>(ref t2, saveDestroyedThings, "li", ctorArgs); } else if (lookMode == LookMode.Reference) { ILoadReferenceable loadReferenceable = (ILoadReferenceable)((object)current); Scribe_References.Look <ILoadReferenceable>(ref loadReferenceable, "li", saveDestroyedThings); } } } } else if (Scribe.mode == LoadSaveMode.LoadingVars) { XmlNode curXmlParent = Scribe.loader.curXmlParent; XmlAttribute xmlAttribute = curXmlParent.Attributes["IsNull"]; if (xmlAttribute != null && xmlAttribute.Value.ToLower() == "true") { list = null; } else if (lookMode == LookMode.Value) { list = new List <T>(curXmlParent.ChildNodes.Count); foreach (XmlNode subNode in curXmlParent.ChildNodes) { T item = ScribeExtractor.ValueFromNode <T>(subNode, default(T)); list.Add(item); } } else if (lookMode == LookMode.Deep) { list = new List <T>(curXmlParent.ChildNodes.Count); foreach (XmlNode subNode2 in curXmlParent.ChildNodes) { T item2 = ScribeExtractor.SaveableFromNode <T>(subNode2, ctorArgs); list.Add(item2); } } else if (lookMode == LookMode.Def) { list = new List <T>(curXmlParent.ChildNodes.Count); foreach (XmlNode subNode3 in curXmlParent.ChildNodes) { T item3 = ScribeExtractor.DefFromNodeUnsafe <T>(subNode3); list.Add(item3); } } else if (lookMode == LookMode.BodyPart) { list = new List <T>(curXmlParent.ChildNodes.Count); int num = 0; foreach (XmlNode node in curXmlParent.ChildNodes) { T item4 = (T)((object)ScribeExtractor.BodyPartFromNode(node, num.ToString(), null)); list.Add(item4); num++; } } else if (lookMode == LookMode.LocalTargetInfo) { list = new List <T>(curXmlParent.ChildNodes.Count); int num2 = 0; foreach (XmlNode node2 in curXmlParent.ChildNodes) { LocalTargetInfo localTargetInfo2 = ScribeExtractor.LocalTargetInfoFromNode(node2, num2.ToString(), LocalTargetInfo.Invalid); T item5 = (T)((object)localTargetInfo2); list.Add(item5); num2++; } } else if (lookMode == LookMode.TargetInfo) { list = new List <T>(curXmlParent.ChildNodes.Count); int num3 = 0; foreach (XmlNode node3 in curXmlParent.ChildNodes) { TargetInfo targetInfo2 = ScribeExtractor.TargetInfoFromNode(node3, num3.ToString(), TargetInfo.Invalid); T item6 = (T)((object)targetInfo2); list.Add(item6); num3++; } } else if (lookMode == LookMode.GlobalTargetInfo) { list = new List <T>(curXmlParent.ChildNodes.Count); int num4 = 0; foreach (XmlNode node4 in curXmlParent.ChildNodes) { GlobalTargetInfo globalTargetInfo2 = ScribeExtractor.GlobalTargetInfoFromNode(node4, num4.ToString(), GlobalTargetInfo.Invalid); T item7 = (T)((object)globalTargetInfo2); list.Add(item7); num4++; } } else if (lookMode == LookMode.Reference) { List <string> list2 = new List <string>(curXmlParent.ChildNodes.Count); foreach (XmlNode xmlNode in curXmlParent.ChildNodes) { list2.Add(xmlNode.InnerText); } Scribe.loader.crossRefs.loadIDs.RegisterLoadIDListReadFromXml(list2, string.Empty); } } else if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs) { if (lookMode == LookMode.Reference) { list = Scribe.loader.crossRefs.TakeResolvedRefList <T>(string.Empty); } else if (lookMode == LookMode.LocalTargetInfo) { if (list != null) { for (int i = 0; i < list.Count; i++) { list[i] = (T)((object)ScribeExtractor.ResolveLocalTargetInfo((LocalTargetInfo)((object)list[i]), i.ToString())); } } } else if (lookMode == LookMode.TargetInfo) { if (list != null) { for (int j = 0; j < list.Count; j++) { list[j] = (T)((object)ScribeExtractor.ResolveTargetInfo((TargetInfo)((object)list[j]), j.ToString())); } } } else if (lookMode == LookMode.GlobalTargetInfo && list != null) { for (int k = 0; k < list.Count; k++) { list[k] = (T)((object)ScribeExtractor.ResolveGlobalTargetInfo((GlobalTargetInfo)((object)list[k]), k.ToString())); } } } } finally { Scribe.ExitNode(); } } else if (Scribe.mode == LoadSaveMode.LoadingVars) { if (lookMode == LookMode.Reference) { Scribe.loader.crossRefs.loadIDs.RegisterLoadIDListReadFromXml(null, label); } list = null; } }
public override void ExposeData() { base.ExposeData(); Scribe_Defs.Look(ref abilityUsed, "abilityUsed"); }
public static void Look <T>(ref List <T> list, bool saveDestroyedThings, string label, LookMode lookMode = LookMode.Undefined, params object[] ctorArgs) { if (lookMode == LookMode.Undefined && !Scribe_Universal.TryResolveLookMode(typeof(T), out lookMode)) { Log.Error("LookList call with a list of " + typeof(T) + " must have lookMode set explicitly."); } else if (Scribe.EnterNode(label)) { try { if (Scribe.mode == LoadSaveMode.Saving) { if (list == null) { Scribe.saver.WriteAttribute("IsNull", "True"); } else { foreach (T item8 in list) { switch (lookMode) { case LookMode.Value: { T value5 = item8; Scribe_Values.Look(ref value5, "li", default(T), forceSave: true); break; } case LookMode.LocalTargetInfo: { LocalTargetInfo value4 = (LocalTargetInfo)(object)item8; Scribe_TargetInfo.Look(ref value4, saveDestroyedThings, "li"); break; } case LookMode.TargetInfo: { TargetInfo value3 = (TargetInfo)(object)item8; Scribe_TargetInfo.Look(ref value3, saveDestroyedThings, "li"); break; } case LookMode.GlobalTargetInfo: { GlobalTargetInfo value2 = (GlobalTargetInfo)(object)item8; Scribe_TargetInfo.Look(ref value2, saveDestroyedThings, "li"); break; } case LookMode.Def: { Def value = (Def)(object)item8; Scribe_Defs.Look(ref value, "li"); break; } case LookMode.BodyPart: { BodyPartRecord part = (BodyPartRecord)(object)item8; Scribe_BodyParts.Look(ref part, "li"); break; } case LookMode.Deep: { T target = item8; Scribe_Deep.Look(ref target, saveDestroyedThings, "li", ctorArgs); break; } case LookMode.Reference: { ILoadReferenceable refee = (ILoadReferenceable)(object)item8; Scribe_References.Look(ref refee, "li", saveDestroyedThings); break; } } } } } else if (Scribe.mode == LoadSaveMode.LoadingVars) { XmlNode curXmlParent = Scribe.loader.curXmlParent; XmlAttribute xmlAttribute = curXmlParent.Attributes["IsNull"]; if (xmlAttribute != null && xmlAttribute.Value.ToLower() == "true") { if (lookMode == LookMode.Reference) { Scribe.loader.crossRefs.loadIDs.RegisterLoadIDListReadFromXml(null, null); } list = null; } else { switch (lookMode) { case LookMode.Value: list = new List <T>(curXmlParent.ChildNodes.Count); foreach (XmlNode childNode in curXmlParent.ChildNodes) { T item = ScribeExtractor.ValueFromNode(childNode, default(T)); list.Add(item); } break; case LookMode.Deep: list = new List <T>(curXmlParent.ChildNodes.Count); foreach (XmlNode childNode2 in curXmlParent.ChildNodes) { T item7 = ScribeExtractor.SaveableFromNode <T>(childNode2, ctorArgs); list.Add(item7); } break; case LookMode.Def: list = new List <T>(curXmlParent.ChildNodes.Count); foreach (XmlNode childNode3 in curXmlParent.ChildNodes) { T item6 = ScribeExtractor.DefFromNodeUnsafe <T>(childNode3); list.Add(item6); } break; case LookMode.BodyPart: { list = new List <T>(curXmlParent.ChildNodes.Count); int num4 = 0; foreach (XmlNode childNode4 in curXmlParent.ChildNodes) { T item5 = (T)(object)ScribeExtractor.BodyPartFromNode(childNode4, num4.ToString(), null); list.Add(item5); num4++; } break; } case LookMode.LocalTargetInfo: { list = new List <T>(curXmlParent.ChildNodes.Count); int num3 = 0; foreach (XmlNode childNode5 in curXmlParent.ChildNodes) { T item4 = (T)(object)ScribeExtractor.LocalTargetInfoFromNode(childNode5, num3.ToString(), LocalTargetInfo.Invalid); list.Add(item4); num3++; } break; } case LookMode.TargetInfo: { list = new List <T>(curXmlParent.ChildNodes.Count); int num2 = 0; foreach (XmlNode childNode6 in curXmlParent.ChildNodes) { T item3 = (T)(object)ScribeExtractor.TargetInfoFromNode(childNode6, num2.ToString(), TargetInfo.Invalid); list.Add(item3); num2++; } break; } case LookMode.GlobalTargetInfo: { list = new List <T>(curXmlParent.ChildNodes.Count); int num = 0; foreach (XmlNode childNode7 in curXmlParent.ChildNodes) { T item2 = (T)(object)ScribeExtractor.GlobalTargetInfoFromNode(childNode7, num.ToString(), GlobalTargetInfo.Invalid); list.Add(item2); num++; } break; } case LookMode.Reference: { List <string> list2 = new List <string>(curXmlParent.ChildNodes.Count); foreach (XmlNode childNode8 in curXmlParent.ChildNodes) { list2.Add(childNode8.InnerText); } Scribe.loader.crossRefs.loadIDs.RegisterLoadIDListReadFromXml(list2, ""); break; } } } } else if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs) { switch (lookMode) { case LookMode.Reference: list = Scribe.loader.crossRefs.TakeResolvedRefList <T>(""); break; case LookMode.LocalTargetInfo: if (list != null) { for (int j = 0; j < list.Count; j++) { list[j] = (T)(object)ScribeExtractor.ResolveLocalTargetInfo((LocalTargetInfo)(object)list[j], j.ToString()); } } break; case LookMode.TargetInfo: if (list != null) { for (int k = 0; k < list.Count; k++) { list[k] = (T)(object)ScribeExtractor.ResolveTargetInfo((TargetInfo)(object)list[k], k.ToString()); } } break; case LookMode.GlobalTargetInfo: if (list != null) { for (int i = 0; i < list.Count; i++) { list[i] = (T)(object)ScribeExtractor.ResolveGlobalTargetInfo((GlobalTargetInfo)(object)list[i], i.ToString()); } } break; } } } finally { Scribe.ExitNode(); } } else if (Scribe.mode == LoadSaveMode.LoadingVars) { if (lookMode == LookMode.Reference) { Scribe.loader.crossRefs.loadIDs.RegisterLoadIDListReadFromXml(null, label); } list = null; } }
public static void Look <T>(ref List <T> list, bool saveDestroyedThings, string label, LookMode lookMode = LookMode.Undefined, params object[] ctorArgs) { if (lookMode == LookMode.Undefined) { if (ParseHelper.HandlesType(typeof(T))) { lookMode = LookMode.Value; } else if (typeof(T) == typeof(LocalTargetInfo)) { lookMode = LookMode.LocalTargetInfo; } else if (typeof(T) == typeof(TargetInfo)) { lookMode = LookMode.TargetInfo; } else if (typeof(T) == typeof(GlobalTargetInfo)) { lookMode = LookMode.GlobalTargetInfo; } else if (typeof(Def).IsAssignableFrom(typeof(T))) { lookMode = LookMode.Def; } else if (typeof(T) == typeof(BodyPartRecord)) { lookMode = LookMode.BodyPart; } else { if (!typeof(IExposable).IsAssignableFrom(typeof(T)) || typeof(ILoadReferenceable).IsAssignableFrom(typeof(T))) { Log.Error("LookList call with a list of " + typeof(T) + " must have lookMode set explicitly."); return; } lookMode = LookMode.Deep; } } if (Scribe.EnterNode(label)) { try { if (Scribe.mode == LoadSaveMode.Saving) { if (list == null) { Scribe.saver.WriteAttribute("IsNull", "True"); } else { foreach (T item8 in list) { switch (lookMode) { case LookMode.Value: { T value5 = item8; Scribe_Values.Look(ref value5, "li", default(T), forceSave: true); break; } case LookMode.LocalTargetInfo: { LocalTargetInfo value4 = (LocalTargetInfo)(object)item8; Scribe_TargetInfo.Look(ref value4, saveDestroyedThings, "li"); break; } case LookMode.TargetInfo: { TargetInfo value3 = (TargetInfo)(object)item8; Scribe_TargetInfo.Look(ref value3, saveDestroyedThings, "li"); break; } case LookMode.GlobalTargetInfo: { GlobalTargetInfo value2 = (GlobalTargetInfo)(object)item8; Scribe_TargetInfo.Look(ref value2, saveDestroyedThings, "li"); break; } case LookMode.Def: { Def value = (Def)(object)item8; Scribe_Defs.Look(ref value, "li"); break; } case LookMode.BodyPart: { BodyPartRecord part = (BodyPartRecord)(object)item8; Scribe_BodyParts.Look(ref part, "li"); break; } case LookMode.Deep: { T target = item8; Scribe_Deep.Look(ref target, saveDestroyedThings, "li", ctorArgs); break; } case LookMode.Reference: { ILoadReferenceable refee = (ILoadReferenceable)(object)item8; Scribe_References.Look(ref refee, "li", saveDestroyedThings); break; } } } } } else if (Scribe.mode == LoadSaveMode.LoadingVars) { XmlNode curXmlParent = Scribe.loader.curXmlParent; XmlAttribute xmlAttribute = curXmlParent.Attributes["IsNull"]; if (xmlAttribute == null || !(xmlAttribute.Value.ToLower() == "true")) { switch (lookMode) { case LookMode.Value: { list = new List <T>(curXmlParent.ChildNodes.Count); IEnumerator enumerator3 = curXmlParent.ChildNodes.GetEnumerator(); try { while (enumerator3.MoveNext()) { XmlNode subNode = (XmlNode)enumerator3.Current; T item = ScribeExtractor.ValueFromNode(subNode, default(T)); list.Add(item); } } finally { IDisposable disposable2; if ((disposable2 = (enumerator3 as IDisposable)) != null) { disposable2.Dispose(); } } break; } case LookMode.Deep: { list = new List <T>(curXmlParent.ChildNodes.Count); IEnumerator enumerator9 = curXmlParent.ChildNodes.GetEnumerator(); try { while (enumerator9.MoveNext()) { XmlNode subNode3 = (XmlNode)enumerator9.Current; T item7 = ScribeExtractor.SaveableFromNode <T>(subNode3, ctorArgs); list.Add(item7); } } finally { IDisposable disposable8; if ((disposable8 = (enumerator9 as IDisposable)) != null) { disposable8.Dispose(); } } break; } case LookMode.Def: { list = new List <T>(curXmlParent.ChildNodes.Count); IEnumerator enumerator8 = curXmlParent.ChildNodes.GetEnumerator(); try { while (enumerator8.MoveNext()) { XmlNode subNode2 = (XmlNode)enumerator8.Current; T item6 = ScribeExtractor.DefFromNodeUnsafe <T>(subNode2); list.Add(item6); } } finally { IDisposable disposable7; if ((disposable7 = (enumerator8 as IDisposable)) != null) { disposable7.Dispose(); } } break; } case LookMode.BodyPart: { list = new List <T>(curXmlParent.ChildNodes.Count); int num4 = 0; IEnumerator enumerator7 = curXmlParent.ChildNodes.GetEnumerator(); try { while (enumerator7.MoveNext()) { XmlNode node4 = (XmlNode)enumerator7.Current; T item5 = (T)(object)ScribeExtractor.BodyPartFromNode(node4, num4.ToString(), null); list.Add(item5); num4++; } } finally { IDisposable disposable6; if ((disposable6 = (enumerator7 as IDisposable)) != null) { disposable6.Dispose(); } } break; } case LookMode.LocalTargetInfo: { list = new List <T>(curXmlParent.ChildNodes.Count); int num3 = 0; IEnumerator enumerator6 = curXmlParent.ChildNodes.GetEnumerator(); try { while (enumerator6.MoveNext()) { XmlNode node3 = (XmlNode)enumerator6.Current; LocalTargetInfo localTargetInfo = ScribeExtractor.LocalTargetInfoFromNode(node3, num3.ToString(), LocalTargetInfo.Invalid); T item4 = (T)(object)localTargetInfo; list.Add(item4); num3++; } } finally { IDisposable disposable5; if ((disposable5 = (enumerator6 as IDisposable)) != null) { disposable5.Dispose(); } } break; } case LookMode.TargetInfo: { list = new List <T>(curXmlParent.ChildNodes.Count); int num2 = 0; IEnumerator enumerator5 = curXmlParent.ChildNodes.GetEnumerator(); try { while (enumerator5.MoveNext()) { XmlNode node2 = (XmlNode)enumerator5.Current; TargetInfo targetInfo = ScribeExtractor.TargetInfoFromNode(node2, num2.ToString(), TargetInfo.Invalid); T item3 = (T)(object)targetInfo; list.Add(item3); num2++; } } finally { IDisposable disposable4; if ((disposable4 = (enumerator5 as IDisposable)) != null) { disposable4.Dispose(); } } break; } case LookMode.GlobalTargetInfo: { list = new List <T>(curXmlParent.ChildNodes.Count); int num = 0; IEnumerator enumerator4 = curXmlParent.ChildNodes.GetEnumerator(); try { while (enumerator4.MoveNext()) { XmlNode node = (XmlNode)enumerator4.Current; GlobalTargetInfo globalTargetInfo = ScribeExtractor.GlobalTargetInfoFromNode(node, num.ToString(), GlobalTargetInfo.Invalid); T item2 = (T)(object)globalTargetInfo; list.Add(item2); num++; } } finally { IDisposable disposable3; if ((disposable3 = (enumerator4 as IDisposable)) != null) { disposable3.Dispose(); } } break; } case LookMode.Reference: { List <string> list2 = new List <string>(curXmlParent.ChildNodes.Count); IEnumerator enumerator2 = curXmlParent.ChildNodes.GetEnumerator(); try { while (enumerator2.MoveNext()) { XmlNode xmlNode = (XmlNode)enumerator2.Current; list2.Add(xmlNode.InnerText); } } finally { IDisposable disposable; if ((disposable = (enumerator2 as IDisposable)) != null) { disposable.Dispose(); } } Scribe.loader.crossRefs.loadIDs.RegisterLoadIDListReadFromXml(list2, string.Empty); break; } } } else { list = null; } } else if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs) { switch (lookMode) { case LookMode.Reference: list = Scribe.loader.crossRefs.TakeResolvedRefList <T>(string.Empty); break; case LookMode.LocalTargetInfo: if (list != null) { for (int j = 0; j < list.Count; j++) { list[j] = (T)(object)ScribeExtractor.ResolveLocalTargetInfo((LocalTargetInfo)(object)list[j], j.ToString()); } } break; case LookMode.TargetInfo: if (list != null) { for (int k = 0; k < list.Count; k++) { list[k] = (T)(object)ScribeExtractor.ResolveTargetInfo((TargetInfo)(object)list[k], k.ToString()); } } break; case LookMode.GlobalTargetInfo: if (list != null) { for (int i = 0; i < list.Count; i++) { list[i] = (T)(object)ScribeExtractor.ResolveGlobalTargetInfo((GlobalTargetInfo)(object)list[i], i.ToString()); } } break; } } } finally { Scribe.ExitNode(); } } else if (Scribe.mode == LoadSaveMode.LoadingVars) { if (lookMode == LookMode.Reference) { Scribe.loader.crossRefs.loadIDs.RegisterLoadIDListReadFromXml(null, label); } list = null; } }
public override void PostExposeData(object obj) { if (Scribe.mode == LoadSaveMode.LoadingVars) { Game game = obj as Game; if (game != null && game.battleLog == null) { game.battleLog = new BattleLog(); } BattleLogEntry_MeleeCombat battleLogEntry_MeleeCombat = obj as BattleLogEntry_MeleeCombat; if (battleLogEntry_MeleeCombat != null) { if (battleLogEntry_MeleeCombat.RuleDef == null) { RulePackDef value = null; RulePackDef value2 = null; Scribe_Defs.Look(ref value, "outcomeRuleDef"); Scribe_Defs.Look(ref value2, "maneuverRuleDef"); if (value != null && value2 != null) { foreach (RulePackDef item in DefDatabase <RulePackDef> .AllDefsListForReading) { if (!item.include.NullOrEmpty() && item.include.Count == 2 && ((item.include[0] == value && item.include[1] == value2) || (item.include[1] == value && item.include[0] == value2))) { battleLogEntry_MeleeCombat.RuleDef = item; break; } } } } if (battleLogEntry_MeleeCombat.def == null) { battleLogEntry_MeleeCombat.def = LogEntryDefOf.MeleeAttack; } } } if (Scribe.mode == LoadSaveMode.PostLoadInit) { Map map = obj as Map; if (map != null && map.pawnDestinationReservationManager == null) { map.pawnDestinationReservationManager = new PawnDestinationReservationManager(); } Pawn pawn = obj as Pawn; if (pawn != null && pawn.Spawned && pawn.rotationTracker == null) { pawn.rotationTracker = new Pawn_RotationTracker(pawn); } Pawn_MindState pawn_MindState = obj as Pawn_MindState; if (pawn_MindState != null && pawn_MindState.inspirationHandler == null) { pawn_MindState.inspirationHandler = new InspirationHandler(pawn_MindState.pawn); } ImportantPawnComp importantPawnComp = obj as ImportantPawnComp; if (importantPawnComp != null && importantPawnComp.pawn == null) { importantPawnComp.pawn = new ThingOwner <Pawn>(importantPawnComp, oneStackOnly: true); } Pawn_RecordsTracker pawn_RecordsTracker = obj as Pawn_RecordsTracker; if (pawn_RecordsTracker != null && Find.TaleManager.AnyTaleConcerns(pawn_RecordsTracker.pawn)) { pawn_RecordsTracker.AccumulateStoryEvent(StoryEventDefOf.TaleCreated); } WorldPawns worldPawns = obj as WorldPawns; if (worldPawns != null && worldPawns.gc == null) { worldPawns.gc = new WorldPawnGC(); } GameCondition gameCondition = obj as GameCondition; if (gameCondition != null && !gameCondition.Permanent && gameCondition.Duration > 1000000000) { gameCondition.Permanent = true; } Building_TurretGun building_TurretGun = obj as Building_TurretGun; if (building_TurretGun != null && building_TurretGun.gun == null) { building_TurretGun.MakeGun(); } } }
public override void ExposeData() { base.ExposeData(); Scribe_Defs.Look(ref itemUsed, "itemUsed"); }
public void ExposeData() { Scribe_Values.Look(ref prioritizedCell, "prioritizedCell"); Scribe_Defs.Look(ref prioritizedWorkType, "prioritizedWorkType"); Scribe_Values.Look(ref prioritizeTick, "prioritizeTick", 0); }
private static void LookInternalDef <T>(ref T obj, string label, LookMode lookMode) where T : Def, new() { Scribe_Defs.Look(ref obj, label); }
public void ExposeData() { Scribe_Defs.Look <ThingDef>(ref this.thingDef, "thingDef"); Scribe_Values.Look <IntRange>(ref this.countRange, "countRange", default(IntRange), false); }
public void ExposeData() { Scribe_Defs.Look(ref thingDef, "thingDef"); Scribe_Values.Look(ref count, "count", 1); }
public virtual void ExposeData() { Scribe_Values.Look <int>(ref this.ticksAbs, "ticksAbs", 0, false); Scribe_Values.Look <int>(ref this.logID, "logID", 0, false); Scribe_Defs.Look <LogEntryDef>(ref this.def, "def"); }
public void ExposeData() { Scribe_Defs.Look <ThingDef>(ref this.thingDef, "thingDef"); Scribe_Values.Look <int>(ref this.count, "count", 1, false); }
public void ExposeData() { Scribe_Defs.Look(ref hediffDef, "hediffDef"); Scribe_Defs.Look(ref source, "source"); Scribe_Values.Look(ref immunity, "immunity", 0f); }