diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll index a714baac..7ee2c616 100644 Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/MCP/vector_cache/knowledge_cache.json b/MCP/vector_cache/knowledge_cache.json index 38282d29..aab11e09 100644 --- a/MCP/vector_cache/knowledge_cache.json +++ b/MCP/vector_cache/knowledge_cache.json @@ -5173,5 +5173,1041 @@ ], "result": "--- 结果 1 (相似度: 1.000) ---\n文件路径: C:\\Steam\\steamapps\\common\\RimWorld\\Data\\dll1.6\\Verse\\Map.txt\n\npublic sealed class Map : IIncidentTarget, ILoadReferenceable, IThingHolder, IExposable, IDisposable\n{\n\tpublic MapFileCompressor compressor;\n\n\tprivate List loadedFullThings;\n\n\tpublic MapGeneratorDef generatorDef;\n\n\tpublic int uniqueID = -1;\n\n\tpublic int generationTick;\n\n\tpublic bool wasSpawnedViaGravShipLanding;\n\n\tprivate Color? fogOfWarColor;\n\n\tprivate OrbitalDebrisDef orbitalDebris;\n\n\tprivate int generatedId;\n\n\tpublic MapInfo info = new MapInfo();\n\n\tpublic MapEvents events;\n\n\tpublic List components = new List();\n\n\tpublic ThingOwner spawnedThings;\n\n\tpublic CellIndices cellIndices;\n\n\tpublic ListerThings listerThings;\n\n\tpublic ListerBuildings listerBuildings;\n\n\tpublic MapPawns mapPawns;\n\n\tpublic DynamicDrawManager dynamicDrawManager;\n\n\tpublic MapDrawer mapDrawer;\n\n\tpublic PawnDestinationReservationManager pawnDestinationReservationManager;\n\n\tpublic TooltipGiverList tooltipGiverList;\n\n\tpublic ReservationManager reservationManager;\n\n\tpublic EnrouteManager enrouteManager;\n\n\tpublic PhysicalInteractionReservationManager physicalInteractionReservationManager;\n\n\tpublic DesignationManager designationManager;\n\n\tpublic LordManager lordManager;\n\n\tpublic PassingShipManager passingShipManager;\n\n\tpublic HaulDestinationManager haulDestinationManager;\n\n\tpublic DebugCellDrawer debugDrawer;\n\n\tpublic GameConditionManager gameConditionManager;\n\n\tpublic WeatherManager weatherManager;\n\n\tpublic ZoneManager zoneManager;\n\n\tpublic PlanManager planManager;\n\n\tpublic ResourceCounter resourceCounter;\n\n\tpublic MapTemperature mapTemperature;\n\n\tpublic TemperatureVacuumCache TemperatureVacuumCache;\n\n\tpublic AreaManager areaManager;\n\n\tpublic AttackTargetsCache attackTargetsCache;\n\n\tpublic AttackTargetReservationManager attackTargetReservationManager;\n\n\tpublic VoluntarilyJoinableLordsStarter lordsStarter;\n\n\tpublic FleckManager flecks;\n\n\tpublic DeferredSpawner deferredSpawner;\n\n\tpublic ThingGrid thingGrid;\n\n\tpublic CoverGrid coverGrid;\n\n\tpublic EdificeGrid edificeGrid;\n\n\tpublic BlueprintGrid blueprintGrid;\n\n\tpublic FogGrid fogGrid;\n\n\tpublic RegionGrid regionGrid;\n\n\tpublic GlowGrid glowGrid;\n\n\tpublic TerrainGrid terrainGrid;\n\n\tpublic Pathing pathing;\n\n\tpublic RoofGrid roofGrid;\n\n\tpublic FertilityGrid fertilityGrid;\n\n\tpublic SnowGrid snowGrid;\n\n\tpublic DeepResourceGrid deepResourceGrid;\n\n\tpublic ExitMapGrid exitMapGrid;\n\n\tpublic AvoidGrid avoidGrid;\n\n\tpublic GasGrid gasGrid;\n\n\tpublic PollutionGrid pollutionGrid;\n\n\tpublic SubstructureGrid substructureGrid;\n\n\tpublic WaterBodyTracker waterBodyTracker;\n\n\tpublic SandGrid sandGrid;\n\n\tpublic LinkGrid linkGrid;\n\n\tpublic PowerNetManager powerNetManager;\n\n\tpublic PowerNetGrid powerNetGrid;\n\n\tpublic RegionMaker regionMaker;\n\n\tpublic PathFinder pathFinder;\n\n\tpublic PawnPathPool pawnPathPool;\n\n\tpublic RegionAndRoomUpdater regionAndRoomUpdater;\n\n\tpublic RegionLinkDatabase regionLinkDatabase;\n\n\tpublic MoteCounter moteCounter;\n\n\tpublic GatherSpotLister gatherSpotLister;\n\n\tpublic WindManager windManager;\n\n\tpublic ListerBuildingsRepairable listerBuildingsRepairable;\n\n\tpublic ListerHaulables listerHaulables;\n\n\tpublic ListerMergeables listerMergeables;\n\n\tpublic ListerArtificialBuildingsForMeditation listerArtificialBuildingsForMeditation;\n\n\tpublic ListerBuldingOfDefInProximity listerBuldingOfDefInProximity;\n\n\tpublic ListerBuildingWithTagInProximity listerBuildingWithTagInProximity;\n\n\tpublic ListerFilthInHomeArea listerFilthInHomeArea;\n\n\tpublic Reachability reachability;\n\n\tpublic ItemAvailability itemAvailability;\n\n\tpublic AutoBuildRoofAreaSetter autoBuildRoofAreaSetter;\n\n\tpublic RoofCollapseBufferResolver roofCollapseBufferResolver;\n\n\tpublic RoofCollapseBuffer roofCollapseBuffer;\n\n\tpublic WildAnimalSpawner wildAnimalSpawner;\n\n\tpublic WildPlantSpawner wildPlantSpawner;\n\n\tpublic SteadyEnvironmentEffects steadyEnvironmentEffects;\n\n\tpublic TempTerrainManager tempTerrain;\n\n\tpublic FreezeManager freezeManager;\n\n\tpublic SkyManager skyManager;\n\n\tpublic OverlayDrawer overlayDrawer;\n\n\tpublic FloodFiller floodFiller;\n\n\tpublic WeatherDecider weatherDecider;\n\n\tpublic FireWatcher fireWatcher;\n\n\tpublic DangerWatcher dangerWatcher;\n\n\tpublic DamageWatcher damageWatcher;\n\n\tpublic StrengthWatcher strengthWatcher;\n\n\tpublic WealthWatcher wealthWatcher;\n\n\tpublic RegionDirtyer regionDirtyer;\n\n\tpublic MapCellsInRandomOrder cellsInRandomOrder;\n\n\tpublic RememberedCameraPos rememberedCameraPos;\n\n\tpublic MineStrikeManager mineStrikeManager;\n\n\tpublic StoryState storyState;\n\n\tpublic RoadInfo roadInfo;\n\n\tpublic WaterInfo waterInfo;\n\n\tpublic RetainedCaravanData retainedCaravanData;\n\n\tpublic TemporaryThingDrawer temporaryThingDrawer;\n\n\tpublic AnimalPenManager animalPenManager;\n\n\tpublic MapPlantGrowthRateCalculator plantGrowthRateCalculator;\n\n\tpublic AutoSlaughterManager autoSlaughterManager;\n\n\tpublic TreeDestructionTracker treeDestructionTracker;\n\n\tpublic StorageGroupManager storageGroups;\n\n\tpublic EffecterMaintainer effecterMaintainer;\n\n\tpublic PostTickVisuals postTickVisuals;\n\n\tpublic List layoutStructureSketches = new List();\n\n\tpublic ThingListChangedCallbacks thingListChangedCallbacks = new ThingListChangedCallbacks();\n\n\tpublic List landingBlockers = new List();\n\n\tpublic Tile pocketTileInfo;\n\n\tpublic const string ThingSaveKey = \"thing\";\n\n\t[TweakValue(\"Graphics_Shadow\", 0f, 100f)]\n\tprivate static bool AlwaysRedrawShadows;\n\n\tprivate MixedBiomeMapComponent mixedBiomeComp;\n\n\tpublic int Index => Find.Maps.IndexOf(this);\n\n\tpublic IntVec3 Size => info.Size;\n\n\tpublic IntVec3 Center => new IntVec3(Size.x / 2, 0, Size.z / 2);\n\n\tpublic Faction ParentFaction => info.parent?.Faction;\n\n\tpublic int Area => Size.x * Size.z;\n\n\tpublic IThingHolder ParentHolder => info.parent;\n\n\tpublic bool DrawMapClippers => !generatorDef.disableMapClippers;\n\n\tpublic bool CanEverExit\n\t{\n\t\tget\n\t\t{\n\t\t\tif (!info.isPocketMap)\n\t\t\t{\n\t\t\t\treturn Biome.canExitMap;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic Color? FogOfWarColor\n\t{\n\t\tget\n\t\t{\n\t\t\treturn fogOfWarColor ?? Biome.fogOfWarColor;\n\t\t}\n\t\tset\n\t\t{\n\t\t\tfogOfWarColor = value;\n\t\t}\n\t}\n\n\tpublic OrbitalDebrisDef OrbitalDebris\n\t{\n\t\tget\n\t\t{\n\t\t\treturn orbitalDebris ?? Biome.orbitalDebris;\n\t\t}\n\t\tset\n\t\t{\n\t\t\torbitalDebris = value;\n\t\t}\n\t}\n\n\tpublic Material MapEdgeMaterial\n\t{\n\t\tget\n\t\t{\n\t\t\tif (ModsConfig.AnomalyActive && generatorDef == MapGeneratorDefOf.MetalHell)\n\t\t\t{\n\t\t\t\treturn MapEdgeClipDrawer.ClipMatMetalhell;\n\t\t\t}\n\t\t\tWorldObject parent = Parent;\n\t\t\tif (parent != null && parent.def.MapEdgeMaterial != null)\n\t\t\t{\n\t\t\t\treturn parent.def.MapEdgeMaterial;\n\t\t\t}\n\t\t\treturn MapEdgeClipDrawer.ClipMat;\n\t\t}\n\t}\n\n\tpublic bool Disposed { get; private set; }\n\n\tpublic IEnumerable AllCells\n\t{\n\t\tget\n\t\t{\n\t\t\tfor (int z = 0; z < Size.z; z++)\n\t\t\t{\n\t\t\t\tfor (int y = 0; y < Size.y; y++)\n\t\t\t\t{\n\t\t\t\t\tfor (int x = 0; x < Size.x; x++)\n\t\t\t\t\t{\n\t\t\t\t\t\tyield return new IntVec3(x, y, z);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic bool IsPlayerHome\n\t{\n\t\tget\n\t\t{\n\t\t\tif (!wasSpawnedViaGravShipLanding)\n\t\t\t{\n\t\t\t\tif (info?.parent != null && info.parent.Faction == Faction.OfPlayer)\n\t\t\t\t{\n\t\t\t\t\treturn info.parent.def.canBePlayerHome;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tpublic bool TreatAsPlayerHomeForThreatPoints\n\t{\n\t\tget\n\t\t{\n\t\t\tif (IsPlayerHome)\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (info.parent != null && info.parent.def.treatAsPlayerHome)\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic bool IsTempIncidentMap => info.parent.def.isTempIncidentMapOwner;\n\n\tpublic PlanetTile Tile => info.Tile;\n\n\tpublic Tile TileInfo\n\t{\n\t\tget\n\t\t{\n\t\t\tif (!IsPocketMap)\n\t\t\t{\n\t\t\t\treturn Find.WorldGrid[Tile];\n\t\t\t}\n\t\t\treturn pocketTileInfo;\n\t\t}\n\t}\n\n\tpublic BiomeDef Biome => TileInfo.PrimaryBiome;\n\n\tpublic IEnumerable Biomes => TileInfo.Biomes;\n\n\tpublic MixedBiomeMapComponent MixedBiomeComp => mixedBiomeComp ?? (mixedBiomeComp = GetComponent());\n\n\tpublic bool IsStartingMap => Find.GameInfo.startingTile == Tile;\n\n\tpublic bool IsPocketMap => info.isPocketMap;\n\n\tpublic StoryState StoryState => storyState;\n\n\tpublic GameConditionManager GameConditionManager => gameConditionManager;\n\n\tpublic float PlayerWealthForStoryteller\n\t{\n\t\tget\n\t\t{\n\t\t\tif (TreatAsPlayerHomeForThreatPoints)\n\t\t\t{\n\t\t\t\tif (Find.Storyteller.difficulty.fixedWealthMode)\n\t\t\t\t{\n\t\t\t\t\treturn StorytellerUtility.FixedWealthModeMapWealthFromTimeCurve.Evaluate(AgeInDays * Find.Storyteller.difficulty.fixedWealthTimeFactor);\n\t\t\t\t}\n\t\t\t\treturn wealthWatcher.WealthItems + wealthWatcher.WealthBuildings * 0.5f + wealthWatcher.WealthPawns;\n\t\t\t}\n\t\t\tfloat num = 0f;\n\t\t\tforeach (Pawn item in mapPawns.PawnsInFaction(Faction.OfPlayer))\n\t\t\t{\n\t\t\t\tif (item.IsFreeColonist)\n\t\t\t\t{\n\t\t\t\t\tnum += WealthWatcher.GetEquipmentApparelAndInventoryWealth(item);\n\t\t\t\t}\n\t\t\t\tif (item.IsAnimal)\n\t\t\t\t{\n\t\t\t\t\tnum += item.MarketValue;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn num;\n\t\t}\n\t}\n\n\tpublic IEnumerable PlayerPawnsForStoryteller => mapPawns.PawnsInFaction(Faction.OfPlayer);\n\n\tpublic FloatRange IncidentPointsRandomFactorRange => FloatRange.One;\n\n\tpublic MapParent Parent => info.parent;\n\n\tpublic PocketMapParent PocketMapParent\n\t{\n\t\tget\n\t\t{\n\t\t\tif (!IsPocketMap)\n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn Parent as PocketMapParent;\n\t\t}\n\t}\n\n\tpublic IEnumerable ChildPocketMaps\n\t{\n\t\tget\n\t\t{\n\t\t\tforeach (PocketMapParent pocketMap in Find.World.pocketMaps)\n\t\t\t{\n\t\t\t\tif (pocketMap.sourceMap == this)\n\t\t\t\t{\n\t\t\t\t\tyield return pocketMap.Map;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic float AgeInDays => (float)(Find.TickManager.TicksGame - generationTick) / 60000f;\n\n\tpublic int NextGenSeed => HashCode.Combine(TileInfo.tile.Valid ? TileInfo.tile.GetHashCode() : uniqueID, generatedId++, Find.World.info.Seed);\n\n\tpublic int ConstantRandSeed => uniqueID ^ 0xFDA252;\n\n\tpublic IEnumerator GetEnumerator()\n\t{\n\t\tforeach (IntVec3 allCell in AllCells)\n\t\t{\n\t\t\tyield return allCell;\n\t\t}\n\t}\n\n\tpublic IEnumerable IncidentTargetTags()\n\t{\n\t\treturn info.parent?.IncidentTargetTags() ?? Enumerable.Empty();\n\t}\n\n\tpublic void ConstructComponents()\n\t{\n\t\tspawnedThings = new ThingOwner(this);\n\t\tcellIndices = new CellIndices(this);\n\t\tlisterThings = new ListerThings(ListerThingsUse.Global, thingListChangedCallbacks);\n\t\tlisterBuildings = new ListerBuildings();\n\t\tmapPawns = new MapPawns(this);\n\t\tdynamicDrawManager = new DynamicDrawManager(this);\n\t\tmapDrawer = new MapDrawer(this);\n\t\ttooltipGiverList = new TooltipGiverList();\n\t\tpawnDestinationReservationManager = new PawnDestinationReservationManager();\n\t\treservationManager = new ReservationManager(this);\n\t\tenrouteManager = new EnrouteManager(this);\n\t\tphysicalInteractionReservationManager = new PhysicalInteractionReservationManager();\n\t\tdesignationManager = new DesignationManager(this);\n\t\tlordManager = new LordManager(this);\n\t\tdebugDrawer = new DebugCellDrawer();\n\t\tpassingShipManager = new PassingShipManager(this);\n\t\thaulDestinationManager = new HaulDestinationManager(this);\n\t\tgameConditionManager = new GameConditionManager(this);\n\t\tweatherManager = new WeatherManager(this);\n\t\tzoneManager = new ZoneManager(this);\n\t\tplanManager = new PlanManager(this);\n\t\tresourceCounter = new ResourceCounter(this);\n\t\tmapTemperature = new MapTemperature(this);\n\t\tTemperatureVacuumCache = new TemperatureVacuumCache(this);\n\t\tareaManager = new AreaManager(this);\n\t\tattackTargetsCache = new AttackTargetsCache(this);\n\t\tattackTargetReservationManager = new AttackTargetReservationManager(this);\n\t\tlordsStarter = new VoluntarilyJoinableLordsStarter(this);\n\t\tflecks = new FleckManager(this);\n\t\tdeferredSpawner = new DeferredSpawner(this);\n\t\tthingGrid = new ThingGrid(this);\n\t\tcoverGrid = new CoverGrid(this);\n\t\tedificeGrid = new EdificeGrid(this);\n\t\tblueprintGrid = new BlueprintGrid(this);\n\t\tfogGrid = new FogGrid(this);\n\t\tglowGrid = new GlowGrid(this);\n\t\tregionGrid = new RegionGrid(this);\n\t\tterrainGrid = new TerrainGrid(this);\n\t\tpathing = new Pathing(this);\n\t\troofGrid = new RoofGrid(this);\n\t\tfertilityGrid = new FertilityGrid(this);\n\t\tsnowGrid = new SnowGrid(this);\n\t\tgasGrid = new GasGrid(this);\n\t\tpollutionGrid = new PollutionGrid(this);\n\t\tdeepResourceGrid = new DeepResourceGrid(this);\n\t\texitMapGrid = new ExitMapGrid(this);\n\t\tavoidGrid = new AvoidGrid(this);\n\t\tlinkGrid = new LinkGrid(this);\n\t\tpowerNetManager = new PowerNetManager(this);\n\t\tpowerNetGrid = new PowerNetGrid(this);\n\t\tregionMaker = new RegionMaker(this);\n\t\tpathFinder = new PathFinder(this);\n\t\tpawnPathPool = new PawnPathPool(this);\n\t\tregionAndRoomUpdater = new RegionAndRoomUpdater(this);\n\t\tregionLinkDatabase = new RegionLinkDatabase();\n\t\tmoteCounter = new MoteCounter();\n\t\tgatherSpotLister = new GatherSpotLister();\n\t\twindManager = new WindManager(this);\n\t\tlisterBuildingsRepairable = new ListerBuildingsRepairable();\n\t\tlisterHaulables = new ListerHaulables(this);\n\t\tlisterMergeables = new ListerMergeables(this);\n\t\tlisterFilthInHomeArea = new ListerFilthInHomeArea(this);\n\t\tlisterArtificialBuildingsForMeditation = new ListerArtificialBuildingsForMeditation(this);\n\t\tlisterBuldingOfDefInProximity = new ListerBuldingOfDefInProximity(this);\n\t\tlisterBuildingWithTagInProximity = new ListerBuildingWithTagInProximity(this);\n\t\treachability = new Reachability(this);\n\t\titemAvailability = new ItemAvailability(this);\n\t\tautoBuildRoofAreaSetter = new AutoBuildRoofAreaSetter(this);\n\t\troofCollapseBufferResolver = new RoofCollapseBufferResolver(this);\n\t\troofCollapseBuffer = new RoofCollapseBuffer();\n\t\twildAnimalSpawner = new WildAnimalSpawner(this);\n\t\twildPlantSpawner = new WildPlantSpawner(this);\n\t\tsteadyEnvironmentEffects = new SteadyEnvironmentEffects(this);\n\t\ttempTerrain = new TempTerrainManager(this);\n\t\tskyManager = new SkyManager(this);\n\t\toverlayDrawer = new OverlayDrawer();\n\t\tfloodFiller = new FloodFiller(this);\n\t\tweatherDecider = new WeatherDecider(this);\n\t\tfireWatcher = new FireWatcher(this);\n\t\tdangerWatcher = new DangerWatcher(this);\n\t\tdamageWatcher = new DamageWatcher();\n\t\tstrengthWatcher = new StrengthWatcher(this);\n\t\twealthWatcher = new WealthWatcher(this);\n\t\tregionDirtyer = new RegionDirtyer(this);\n\t\tcellsInRandomOrder = new MapCellsInRandomOrder(this);\n\t\trememberedCameraPos = new RememberedCameraPos(this);\n\t\tmineStrikeManager = new MineStrikeManager();\n\t\tstoryState = new StoryState(this);\n\t\tretainedCaravanData = new RetainedCaravanData(this);\n\t\ttemporaryThingDrawer = new TemporaryThingDrawer();\n\t\tanimalPenManager = new AnimalPenManager(this);\n\t\tplantGrowthRateCalculator = new MapPlantGrowthRateCalculator();\n\t\tautoSlaughterManager = new AutoSlaughterManager(this);\n\t\ttreeDestructionTracker = new TreeDestructionTracker(this);\n\t\tstorageGroups = new StorageGroupManager(this);\n\t\teffecterMaintainer = new EffecterMaintainer(this);\n\t\tpostTickVisuals = new PostTickVisuals(this);\n\t\tif (ModsConfig.OdysseyActive)\n\t\t{\n\t\t\tsubstructureGrid = new SubstructureGrid(this);\n\t\t\twaterBodyTracker = new WaterBodyTracker(this);\n\t\t\tfreezeManager = new FreezeManager(this);\n\t\t\tsandGrid = new SandGrid(this);\n\t\t}\n\t\tcomponents.Clear();\n\t\tFillComponents();\n\t}\n\n\tpublic void ExposeData()\n\t{\n\t\tif (Scribe.mode == LoadSaveMode.LoadingVars)\n\t\t{\n\t\t\tevents = new MapEvents(this);\n\t\t}\n\t\tScribe_Values.Look(ref uniqueID, \"uniqueID\", -1);\n\t\tScribe_Values.Look(ref generationTick, \"generationTick\", 0);\n\t\tScribe_Values.Look(ref wasSpawnedViaGravShipLanding, \"wasSpawnedViaGravShipLanding\", defaultValue: false);\n\t\tScribe_Values.Look(ref fogOfWarColor, \"fogOfWarColor\");\n\t\tScribe_Values.Look(ref generatedId, \"generatedId\", 0);\n\t\tScribe_Defs.Look(ref orbitalDebris, \"orbitalDebris\");\n\t\tScribe_Defs.Look(ref generatorDef, \"generatorDef\");\n\t\tScribe_Deep.Look(ref pocketTileInfo, \"pocketTileInfo\");\n\t\tScribe_Deep.Look(ref info, \"mapInfo\");\n\t\tScribe_Collections.Look(ref layoutStructureSketches, \"layoutStructureSketches\", LookMode.Deep);\n\t\tScribe_Collections.Look(ref landingBlockers, \"landingBlockers\", LookMode.Undefined);\n\t\tif (Scribe.mode == LoadSaveMode.Saving)\n\t\t{\n\t\t\tcompressor = new MapFileCompressor(this);\n\t\t\tcompressor.BuildCompressedString();\n\t\t\tExposeComponents();\n\t\t\tcompressor.ExposeData();\n\t\t\tHashSet hashSet = new HashSet();\n\t\t\tif (Scribe.EnterNode(\"things\"))\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tforeach (Thing allThing in listerThings.AllThings)\n\t\t\t\t\t{\n\t\t\t\t\t\ttry\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (allThing.def.isSaveable && !allThing.IsSaveCompressible())\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (!hashSet.Add(allThing.ThingID))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tLog.Error(\"Saving Thing with already-used ID \" + allThing.ThingID);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\thashSet.Add(allThing.ThingID);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tThing target = allThing;\n\t\t\t\t\t\t\t\tScribe_Deep.Look(ref target, \"thing\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (OutOfMemoryException)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthrow;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (Exception arg)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tLog.Error($\"Exception saving {allThing}: {arg}\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfinally\n\t\t\t\t{\n\t\t\t\t\tScribe.ExitNode();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tLog.Error(\"Could not enter the things node while saving.\");\n\t\t\t}\n\t\t\tcompressor = null;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (Scribe.mode == LoadSaveMode.LoadingVars)\n\t\t\t{\n\t\t\t\tConstructComponents();\n\t\t\t\tregionAndRoomUpdater.Enabled = false;\n\t\t\t\tcompressor = new MapFileCompressor(this);\n\t\t\t}\n\t\t\telse if (Scribe.mode == LoadSaveMode.PostLoadInit && landingBlockers == null)\n\t\t\t{\n\t\t\t\tlandingBlockers = new List();\n\t\t\t}\n\t\t\tExposeComponents();\n\t\t\tDeepProfiler.Start(\"Load compressed things\");\n\t\t\tcompressor.ExposeData();\n\t\t\tDeepProfiler.End();\n\t\t\tDeepProfiler.Start(\"Load non-compressed things\");\n\t\t\tScribe_Collections.Look(ref loadedFullThings, \"things\", LookMode.Deep);\n\t\t\tDeepProfiler.End();\n\t\t}\n\t\tBackCompatibility.PostExposeData(this);\n\t}\n\n\tprivate void FillComponents()\n\t{\n\t\tcomponents.RemoveAll((MapComponent component) => component == null);\n\t\tforeach (Type item3 in typeof(MapComponent).AllSubclassesNonAbstract())\n\t\t{\n\t\t\tif (!typeof(CustomMapComponent).IsAssignableFrom(item3) && GetComponent(item3) == null)\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tMapComponent item = (MapComponent)Activator.CreateInstance(item3, this);\n\t\t\t\t\tcomponents.Add(item);\n\t\t\t\t}\n\t\t\t\tcatch (Exception ex)\n\t\t\t\t{\n\t\t\t\t\tLog.Error(\"Could not instantiate a MapComponent of type \" + item3?.ToString() + \": \" + ex);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (generatorDef?.customMapComponents != null)\n\t\t{\n\t\t\tforeach (Type customMapComponent in generatorDef.customMapComponents)\n\t\t\t{\n\t\t\t\tif (GetComponent(customMapComponent) == null)\n\t\t\t\t{\n\t\t\t\t\ttry\n\t\t\t\t\t{\n\t\t\t\t\t\tMapComponent item2 = (MapComponent)Activator.CreateInstance(customMapComponent, this);\n\t\t\t\t\t\tcomponents.Add(item2);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (Exception ex2)\n\t\t\t\t\t{\n\t\t\t\t\t\tLog.Error(\"Could not instantiate a MapComponent of type \" + customMapComponent?.ToString() + \": \" + ex2);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\troadInfo = GetComponent();\n\t\twaterInfo = GetComponent();\n\t}\n\n\tpublic void FinalizeLoading()\n\t{\n\t\tregionAndRoomUpdater.Enabled = true;\n\t\tList list = compressor.ThingsToSpawnAfterLoad().ToList();\n\t\tcompressor = null;\n\t\tDeepProfiler.Start(\"Merge compressed and non-compressed thing lists\");\n\t\tList list2 = new List(loadedFullThings.Count + list.Count);\n\t\tforeach (Thing item in loadedFullThings.Concat(list))\n\t\t{\n\t\t\tlist2.Add(item);\n\t\t}\n\t\tloadedFullThings.Clear();\n\t\tDeepProfiler.End();\n\t\tDeepProfiler.Start(\"Spawn everything into the map\");\n\t\tBackCompatibility.PreCheckSpawnBackCompatibleThingAfterLoading(this);\n\t\tforeach (Thing item2 in list2)\n\t\t{\n\t\t\tif (item2 is Building)\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif (!BackCompatibility.CheckSpawnBackCompatibleThingAfterLoading(item2, this))\n\t\t\t\t{\n\t\t\t\t\tGenSpawn.Spawn(item2, item2.Position, this, item2.Rotation, WipeMode.FullRefund, respawningAfterLoad: true);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (Exception ex)\n\t\t\t{\n\t\t\t\tLog.Error(\"Exception spawning loaded thing \" + item2.ToStringSafe() + \": \" + ex);\n\t\t\t}\n\t\t}\n\t\tforeach (Building item3 in from t in list2.OfType()\n\t\t\torderby t.def.size.Magnitude\n\t\t\tselect t)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tGenSpawn.SpawnBuildingAsPossible(item3, this, respawningAfterLoad: true);\n\t\t\t}\n\t\t\tcatch (Exception ex2)\n\t\t\t{\n\t\t\t\tLog.Error(\"Exception spawning loaded thing \" + item3.ToStringSafe() + \": \" + ex2);\n\t\t\t}\n\t\t}\n\t\tBackCompatibility.PostCheckSpawnBackCompatibleThingAfterLoading(this);\n\t\tDeepProfiler.End();\n\t\tFinalizeInit();\n\t}\n\n\tpublic void FinalizeInit()\n\t{\n\t\tDeepProfiler.Start(\"Finalize geometry\");\n\t\tpathing.RecalculateAllPerceivedPathCosts();\n\t\tregionAndRoomUpdater.Enabled = true;\n\t\tregionAndRoomUpdater.RebuildAllRegionsAndRooms();\n\t\tpowerNetManager.UpdatePowerNetsAndConnections_First();\n\t\tTemperatureVacuumCache.TemperatureVacuumSaveLoad.ApplyLoadedDataToRegions();\n\t\tavoidGrid.Regenerate();\n\t\tanimalPenManager.RebuildAllPens();\n\t\tplantGrowthRateCalculator.BuildFor(this);\n\t\tgasGrid.RecalculateEverHadGas();\n\t\tDeepProfiler.End();\n\t\tDeepProfiler.Start(\"Thing.PostMapInit()\");\n\t\tforeach (Thing item in listerThings.AllThings.ToList())\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\titem.PostMapInit();\n\t\t\t}\n\t\t\tcatch (Exception ex)\n\t\t\t{\n\t\t\t\tLog.Error(\"Error in PostMapInit() for \" + item.ToStringSafe() + \": \" + ex);\n\t\t\t}\n\t\t}\n\t\tDeepProfiler.End();\n\t\tDeepProfiler.Start(\"listerFilthInHomeArea.RebuildAll()\");\n\t\tlisterFilthInHomeArea.RebuildAll();\n\t\tDeepProfiler.End();\n\t\tif (ModsConfig.OdysseyActive)\n\t\t{\n\t\t\tGetComponent().SetDrawerDirty();\n\t\t}\n\t\tLongEventHandler.ExecuteWhenFinished(delegate\n\t\t{\n\t\t\tmapDrawer.RegenerateEverythingNow();\n\t\t});\n\t\tDeepProfiler.Start(\"resourceCounter.UpdateResourceCounts()\");\n\t\tresourceCounter.UpdateResourceCounts();\n\t\tDeepProfiler.End();\n\t\tDeepProfiler.Start(\"wealthWatcher.ForceRecount()\");\n\t\twealthWatcher.ForceRecount(allowDuringInit: true);\n\t\tDeepProfiler.End();\n\t\tif (ModsConfig.OdysseyActive)\n\t\t{\n\t\t\tusing (new ProfilerBlock(\"WaterBodyTracker.ConstructBodies()\"))\n\t\t\t{\n\t\t\t\twaterBodyTracker?.ConstructBodies();\n\t\t\t}\n\t\t}\n\t\tMapComponentUtility.FinalizeInit(this);\n\t\tLongEventHandler.ExecuteWhenFinished(delegate\n\t\t{\n\t\t\tFind.MusicManagerPlay.CheckTransitions();\n\t\t});\n\t}\n\n\tprivate void ExposeComponents()\n\t{\n\t\tScribe_Deep.Look(ref weatherManager, \"weatherManager\", this);\n\t\tScribe_Deep.Look(ref reservationManager, \"reservationManager\", this);\n\t\tScribe_Deep.Look(ref enrouteManager, \"enrouteManager\", this);\n\t\tScribe_Deep.Look(ref physicalInteractionReservationManager, \"physicalInteractionReservationManager\");\n\t\tScribe_Deep.Look(ref planManager, \"planManager\", this);\n\t\tScribe_Deep.Look(ref designationManager, \"designationManager\", this);\n\t\tScribe_Deep.Look(ref pawnDestinationReservationManager, \"pawnDestinationReservationManager\");\n\t\tScribe_Deep.Look(ref lordManager, \"lordManager\", this);\n\t\tScribe_Deep.Look(ref passingShipManager, \"visitorManager\", this);\n\t\tScribe_Deep.Look(ref gameConditionManager, \"gameConditionManager\", this);\n\t\tScribe_Deep.Look(ref fogGrid, \"fogGrid\", this);\n\t\tScribe_Deep.Look(ref roofGrid, \"roofGrid\", this);\n\t\tScribe_Deep.Look(ref terrainGrid, \"terrainGrid\", this);\n\t\tScribe_Deep.Look(ref zoneManager, \"zoneManager\", this);\n\t\tScribe_Deep.Look(ref TemperatureVacuumCache, \"temperatureCache\", this);\n\t\tScribe_Deep.Look(ref snowGrid, \"snowGrid\", this);\n\t\tScribe_Deep.Look(ref gasGrid, \"gasGrid\", this);\n\t\tScribe_Deep.Look(ref pollutionGrid, \"pollutionGrid\", this);\n\t\tScribe_Deep.Look(ref waterBodyTracker, \"waterBodyTracker\", this);\n\t\tScribe_Deep.Look(ref areaManager, \"areaManager\", this);\n\t\tScribe_Deep.Look(ref lordsStarter, \"lordsStarter\", this);\n\t\tScribe_Deep.Look(ref attackTargetReservationManager, \"attackTargetReservationManager\", this);\n\t\tScribe_Deep.Look(ref deepResourceGrid, \"deepResourceGrid\", this);\n\t\tScribe_Deep.Look(ref weatherDecider, \"weatherDecider\", this);\n\t\tScribe_Deep.Look(ref damageWatcher, \"damageWatcher\");\n\t\tScribe_Deep.Look(ref rememberedCameraPos, \"rememberedCameraPos\", this);\n\t\tScribe_Deep.Look(ref mineStrikeManager, \"mineStrikeManager\");\n\t\tScribe_Deep.Look(ref retainedCaravanData, \"retainedCaravanData\", this);\n\t\tScribe_Deep.Look(ref storyState, \"storyState\", this);\n\t\tScribe_Deep.Look(ref tempTerrain, \"tempTerrain\", this);\n\t\tScribe_Deep.Look(ref wildPlantSpawner, \"wildPlantSpawner\", this);\n\t\tScribe_Deep.Look(ref temporaryThingDrawer, \"temporaryThingDrawer\");\n\t\tScribe_Deep.Look(ref flecks, \"flecks\", this);\n\t\tScribe_Deep.Look(ref deferredSpawner, \"deferredSpawner\", this);\n\t\tScribe_Deep.Look(ref autoSlaughterManager, \"autoSlaughterManager\", this);\n\t\tScribe_Deep.Look(ref treeDestructionTracker, \"treeDestructionTracker\", this);\n\t\tScribe_Deep.Look(ref storageGroups, \"storageGroups\", this);\n\t\tScribe_Deep.Look(ref sandGrid, \"sandGrid\", this);\n\t\tScribe_Collections.Look(ref components, \"components\", LookMode.Deep, this);\n\t\tif (Scribe.mode == LoadSaveMode.PostLoadInit)\n\t\t{\n\t\t\tif (planManager == null)\n\t\t\t{\n\t\t\t\tplanManager = new PlanManager(this);\n\t\t\t}\n\t\t\tif (ModsConfig.BiotechActive && pollutionGrid == null)\n\t\t\t{\n\t\t\t\tpollutionGrid = new PollutionGrid(this);\n\t\t\t}\n\t\t\tif (ModsConfig.OdysseyActive)\n\t\t\t{\n\t\t\t\tif (sandGrid == null)\n\t\t\t\t{\n\t\t\t\t\tsandGrid = new SandGrid(this);\n\t\t\t\t}\n\t\t\t\tif (substructureGrid == null)\n\t\t\t\t{\n\t\t\t\t\tsubstructureGrid = new SubstructureGrid(this);\n\t\t\t\t}\n\t\t\t\tif (waterBodyTracker == null)\n\t\t\t\t{\n\t\t\t\t\twaterBodyTracker = new WaterBodyTracker(this);\n\t\t\t\t}\n\t\t\t\tif (freezeManager == null)\n\t\t\t\t{\n\t\t\t\t\tfreezeManager = new FreezeManager(this);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tFillComponents();\n\t\tBackCompatibility.PostExposeData(this);\n\t}\n\n\tpublic void MapPreTick()\n\t{\n\t\titemAvailability.Tick();\n\t\tlisterHaulables.ListerHaulablesTick();\n\t\ttry\n\t\t{\n\t\t\tautoBuildRoofAreaSetter.AutoBuildRoofAreaSetterTick_First();\n\t\t}\n\t\tcatch (Exception ex)\n\t\t{\n\t\t\tLog.Error(ex.ToString());\n\t\t}\n\t\troofCollapseBufferResolver.CollapseRoofsMarkedToCollapse();\n\t\twindManager.WindManagerTick();\n\t\ttry\n\t\t{\n\t\t\tmapTemperature.MapTemperatureTick();\n\t\t}\n\t\tcatch (Exception ex2)\n\t\t{\n\t\t\tLog.Error(ex2.ToString());\n\t\t}\n\t\ttemporaryThingDrawer.Tick();\n\t\ttry\n\t\t{\n\t\t\tpathFinder.PathFinderTick();\n\t\t}\n\t\tcatch (Exception ex3)\n\t\t{\n\t\t\tLog.Error(ex3.ToString());\n\t\t}\n\t}\n\n\tpublic void MapPostTick()\n\t{\n\t\ttry\n\t\t{\n\t\t\twildAnimalSpawner.WildAnimalSpawnerTick();\n\t\t}\n\t\tcatch (Exception ex)\n\t\t{\n\t\t\tLog.Error(ex.ToString());\n\t\t}\n\t\ttry\n\t\t{\n\t\t\twildPlantSpawner.WildPlantSpawnerTick();\n\t\t}\n\t\tcatch (Exception ex2)\n\t\t{\n\t\t\tLog.Error(ex2.ToString());\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tpowerNetManager.PowerNetsTick();\n\t\t}\n\t\tcatch (Exception ex3)\n\t\t{\n\t\t\tLog.Error(ex3.ToString());\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tsteadyEnvironmentEffects.SteadyEnvironmentEffectsTick();\n\t\t}\n\t\tcatch (Exception ex4)\n\t\t{\n\t\t\tLog.Error(ex4.ToString());\n\t\t}\n\t\ttry\n\t\t{\n\t\t\ttempTerrain.Tick();\n\t\t}\n\t\tcatch (Exception ex5)\n\t\t{\n\t\t\tLog.Error(ex5.ToString());\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tgasGrid.Tick();\n\t\t}\n\t\tcatch (Exception ex6)\n\t\t{\n\t\t\tLog.Error(ex6.ToString());\n\t\t}\n\t\tif (ModsConfig.BiotechActive)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tpollutionGrid.PollutionTick();\n\t\t\t}\n\t\t\tcatch (Exception ex7)\n\t\t\t{\n\t\t\t\tLog.Error(ex7.ToString());\n\t\t\t}\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tdeferredSpawner.DeferredSpawnerTick();\n\t\t}\n\t\tcatch (Exception ex8)\n\t\t{\n\t\t\tLog.Error(ex8.ToString());\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tlordManager.LordManagerTick();\n\t\t}\n\t\tcatch (Exception ex9)\n\t\t{\n\t\t\tLog.Error(ex9.ToString());\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tpassingShipManager.PassingShipManagerTick();\n\t\t}\n\t\tcatch (Exception ex10)\n\t\t{\n\t\t\tLog.Error(ex10.ToString());\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tdebugDrawer.DebugDrawerTick();\n\t\t}\n\t\tcatch (Exception ex11)\n\t\t{\n\t\t\tLog.Error(ex11.ToString());\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tlordsStarter.VoluntarilyJoinableLordsStarterTick();\n\t\t}\n\t\tcatch (Exception ex12)\n\t\t{\n\t\t\tLog.Error(ex12.ToString());\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tgameConditionManager.GameConditionManagerTick();\n\t\t}\n\t\tcatch (Exception ex13)\n\t\t{\n\t\t\tLog.Error(ex13.ToString());\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tweatherManager.WeatherManagerTick();\n\t\t}\n\t\tcatch (Exception ex14)\n\t\t{\n\t\t\tLog.Error(ex14.ToString());\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tresourceCounter.ResourceCounterTick();\n\t\t}\n\t\tcatch (Exception ex15)\n\t\t{\n\t\t\tLog.Error(ex15.ToString());\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tweatherDecider.WeatherDeciderTick();\n\t\t}\n\t\tcatch (Exception ex16)\n\t\t{\n\t\t\tLog.Error(ex16.ToString());\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tfireWatcher.FireWatcherTick();\n\t\t}\n\t\tcatch (Exception ex17)\n\t\t{\n\t\t\tLog.Error(ex17.ToString());\n\t\t}\n\t\tif (ModsConfig.OdysseyActive)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\twaterBodyTracker?.Tick();\n\t\t\t}\n\t\t\tcatch (Exception ex18)\n\t\t\t{\n\t\t\t\tLog.Error(ex18.ToString());\n\t\t\t}\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tflecks.FleckManagerTick();\n\t\t}\n\t\tcatch (Exception ex19)\n\t\t{\n\t\t\tLog.Error(ex19.ToString());\n\t\t}\n\t\ttry\n\t\t{\n\t\t\teffecterMaintainer.EffecterMaintainerTick();\n\t\t}\n\t\tcatch (Exception ex20)\n\t\t{\n\t\t\tLog.Error(ex20.ToString());\n\t\t}\n\t\tMapComponentUtility.MapComponentTick(this);\n\t\ttry\n\t\t{\n\t\t\tforeach (TileMutatorDef mutator in TileInfo.Mutators)\n\t\t\t{\n\t\t\t\tmutator.Worker?.Tick(this);\n\t\t\t}\n\t\t}\n\t\tcatch (Exception ex21)\n\t\t{\n\t\t\tLog.Error(ex21.ToString());\n\t\t}\n\t}\n\n\tpublic void MapUpdate()\n\t{\n\t\tif (Disposed)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\tbool drawingMap = WorldRendererUtility.DrawingMap;\n\t\tskyManager.SkyManagerUpdate();\n\t\tpowerNetManager.UpdatePowerNetsAndConnections_First();\n\t\tregionGrid.UpdateClean();\n\t\tregionAndRoomUpdater.TryRebuildDirtyRegionsAndRooms();\n\t\tglowGrid.GlowGridUpdate_First();\n\t\tlordManager.LordManagerUpdate();\n\t\tpostTickVisuals.ProcessPostTickVisuals();\n\t\tif (drawingMap && Find.CurrentMap == this)\n\t\t{\n\t\t\tif (AlwaysRedrawShadows)\n\t\t\t{\n\t\t\t\tmapDrawer.WholeMapChanged(MapMeshFlagDefOf.Things);\n\t\t\t}\n\t\t\tGlobalRendererUtility.UpdateGlobalShadersParams();\n\t\t\tPlantFallColors.SetFallShaderGlobals(this);\n\t\t\twaterInfo.SetTextures();\n\t\t\tavoidGrid.DebugDrawOnMap();\n\t\t\tBreachingGridDebug.DebugDrawAllOnMap(this);\n\t\t\tmapDrawer.MapMeshDrawerUpdate_First();\n\t\t\tpowerNetGrid.DrawDebugPowerNetGrid();\n\t\t\tDoorsDebugDrawer.DrawDebug();\n\t\t\tmapDrawer.DrawMapMesh();\n\t\t\tdynamicDrawManager.DrawDynamicThings();\n\t\t\tgameConditionManager.GameConditionManagerDraw(this);\n\t\t\tMapEdgeClipDrawer.DrawClippers(this);\n\t\t\tdesignationManager.DrawDesignations();\n\t\t\toverlayDrawer.DrawAllOverlays();\n\t\t\ttemporaryThingDrawer.Draw();\n\t\t\tflecks.FleckManagerDraw();\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tareaManager.AreaManagerUpdate();\n\t\t}\n\t\tcatch (Exception ex)\n\t\t{\n\t\t\tLog.Error(ex.ToString());\n\t\t}\n\t\tweatherManager.WeatherManagerUpdate();\n\t\ttry\n\t\t{\n\t\t\tflecks.FleckManagerUpdate();\n\t\t}\n\t\tcatch (Exception ex2)\n\t\t{\n\t\t\tLog.Error(ex2.ToString());\n\t\t}\n\t\tMapComponentUtility.MapComponentUpdate(this);\n\t}\n\n\tpublic T GetComponent() where T : MapComponent\n\t{\n\t\tfor (int i = 0; i < components.Count; i++)\n\t\t{\n\t\t\tif (components[i] is T result)\n\t\t\t{\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic MapComponent GetComponent(Type type)\n\t{\n\t\tfor (int i = 0; i < components.Count; i++)\n\t\t{\n\t\t\tif (type.IsInstanceOfType(components[i]))\n\t\t\t{\n\t\t\t\treturn components[i];\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic void MapOnGUI()\n\t{\n\t\tDevGUISketches();\n\t\tDevRoadPaths();\n\t\tpathFinder.OnGUI();\n\t}\n\n\tprivate static void DevRoadPaths()\n\t{\n\t\tif (!DebugViewSettings.drawRoadPaths)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\tfor (int i = 0; i < GenStep_Roads.paths.Count; i++)\n\t\t{\n\t\t\tforeach (IntVec3 item in GenStep_Roads.paths[i])\n\t\t\t{\n\t\t\t\tVector2 vector = item.ToVector3Shifted().MapToUIPosition();\n\t\t\t\tDevGUI.DrawRect(new Rect(vector.x, vector.y, 5f, 5f), (i % 2 == 0) ? Color.yellow : Color.blue);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void DevGUISketches()\n\t{\n\t\tif ((!DebugViewSettings.drawMapGraphs && !DebugViewSettings.drawMapRooms) || layoutStructureSketches.NullOrEmpty())\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\tforeach (LayoutStructureSketch layoutStructureSketch in layoutStructureSketches)\n\t\t{\n\t\t\tDebugGUILayoutStructure(layoutStructureSketch);\n\t\t}\n\t}\n\n\tprivate void DebugGUILayoutStructure(LayoutStructureSketch layoutStructureSketch)\n\t{\n\t\tDevDrawOutline(layoutStructureSketch.structureLayout.container, Color.yellow);\n\t\tVector2 pos = (layoutStructureSketch.structureLayout.container.Min - IntVec3.South).ToVector3().MapToUIPosition();\n\t\tDevDrawLabel(layoutStructureSketch.layoutDef.defName, pos);\n\t\tif (DebugViewSettings.drawMapGraphs && layoutStructureSketch.structureLayout?.neighbours != null)\n\t\t{\n\t\t\tforeach (KeyValuePair> connection in layoutStructureSketch.structureLayout.neighbours.connections)\n\t\t\t{\n\t\t\t\tforeach (Vector2 item in connection.Value)\n\t\t\t\t{\n\t\t\t\t\tVector2 vector = layoutStructureSketch.center.ToVector2();\n\t\t\t\t\tVector2 vector2 = vector + connection.Key;\n\t\t\t\t\tVector2 vector3 = vector + item;\n\t\t\t\t\tVector2 start = new Vector3(vector2.x, 0f, vector2.y).MapToUIPosition();\n\t\t\t\t\tVector2 end = new Vector3(vector3.x, 0f, vector3.y).MapToUIPosition();\n\t\t\t\t\tDevGUI.DrawLine(start, end, Color.green, 2f);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!DebugViewSettings.drawMapRooms || layoutStructureSketch.structureLayout?.Rooms == null)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\tforeach (LayoutRoom room in layoutStructureSketch.structureLayout.Rooms)\n\t\t{\n\t\t\tstring name = \"NA\";\n\t\t\tif (!room.defs.NullOrEmpty())\n\t\t\t{\n\t\t\t\tname = room.defs.Select((LayoutRoomDef x) => x.defName).ToCommaList();\n\t\t\t}\n\t\t\tDevDrawLabel(name, room.rects[0].CenterVector3.MapToUIPosition());\n\t\t\tforeach (CellRect rect in room.rects)\n\t\t\t{\n\t\t\t\tDevDrawOutline(rect, Color.blue);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static void DevDrawLabel(string name, Vector2 pos)\n\t{\n\t\tfloat widthCached = name.GetWidthCached();\n\t\tDevGUI.Label(new Rect(pos.x - widthCached / 2f, pos.y, widthCached, 20f), name);\n\t}\n\n\tprivate static void DevDrawOutline(CellRect r, Color color)\n\t{\n\t\tIntVec3 min = r.Min;\n\t\tIntVec3 intVec = r.Max + new IntVec3(1, 0, 1);\n\t\tIntVec3 a = new IntVec3(min.x, 0, min.z);\n\t\tIntVec3 intVec2 = new IntVec3(intVec.x, 0, min.z);\n\t\tIntVec3 intVec3 = new IntVec3(min.x, 0, intVec.z);\n\t\tIntVec3 b = new IntVec3(intVec.x, 0, intVec.z);\n\t\tDevDrawLine(a, intVec2, color);\n\t\tDevDrawLine(a, intVec3, color);\n\t\tDevDrawLine(intVec3, b, color);\n\t\tDevDrawLine(intVec2, b, color);\n\t}\n\n\tprivate static void DevDrawLine(IntVec3 a, IntVec3 b, Color color)\n\t{\n\t\tVector2 start = a.ToVector3().MapToUIPosition();\n\t\tVector2 end = b.ToVector3().MapToUIPosition();\n\t\tDevGUI.DrawLine(start, end, color, 2f);\n\t}\n\n\tpublic string GetUniqueLoadID()\n\t{\n\t\treturn \"Map_\" + uniqueID;\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\tstring text = \"Map-\" + uniqueID;\n\t\tif (IsPlayerHome)\n\t\t{\n\t\t\ttext += \"-PlayerHome\";\n\t\t}\n\t\treturn text;\n\t}\n\n\tpublic ThingOwner GetDirectlyHeldThings()\n\t{\n\t\treturn spawnedThings;\n\t}\n\n\tpublic void GetChildHolders(List outChildren)\n\t{\n\t\tThingOwnerUtility.AppendThingHoldersFromThings(outChildren, listerThings.ThingsInGroup(ThingRequestGroup.ThingHolder));\n\t\tList passingShips = passingShipManager.passingShips;\n\t\tfor (int i = 0; i < passingShips.Count; i++)\n\t\t{\n\t\t\tif (passingShips[i] is IThingHolder item)\n\t\t\t{\n\t\t\t\toutChildren.Add(item);\n\t\t\t}\n\t\t}\n\t\tfor (int j = 0; j < components.Count; j++)\n\t\t{\n\t\t\tif (components[j] is IThingHolder item2)\n\t\t\t{\n\t\t\t\toutChildren.Add(item2);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tif (Disposed)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\tDisposed = true;\n\t\tforeach (MapComponent component in components)\n\t\t{\n\t\t\tif (component is IDisposable disposable)\n\t\t\t{\n\t\t\t\tdisposable.Dispose();\n\t\t\t}\n\t\t}\n\t\tif (regionAndRoomUpdater != null)\n\t\t{\n\t\t\tregionAndRoomUpdater.Enabled = false;\n\t\t}\n\t\tpathFinder?.Dispose();\n\t\tlordManager?.Dispose();\n\t\tfogGrid?.Dispose();\n\t\tsnowGrid?.Dispose();\n\t\tglowGrid?.Dispose();\n\t\tsandGrid?.Dispose();\n\t\tavoidGrid?.Dispose();\n\t\tlisterBuildings?.Dispose();\n\t\tlisterThings?.Clear();\n\t\tregionDirtyer?.SetAllDirty();\n\t\tregionGrid?.Dispose();\n\t\tpathing?.Dispose();\n\t\tmapDrawer?.Dispose();\n\t\tResources.UnloadUnusedAssets();\n\t\tMapGenerator.ClearDebugMode();\n\t}\n}\n\n", "timestamp": "2025-08-25 11:41:03,392" + }, + "Thing-class-definition": { + "keywords": [ + "Thing", + "class", + "definition" + ], + "question": "Thing class definition", + "embedding": [ + -0.03260350599884987, + 0.02423495054244995, + 0.021687297150492668, + -0.0035957377403974533, + -0.038440532982349396, + -0.006014395505189896, + -0.03369996324181557, + 0.0753331258893013, + 0.057306062430143356, + 0.10796888172626495, + -0.06514251232147217, + -0.039601489901542664, + -0.012843072414398193, + -0.0421491414308548, + 0.06291735172271729, + -0.03266800194978714, + 0.0012244454119354486, + -0.08120240271091461, + -0.015938954427838326, + -0.02213877998292446, + 0.031523171812295914, + 0.07765503227710724, + 0.004659947007894516, + 0.04437430575489998, + 0.04353583976626396, + 0.008449177257716656, + -0.004825221840292215, + 0.04705095291137695, + -0.030555708333849907, + -0.05395219102501869, + -0.003035415429621935, + -0.004514827858656645, + -0.016479121521115303, + 0.012480273842811584, + -0.01504405029118061, + 0.014713500626385212, + -0.017027350142598152, + 0.004958248231559992, + 0.017478832975029945, + -0.011222572065889835, + 0.019252514466643333, + -0.000278397579677403, + -0.03389345481991768, + -0.013600918464362621, + -0.028330544009804726, + 0.025782890617847443, + 0.00896515790373087, + -0.057725295424461365, + -0.019510505720973015, + 0.08262134343385696, + -0.0044906409457325935, + 0.030555708333849907, + -0.013705726712942123, + -0.023364232853055, + 0.002277569379657507, + 0.014310391619801521, + 0.04830865561962128, + -0.018285052850842476, + 0.0028197518549859524, + 0.03582838177680969, + 0.023380357772111893, + 0.024380069226026535, + -0.044535551220178604, + -0.011891733855009079, + 0.09100602567195892, + -0.022300023585557938, + 0.022944999858736992, + 0.01805931143462658, + 0.056499842554330826, + -0.029862361028790474, + -0.011456375010311604, + 0.07900948077440262, + -0.06939934939146042, + 0.024444567039608955, + -0.056435346603393555, + 0.04008521884679794, + -0.006252230145037174, + -0.009190899319946766, + -0.028443414717912674, + -0.01547134667634964, + 0.01181111205369234, + 0.011948169209063053, + -0.008392741903662682, + 0.002870140364393592, + 0.04443880543112755, + 0.038988761603832245, + 0.011770800687372684, + -0.07384967803955078, + -0.011150011792778969, + 0.07720354944467545, + -0.02342873066663742, + 0.007421248126775026, + 0.019881365820765495, + 0.009779439307749271, + 0.010400228202342987, + 0.06488452106714249, + -0.05543563514947891, + 0.01738208718597889, + -0.02146155573427677, + 0.047502435743808746, + -0.0262021254748106, + -0.054468169808387756, + -0.021364809945225716, + 0.04134292155504227, + 0.024186577647924423, + 0.08629770576953888, + -0.04508377984166145, + -0.010150300338864326, + -0.022025909274816513, + -0.01235934067517519, + 0.0018784907879307866, + 0.03002360463142395, + -0.012657641433179379, + 0.03850502893328667, + -0.007868699729442596, + 0.07197925448417664, + -0.05085630714893341, + -0.010101926513016224, + 0.045825500041246414, + 0.004369708243757486, + -0.0008641662425361574, + -0.04266512021422386, + -0.012722139246761799, + -0.022042034193873405, + 0.010255108587443829, + 0.00850561261177063, + 0.06446529179811478, + -0.0032450323924422264, + -0.0024287353735417128, + -0.016688738018274307, + -0.03918225318193436, + -0.0026302901096642017, + 0.028443414717912674, + -0.01893002726137638, + -0.012899507768452168, + -0.018043186515569687, + 0.036344364285469055, + 0.005349264480173588, + -0.06185314059257507, + 0.007010076195001602, + -0.02362222410738468, + -0.013270368799567223, + -0.0237995907664299, + 0.030249346047639847, + 0.0679159089922905, + -0.03927899897098541, + 0.010771089233458042, + -0.057048071175813675, + -0.0004847393138334155, + 0.0024105955380946398, + -0.02181629277765751, + -0.057983286678791046, + -0.014302329160273075, + 0.0071511645801365376, + 0.021735670045018196, + -0.006909298710525036, + 0.0016537571791559458, + -0.04185890033841133, + 0.02046184428036213, + -0.04289086163043976, + 0.018849406391382217, + -0.011093576438724995, + -0.03070082888007164, + -0.01762395165860653, + -0.02255801483988762, + -0.03395795449614525, + -0.02995910681784153, + 0.05246874690055847, + -0.06804490089416504, + -0.011109701357781887, + 0.042374882847070694, + -0.009739127941429615, + -0.015551968477666378, + -0.002868124982342124, + 0.020171605050563812, + 0.001337316120043397, + 0.03241001442074776, + 0.008932908996939659, + 0.02238064631819725, + -0.046825211495161057, + 0.02349322848021984, + 0.011698241345584393, + 0.07081829756498337, + 0.0011942122364416718, + -0.006167577113956213, + -0.016543619334697723, + -0.016737110912799835, + 0.017494957894086838, + 0.030071977525949478, + 0.011198384687304497, + -0.04766368120908737, + 0.002444859826937318, + 0.02908838912844658, + 0.05617735534906387, + -0.07913848012685776, + -0.03360321745276451, + 0.006917361170053482, + 0.031103936955332756, + -0.0035816289018839598, + -0.040536701679229736, + -0.005889431573450565, + 0.028798149898648262, + 0.013987903483211994, + 0.008562047965824604, + 0.04134292155504227, + -0.03518340736627579, + -0.005357326939702034, + -0.0012365387519821525, + 0.00786063726991415, + -0.002368269022554159, + 0.00965044368058443, + -0.025782890617847443, + 0.019897490739822388, + -0.013536420650780201, + -0.025799015536904335, + -0.023348107933998108, + -0.06024070084095001, + 0.007336595095694065, + -0.027701692655682564, + -0.018655912950634956, + -0.029539871960878372, + 0.029120638966560364, + 0.010005180723965168, + 0.04440655559301376, + 0.027217961847782135, + -0.01085171103477478, + 0.01731758937239647, + 0.01565677672624588, + -0.015560030937194824, + -0.0010314567480236292, + -0.017704574391245842, + 0.033925704658031464, + -0.0882326290011406, + 0.04147191718220711, + 0.03731182590126991, + 0.0014330546837300062, + -0.02428332343697548, + -0.010674342513084412, + 0.0316682904958725, + 0.02004260942339897, + -0.01007774006575346, + 0.04079469293355942, + -0.06182089075446129, + 0.06314308941364288, + -0.00825568474829197, + -0.008836162276566029, + -0.050211332738399506, + -0.027330832555890083, + 0.05450041964650154, + -0.016978977248072624, + -0.008521737530827522, + 0.0014542179415002465, + -0.05011458694934845, + -0.023267487064003944, + -0.04179440438747406, + 0.04253612458705902, + -0.016471058130264282, + 0.01652749441564083, + 0.0024408285971730947, + -0.006219981238245964, + -0.015955079346895218, + -0.011077452450990677, + 0.0020619055721908808, + -0.027169587090611458, + -0.03311948478221893, + 0.004974372684955597, + -0.00293665356002748, + -0.0421491414308548, + -0.11448313295841217, + 0.0033296854235231876, + -0.015890581533312798, + 0.031232932582497597, + 0.00927958358079195, + -0.029620494693517685, + -0.01973624713718891, + 0.02786293625831604, + 0.01652749441564083, + 0.058950748294591904, + -0.07997694611549377, + -0.012085226364433765, + -0.0075784604996442795, + 0.012843072414398193, + 0.010085802525281906, + -0.04205239564180374, + -0.0032006902620196342, + 0.023396482691168785, + 0.02360609918832779, + 0.006913329940289259, + 0.03747307136654854, + -0.0031341772992163897, + 0.010932332836091518, + 0.0055669439025223255, + -0.02700834348797798, + -0.010488912463188171, + -0.01060178317129612, + 0.00507111893966794, + -0.0006580764311365783, + -0.0017656200798228383, + 0.003998847212642431, + 0.03592512756586075, + 0.00510336784645915, + 0.01245608739554882, + -0.007022169418632984, + -0.00439389469102025, + 0.04895363003015518, + 0.012754388153553009, + -0.00882003828883171, + -0.09384391456842422, + -0.009110277518630028, + -0.09055454283952713, + 0.0011387846898287535, + -0.01174661424010992, + -0.007002014201134443, + -0.008666856214404106, + 0.01659199222922325, + 0.010932332836091518, + -0.03902101144194603, + -0.01418139599263668, + -0.011311255395412445, + 0.012472211383283138, + -0.03292599320411682, + -0.006598904263228178, + 0.0430198572576046, + 0.016309814527630806, + -0.0083524314686656, + 0.00902965571731329, + 0.05311372131109238, + 0.00850561261177063, + -0.01768844947218895, + -0.014294266700744629, + -0.0001568348379805684, + 0.004889719653874636, + 0.02157442644238472, + -0.008392741903662682, + 0.012875321321189404, + -0.004728475585579872, + -0.008062192238867283, + 0.032281018793582916, + -0.01755945384502411, + 0.011238696053624153, + -0.012036853469908237, + 0.06307858973741531, + 0.018043186515569687, + -0.029862361028790474, + 0.01818830519914627, + -0.03076532483100891, + -0.010182549245655537, + 0.03271637484431267, + -0.021864665672183037, + 0.021219689399003983, + -0.008126690052449703, + -0.014310391619801521, + -0.003769074799492955, + 0.02441231906414032, + 0.0021304343827068806, + -0.011262882500886917, + 0.018462419509887695, + 0.007223724387586117, + -0.01264151744544506, + -0.00168701377697289, + -0.017672324553132057, + 0.06843189150094986, + 0.01050503645092249, + 0.03889201581478119, + 0.05627410113811493, + 0.030410589650273323, + -0.006699681747704744, + 0.03808579593896866, + 0.018349548801779747, + 0.011835298500955105, + 0.023267487064003944, + -0.02644398994743824, + -0.03274862468242645, + 0.008481426164507866, + -0.029491499066352844, + -0.028314419090747833, + 0.01214166171848774, + 0.007630865089595318, + 0.016737110912799835, + 0.028459537774324417, + 0.06694844365119934, + 0.024815427139401436, + -6.172616122057661e-05, + -0.05862826108932495, + -0.009384391829371452, + 0.0036400798708200455, + 0.0421491414308548, + 0.005054994486272335, + 0.025508776307106018, + -0.04943736270070076, + 0.0679159089922905, + -0.007433341350406408, + 0.006280447822064161, + -0.009392454288899899, + 0.03789230436086655, + 0.014721563085913658, + 0.011859484948217869, + 0.023138491436839104, + 0.010698528960347176, + -0.012504460290074348, + 0.01506823766976595, + -0.025137916207313538, + -0.010996830649673939, + 0.027524324133992195, + -0.038376033306121826, + -0.0345061831176281, + 0.008235529065132141, + 0.026863224804401398, + 0.008424990810453892, + 0.04985659569501877, + -0.08597521483898163, + 0.03087819553911686, + 0.08874861150979996, + -0.014262017793953419, + -0.04260062426328659, + -0.01572933793067932, + -0.003057586494833231, + -0.015890581533312798, + 0.06959284096956253, + -0.026863224804401398, + 0.007292252965271473, + 0.022574137896299362, + 0.015890581533312798, + -0.007876762188971043, + -0.03437718749046326, + 0.011383815668523312, + -0.024122079834342003, + -0.00732047064229846, + 0.01278663706034422, + 0.0018281020456925035, + -0.06504576653242111, + -0.05856376513838768, + 0.02109069563448429, + 0.0644330382347107, + 0.013270368799567223, + -0.0469542071223259, + -0.0006228043348528445, + 0.0017918222583830357, + -0.030346091836690903, + -0.00786466896533966, + -0.0775260403752327, + -0.012835009954869747, + 0.015793833881616592, + -0.02373509481549263, + -0.036279864609241486, + -0.010553409345448017, + 0.019284764304757118, + -0.013060751371085644, + 0.011996542103588581, + -0.016446871683001518, + -0.018526917323470116, + 0.01645493507385254, + -0.001411891425959766, + 0.04131067171692848, + 0.013294555246829987, + 0.020735958591103554, + -0.010916207917034626, + -0.004514827858656645, + 0.002833860693499446, + -0.021671172231435776, + 0.019155768677592278, + -0.029942981898784637, + 0.012448024936020374, + 0.031410299241542816, + 0.007425278890877962, + -0.041149429976940155, + 0.008957095444202423, + -0.001743449131026864, + -0.023718969896435738, + -0.02902389131486416, + 0.026186000555753708, + 0.01368154026567936, + -0.013770224526524544, + 0.03137805312871933, + 0.013246181420981884, + -0.007183413486927748, + -0.00607083085924387, + -0.0038537278305739164, + 0.01507629919797182, + 0.06482002884149551, + 0.05746730789542198, + 0.011875608935952187, + 0.017027350142598152, + 0.007203568704426289, + -0.05740280821919441, + -0.03137805312871933, + -0.017043475061655045, + 0.01060178317129612, + 0.018655912950634956, + -0.052984725683927536, + 0.01954275369644165, + 0.006123234983533621, + 0.026669731363654137, + 0.022283898666501045, + -0.006868987809866667, + -0.02804030478000641, + -0.0006338898674584925, + 0.07243073731660843, + -0.006409442983567715, + -0.08803913742303848, + -0.04063344746828079, + 0.029733365401625633, + -0.06059543788433075, + 0.002835876075550914, + -0.004522889852523804, + 0.02065533585846424, + -0.004950186237692833, + 0.0034848826471716166, + -0.004045205190777779, + 0.025605522096157074, + 0.027201836928725243, + -0.022461267188191414, + 0.05572587251663208, + -0.03063633106648922, + -0.010561471804976463, + 0.01836567372083664, + 0.10596945136785507, + 0.01245608739554882, + 0.006651308387517929, + -0.007804201915860176, + -0.0037368261255323887, + -0.04069794714450836, + -0.028685279190540314, + -0.01794644072651863, + -0.05037257820367813, + 0.02768556773662567, + -0.01143218856304884, + -0.018720410764217377, + 0.0759781002998352, + -0.039923977106809616, + -0.008957095444202423, + 0.0017646122723817825, + 0.037569817155599594, + -0.0295882448554039, + -0.023073993623256683, + 0.038988761603832245, + 0.03299048915505409, + 0.011980418115854263, + -0.013544483110308647, + 0.09932620823383331, + 0.09887472540140152, + 0.035667140036821365, + 0.00459141843020916, + 0.03328073024749756, + 0.035409148782491684, + 0.006901236716657877, + 7.079612259985879e-05, + -0.041891150176525116, + 0.00705844908952713, + -0.03268412873148918, + -0.0028600627556443214, + 0.016414623707532883, + -0.029314130544662476, + -0.04208464175462723, + 0.040407706052064896, + 0.03107168897986412, + 0.014931180514395237, + 0.0005955944652669132, + 0.028217673301696777, + -0.03174891322851181, + -0.02454131282866001, + -0.018075434491038322, + -0.0469542071223259, + -0.03207140043377876, + 0.0052887978963553905, + 0.02083270438015461, + 0.02323523722589016, + 0.010650156065821648, + 0.04724444821476936, + -0.030991066247224808, + -0.03840828314423561, + 0.017801320180296898, + -0.02602475695312023, + 0.02329973503947258, + 0.04124617576599121, + 0.006772241555154324, + -0.006776272784918547, + -0.008376617915928364, + 0.09706879407167435, + 0.011109701357781887, + -0.028072552755475044, + 0.008513675071299076, + 0.021896913647651672, + -0.006219981238245964, + 0.0007785054622218013, + 0.020058734342455864, + 0.03921450302004814, + 0.0011327379615977407, + 0.02576676569879055, + -0.0027794407214969397, + -0.005865244660526514, + 0.013238119892776012, + -0.0390855073928833, + -0.016866106539964676, + -0.03194240480661392, + 0.01794644072651863, + 0.026911597698926926, + 0.016624240204691887, + 0.005736249964684248, + 0.04772817716002464, + 0.021687297150492668, + -0.04605124145746231, + -0.0048211910761892796, + 0.003075726330280304, + 0.009045779705047607, + -0.03149092197418213, + 0.005712063051760197, + -0.009045779705047607, + 0.007042325101792812, + 0.04011746868491173, + 0.06933484971523285, + 0.053468458354473114, + -0.04353583976626396, + 0.021558301523327827, + 0.0353768989443779, + -0.003380074165761471, + 0.0040391581133008, + 0.012512522749602795, + 0.02570226974785328, + -0.04630923271179199, + -0.039536990225315094, + 0.008134751580655575, + -0.001273826346732676, + -0.03302273899316788, + 0.006651308387517929, + -0.01152893528342247, + 0.026976095512509346, + -0.00555081944912672, + -0.057241566479206085, + -0.01525366771966219, + -0.021219689399003983, + 0.04637372866272926, + -0.02594413422048092, + 0.04085918888449669, + -0.022509640082716942, + 0.007155195809900761, + -0.005990209057927132, + 0.005143678747117519, + 0.0021949317306280136, + -0.023009495809674263, + 0.01762395165860653, + 0.007913041859865189, + 0.013576732017099857, + -0.03120068460702896, + 0.00274316081777215, + 0.006473940331488848, + -0.05340396240353584, + -0.03753756731748581, + 0.015624528750777245, + -0.02342873066663742, + 0.010521160438656807, + 0.02213877998292446, + 0.04224588721990585, + -0.0063368831761181355, + 0.03353872150182724, + 0.03207140043377876, + -0.04495478421449661, + 0.054468169808387756, + 0.020268350839614868, + -0.02749207615852356, + -0.038924265652894974, + -0.023073993623256683, + -0.024267198517918587, + -0.018268927931785583, + 0.03211977332830429, + 0.024686433374881744, + -0.017333712428808212, + -0.02218715287744999, + 0.01146443746984005, + 0.003253094619140029, + 0.00699798297137022, + -0.01880103163421154, + 0.02305787056684494, + -0.0310071911662817, + 0.015987327322363853, + 0.0478249229490757, + -0.08913559466600418, + -0.03989172726869583, + 0.04469679296016693, + 0.028878772631287575, + 0.002118340926244855, + 0.016108259558677673, + -0.014052401296794415, + -0.020687585696578026, + -0.02749207615852356, + 0.027653319761157036, + -0.021977536380290985, + 0.02028447575867176, + -0.06156289950013161, + 0.014665127731859684, + 0.0674644261598587, + -0.034989915788173676, + 0.02970111556351185, + 0.011907857842743397, + 0.028765901923179626, + -0.02755657397210598, + -0.02205815725028515, + -0.04163316264748573, + 0.003956520929932594, + 0.06810940057039261, + -0.007094729226082563, + 0.007651020307093859, + 0.049405112862586975, + 0.0067923967726528645, + 0.025734517723321915, + 0.009690755046904087, + -0.027750065550208092, + -0.04272961989045143, + 0.004889719653874636, + 0.04218139126896858, + 0.008892597630620003, + 0.012214221060276031, + 0.023444855585694313, + -0.010625969618558884, + -0.0007774976547807455, + 0.009803625755012035, + 0.020171605050563812, + -0.01910739578306675, + -0.037569817155599594, + -0.019526628777384758, + -0.03026546910405159, + -0.018704285845160484, + 0.03969823569059372, + 0.02299337275326252, + -0.052243005484342575, + -0.045535262674093246, + 0.018897779285907745, + -0.019091270864009857, + 0.008900660090148449, + 0.06798040866851807, + -0.01297206711024046, + -0.030233221128582954, + 0.0023158646654337645, + 0.012004604563117027, + 0.01069046650081873, + -0.049953341484069824, + 0.0039041165728121996, + -0.055016398429870605, + -0.0020467890426516533, + 0.0028318450786173344, + 0.018156057223677635, + -0.023815715685486794, + 0.004329397343099117, + -0.04211689159274101, + 0.05201726406812668, + -0.022606387734413147, + -0.04576100409030914, + 0.005865244660526514, + 0.0011851423187181354, + -0.026830974966287613, + -0.002674632240086794, + 0.015479409135878086, + -0.05037257820367813, + 0.019881365820765495, + -0.010166424326598644, + -0.006373162847012281, + 0.030652454122900963, + 0.004607542883604765, + -0.003172472584992647, + 0.046889711171388626, + -7.04182093613781e-05, + 0.022896625101566315, + 0.0013353006215766072, + 0.0600472092628479, + 0.003166425973176956, + 0.007703424897044897, + -0.0001686761825112626, + 0.024009209126234055, + -0.005272673908621073, + -0.0325390063226223, + -0.03321623057126999, + -0.018543042242527008, + -0.007586522959172726, + 0.07694556564092636, + -0.0012415775563567877, + -0.004575293976813555, + 0.005913618020713329, + 0.01232709176838398, + -0.0040351273491978645, + -0.016180820763111115, + 0.017236966639757156, + -0.0030031665228307247, + -0.04672846570611, + -0.010996830649673939, + 0.029378628358244896, + 0.032393887639045715, + -0.03934349864721298, + 0.04801841825246811, + 0.0019873303826898336, + -0.005720125511288643, + 0.0006495103589259088, + -0.015519720502197742, + 0.032942116260528564, + 0.023589974269270897, + 0.029572121798992157, + -0.0019530660938471556, + -0.029862361028790474, + 0.036408860236406326, + 0.046825211495161057, + 0.022961122915148735, + 0.05314597114920616, + -0.026298871263861656, + 0.05182377249002457, + -0.024138202890753746, + -0.011424126103520393, + 0.038730770349502563, + -3.287862637080252e-05, + -0.009319894015789032, + 0.019494380801916122, + -0.021848540753126144, + 0.01794644072651863, + 0.00405125180259347, + -0.020913327112793922, + -0.02279987931251526, + -0.0014421246014535427, + -0.04037545993924141, + -0.003922256641089916, + -0.00789288617670536, + -0.026250498369336128, + 0.04647047445178032, + 0.01954275369644165, + 0.031523171812295914, + 0.008900660090148449, + 0.0025033107958734035, + 0.008171032182872295, + -0.006187732331454754, + 0.02539590559899807, + -0.04179440438747406, + 0.002299740444868803, + 0.03205527737736702, + 0.058660510927438736, + 0.022767631337046623, + -0.050630565732717514, + 0.005139647517353296, + 0.0022191184107214212, + -0.017672324553132057, + -0.05579037219285965, + -0.006111141759902239, + 0.0399562232196331, + 0.005929742474108934, + -0.02120356634259224, + 0.007618771865963936, + -0.005441979970782995, + -0.007900948636233807, + -0.04414856433868408, + 0.023364232853055, + 0.004333428107202053, + -0.03274862468242645, + -0.021122943609952927, + -0.056628838181495667, + 0.019284764304757118, + 0.030894320458173752, + 0.006844801362603903, + 0.012794699519872665, + -0.002307802438735962, + 0.04637372866272926, + -0.020203853026032448, + -0.017494957894086838, + 0.0018956229323521256, + 0.0055911303497850895, + -0.027072841301560402, + 0.012254532426595688, + -0.025750642642378807, + 0.019929738715291023, + -0.022283898666501045, + 0.0063368831761181355, + 0.010053553618490696, + 0.021977536380290985, + 0.0014945288421586156, + -0.02655686065554619, + 0.05108204856514931, + 0.04043995589017868, + -0.025073418393731117, + 0.02410595491528511, + -0.010166424326598644, + 0.02607312984764576, + -0.02854016050696373, + 0.03176503628492355, + 0.010101926513016224, + 0.05227525532245636, + 0.004345521796494722, + -0.039601489901542664, + 0.02854016050696373, + -0.016817733645439148, + 0.012625393457710743, + -0.02207428216934204, + 0.03373221307992935, + -0.032700251787900925, + -0.04253612458705902, + 0.037086084485054016, + -0.011819173581898212, + -0.01335099060088396, + -0.03224876895546913, + 0.029314130544662476, + -0.02742757834494114, + 0.0023219112772494555, + 0.006941547617316246, + -0.020074859261512756, + -0.02133256010711193, + -0.02404145710170269, + 0.021219689399003983, + -0.06765791773796082, + 0.021671172231435776, + -0.031152311712503433, + 0.005478259641677141, + 0.02607312984764576, + -0.05134003981947899, + -0.013326804153621197, + -0.05991821363568306, + 0.02908838912844658, + -0.0028499849140644073, + 0.01991361565887928, + 0.023928586393594742, + 0.007026200648397207, + -0.019381510093808174, + -0.029620494693517685, + -0.024380069226026535, + 0.035731635987758636, + 0.001526777632534504, + -0.05201726406812668, + 0.04424531012773514, + 0.01880103163421154, + -0.014471635222434998, + -0.01694672740995884, + 0.01831730082631111, + 0.00838468037545681, + -0.044535551220178604, + 0.06785140931606293, + -0.03168441727757454, + 0.05843476951122284, + 0.030652454122900963, + 0.04408406838774681, + 0.037086084485054016, + 0.0027451764326542616, + -0.000567880691960454, + -0.011794987134635448, + -0.015697088092565536, + -0.009303770028054714, + 0.026605233550071716, + -0.02496054768562317, + 0.018720410764217377, + -0.04414856433868408, + 0.021977536380290985, + -0.007848544046282768, + 0.050017841160297394, + 0.016801608726382256, + -0.01039216574281454, + -0.024138202890753746, + 0.0561128593981266, + -0.004418081138283014, + 0.01257701963186264, + -0.04914712533354759, + -0.016180820763111115, + -0.004514827858656645, + -0.04095593839883804, + -0.019091270864009857, + 0.0049139061011374, + -0.053049225360155106, + -0.01371378917247057, + -0.03311948478221893, + 0.0364733561873436, + 0.024831552058458328, + 0.02644398994743824, + -0.051501285284757614, + 0.03210365027189255, + 0.002547652693465352, + -0.05017908290028572, + -0.02607312984764576, + 0.003793261479586363, + 0.02520241215825081, + -0.02823379635810852, + 0.03453843295574188, + -0.008130720816552639, + -0.05221075564622879, + -0.01891390234231949, + 0.04308435693383217, + -0.013834722340106964, + -0.04085918888449669, + -0.03207140043377876, + -0.0044785477221012115, + 0.020993947982788086, + 0.021558301523327827, + -0.0001853044523159042, + 0.01941375806927681, + -0.02546040341258049, + -0.025347532704472542, + 0.017091847956180573, + -0.003454649355262518, + 0.029056141152977943, + -0.0258796364068985, + 0.007348688319325447, + -0.04598674550652504, + -0.01688223145902157, + -0.01781744509935379, + -0.018946152180433273, + -0.01075496431440115, + -0.004272961989045143, + -0.03889201581478119, + 0.04530952125787735, + 0.013770224526524544, + -0.02502504549920559, + 0.07081829756498337, + -0.026363369077444077, + -0.007699393667280674, + 7.614992500748485e-05, + -0.004494672175496817, + -0.06888337433338165, + -0.0031059596221894026, + -0.005216238554567099, + -0.039665985852479935, + 0.05046932399272919, + 0.012931756675243378, + 0.0011750644771382213, + 0.005599192343652248, + 0.01764007657766342, + 0.014229768887162209, + -0.03976273164153099, + -0.012560895644128323, + 0.007284190505743027, + 0.013802473433315754, + -0.03789230436086655, + 0.045535262674093246, + -0.03315173462033272, + 0.0007538149948231876 + ], + "result": "--- 结果 1 (相似度: 1.000) ---\n文件路径: C:\\Steam\\steamapps\\common\\RimWorld\\Data\\dll1.6\\Verse\\Thing.txt\n\npublic class Thing : Entity, ISelectable, ILoadReferenceable, ISignalReceiver, IExposable, IEquatable\n{\n\tpublic ThingDef def;\n\n\tpublic int thingIDNumber = -1;\n\n\tprivate sbyte mapIndexOrState = -1;\n\n\tprivate IntVec3 positionInt = IntVec3.Invalid;\n\n\tprivate Rot4 rotationInt = Rot4.North;\n\n\tpublic int stackCount = 1;\n\n\tprotected Faction factionInt;\n\n\tprivate ThingDef stuffInt;\n\n\tprivate Graphic graphicInt;\n\n\tprotected Graphic styleGraphicInt;\n\n\tprivate int hitPointsInt = -1;\n\n\tpublic ThingOwner holdingOwner;\n\n\tpublic List questTags;\n\n\tpublic int spawnedTick = -1;\n\n\tpublic int despawnedTick = -1;\n\n\tpublic int? overrideGraphicIndex;\n\n\tpublic bool debugRotLocked;\n\n\tprivate bool beingTransportedOnGravship;\n\n\tprivate int tickDelta;\n\n\tprivate bool beenRevealed;\n\n\tpublic bool shouldHighlightCached;\n\n\tpublic int shouldHighlightCachedTick;\n\n\tpublic Color highlightColorCached;\n\n\tpublic int highlightColorCachedTick;\n\n\tprotected const sbyte UnspawnedState = -1;\n\n\tprivate const sbyte MemoryState = -2;\n\n\tprivate const sbyte DiscardedState = -3;\n\n\tprivate List tmpHolders;\n\n\tpublic static bool allowDestroyNonDestroyable = false;\n\n\tprivate static Dictionary facIDsCached = new Dictionary();\n\n\tprivate static List tmpDeteriorationReasons = new List();\n\n\tpublic static HashSet showingGizmosForRitualsTmp = new HashSet();\n\n\tprivate static List tmpIdeoNames = new List();\n\n\tpublic const float SmeltCostRecoverFraction = 0.25f;\n\n\tpublic virtual int HitPoints\n\t{\n\t\tget\n\t\t{\n\t\t\treturn hitPointsInt;\n\t\t}\n\t\tset\n\t\t{\n\t\t\thitPointsInt = value;\n\t\t}\n\t}\n\n\tpublic int MaxHitPoints => Mathf.RoundToInt(this.GetStatValue(StatDefOf.MaxHitPoints, applyPostProcess: true, 10));\n\n\tpublic virtual float MarketValue => this.GetStatValue(StatDefOf.MarketValue);\n\n\tpublic virtual float RoyalFavorValue => this.GetStatValue(StatDefOf.RoyalFavorValue);\n\n\tpublic virtual int? OverrideGraphicIndex => overrideGraphicIndex;\n\n\tpublic virtual Texture UIIconOverride => null;\n\n\tpublic bool EverSeenByPlayer\n\t{\n\t\tget\n\t\t{\n\t\t\treturn this.GetEverSeenByPlayer();\n\t\t}\n\t\tset\n\t\t{\n\t\t\tthis.SetEverSeenByPlayer(value);\n\t\t}\n\t}\n\n\tpublic virtual ThingStyleDef StyleDef\n\t{\n\t\tget\n\t\t{\n\t\t\treturn this.GetStyleDef();\n\t\t}\n\t\tset\n\t\t{\n\t\t\tstyleGraphicInt = null;\n\t\t\tthis.SetStyleDef(value);\n\t\t}\n\t}\n\n\tpublic Precept_ThingStyle StyleSourcePrecept\n\t{\n\t\tget\n\t\t{\n\t\t\treturn this.GetStyleSourcePrecept();\n\t\t}\n\t\tset\n\t\t{\n\t\t\tthis.SetStyleSourcePrecept(value);\n\t\t}\n\t}\n\n\tpublic bool FlammableNow\n\t{\n\t\tget\n\t\t{\n\t\t\tif (this.GetStatValue(StatDefOf.Flammability) < 0.01f)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (Spawned && !FireBulwark)\n\t\t\t{\n\t\t\t\tList thingList = Position.GetThingList(Map);\n\t\t\t\tif (thingList != null)\n\t\t\t\t{\n\t\t\t\t\tfor (int i = 0; i < thingList.Count; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (thingList[i].FireBulwark)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tpublic virtual bool FireBulwark => def.Fillage == FillCategory.Full;\n\n\tpublic bool Destroyed\n\t{\n\t\tget\n\t\t{\n\t\t\tif (mapIndexOrState != -2)\n\t\t\t{\n\t\t\t\treturn mapIndexOrState == -3;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tpublic bool Discarded => mapIndexOrState == -3;\n\n\tpublic bool Spawned\n\t{\n\t\tget\n\t\t{\n\t\t\tif (mapIndexOrState < 0 || Find.Maps == null)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (mapIndexOrState < Find.Maps.Count)\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tLog.ErrorOnce($\"Thing {ThingID} is associated with invalid map index {mapIndexOrState}\", 64664487);\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic bool SpawnedOrAnyParentSpawned => SpawnedParentOrMe != null;\n\n\tpublic Thing SpawnedParentOrMe\n\t{\n\t\tget\n\t\t{\n\t\t\tif (Spawned)\n\t\t\t{\n\t\t\t\treturn this;\n\t\t\t}\n\t\t\tif (ParentHolder != null)\n\t\t\t{\n\t\t\t\treturn ThingOwnerUtility.SpawnedParentOrMe(ParentHolder);\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tpublic int TickSpawned => spawnedTick;\n\n\tpublic int TickDeSpawned => despawnedTick;\n\n\tpublic Map Map\n\t{\n\t\tget\n\t\t{\n\t\t\tif (mapIndexOrState >= 0)\n\t\t\t{\n\t\t\t\treturn Find.Maps?[mapIndexOrState];\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tpublic Map MapHeld\n\t{\n\t\tget\n\t\t{\n\t\t\tif (Spawned)\n\t\t\t{\n\t\t\t\treturn Map;\n\t\t\t}\n\t\t\tif (ParentHolder == null)\n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn ThingOwnerUtility.GetRootMap(ParentHolder);\n\t\t}\n\t}\n\n\tpublic IntVec3 Position\n\t{\n\t\tget\n\t\t{\n\t\t\treturn positionInt;\n\t\t}\n\t\tset\n\t\t{\n\t\t\tif (value == positionInt)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (Spawned)\n\t\t\t{\n\t\t\t\tif (def.AffectsRegions)\n\t\t\t\t{\n\t\t\t\t\tLog.Warning(\"Changed position of a spawned thing which affects regions. This is not supported.\");\n\t\t\t\t}\n\t\t\t\tDirtyMapMesh(Map);\n\t\t\t\tRegionListersUpdater.DeregisterInRegions(this, Map);\n\t\t\t\tMap.thingGrid.Deregister(this);\n\t\t\t\tMap.coverGrid.DeRegister(this);\n\t\t\t}\n\t\t\tpositionInt = value;\n\t\t\tif (Spawned)\n\t\t\t{\n\t\t\t\tMap.thingGrid.Register(this);\n\t\t\t\tMap.coverGrid.Register(this);\n\t\t\t\tMap.gasGrid.Notify_ThingSpawned(this);\n\t\t\t\tRegionListersUpdater.RegisterInRegions(this, Map);\n\t\t\t\tDirtyMapMesh(Map);\n\t\t\t\tif (def.AffectsReachability)\n\t\t\t\t{\n\t\t\t\t\tMap.reachability.ClearCache();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic IntVec3 PositionHeld\n\t{\n\t\tget\n\t\t{\n\t\t\tif (Spawned)\n\t\t\t{\n\t\t\t\treturn Position;\n\t\t\t}\n\t\t\tIntVec3 rootPosition = ThingOwnerUtility.GetRootPosition(ParentHolder);\n\t\t\tif (rootPosition.IsValid)\n\t\t\t{\n\t\t\t\treturn rootPosition;\n\t\t\t}\n\t\t\treturn Position;\n\t\t}\n\t}\n\n\tpublic Rot4 Rotation\n\t{\n\t\tget\n\t\t{\n\t\t\treturn rotationInt;\n\t\t}\n\t\tset\n\t\t{\n\t\t\tif (value == rotationInt || debugRotLocked)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (Spawned && (def.size.x != 1 || def.size.z != 1))\n\t\t\t{\n\t\t\t\tif (def.AffectsRegions)\n\t\t\t\t{\n\t\t\t\t\tLog.Warning(\"Changed rotation of a spawned non-single-cell thing which affects regions. This is not supported.\");\n\t\t\t\t}\n\t\t\t\tRegionListersUpdater.DeregisterInRegions(this, Map);\n\t\t\t\tMap.thingGrid.Deregister(this);\n\t\t\t}\n\t\t\trotationInt = value;\n\t\t\tif (Spawned && (def.size.x != 1 || def.size.z != 1))\n\t\t\t{\n\t\t\t\tMap.thingGrid.Register(this);\n\t\t\t\tRegionListersUpdater.RegisterInRegions(this, Map);\n\t\t\t\tMap.gasGrid.Notify_ThingSpawned(this);\n\t\t\t\tif (def.AffectsReachability)\n\t\t\t\t{\n\t\t\t\t\tMap.reachability.ClearCache();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic bool Smeltable\n\t{\n\t\tget\n\t\t{\n\t\t\tif (this.IsRelic())\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (def.smeltable)\n\t\t\t{\n\t\t\t\tif (def.MadeFromStuff)\n\t\t\t\t{\n\t\t\t\t\treturn Stuff.smeltable;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic bool BurnableByRecipe\n\t{\n\t\tget\n\t\t{\n\t\t\tif (def.burnableByRecipe)\n\t\t\t{\n\t\t\t\tif (def.MadeFromStuff)\n\t\t\t\t{\n\t\t\t\t\treturn Stuff.burnableByRecipe;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic IThingHolder ParentHolder => holdingOwner?.Owner;\n\n\tpublic Faction Faction => factionInt;\n\n\tpublic string ThingID\n\t{\n\t\tget\n\t\t{\n\t\t\tif (def.HasThingIDNumber)\n\t\t\t{\n\t\t\t\treturn def.defName + thingIDNumber;\n\t\t\t}\n\t\t\treturn def.defName;\n\t\t}\n\t\tset\n\t\t{\n\t\t\tthingIDNumber = IDNumberFromThingID(value);\n\t\t}\n\t}\n\n\tpublic IntVec2 RotatedSize\n\t{\n\t\tget\n\t\t{\n\t\t\tif (!rotationInt.IsHorizontal)\n\t\t\t{\n\t\t\t\treturn def.size;\n\t\t\t}\n\t\t\treturn new IntVec2(def.size.z, def.size.x);\n\t\t}\n\t}\n\n\tpublic virtual CellRect? CustomRectForSelector => null;\n\n\tpublic override string Label\n\t{\n\t\tget\n\t\t{\n\t\t\tif (stackCount > 1)\n\t\t\t{\n\t\t\t\treturn LabelNoCount + \" x\" + stackCount.ToStringCached();\n\t\t\t}\n\t\t\treturn LabelNoCount;\n\t\t}\n\t}\n\n\tpublic virtual string LabelNoCount => GenLabel.ThingLabel(this, 1);\n\n\tpublic override string LabelCap => Label.CapitalizeFirst(def);\n\n\tpublic virtual string LabelCapNoCount => LabelNoCount.CapitalizeFirst(def);\n\n\tpublic override string LabelShort => LabelNoCount;\n\n\tpublic virtual string LabelNoParenthesis => GenLabel.ThingLabel(this, 1, includeHp: false, includeQuality: false);\n\n\tpublic string LabelNoParenthesisCap => LabelNoParenthesis.CapitalizeFirst();\n\n\tpublic virtual ModContentPack ContentSource => def.modContentPack;\n\n\tpublic virtual bool IngestibleNow\n\t{\n\t\tget\n\t\t{\n\t\t\tif (this.IsBurning())\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn def.IsIngestible;\n\t\t}\n\t}\n\n\tpublic ThingDef Stuff => stuffInt;\n\n\tpublic Graphic DefaultGraphic\n\t{\n\t\tget\n\t\t{\n\t\t\tif (graphicInt == null)\n\t\t\t{\n\t\t\t\tif (def.graphicData == null)\n\t\t\t\t{\n\t\t\t\t\treturn BaseContent.BadGraphic;\n\t\t\t\t}\n\t\t\t\tgraphicInt = def.graphicData.GraphicColoredFor(this);\n\t\t\t}\n\t\t\treturn graphicInt;\n\t\t}\n\t}\n\n\tpublic virtual Graphic Graphic\n\t{\n\t\tget\n\t\t{\n\t\t\tThingStyleDef styleDef = StyleDef;\n\t\t\tif (styleDef?.Graphic != null)\n\t\t\t{\n\t\t\t\tif (styleGraphicInt == null)\n\t\t\t\t{\n\t\t\t\t\tif (styleDef.graphicData != null)\n\t\t\t\t\t{\n\t\t\t\t\t\tstyleGraphicInt = styleDef.graphicData.GraphicColoredFor(this);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tstyleGraphicInt = styleDef.Graphic;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn styleGraphicInt;\n\t\t\t}\n\t\t\treturn DefaultGraphic;\n\t\t}\n\t}\n\n\tpublic virtual List InteractionCells => ThingUtility.InteractionCellsWhenAt(def, Position, Rotation, Map, allowFallbackCell: true);\n\n\tpublic virtual IntVec3 InteractionCell => ThingUtility.InteractionCellWhenAt(def, Position, Rotation, Map);\n\n\tpublic float AmbientTemperature\n\t{\n\t\tget\n\t\t{\n\t\t\tif (Spawned)\n\t\t\t{\n\t\t\t\treturn GenTemperature.GetTemperatureForCell(Position, Map);\n\t\t\t}\n\t\t\tif (ParentHolder != null)\n\t\t\t{\n\t\t\t\tfor (IThingHolder parentHolder = ParentHolder; parentHolder != null; parentHolder = parentHolder.ParentHolder)\n\t\t\t\t{\n\t\t\t\t\tif (ThingOwnerUtility.TryGetFixedTemperature(parentHolder, this, out var temperature))\n\t\t\t\t\t{\n\t\t\t\t\t\treturn temperature;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (SpawnedOrAnyParentSpawned)\n\t\t\t{\n\t\t\t\treturn GenTemperature.GetTemperatureForCell(PositionHeld, MapHeld);\n\t\t\t}\n\t\t\tif (Tile.Valid)\n\t\t\t{\n\t\t\t\treturn GenTemperature.GetTemperatureAtTile(Tile);\n\t\t\t}\n\t\t\treturn 21f;\n\t\t}\n\t}\n\n\tpublic PlanetTile Tile\n\t{\n\t\tget\n\t\t{\n\t\t\tif (Spawned)\n\t\t\t{\n\t\t\t\treturn Map.Tile;\n\t\t\t}\n\t\t\tif (ParentHolder != null)\n\t\t\t{\n\t\t\t\treturn ThingOwnerUtility.GetRootTile(ParentHolder);\n\t\t\t}\n\t\t\treturn PlanetTile.Invalid;\n\t\t}\n\t}\n\n\tpublic virtual bool Suspended\n\t{\n\t\tget\n\t\t{\n\t\t\tif (Spawned)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (ParentHolder != null)\n\t\t\t{\n\t\t\t\treturn ThingOwnerUtility.ContentsSuspended(ParentHolder);\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic bool InCryptosleep\n\t{\n\t\tget\n\t\t{\n\t\t\tif (Spawned)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (ParentHolder != null)\n\t\t\t{\n\t\t\t\treturn ThingOwnerUtility.ContentsInCryptosleep(ParentHolder);\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic virtual string DescriptionDetailed => def.DescriptionDetailed;\n\n\tpublic virtual string DescriptionFlavor => def.description;\n\n\tpublic bool IsOnHoldingPlatform\n\t{\n\t\tget\n\t\t{\n\t\t\tif (ModsConfig.AnomalyActive)\n\t\t\t{\n\t\t\t\treturn ParentHolder is Building_HoldingPlatform;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic TerrainAffordanceDef TerrainAffordanceNeeded => def.GetTerrainAffordanceNeed(stuffInt);\n\n\tpublic bool BeingTransportedOnGravship => beingTransportedOnGravship;\n\n\tprotected virtual int MinTickIntervalRate => 1;\n\n\tprotected virtual int MaxTickIntervalRate => 15;\n\n\tprotected virtual int UpdateRateTickOffset => this.HashOffset();\n\n\tpublic virtual int UpdateRateTicks => GenTicks.GetCameraUpdateRate(this);\n\n\tpublic Vector3? DrawPosHeld\n\t{\n\t\tget\n\t\t{\n\t\t\tif (Spawned)\n\t\t\t{\n\t\t\t\treturn DrawPos;\n\t\t\t}\n\t\t\treturn ThingOwnerUtility.SpawnedParentOrMe(ParentHolder)?.DrawPos;\n\t\t}\n\t}\n\n\tpublic virtual Vector3 DrawPos => this.TrueCenter();\n\n\tpublic virtual Vector2 DrawSize\n\t{\n\t\tget\n\t\t{\n\t\t\tif (def.graphicData != null)\n\t\t\t{\n\t\t\t\treturn def.graphicData.drawSize;\n\t\t\t}\n\t\t\treturn Vector2.one;\n\t\t}\n\t}\n\n\tpublic virtual Color DrawColor\n\t{\n\t\tget\n\t\t{\n\t\t\tif (Stuff != null)\n\t\t\t{\n\t\t\t\treturn def.GetColorForStuff(Stuff);\n\t\t\t}\n\t\t\tif (def.graphicData != null)\n\t\t\t{\n\t\t\t\treturn def.graphicData.color;\n\t\t\t}\n\t\t\treturn Color.white;\n\t\t}\n\t\tset\n\t\t{\n\t\t\tLog.Error($\"Cannot set instance color on non-ThingWithComps {LabelCap} at {Position}.\");\n\t\t}\n\t}\n\n\tpublic virtual Color DrawColorTwo\n\t{\n\t\tget\n\t\t{\n\t\t\tif (def.graphicData != null)\n\t\t\t{\n\t\t\t\treturn def.graphicData.colorTwo;\n\t\t\t}\n\t\t\treturn Color.white;\n\t\t}\n\t}\n\n\tpublic virtual IEnumerable DescriptionHyperlinks\n\t{\n\t\tget\n\t\t{\n\t\t\tif (def.descriptionHyperlinks != null)\n\t\t\t{\n\t\t\t\tfor (int i = 0; i < def.descriptionHyperlinks.Count; i++)\n\t\t\t\t{\n\t\t\t\t\tyield return def.descriptionHyperlinks[i];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static int IDNumberFromThingID(string thingID)\n\t{\n\t\tstring value = Regex.Match(thingID, \"\\\\d+$\").Value;\n\t\tint result = 0;\n\t\ttry\n\t\t{\n\t\t\tCultureInfo invariantCulture = CultureInfo.InvariantCulture;\n\t\t\tresult = Convert.ToInt32(value, invariantCulture);\n\t\t}\n\t\tcatch (Exception ex)\n\t\t{\n\t\t\tLog.Error(\"Could not convert id number from thingID=\" + thingID + \", numString=\" + value + \" Exception=\" + ex);\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic void DoTick()\n\t{\n\t\tif (Destroyed)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\tif (def.tickerType == TickerType.Normal)\n\t\t{\n\t\t\tusing (ProfilerBlock.Scope(\"DoTick()\"))\n\t\t\t{\n\t\t\t\tusing (ProfilerBlock.Scope(\"Tick()\"))\n\t\t\t\t{\n\t\t\t\t\tTick();\n\t\t\t\t}\n\t\t\t\tif (Destroyed)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\ttickDelta++;\n\t\t\t\tint num = Mathf.Min(Mathf.Max(UpdateRateTicks, MinTickIntervalRate), MaxTickIntervalRate);\n\t\t\t\tif (tickDelta >= num || GenTicks.IsTickInterval(UpdateRateTickOffset, num))\n\t\t\t\t{\n\t\t\t\t\tusing (ProfilerBlock.Scope(\"TickInterval()\"))\n\t\t\t\t\t{\n\t\t\t\t\t\tTickInterval(tickDelta);\n\t\t\t\t\t}\n\t\t\t\t\ttickDelta = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (Destroyed || !(this is IThingHolder thingHolder) || this is IThingHolderTickable { ShouldTickContents: false })\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\tif (tmpHolders == null)\n\t\t{\n\t\t\ttmpHolders = new List(8);\n\t\t}\n\t\ttmpHolders.Add(thingHolder);\n\t\tthingHolder.GetChildHolders(tmpHolders);\n\t\tfor (int i = 0; i < tmpHolders.Count; i++)\n\t\t{\n\t\t\tThingOwner directlyHeldThings = tmpHolders[i].GetDirectlyHeldThings();\n\t\t\tif (directlyHeldThings != null)\n\t\t\t{\n\t\t\t\tdirectlyHeldThings.DoTick();\n\t\t\t\tif (Destroyed)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttmpHolders.Clear();\n\t}\n\n\tpublic virtual void PostMake()\n\t{\n\t\tThingIDMaker.GiveIDTo(this);\n\t\tif (def.useHitPoints)\n\t\t{\n\t\t\tHitPoints = Mathf.RoundToInt((float)MaxHitPoints * Mathf.Clamp01(def.startingHpRange.RandomInRange));\n\t\t}\n\t}\n\n\tpublic virtual void PostPostMake()\n\t{\n\t\tif (!def.randomStyle.NullOrEmpty() && Rand.Chance(def.randomStyleChance))\n\t\t{\n\t\t\tStyleDef = def.randomStyle.RandomElementByWeight((ThingStyleChance x) => x.Chance).StyleDef;\n\t\t}\n\t}\n\n\tpublic virtual void PostQualitySet()\n\t{\n\t}\n\n\tpublic string GetUniqueLoadID()\n\t{\n\t\treturn \"Thing_\" + ThingID;\n\t}\n\n\tpublic override void SpawnSetup(Map map, bool respawningAfterLoad)\n\t{\n\t\tif (Destroyed)\n\t\t{\n\t\t\tLog.Error(\"Spawning destroyed thing \" + this?.ToString() + \" at \" + Position.ToString() + \". Correcting.\");\n\t\t\tmapIndexOrState = -1;\n\t\t\tif (HitPoints <= 0 && def.useHitPoints)\n\t\t\t{\n\t\t\t\tHitPoints = 1;\n\t\t\t}\n\t\t}\n\t\tif (Spawned)\n\t\t{\n\t\t\tLog.Error(\"Tried to spawn already-spawned thing \" + this?.ToString() + \" at \" + Position.ToString());\n\t\t\treturn;\n\t\t}\n\t\tint num = Find.Maps.IndexOf(map);\n\t\tif (num < 0)\n\t\t{\n\t\t\tLog.Error(\"Tried to spawn thing \" + this?.ToString() + \", but the map provided does not exist.\");\n\t\t\treturn;\n\t\t}\n\t\tif (stackCount > def.stackLimit)\n\t\t{\n\t\t\tLog.Error(\"Spawned \" + this?.ToString() + \" with stackCount \" + stackCount + \" but stackLimit is \" + def.stackLimit + \". Truncating.\");\n\t\t\tstackCount = def.stackLimit;\n\t\t}\n\t\tmapIndexOrState = (sbyte)num;\n\t\tRegionListersUpdater.RegisterInRegions(this, map);\n\t\tif (!map.spawnedThings.TryAdd(this, canMergeWithExistingStacks: false))\n\t\t{\n\t\t\tLog.Error(\"Couldn't add thing \" + this?.ToString() + \" to spawned things.\");\n\t\t}\n\t\tmap.listerThings.Add(this);\n\t\tmap.thingGrid.Register(this);\n\t\tmap.gasGrid.Notify_ThingSpawned(this);\n\t\tmap.mapTemperature.Notify_ThingSpawned(this);\n\t\tif (map.IsPlayerHome)\n\t\t{\n\t\t\tEverSeenByPlayer = true;\n\t\t}\n\t\tif (Find.TickManager != null)\n\t\t{\n\t\t\tFind.TickManager.RegisterAllTickabilityFor(this);\n\t\t}\n\t\tDirtyMapMesh(map);\n\t\tif (def.drawerType != DrawerType.MapMeshOnly)\n\t\t{\n\t\t\tmap.dynamicDrawManager.RegisterDrawable(this);\n\t\t}\n\t\tmap.tooltipGiverList.Notify_ThingSpawned(this);\n\t\tif (def.CanAffectLinker)\n\t\t{\n\t\t\tmap.linkGrid.Notify_LinkerCreatedOrDestroyed(this);\n\t\t\tmap.mapDrawer.MapMeshDirty(Position, MapMeshFlagDefOf.Things, regenAdjacentCells: true, regenAdjacentSections: false);\n\t\t}\n\t\tif (!def.CanOverlapZones)\n\t\t{\n\t\t\tmap.zoneManager.Notify_NoZoneOverlapThingSpawned(this);\n\t\t}\n\t\tif (def.AffectsRegions)\n\t\t{\n\t\t\tmap.regionDirtyer.Notify_ThingAffectingRegionsSpawned(this);\n\t\t}\n\t\tif (def.pathCost != 0 || def.passability == Traversability.Impassable)\n\t\t{\n\t\t\tmap.pathing.RecalculatePerceivedPathCostUnderThing(this);\n\t\t}\n\t\tif (def.AffectsReachability)\n\t\t{\n\t\t\tmap.reachability.ClearCache();\n\t\t}\n\t\tmap.coverGrid.Register(this);\n\t\tif (def.category == ThingCategory.Item)\n\t\t{\n\t\t\tmap.listerHaulables.Notify_Spawned(this);\n\t\t\tmap.listerMergeables.Notify_Spawned(this);\n\t\t}\n\t\tmap.attackTargetsCache.Notify_ThingSpawned(this);\n\t\tmap.regionGrid.GetValidRegionAt_NoRebuild(Position)?.Room?.Notify_ContainedThingSpawnedOrDespawned(this);\n\t\tStealAIDebugDrawer.Notify_ThingChanged(this);\n\t\tif (this is IHaulDestination haulDestination)\n\t\t{\n\t\t\tmap.haulDestinationManager.AddHaulDestination(haulDestination);\n\t\t}\n\t\tif (this is IHaulSource source)\n\t\t{\n\t\t\tmap.haulDestinationManager.AddHaulSource(source);\n\t\t}\n\t\tif (this is IThingHolder && Find.ColonistBar != null)\n\t\t{\n\t\t\tFind.ColonistBar.MarkColonistsDirty();\n\t\t}\n\t\tif (def.category == ThingCategory.Item)\n\t\t{\n\t\t\tISlotGroupParent slotGroupParent = Position.GetSlotGroup(map)?.parent;\n\t\t\tif (slotGroupParent != null)\n\t\t\t{\n\t\t\t\tslotGroupParent.Notify_ReceivedThing(this);\n\t\t\t\tGenThing.TryDirtyAdjacentGroupContainers(slotGroupParent, map);\n\t\t\t}\n\t\t}\n\t\tif (def.receivesSignals)\n\t\t{\n\t\t\tFind.SignalManager.RegisterReceiver(this);\n\t\t}\n\t\tif (!BeingTransportedOnGravship)\n\t\t{\n\t\t\tdef.soundSpawned?.PlayOneShot(this);\n\t\t\tif (!respawningAfterLoad)\n\t\t\t{\n\t\t\t\tQuestUtility.SendQuestTargetSignals(questTags, \"Spawned\", this.Named(\"SUBJECT\"));\n\t\t\t\tspawnedTick = Find.TickManager.TicksGame;\n\t\t\t\tdespawnedTick = -1;\n\t\t\t\tif (AnomalyUtility.ShouldNotifyCodex(this, EntityDiscoveryType.Spawn, out var entries))\n\t\t\t\t{\n\t\t\t\t\tFind.EntityCodex.SetDiscovered(entries, def, this);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tFind.HiddenItemsManager.SetDiscovered(def);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tmap.events.Notify_ThingSpawned(this);\n\t}\n\n\tpublic bool DeSpawnOrDeselect(DestroyMode mode = DestroyMode.Vanish)\n\t{\n\t\tbool flag = Current.ProgramState == ProgramState.Playing && Find.Selector.IsSelected(this);\n\t\tif (Spawned)\n\t\t{\n\t\t\tDeSpawn(mode);\n\t\t}\n\t\telse if (flag)\n\t\t{\n\t\t\tFind.Selector.Deselect(this);\n\t\t\tFind.MainButtonsRoot.tabs.Notify_SelectedObjectDespawned();\n\t\t}\n\t\treturn flag;\n\t}\n\n\tpublic override void DeSpawn(DestroyMode mode = DestroyMode.Vanish)\n\t{\n\t\tif (Destroyed)\n\t\t{\n\t\t\tLog.Error(\"Tried to despawn \" + this.ToStringSafe() + \" which is already destroyed.\");\n\t\t\treturn;\n\t\t}\n\t\tif (!Spawned)\n\t\t{\n\t\t\tLog.Error(\"Tried to despawn \" + this.ToStringSafe() + \" which is not spawned.\");\n\t\t\treturn;\n\t\t}\n\t\tMap map = Map;\n\t\tmap.overlayDrawer.DisposeHandle(this);\n\t\tRegionListersUpdater.DeregisterInRegions(this, map);\n\t\tmap.spawnedThings.Remove(this);\n\t\tmap.listerThings.Remove(this);\n\t\tmap.thingGrid.Deregister(this);\n\t\tmap.coverGrid.DeRegister(this);\n\t\tif (def.receivesSignals)\n\t\t{\n\t\t\tFind.SignalManager.DeregisterReceiver(this);\n\t\t}\n\t\tmap.tooltipGiverList.Notify_ThingDespawned(this);\n\t\tif (def.CanAffectLinker)\n\t\t{\n\t\t\tmap.linkGrid.Notify_LinkerCreatedOrDestroyed(this);\n\t\t\tmap.mapDrawer.MapMeshDirty(Position, MapMeshFlagDefOf.Things, regenAdjacentCells: true, regenAdjacentSections: false);\n\t\t}\n\t\tif (Find.Selector.IsSelected(this))\n\t\t{\n\t\t\tFind.Selector.Deselect(this);\n\t\t\tFind.MainButtonsRoot.tabs.Notify_SelectedObjectDespawned();\n\t\t}\n\t\tDirtyMapMesh(map);\n\t\tif (def.drawerType != DrawerType.MapMeshOnly)\n\t\t{\n\t\t\tmap.dynamicDrawManager.DeRegisterDrawable(this);\n\t\t}\n\t\tmap.regionGrid.GetValidRegionAt_NoRebuild(Position)?.Room?.Notify_ContainedThingSpawnedOrDespawned(this);\n\t\tif (def.AffectsRegions)\n\t\t{\n\t\t\tmap.regionDirtyer.Notify_ThingAffectingRegionsDespawned(this);\n\t\t}\n\t\tif (def.pathCost != 0 || def.passability == Traversability.Impassable)\n\t\t{\n\t\t\tmap.pathing.RecalculatePerceivedPathCostUnderThing(this);\n\t\t}\n\t\tif (def.AffectsReachability)\n\t\t{\n\t\t\tmap.reachability.ClearCache();\n\t\t}\n\t\tFind.TickManager.DeRegisterAllTickabilityFor(this);\n\t\tmapIndexOrState = -1;\n\t\tif (def.category == ThingCategory.Item)\n\t\t{\n\t\t\tmap.listerHaulables.Notify_DeSpawned(this);\n\t\t\tmap.listerMergeables.Notify_DeSpawned(this);\n\t\t}\n\t\tmap.attackTargetsCache.Notify_ThingDespawned(this);\n\t\tmap.physicalInteractionReservationManager.ReleaseAllForTarget(this);\n\t\tif (this is IHaulEnroute thing)\n\t\t{\n\t\t\tmap.enrouteManager.Notify_ContainerDespawned(thing);\n\t\t}\n\t\tStealAIDebugDrawer.Notify_ThingChanged(this);\n\t\tif (this is IHaulDestination haulDestination)\n\t\t{\n\t\t\tmap.haulDestinationManager.RemoveHaulDestination(haulDestination);\n\t\t}\n\t\tif (this is IHaulSource source)\n\t\t{\n\t\t\tmap.haulDestinationManager.RemoveHaulSource(source);\n\t\t}\n\t\tif (this is IThingHolder && Find.ColonistBar != null)\n\t\t{\n\t\t\tFind.ColonistBar.MarkColonistsDirty();\n\t\t}\n\t\tif (def.category == ThingCategory.Item)\n\t\t{\n\t\t\tISlotGroupParent slotGroupParent = Position.GetSlotGroup(map)?.parent;\n\t\t\tif (slotGroupParent != null)\n\t\t\t{\n\t\t\t\tslotGroupParent.Notify_LostThing(this);\n\t\t\t\tGenThing.TryDirtyAdjacentGroupContainers(slotGroupParent, map);\n\t\t\t}\n\t\t}\n\t\tQuestUtility.SendQuestTargetSignals(questTags, \"Despawned\", this.Named(\"SUBJECT\"));\n\t\tspawnedTick = -1;\n\t\tdespawnedTick = Find.TickManager.TicksGame;\n\t\tmap.events.Notify_ThingDespawned(this);\n\t}\n\n\tpublic virtual void Kill(DamageInfo? dinfo = null, Hediff exactCulprit = null)\n\t{\n\t\tDestroy(DestroyMode.KillFinalize);\n\t}\n\n\tpublic virtual void Destroy(DestroyMode mode = DestroyMode.Vanish)\n\t{\n\t\tif (!allowDestroyNonDestroyable && !def.destroyable)\n\t\t{\n\t\t\tLog.Error(\"Tried to destroy non-destroyable thing \" + this);\n\t\t\treturn;\n\t\t}\n\t\tif (Destroyed)\n\t\t{\n\t\t\tLog.Error(\"Tried to destroy already-destroyed thing \" + this);\n\t\t\treturn;\n\t\t}\n\t\tbool spawned = Spawned;\n\t\tMap map = Map;\n\t\tif (StyleSourcePrecept != null)\n\t\t{\n\t\t\tStyleSourcePrecept.Notify_ThingLost(this, spawned);\n\t\t}\n\t\tif (Spawned)\n\t\t{\n\t\t\tDeSpawn(mode);\n\t\t}\n\t\telse if (Current.ProgramState == ProgramState.Playing && Find.Selector.IsSelected(this))\n\t\t{\n\t\t\tFind.Selector.Deselect(this);\n\t\t\tFind.MainButtonsRoot.tabs.Notify_SelectedObjectDespawned();\n\t\t}\n\t\tmapIndexOrState = -2;\n\t\tif (def.DiscardOnDestroyed)\n\t\t{\n\t\t\tDiscard();\n\t\t}\n\t\tCompExplosive compExplosive = this.TryGetComp();\n\t\tif (spawned)\n\t\t{\n\t\t\tList list = new List();\n\t\t\tGenLeaving.DoLeavingsFor(this, map, mode, list);\n\t\t\tcompExplosive?.AddThingsIgnoredByExplosion(list);\n\t\t\tNotify_KilledLeavingsLeft(list);\n\t\t}\n\t\tif (holdingOwner != null)\n\t\t{\n\t\t\tholdingOwner.Notify_ContainedItemDestroyed(this);\n\t\t}\n\t\tRemoveAllReservationsAndDesignationsOnThis();\n\t\tif (!(this is Pawn))\n\t\t{\n\t\t\tstackCount = 0;\n\t\t}\n\t\tif (mode != DestroyMode.QuestLogic)\n\t\t{\n\t\t\tQuestUtility.SendQuestTargetSignals(questTags, \"Destroyed\", this.Named(\"SUBJECT\"));\n\t\t}\n\t\tif (mode == DestroyMode.KillFinalize)\n\t\t{\n\t\t\tQuestUtility.SendQuestTargetSignals(questTags, \"Killed\", this.Named(\"SUBJECT\"), map.Named(\"MAP\"));\n\t\t}\n\t}\n\n\tpublic virtual void PreTraded(TradeAction action, Pawn playerNegotiator, ITrader trader)\n\t{\n\t}\n\n\tpublic virtual void PostGeneratedForTrader(TraderKindDef trader, PlanetTile forTile, Faction forFaction)\n\t{\n\t\tif (def.colorGeneratorInTraderStock != null)\n\t\t{\n\t\t\tthis.SetColor(def.colorGeneratorInTraderStock.NewRandomizedColor());\n\t\t}\n\t}\n\n\tpublic virtual float GetBeauty(bool outside)\n\t{\n\t\tif (!outside || !def.StatBaseDefined(StatDefOf.BeautyOutdoors))\n\t\t{\n\t\t\treturn this.GetStatValue(StatDefOf.Beauty);\n\t\t}\n\t\treturn this.GetStatValue(StatDefOf.BeautyOutdoors);\n\t}\n\n\tpublic virtual void Notify_MyMapRemoved()\n\t{\n\t\tif (def.receivesSignals)\n\t\t{\n\t\t\tFind.SignalManager.DeregisterReceiver(this);\n\t\t}\n\t\tif (StyleSourcePrecept != null)\n\t\t{\n\t\t\tStyleSourcePrecept.Notify_ThingLost(this);\n\t\t}\n\t\tif (!ThingOwnerUtility.AnyParentIs(this))\n\t\t{\n\t\t\tmapIndexOrState = -3;\n\t\t}\n\t\tThingOwner thingOwner = holdingOwner;\n\t\tif (thingOwner != null && thingOwner.Owner is Map)\n\t\t{\n\t\t\tholdingOwner = null;\n\t\t}\n\t\tRemoveAllReservationsAndDesignationsOnThis();\n\t}\n\n\tpublic virtual void Notify_LordDestroyed()\n\t{\n\t}\n\n\tpublic virtual void Notify_AbandonedAtTile(PlanetTile tile)\n\t{\n\t}\n\n\tpublic virtual void Notify_KilledLeavingsLeft(List leavings)\n\t{\n\t}\n\n\tpublic virtual void Notify_Studied(Pawn studier, float amount, KnowledgeCategoryDef category = null)\n\t{\n\t}\n\n\tpublic virtual void Notify_Unfogged()\n\t{\n\t\tif (!beenRevealed)\n\t\t{\n\t\t\tbeenRevealed = true;\n\t\t\tif (ModsConfig.AnomalyActive && AnomalyUtility.ShouldNotifyCodex(this, EntityDiscoveryType.Unfog, out var entries))\n\t\t\t{\n\t\t\t\tFind.EntityCodex.SetDiscovered(entries, def, this);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tFind.HiddenItemsManager.SetDiscovered(def);\n\t\t\t}\n\t\t\tQuestUtility.SendQuestTargetSignals(questTags, \"Unfogged\", this);\n\t\t\tCompLetterOnRevealed compLetterOnRevealed = this.TryGetComp();\n\t\t\tif (compLetterOnRevealed != null)\n\t\t\t{\n\t\t\t\tFind.LetterStack.ReceiveLetter(compLetterOnRevealed.Props.label, compLetterOnRevealed.Props.text, compLetterOnRevealed.Props.letterDef, this);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic void ForceSetStateToUnspawned()\n\t{\n\t\tmapIndexOrState = -1;\n\t}\n\n\tpublic void DecrementMapIndex()\n\t{\n\t\tif (mapIndexOrState <= 0)\n\t\t{\n\t\t\tLog.Warning(\"Tried to decrement map index for \" + this?.ToString() + \", but mapIndexOrState=\" + mapIndexOrState);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmapIndexOrState--;\n\t\t}\n\t}\n\n\tprivate void RemoveAllReservationsAndDesignationsOnThis()\n\t{\n\t\tif (def.category == ThingCategory.Mote)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\tList maps = Find.Maps;\n\t\tfor (int i = 0; i < maps.Count; i++)\n\t\t{\n\t\t\tmaps[i].reservationManager.ReleaseAllForTarget(this);\n\t\t\tmaps[i].physicalInteractionReservationManager.ReleaseAllForTarget(this);\n\t\t\tif (this is IAttackTarget target)\n\t\t\t{\n\t\t\t\tmaps[i].attackTargetReservationManager.ReleaseAllForTarget(target);\n\t\t\t}\n\t\t\tmaps[i].designationManager.RemoveAllDesignationsOn(this);\n\t\t}\n\t}\n\n\tpublic virtual void ExposeData()\n\t{\n\t\tScribe_Defs.Look(ref def, \"def\");\n\t\tScribe_Values.Look(ref tickDelta, \"tickDelta\", 0);\n\t\tif (def.HasThingIDNumber)\n\t\t{\n\t\t\tstring value = ThingID;\n\t\t\tScribe_Values.Look(ref value, \"id\");\n\t\t\tif (Scribe.mode != LoadSaveMode.Saving)\n\t\t\t{\n\t\t\t\tThingID = value;\n\t\t\t}\n\t\t}\n\t\tScribe_Values.Look(ref mapIndexOrState, \"map\", -1);\n\t\tif (Scribe.mode == LoadSaveMode.LoadingVars && mapIndexOrState >= 0)\n\t\t{\n\t\t\tmapIndexOrState = -1;\n\t\t}\n\t\tScribe_Values.Look(ref positionInt, \"pos\", IntVec3.Invalid);\n\t\tScribe_Values.Look(ref rotationInt, \"rot\", Rot4.North);\n\t\tScribe_Values.Look(ref debugRotLocked, \"debugRotLocked\", defaultValue: false);\n\t\tif (def.useHitPoints)\n\t\t{\n\t\t\tScribe_Values.Look(ref hitPointsInt, \"health\", -1);\n\t\t}\n\t\tbool flag = def.tradeability != 0 && def.category == ThingCategory.Item;\n\t\tif (def.stackLimit > 1 || flag)\n\t\t{\n\t\t\tScribe_Values.Look(ref stackCount, \"stackCount\", 0, forceSave: true);\n\t\t}\n\t\tScribe_Defs.Look(ref stuffInt, \"stuff\");\n\t\tstring facID = ((factionInt != null) ? factionInt.GetUniqueLoadID() : \"null\");\n\t\tScribe_Values.Look(ref facID, \"faction\", \"null\");\n\t\tif (Scribe.mode == LoadSaveMode.LoadingVars)\n\t\t{\n\t\t\tif (facID == \"null\")\n\t\t\t{\n\t\t\t\tfactionInt = null;\n\t\t\t}\n\t\t\telse if (Find.World != null && Find.FactionManager != null)\n\t\t\t{\n\t\t\t\tfactionInt = Find.FactionManager.AllFactions.FirstOrDefault((Faction fa) => fa.GetUniqueLoadID() == facID);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfacIDsCached.SetOrAdd(this, facID);\n\t\t\t}\n\t\t}\n\t\tif (Scribe.mode == LoadSaveMode.ResolvingCrossRefs)\n\t\t{\n\t\t\tif (facID == \"null\" && facIDsCached.TryGetValue(this, out facID))\n\t\t\t{\n\t\t\t\tfacIDsCached.Remove(this);\n\t\t\t}\n\t\t\tif (facID != \"null\")\n\t\t\t{\n\t\t\t\tfactionInt = Find.FactionManager.AllFactions.FirstOrDefault((Faction fa) => fa.GetUniqueLoadID() == facID);\n\t\t\t}\n\t\t}\n\t\tif (Scribe.mode == LoadSaveMode.PostLoadInit)\n\t\t{\n\t\t\tfacIDsCached.Clear();\n\t\t}\n\t\tScribe_Collections.Look(ref questTags, \"questTags\", LookMode.Value);\n\t\tScribe_Values.Look(ref overrideGraphicIndex, \"overrideGraphicIndex\");\n\t\tScribe_Values.Look(ref spawnedTick, \"spawnedTick\", -1);\n\t\tScribe_Values.Look(ref despawnedTick, \"despawnedTick\", 0);\n\t\tScribe_Values.Look(ref beenRevealed, \"beenRevealed\", defaultValue: false);\n\t\tBackCompatibility.PostExposeData(this);\n\t}\n\n\tpublic virtual void PostMapInit()\n\t{\n\t}\n\n\tpublic void DrawNowAt(Vector3 drawLoc, bool flip = false)\n\t{\n\t\tDynamicDrawPhaseAt(DrawPhase.Draw, drawLoc, flip);\n\t}\n\n\tpublic void DynamicDrawPhase(DrawPhase phase)\n\t{\n\t\tif (def.drawerType != DrawerType.MapMeshOnly)\n\t\t{\n\t\t\tDynamicDrawPhaseAt(phase, DrawPos);\n\t\t}\n\t}\n\n\tpublic virtual void DynamicDrawPhaseAt(DrawPhase phase, Vector3 drawLoc, bool flip = false)\n\t{\n\t\tif (phase == DrawPhase.Draw)\n\t\t{\n\t\t\tDrawAt(drawLoc, flip);\n\t\t}\n\t}\n\n\tprotected virtual void DrawAt(Vector3 drawLoc, bool flip = false)\n\t{\n\t\tif (def.drawerType == DrawerType.RealtimeOnly || !Spawned)\n\t\t{\n\t\t\tGraphic.Draw(drawLoc, flip ? Rotation.Opposite : Rotation, this);\n\t\t}\n\t\tSilhouetteUtility.DrawGraphicSilhouette(this, drawLoc);\n\t}\n\n\tpublic virtual void Print(SectionLayer layer)\n\t{\n\t\tif (!def.dontPrint)\n\t\t{\n\t\t\tGraphic.Print(layer, this, 0f);\n\t\t}\n\t}\n\n\tpublic void DirtyMapMesh(Map map)\n\t{\n\t\tif (def.drawerType == DrawerType.RealtimeOnly)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\tforeach (IntVec3 item in this.OccupiedRect())\n\t\t{\n\t\t\tmap.mapDrawer.MapMeshDirty(item, MapMeshFlagDefOf.Things);\n\t\t}\n\t}\n\n\tpublic virtual void DrawGUIOverlay()\n\t{\n\t\tif (Find.CameraDriver.CurrentZoom == CameraZoomRange.Closest)\n\t\t{\n\t\t\tQualityCategory qc;\n\t\t\tif (def.stackLimit > 1)\n\t\t\t{\n\t\t\t\tGenMapUI.DrawThingLabel(this, stackCount.ToStringCached());\n\t\t\t}\n\t\t\telse if (def.drawGUIOverlayQuality && this.TryGetQuality(out qc))\n\t\t\t{\n\t\t\t\tGenMapUI.DrawThingLabel(this, qc.GetLabelShort());\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic virtual void DrawExtraSelectionOverlays()\n\t{\n\t\tif (def.specialDisplayRadius > 0.1f)\n\t\t{\n\t\t\tGenDraw.DrawRadiusRing(Position, def.specialDisplayRadius);\n\t\t}\n\t\tif (def.drawPlaceWorkersWhileSelected && def.PlaceWorkers != null)\n\t\t{\n\t\t\tfor (int i = 0; i < def.PlaceWorkers.Count; i++)\n\t\t\t{\n\t\t\t\tdef.PlaceWorkers[i].DrawGhost(def, Position, Rotation, Color.white, this);\n\t\t\t}\n\t\t}\n\t\tGenDraw.DrawInteractionCells(def, Position, rotationInt);\n\t}\n\n\tpublic virtual string GetInspectString()\n\t{\n\t\tStringBuilder stringBuilder = new StringBuilder();\n\t\tQuestUtility.AppendInspectStringsFromQuestParts(stringBuilder, this);\n\t\treturn stringBuilder.ToString();\n\t}\n\n\tpublic virtual string GetInspectStringLowPriority()\n\t{\n\t\tstring result = null;\n\t\ttmpDeteriorationReasons.Clear();\n\t\tfloat f = SteadyEnvironmentEffects.FinalDeteriorationRate(this, tmpDeteriorationReasons);\n\t\tif (tmpDeteriorationReasons.Count != 0)\n\t\t{\n\t\t\tresult = string.Format(\"{0}: {1} ({2})\", \"DeterioratingBecauseOf\".Translate(), tmpDeteriorationReasons.ToCommaList().CapitalizeFirst(), \"PerDay\".Translate(f.ToStringByStyle(ToStringStyle.FloatMaxTwo)));\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic virtual IEnumerable GetGizmos()\n\t{\n\t\tGizmo gizmo = ContainingSelectionUtility.SelectContainingThingGizmo(this);\n\t\tif (gizmo != null)\n\t\t{\n\t\t\tyield return gizmo;\n\t\t}\n\t\tshowingGizmosForRitualsTmp.Clear();\n\t\tforeach (Ideo ideo in Faction.OfPlayer.ideos.AllIdeos)\n\t\t{\n\t\t\tfor (int i = 0; i < ideo.PreceptsListForReading.Count; i++)\n\t\t\t{\n\t\t\t\tPrecept precept = ideo.PreceptsListForReading[i];\n\t\t\t\tif (!(precept is Precept_Ritual ritual) || (precept.def.mergeRitualGizmosFromAllIdeos && showingGizmosForRitualsTmp.Contains(ritual.sourcePattern)) || !ritual.ShouldShowGizmo(this))\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tforeach (Gizmo item in ritual.GetGizmoFor(this))\n\t\t\t\t{\n\t\t\t\t\tyield return item;\n\t\t\t\t\tshowingGizmosForRitualsTmp.Add(ritual.sourcePattern);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tList activeRituals = Find.IdeoManager.GetActiveRituals(MapHeld);\n\t\tforeach (LordJob_Ritual item2 in activeRituals)\n\t\t{\n\t\t\tif (item2.selectedTarget == this)\n\t\t\t{\n\t\t\t\tyield return item2.GetCancelGizmo();\n\t\t\t}\n\t\t}\n\t\tif (ModsConfig.AnomalyActive)\n\t\t{\n\t\t\tGizmo gizmo2 = AnomalyUtility.OpenCodexGizmo(this);\n\t\t\tif (gizmo2 != null)\n\t\t\t{\n\t\t\t\tyield return gizmo2;\n\t\t\t}\n\t\t}\n\t\tif (DebugSettings.ShowDevGizmos && this.HasAttachment(ThingDefOf.Fire))\n\t\t{\n\t\t\tyield return new Command_Action\n\t\t\t{\n\t\t\t\tdefaultLabel = \"DEV: Extinguish\",\n\t\t\t\taction = delegate\n\t\t\t\t{\n\t\t\t\t\tthis.GetAttachment(ThingDefOf.Fire)?.Destroy();\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n\n\tpublic virtual IEnumerable GetFloatMenuOptions(Pawn selPawn)\n\t{\n\t\treturn Enumerable.Empty();\n\t}\n\n\tpublic virtual IEnumerable GetMultiSelectFloatMenuOptions(IEnumerable selPawns)\n\t{\n\t\treturn Enumerable.Empty();\n\t}\n\n\tpublic virtual IEnumerable GetInspectTabs()\n\t{\n\t\treturn def.inspectorTabsResolved;\n\t}\n\n\tpublic virtual string GetCustomLabelNoCount(bool includeHp = true)\n\t{\n\t\treturn GenLabel.ThingLabel(this, 1, includeHp);\n\t}\n\n\tpublic DamageWorker.DamageResult TakeDamage(DamageInfo dinfo)\n\t{\n\t\tif (Destroyed)\n\t\t{\n\t\t\treturn new DamageWorker.DamageResult();\n\t\t}\n\t\tif (dinfo.Amount == 0f)\n\t\t{\n\t\t\treturn new DamageWorker.DamageResult();\n\t\t}\n\t\tif (def.damageMultipliers != null)\n\t\t{\n\t\t\tfor (int i = 0; i < def.damageMultipliers.Count; i++)\n\t\t\t{\n\t\t\t\tif (def.damageMultipliers[i].damageDef == dinfo.Def)\n\t\t\t\t{\n\t\t\t\t\tint num = Mathf.RoundToInt(dinfo.Amount * def.damageMultipliers[i].multiplier);\n\t\t\t\t\tdinfo.SetAmount(num);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tPreApplyDamage(ref dinfo, out var absorbed);\n\t\tif (absorbed)\n\t\t{\n\t\t\treturn new DamageWorker.DamageResult();\n\t\t}\n\t\tbool spawnedOrAnyParentSpawned = SpawnedOrAnyParentSpawned;\n\t\tMap mapHeld = MapHeld;\n\t\tDamageWorker.DamageResult damageResult = dinfo.Def.Worker.Apply(dinfo, this);\n\t\tif (dinfo.Def.harmsHealth && spawnedOrAnyParentSpawned)\n\t\t{\n\t\t\tmapHeld.damageWatcher.Notify_DamageTaken(this, damageResult.totalDamageDealt);\n\t\t}\n\t\tif (dinfo.Instigator is Pawn pawn)\n\t\t{\n\t\t\tforeach (Hediff hediff in pawn.health.hediffSet.hediffs)\n\t\t\t{\n\t\t\t\thediff.Notify_PawnDamagedThing(this, dinfo, damageResult);\n\t\t\t}\n\t\t}\n\t\tif (dinfo.Def.ExternalViolenceFor(this))\n\t\t{\n\t\t\tif (dinfo.SpawnFilth)\n\t\t\t{\n\t\t\t\tGenLeaving.DropFilthDueToDamage(this, damageResult.totalDamageDealt);\n\t\t\t}\n\t\t\tif (dinfo.Instigator != null)\n\t\t\t{\n\t\t\t\tif (dinfo.Instigator is Pawn pawn2)\n\t\t\t\t{\n\t\t\t\t\tpawn2.records.AddTo(RecordDefOf.DamageDealt, damageResult.totalDamageDealt);\n\t\t\t\t}\n\t\t\t\tif (dinfo.Instigator.Faction == Faction.OfPlayer)\n\t\t\t\t{\n\t\t\t\t\tQuestUtility.SendQuestTargetSignals(questTags, \"TookDamageFromPlayer\", this.Named(\"SUBJECT\"), dinfo.Instigator.Named(\"INSTIGATOR\"));\n\t\t\t\t}\n\t\t\t}\n\t\t\tQuestUtility.SendQuestTargetSignals(questTags, \"TookDamage\", this.Named(\"SUBJECT\"), dinfo.Instigator.Named(\"INSTIGATOR\"), mapHeld.Named(\"MAP\"));\n\t\t}\n\t\tif (!Destroyed && FlammableNow && dinfo.Def.igniteChanceByTargetFlammability != null && Rand.Chance(dinfo.Def.igniteChanceByTargetFlammability.Evaluate(this.GetStatValue(StatDefOf.Flammability))))\n\t\t{\n\t\t\tthis.TryAttachFire(Rand.Range(0.55f, 0.85f), dinfo.Instigator);\n\t\t}\n\t\tPostApplyDamage(dinfo, damageResult.totalDamageDealt);\n\t\treturn damageResult;\n\t}\n\n\tpublic virtual void PreApplyDamage(ref DamageInfo dinfo, out bool absorbed)\n\t{\n\t\tabsorbed = false;\n\t}\n\n\tpublic virtual void PostApplyDamage(DamageInfo dinfo, float totalDamageDealt)\n\t{\n\t}\n\n\tpublic virtual bool CanStackWith(Thing other)\n\t{\n\t\tif (Destroyed || other.Destroyed)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tif (def.category != ThingCategory.Item)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tif (this.IsRelic() || other.IsRelic())\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tif (def == other.def)\n\t\t{\n\t\t\treturn Stuff == other.Stuff;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic virtual bool TryAbsorbStack(Thing other, bool respectStackLimit)\n\t{\n\t\tif (!CanStackWith(other))\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tint num = ThingUtility.TryAbsorbStackNumToTake(this, other, respectStackLimit);\n\t\tif (def.useHitPoints)\n\t\t{\n\t\t\tHitPoints = Mathf.CeilToInt((float)(HitPoints * stackCount + other.HitPoints * num) / (float)(stackCount + num));\n\t\t}\n\t\tstackCount += num;\n\t\tother.stackCount -= num;\n\t\tif (Map != null)\n\t\t{\n\t\t\tDirtyMapMesh(Map);\n\t\t}\n\t\tStealAIDebugDrawer.Notify_ThingChanged(this);\n\t\tif (Spawned)\n\t\t{\n\t\t\tMap.listerMergeables.Notify_ThingStackChanged(this);\n\t\t}\n\t\tif (other.stackCount <= 0)\n\t\t{\n\t\t\tother.Destroy();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic virtual Thing SplitOff(int count)\n\t{\n\t\tif (count <= 0)\n\t\t{\n\t\t\tthrow new ArgumentException(\"SplitOff with count <= 0\", \"count\");\n\t\t}\n\t\tif (count >= stackCount)\n\t\t{\n\t\t\tif (count > stackCount)\n\t\t\t{\n\t\t\t\tLog.Error(\"Tried to split off \" + count + \" of \" + this?.ToString() + \" but there are only \" + stackCount);\n\t\t\t}\n\t\t\tDeSpawnOrDeselect();\n\t\t\tholdingOwner?.Remove(this);\n\t\t\treturn this;\n\t\t}\n\t\tThing thing = ThingMaker.MakeThing(def, Stuff);\n\t\tthing.stackCount = count;\n\t\tstackCount -= count;\n\t\tif (Map != null)\n\t\t{\n\t\t\tDirtyMapMesh(Map);\n\t\t}\n\t\tif (Spawned)\n\t\t{\n\t\t\tMap.listerMergeables.Notify_ThingStackChanged(this);\n\t\t}\n\t\tif (def.useHitPoints)\n\t\t{\n\t\t\tthing.HitPoints = HitPoints;\n\t\t}\n\t\treturn thing;\n\t}\n\n\tpublic virtual IEnumerable SpecialDisplayStats()\n\t{\n\t\tif (Stuff != null)\n\t\t{\n\t\t\tyield return new StatDrawEntry(StatCategoryDefOf.BasicsImportant, \"Stat_Stuff_Name\".Translate(), Stuff.LabelCap, \"Stat_Stuff_Desc\".Translate(), 1100, null, new Dialog_InfoCard.Hyperlink[1]\n\t\t\t{\n\t\t\t\tnew Dialog_InfoCard.Hyperlink(Stuff)\n\t\t\t});\n\t\t}\n\t\tif (!ModsConfig.IdeologyActive || Find.IdeoManager.classicMode)\n\t\t{\n\t\t\tyield break;\n\t\t}\n\t\ttmpIdeoNames.Clear();\n\t\tStyleCategoryDef styleCategoryDef = StyleDef?.Category ?? def.dominantStyleCategory;\n\t\tif (styleCategoryDef == null)\n\t\t{\n\t\t\tyield break;\n\t\t}\n\t\tforeach (Ideo item in Find.IdeoManager.IdeosListForReading)\n\t\t{\n\t\t\tif (IdeoUtility.ThingSatisfiesIdeo(this, item))\n\t\t\t{\n\t\t\t\ttmpIdeoNames.Add(item.name.Colorize(item.Color));\n\t\t\t}\n\t\t}\n\t\tyield return new StatDrawEntry(StatCategoryDefOf.BasicsNonPawn, \"Stat_Thing_StyleDominanceCategory\".Translate(), styleCategoryDef.LabelCap, \"Stat_Thing_StyleDominanceCategoryDesc\".Translate() + \"\\n\\n\" + \"Stat_Thing_IdeosSatisfied\".Translate() + \":\" + \"\\n\" + tmpIdeoNames.ToLineList(\" - \"), 6005);\n\t}\n\n\tpublic virtual void Notify_ColorChanged()\n\t{\n\t\tgraphicInt = null;\n\t\tstyleGraphicInt = null;\n\t\tif (Spawned && (def.drawerType == DrawerType.MapMeshOnly || def.drawerType == DrawerType.MapMeshAndRealTime))\n\t\t{\n\t\t\tMap.mapDrawer.MapMeshDirty(Position, MapMeshFlagDefOf.Things);\n\t\t}\n\t}\n\n\tpublic virtual void Notify_Equipped(Pawn pawn)\n\t{\n\t}\n\n\tpublic virtual void Notify_Unequipped(Pawn pawn)\n\t{\n\t}\n\n\tpublic virtual void Notify_UsedVerb(Pawn pawn, Verb verb)\n\t{\n\t}\n\n\tpublic virtual void Notify_UsedWeapon(Pawn pawn)\n\t{\n\t}\n\n\tpublic virtual void Notify_DebugSpawned()\n\t{\n\t}\n\n\tpublic virtual void Notify_RecipeProduced(Pawn pawn)\n\t{\n\t}\n\n\tpublic virtual void Notify_SignalReceived(Signal signal)\n\t{\n\t}\n\n\tpublic virtual void Notify_Explosion(Explosion explosion)\n\t{\n\t}\n\n\tpublic virtual void Notify_BulletImpactNearby(BulletImpactData impactData)\n\t{\n\t}\n\n\tpublic virtual void Notify_ThingSelected()\n\t{\n\t}\n\n\tpublic virtual TipSignal GetTooltip()\n\t{\n\t\tstring text = LabelCap;\n\t\tif (def.useHitPoints)\n\t\t{\n\t\t\ttext = text + \"\\n\" + HitPoints + \" / \" + MaxHitPoints;\n\t\t}\n\t\treturn new TipSignal(text, thingIDNumber * 251235);\n\t}\n\n\tpublic virtual bool BlocksPawn(Pawn p)\n\t{\n\t\tif (def.passability == Traversability.Impassable)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\tif (def.IsFence && p.def.race.FenceBlocked)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic void SetFactionDirect(Faction newFaction)\n\t{\n\t\tif (!def.CanHaveFaction)\n\t\t{\n\t\t\tLog.Error(\"Tried to SetFactionDirect on \" + this?.ToString() + \" which cannot have a faction.\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfactionInt = newFaction;\n\t\t}\n\t}\n\n\tpublic virtual void SetFaction(Faction newFaction, Pawn recruiter = null)\n\t{\n\t\tif (!def.CanHaveFaction)\n\t\t{\n\t\t\tLog.Error(\"Tried to SetFaction on \" + this?.ToString() + \" which cannot have a faction.\");\n\t\t\treturn;\n\t\t}\n\t\tFaction previous = factionInt;\n\t\tfactionInt = newFaction;\n\t\tif (Spawned && this is IAttackTarget t)\n\t\t{\n\t\t\tMap.attackTargetsCache.UpdateTarget(t);\n\t\t}\n\t\tQuestUtility.SendQuestTargetSignals(questTags, \"ChangedFaction\", this.Named(\"SUBJECT\"), newFaction.Named(\"FACTION\"));\n\t\tif (newFaction != Faction.OfPlayer)\n\t\t{\n\t\t\tQuestUtility.SendQuestTargetSignals(questTags, \"ChangedFactionToNonPlayer\", this.Named(\"SUBJECT\"), newFaction.Named(\"FACTION\"));\n\t\t}\n\t\telse\n\t\t{\n\t\t\tQuestUtility.SendQuestTargetSignals(questTags, \"ChangedFactionToPlayer\", this.Named(\"SUBJECT\"), newFaction.Named(\"FACTION\"));\n\t\t}\n\t\tif (Spawned)\n\t\t{\n\t\t\tMap.events.Notify_ThingFactionChanged(previous, factionInt);\n\t\t}\n\t}\n\n\tpublic virtual AcceptanceReport ClaimableBy(Faction by)\n\t{\n\t\treturn false;\n\t}\n\n\tpublic virtual bool AdoptableBy(Faction by, StringBuilder reason = null)\n\t{\n\t\treturn false;\n\t}\n\n\tpublic bool FactionPreventsClaimingOrAdopting(Faction faction, bool forClaim, out string reason)\n\t{\n\t\treason = null;\n\t\tif (faction == null)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tif (faction == Faction.OfInsects)\n\t\t{\n\t\t\tif (HiveUtility.AnyHivePreventsClaiming(this))\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\telse if (faction == Faction.OfMechanoids)\n\t\t{\n\t\t\tforeach (IAttackTarget item in MapHeld.attackTargetsCache.TargetsHostileToFaction(Faction.OfPlayer))\n\t\t\t{\n\t\t\t\tif (item.Thing == null || item.Thing.Faction != faction)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (item.Thing is Pawn pawn)\n\t\t\t\t{\n\t\t\t\t\tif (GenHostility.IsActiveThreatToPlayer(pawn))\n\t\t\t\t\t{\n\t\t\t\t\t\tif (forClaim)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treason = \"MessageCannotClaimWhenPawnThreatsAreNear\".Translate(this.Named(\"CLAIMABLE\"), pawn.Named(\"THREAT\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treason = \"MessageCannotAdoptWhilePawnThreatsAreNear\".Translate(this.Named(\"CLAIMABLE\"), pawn.Named(\"THREAT\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (forClaim)\n\t\t\t\t{\n\t\t\t\t\treason = \"MessageCannotClaimWhenThreatsAreNear\".Translate(this.Named(\"CLAIMABLE\"), item.Named(\"THREAT\"));\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treason = \"MessageCannotAdoptWhileThreatsAreNear\".Translate(this.Named(\"CLAIMABLE\"), item.Named(\"THREAT\"));\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (faction == Faction.OfAncients && Spawned && !Map.IsPlayerHome && GenHostility.AnyHostileActiveThreatToPlayer(Map, countDormantPawnsAsHostile: true, canBeFogged: true))\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (Spawned && faction != Faction.OfPlayer)\n\t\t\t{\n\t\t\t\tList list = Map.mapPawns.SpawnedPawnsInFaction(faction);\n\t\t\t\tfor (int i = 0; i < list.Count; i++)\n\t\t\t\t{\n\t\t\t\t\tif (list[i].RaceProps.ToolUser && GenHostility.IsPotentialThreat(list[i]))\n\t\t\t\t\t{\n\t\t\t\t\t\tif (forClaim)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treason = \"MessageCannotClaimWhenThreatsAreNear\".Translate(this.Named(\"CLAIMABLE\"), list[i].Named(\"THREAT\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treason = \"MessageCannotAdoptWhileThreatsAreNear\".Translate(this.Named(\"CLAIMABLE\"), list[i].Named(\"THREAT\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic void SetPositionDirect(IntVec3 newPos)\n\t{\n\t\tpositionInt = newPos;\n\t}\n\n\tpublic void SetStuffDirect(ThingDef newStuff)\n\t{\n\t\tstuffInt = newStuff;\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\tif (def != null)\n\t\t{\n\t\t\treturn ThingID;\n\t\t}\n\t\treturn GetType().ToString();\n\t}\n\n\tpublic bool Equals(Thing other)\n\t{\n\t\tif (other == null)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tif (def.category == ThingCategory.Mote)\n\t\t{\n\t\t\treturn this == other;\n\t\t}\n\t\tif (thingIDNumber == other.thingIDNumber)\n\t\t{\n\t\t\treturn def.Equals(other.def);\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic override int GetHashCode()\n\t{\n\t\tif (thingIDNumber == -1)\n\t\t{\n\t\t\treturn base.GetHashCode();\n\t\t}\n\t\treturn thingIDNumber;\n\t}\n\n\tpublic virtual void Discard(bool silentlyRemoveReferences = false)\n\t{\n\t\tif (mapIndexOrState != -2)\n\t\t{\n\t\t\tLog.Warning(\"Tried to discard \" + this?.ToString() + \" whose state is \" + mapIndexOrState + \".\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmapIndexOrState = -3;\n\t\t}\n\t}\n\n\tpublic virtual void Notify_DefsHotReloaded()\n\t{\n\t\tgraphicInt = null;\n\t}\n\n\tpublic virtual IEnumerable ButcherProducts(Pawn butcher, float efficiency)\n\t{\n\t\tif (def.butcherProducts == null)\n\t\t{\n\t\t\tyield break;\n\t\t}\n\t\tfor (int i = 0; i < def.butcherProducts.Count; i++)\n\t\t{\n\t\t\tThingDefCountClass thingDefCountClass = def.butcherProducts[i];\n\t\t\tint num = GenMath.RoundRandom((float)thingDefCountClass.count * efficiency);\n\t\t\tif (num > 0)\n\t\t\t{\n\t\t\t\tThing thing = ThingMaker.MakeThing(thingDefCountClass.thingDef);\n\t\t\t\tthing.stackCount = num;\n\t\t\t\tyield return thing;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic virtual IEnumerable SmeltProducts(float efficiency)\n\t{\n\t\tList costListAdj = def.CostListAdjusted(Stuff);\n\t\tfor (int i = 0; i < costListAdj.Count; i++)\n\t\t{\n\t\t\tif (!costListAdj[i].thingDef.intricate && costListAdj[i].thingDef.smeltable)\n\t\t\t{\n\t\t\t\tint num = GenMath.RoundRandom((float)costListAdj[i].count * 0.25f);\n\t\t\t\tif (num > 0)\n\t\t\t\t{\n\t\t\t\t\tThing thing = ThingMaker.MakeThing(costListAdj[i].thingDef);\n\t\t\t\t\tthing.stackCount = num;\n\t\t\t\t\tyield return thing;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (def.smeltProducts != null)\n\t\t{\n\t\t\tfor (int i = 0; i < def.smeltProducts.Count; i++)\n\t\t\t{\n\t\t\t\tThingDefCountClass thingDefCountClass = def.smeltProducts[i];\n\t\t\t\tThing thing2 = ThingMaker.MakeThing(thingDefCountClass.thingDef);\n\t\t\t\tthing2.stackCount = thingDefCountClass.count;\n\t\t\t\tyield return thing2;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic float Ingested(Pawn ingester, float nutritionWanted)\n\t{\n\t\tif (Destroyed)\n\t\t{\n\t\t\tLog.Error(ingester?.ToString() + \" ingested destroyed thing \" + this);\n\t\t\treturn 0f;\n\t\t}\n\t\tif (!IngestibleNow)\n\t\t{\n\t\t\tLog.Error(ingester?.ToString() + \" ingested IngestibleNow=false thing \" + this);\n\t\t\treturn 0f;\n\t\t}\n\t\tingester.mindState.lastIngestTick = Find.TickManager.TicksGame;\n\t\tif (ingester.needs.mood != null)\n\t\t{\n\t\t\tList list = FoodUtility.ThoughtsFromIngesting(ingester, this, def);\n\t\t\tfor (int i = 0; i < list.Count; i++)\n\t\t\t{\n\t\t\t\tThought_Memory thought_Memory = ThoughtMaker.MakeThought(list[i].thought, list[i].fromPrecept);\n\t\t\t\tif (thought_Memory is Thought_FoodEaten thought_FoodEaten)\n\t\t\t\t{\n\t\t\t\t\tthought_FoodEaten.SetFood(this);\n\t\t\t\t}\n\t\t\t\tingester.needs.mood.thoughts.memories.TryGainMemory(thought_Memory);\n\t\t\t}\n\t\t}\n\t\tingester.needs.drugsDesire?.Notify_IngestedDrug(this);\n\t\tbool flag = FoodUtility.IsHumanlikeCorpseOrHumanlikeMeat(this, def);\n\t\tbool flag2 = FoodUtility.IsHumanlikeCorpseOrHumanlikeMeatOrIngredient(this);\n\t\tif (flag && ingester.IsColonist)\n\t\t{\n\t\t\tTaleRecorder.RecordTale(TaleDefOf.AteRawHumanlikeMeat, ingester);\n\t\t}\n\t\tif (flag2)\n\t\t{\n\t\t\tingester.mindState.lastHumanMeatIngestedTick = Find.TickManager.TicksGame;\n\t\t\tFind.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.AteHumanMeat, ingester.Named(HistoryEventArgsNames.Doer)), canApplySelfTookThoughts: false);\n\t\t\tif (flag)\n\t\t\t{\n\t\t\t\tFind.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.AteHumanMeatDirect, ingester.Named(HistoryEventArgsNames.Doer)), canApplySelfTookThoughts: false);\n\t\t\t}\n\t\t}\n\t\telse if (ModsConfig.IdeologyActive && !FoodUtility.AcceptableCannibalNonHumanlikeMeatFood(def))\n\t\t{\n\t\t\tFind.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.AteNonCannibalFood, ingester.Named(HistoryEventArgsNames.Doer)), canApplySelfTookThoughts: false);\n\t\t}\n\t\tif (def.ingestible.ateEvent != null)\n\t\t{\n\t\t\tFind.HistoryEventsManager.RecordEvent(new HistoryEvent(def.ingestible.ateEvent, ingester.Named(HistoryEventArgsNames.Doer)), canApplySelfTookThoughts: false);\n\t\t}\n\t\tif (ModsConfig.IdeologyActive)\n\t\t{\n\t\t\tFoodKind foodKind = FoodUtility.GetFoodKind(this);\n\t\t\tif (foodKind != FoodKind.Any && !def.IsProcessedFood)\n\t\t\t{\n\t\t\t\tif (foodKind == FoodKind.Meat)\n\t\t\t\t{\n\t\t\t\t\tif (!flag2)\n\t\t\t\t\t{\n\t\t\t\t\t\tFind.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.AteMeat, ingester.Named(HistoryEventArgsNames.Doer)), canApplySelfTookThoughts: false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (!def.IsDrug && def.ingestible.CachedNutrition > 0f)\n\t\t\t\t{\n\t\t\t\t\tFind.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.AteNonMeat, ingester.Named(HistoryEventArgsNames.Doer)), canApplySelfTookThoughts: false);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (FoodUtility.IsVeneratedAnimalMeatOrCorpseOrHasIngredients(this, ingester))\n\t\t\t{\n\t\t\t\tFind.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.AteVeneratedAnimalMeat, ingester.Named(HistoryEventArgsNames.Doer)), canApplySelfTookThoughts: false);\n\t\t\t}\n\t\t\tif (def.thingCategories != null && def.thingCategories.Contains(ThingCategoryDefOf.PlantFoodRaw))\n\t\t\t{\n\t\t\t\tif (def.IsFungus)\n\t\t\t\t{\n\t\t\t\t\tFind.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.AteFungus, ingester.Named(HistoryEventArgsNames.Doer)), canApplySelfTookThoughts: false);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tFind.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.AteNonFungusPlant, ingester.Named(HistoryEventArgsNames.Doer)), canApplySelfTookThoughts: false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tCompIngredients compIngredients = this.TryGetComp();\n\t\tif (compIngredients != null)\n\t\t{\n\t\t\tbool flag3 = false;\n\t\t\tbool flag4 = false;\n\t\t\tbool flag5 = false;\n\t\t\tbool flag6 = false;\n\t\t\tbool flag7 = false;\n\t\t\tfor (int j = 0; j < compIngredients.ingredients.Count; j++)\n\t\t\t{\n\t\t\t\tif (!flag3 && FoodUtility.GetMeatSourceCategory(compIngredients.ingredients[j]) == MeatSourceCategory.Humanlike)\n\t\t\t\t{\n\t\t\t\t\tingester.mindState.lastHumanMeatIngestedTick = Find.TickManager.TicksGame;\n\t\t\t\t\tFind.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.AteHumanMeatAsIngredient, ingester.Named(HistoryEventArgsNames.Doer)), canApplySelfTookThoughts: false);\n\t\t\t\t\tflag3 = true;\n\t\t\t\t}\n\t\t\t\telse if (!flag4 && ingester.Ideo != null && compIngredients.ingredients[j].IsMeat && ingester.Ideo.IsVeneratedAnimal(compIngredients.ingredients[j].ingestible.sourceDef))\n\t\t\t\t{\n\t\t\t\t\tFind.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.AteVeneratedAnimalMeat, ingester.Named(HistoryEventArgsNames.Doer)), canApplySelfTookThoughts: false);\n\t\t\t\t\tflag4 = true;\n\t\t\t\t}\n\t\t\t\tif (!flag5 && FoodUtility.GetMeatSourceCategory(compIngredients.ingredients[j]) == MeatSourceCategory.Insect)\n\t\t\t\t{\n\t\t\t\t\tFind.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.AteInsectMeatAsIngredient, ingester.Named(HistoryEventArgsNames.Doer)), canApplySelfTookThoughts: false);\n\t\t\t\t\tflag5 = true;\n\t\t\t\t}\n\t\t\t\tif (ModsConfig.IdeologyActive && !flag6 && compIngredients.ingredients[j].thingCategories.Contains(ThingCategoryDefOf.PlantFoodRaw))\n\t\t\t\t{\n\t\t\t\t\tif (compIngredients.ingredients[j].IsFungus)\n\t\t\t\t\t{\n\t\t\t\t\t\tFind.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.AteFungusAsIngredient, ingester.Named(HistoryEventArgsNames.Doer)), canApplySelfTookThoughts: false);\n\t\t\t\t\t\tflag6 = true;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tflag7 = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (ModsConfig.IdeologyActive && !flag6 && flag7)\n\t\t\t{\n\t\t\t\tFind.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.AteNonFungusMealWithPlants, ingester.Named(HistoryEventArgsNames.Doer)), canApplySelfTookThoughts: false);\n\t\t\t}\n\t\t}\n\t\tIngestedCalculateAmounts(ingester, nutritionWanted, out var numTaken, out var nutritionIngested);\n\t\tif (!ingester.Dead && ingester.needs.joy != null && Mathf.Abs(def.ingestible.joy) > 0.0001f && numTaken > 0)\n\t\t{\n\t\t\tingester.needs.joy.GainJoy((float)numTaken * def.ingestible.joy, def.ingestible.joyKind ?? JoyKindDefOf.Gluttonous);\n\t\t}\n\t\tfloat poisonChanceOverride;\n\t\tfloat chance = (FoodUtility.TryGetFoodPoisoningChanceOverrideFromTraits(ingester, this, out poisonChanceOverride) ? poisonChanceOverride : (this.GetStatValue(StatDefOf.FoodPoisonChanceFixedHuman) * FoodUtility.GetFoodPoisonChanceFactor(ingester)));\n\t\tif (ingester.RaceProps.Humanlike && Rand.Chance(chance))\n\t\t{\n\t\t\tFoodUtility.AddFoodPoisoningHediff(ingester, this, FoodPoisonCause.DangerousFoodType);\n\t\t}\n\t\tList hediffs = ingester.health.hediffSet.hediffs;\n\t\tfor (int k = 0; k < hediffs.Count; k++)\n\t\t{\n\t\t\thediffs[k].Notify_IngestedThing(this, numTaken);\n\t\t}\n\t\tingester.genes?.Notify_IngestedThing(this, numTaken);\n\t\tbool flag8 = false;\n\t\tif (numTaken > 0)\n\t\t{\n\t\t\tif (stackCount == 0)\n\t\t\t{\n\t\t\t\tLog.Error(this?.ToString() + \" stack count is 0.\");\n\t\t\t}\n\t\t\tif (numTaken == stackCount)\n\t\t\t{\n\t\t\t\tflag8 = true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tSplitOff(numTaken);\n\t\t\t}\n\t\t}\n\t\tPrePostIngested(ingester);\n\t\tif (flag8)\n\t\t{\n\t\t\tingester.carryTracker.innerContainer.Remove(this);\n\t\t}\n\t\tif (def.ingestible.outcomeDoers != null)\n\t\t{\n\t\t\tfor (int l = 0; l < def.ingestible.outcomeDoers.Count; l++)\n\t\t\t{\n\t\t\t\tdef.ingestible.outcomeDoers[l].DoIngestionOutcome(ingester, this, numTaken);\n\t\t\t}\n\t\t}\n\t\tif (flag8 && !Destroyed)\n\t\t{\n\t\t\tDestroy();\n\t\t}\n\t\tPostIngested(ingester);\n\t\treturn nutritionIngested;\n\t}\n\n\tprotected virtual void PrePostIngested(Pawn ingester)\n\t{\n\t}\n\n\tprotected virtual void PostIngested(Pawn ingester)\n\t{\n\t}\n\n\tprotected virtual void IngestedCalculateAmounts(Pawn ingester, float nutritionWanted, out int numTaken, out float nutritionIngested)\n\t{\n\t\tfloat num = FoodUtility.NutritionForEater(ingester, this);\n\t\tnumTaken = Mathf.CeilToInt(nutritionWanted / num);\n\t\tnumTaken = Mathf.Min(numTaken, stackCount);\n\t\tif (def.ingestible.maxNumToIngestAtOnce > 0)\n\t\t{\n\t\t\tnumTaken = Mathf.Min(numTaken, def.ingestible.maxNumToIngestAtOnce);\n\t\t}\n\t\tnumTaken = Mathf.Max(numTaken, 1);\n\t\tnutritionIngested = (float)numTaken * num;\n\t}\n\n\tpublic virtual bool PreventPlayerSellingThingsNearby(out string reason)\n\t{\n\t\treason = null;\n\t\treturn false;\n\t}\n\n\tpublic virtual void PreSwapMap()\n\t{\n\t\tbeingTransportedOnGravship = true;\n\t}\n\n\tpublic virtual void PostSwapMap()\n\t{\n\t\tbeingTransportedOnGravship = false;\n\t\tQuestUtility.SendQuestTargetSignals(questTags, \"SwappedMap\", this.Named(\"SUBJECT\"));\n\t}\n\n\tpublic void Notify_LeftBehind()\n\t{\n\t\tQuestUtility.SendQuestTargetSignals(questTags, \"LeftBehind\", this.Named(\"SUBJECT\"));\n\t\tif (!(this is IThingHolder thingHolder) || thingHolder.GetDirectlyHeldThings() == null)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\tforeach (Thing item in (IEnumerable)thingHolder.GetDirectlyHeldThings())\n\t\t{\n\t\t\titem.Notify_LeftBehind();\n\t\t}\n\t}\n}\n\n", + "timestamp": "2025-08-25 14:10:31,694" } } \ No newline at end of file diff --git a/Source/WulaFallenEmpire/HarmonyPatches/DialogEnterPortal_MapPatch.cs b/Source/WulaFallenEmpire/HarmonyPatches/DialogEnterPortal_MapPatch.cs index 1c784c3d..a79384b8 100644 --- a/Source/WulaFallenEmpire/HarmonyPatches/DialogEnterPortal_MapPatch.cs +++ b/Source/WulaFallenEmpire/HarmonyPatches/DialogEnterPortal_MapPatch.cs @@ -14,16 +14,19 @@ namespace WulaFallenEmpire public static IEnumerable Transpiler(IEnumerable instructions) { var codes = new List(instructions); - // 找到 MapPortal.Map 属性的 getter 方法 - var mapPropertyGetter = AccessTools.PropertyGetter(typeof(MapPortal), "Map"); + // 找到 Thing.Map 属性的 getter 方法 (MapPortal 继承自 Thing) + var mapPropertyGetter = AccessTools.PropertyGetter(typeof(Verse.Thing), "Map"); // 找到我们自定义的静态方法,它将返回正确的 Map var getShuttleMapMethod = AccessTools.Method(typeof(DialogEnterPortal_CalculateAndRecacheTransferables_Patch), nameof(GetShuttleMap)); + Log.Message("[WULA-DEBUG] Transpiler for CalculateAndRecacheTransferables started."); + for (int i = 0; i < codes.Count; i++) { - // 查找对 MapPortal.Map 的 get 访问 - if (codes[i].opcode == OpCodes.Callvirt && codes[i].operand is MethodInfo method && method == mapPropertyGetter) + // 查找对 Thing.Map 的 get 访问 + if (codes[i].opcode == OpCodes.Call && codes[i].operand is MethodInfo method && method == mapPropertyGetter) { + Log.Message($"[WULA-DEBUG] Transpiler found Thing.Map getter at index {i}."); // 替换为调用我们的静态方法 yield return new CodeInstruction(OpCodes.Call, getShuttleMapMethod); } @@ -32,20 +35,60 @@ namespace WulaFallenEmpire yield return codes[i]; } } + Log.Message("[WULA-DEBUG] Transpiler for CalculateAndRecacheTransferables finished."); } // 这个静态方法将由 Transpiler 注入,用于返回正确的 Map // 参数 portalInstance 是原始方法中对 MapPortal 实例的引用 public static Map GetShuttleMap(MapPortal portalInstance) { - if (portalInstance is ShuttlePortalAdapter adapter && adapter.shuttle != null) + if (portalInstance is ShuttlePortalAdapter adapter) { - return adapter.shuttle.Map; + Log.Message($"[WULA-DEBUG] portalInstance is ShuttlePortalAdapter. adapter.shuttle: {adapter.shuttle?.def.defName ?? "null"}"); + if (adapter.shuttle != null) + { + // 确保 adapter.shuttle.Map 不为 null + if (adapter.shuttle.Map != null) + { + return adapter.shuttle.Map; + } + else + { + Log.Error($"[WULA] Shuttle {adapter.shuttle.def.defName} is not spawned on any map when trying to get its map."); + return null; // 返回 null,让后续代码处理 + } + } } - // 如果不是我们的适配器或者 shuttle 为空,则返回原始 MapPortal 的 Map - // 我们需要直接访问 Thing 类的 Map 属性,这是 MapPortal 继承的 + + // 如果不是我们的适配器,或者适配器中的 shuttle 为空, + // 则尝试获取原始 MapPortal 的 Map。 + // 这里需要非常小心,因为 portalInstance 本身也可能是 null, + // 或者它继承自 Thing 的 Map 属性是 null。 + if (portalInstance == null) + { + Log.Error("[WULA] GetShuttleMap received a null portalInstance."); + return null; + } + var originalMapGetter = AccessTools.PropertyGetter(typeof(Thing), "Map"); - return (Map)originalMapGetter.Invoke(portalInstance, null); + if (originalMapGetter == null) + { + Log.Error("[WULA] Could not get Thing.Map getter via AccessTools."); + return null; + } + + Map result = null; + try + { + result = (Map)originalMapGetter.Invoke(portalInstance, null); + } + catch (System.Exception ex) + { + Log.Error($"[WULA] Error invoking original Thing.Map getter: {ex.Message}"); + } + + Log.Message($"[WULA-DEBUG] GetShuttleMap returning original Map. Result: {result?.ToString() ?? "null"}"); + return result; } } } \ No newline at end of file diff --git a/Source/WulaFallenEmpire/WULA_Shuttle/CompPocketMapPortal.cs b/Source/WulaFallenEmpire/WULA_Shuttle/CompPocketMapPortal.cs index 203fa873..31c11371 100644 --- a/Source/WulaFallenEmpire/WULA_Shuttle/CompPocketMapPortal.cs +++ b/Source/WulaFallenEmpire/WULA_Shuttle/CompPocketMapPortal.cs @@ -24,22 +24,22 @@ namespace WulaFallenEmpire { base.PostSpawnSetup(respawningAfterLoad); + Log.Message($"[WULA-DEBUG] CompPocketMapPortal.PostSpawnSetup called. Parent: {parent?.def?.defName ?? "null"}"); + // 检查父对象是否是穿梭机 if (ParentShuttle == null) { Log.Error($"[WULA] CompPocketMapPortal attached to non-shuttle building: {parent?.def?.defName}"); + return; // Early exit if parent is not a shuttle } - else + + // 创建MapPortal适配器,并设置其地图和位置信息 + portalAdapter = new ShuttlePortalAdapter(ParentShuttle); + // 确保 portalAdapter 的 shuttle 引用被正确设置 + if (portalAdapter != null) { - // 创建MapPortal适配器,并设置其地图和位置信息 - portalAdapter = new ShuttlePortalAdapter(ParentShuttle); - // 确保 portalAdapter 的 shuttle 引用被正确设置 - // 并在 PostSpawnSetup 中设置 MapPortal 基类的地图和位置信息 - // 确保 portalAdapter 的 shuttle 引用被正确设置 - if (portalAdapter != null) - { - portalAdapter.shuttle = ParentShuttle; - } + portalAdapter.shuttle = ParentShuttle; + Log.Message($"[WULA-DEBUG] portalAdapter.shuttle set in PostSpawnSetup: {portalAdapter.shuttle?.def.defName ?? "null"}"); } } @@ -158,6 +158,7 @@ namespace WulaFallenEmpire if (portalAdapter != null) { + Log.Message($"[WULA-DEBUG] Opening Dialog_EnterPortal with portalAdapter. Type: {portalAdapter.GetType().Name}. Shuttle: {portalAdapter.shuttle?.def.defName ?? "null"}"); var dialog = new Dialog_EnterPortal(portalAdapter); Find.WindowStack.Add(dialog); } @@ -349,8 +350,6 @@ namespace WulaFallenEmpire // def.portal?.traverseSound?.PlayOneShot(this); } } - - /// /// 重写进入按钮文本 /// public override string EnterString => "WULA.PocketSpace.Enter".Translate();