根据向量相似度分析,与 'StatDef' 最相关的代码定义如下: --- **文件路径 (精确匹配):** `C:\Steam\steamapps\common\RimWorld\Data\dll1.6\RimWorld\StatDef.txt` ```csharp public class StatDef : Def { private static HashSet mutableStats; public StatCategoryDef category; public Type workerClass = typeof(StatWorker); public string labelForFullStatList; public bool forInformationOnly; [MustTranslate] private string offsetLabel; public float hideAtValue = -2.1474836E+09f; public bool alwaysHide; public bool showNonAbstract = true; public bool showIfUndefined = true; public bool showOnPawns = true; public bool showOnHumanlikes = true; public bool showOnNonWildManHumanlikes = true; public bool showOnAnimals = true; public bool showOnMechanoids = true; public bool showOnNonWorkTables = true; public bool showOnEntities = true; public bool showOnDrones = true; public bool showOnNonPowerPlants = true; public bool showOnDefaultValue = true; public bool showOnUnhaulables = true; public bool showOnUntradeables = true; public List showIfModsLoaded; public List showIfModsLoadedAny; public List showIfHediffsPresent; public bool neverDisabled; public bool showZeroBaseValue; public bool showOnSlavesOnly; public bool showOnPlayerMechanoids; public DevelopmentalStage showDevelopmentalStageFilter = DevelopmentalStage.Baby | DevelopmentalStage.Child | DevelopmentalStage.Adult; public bool hideInClassicMode; public List showOnPawnKind; public bool overridesHideStats; public int displayPriorityInCategory; public ToStringNumberSense toStringNumberSense = ToStringNumberSense.Absolute; public ToStringStyle toStringStyle; private ToStringStyle? toStringStyleUnfinalized; [MustTranslate] public string formatString; [MustTranslate] public string formatStringUnfinalized; public bool finalizeEquippedStatOffset = true; [MustTranslate] public string statFactorsExplanationHeader; public float defaultBaseValue = 1f; public List skillNeedOffsets; public float noSkillOffset; public List capacityOffsets; public List statFactors; public bool applyFactorsIfNegative = true; public List skillNeedFactors; public float noSkillFactor = 1f; public List capacityFactors; public SimpleCurve postProcessCurve; public List postProcessStatFactors; public float minValue = -9999999f; public float maxValue = 9999999f; public float valueIfMissing; public bool roundValue; public float roundToFiveOver = float.MaxValue; public bool minifiedThingInherits; public bool supressDisabledError; public bool cacheable; public bool displayMaxWhenAboveOrEqual; public bool scenarioRandomizable; public SkillDef disableIfSkillDisabled; public List parts; [Unsaved(false)] private StatWorker workerInt; [Unsaved(false)] public bool immutable; public StatWorker Worker { get { if (workerInt == null) { if (parts != null) { for (int i = 0; i < parts.Count; i++) { parts[i].parentStat = this; } } workerInt = (StatWorker)Activator.CreateInstance(workerClass); workerInt.InitSetStat(this); } return workerInt; } } public ToStringStyle ToStringStyleUnfinalized { get { if (!toStringStyleUnfinalized.HasValue) { return toStringStyle; } return toStringStyleUnfinalized.Value; } } public string LabelForFullStatList { get { if (!labelForFullStatList.NullOrEmpty()) { return labelForFullStatList; } return label; } } public string LabelForFullStatListCap => LabelForFullStatList.CapitalizeFirst(this); public string OffsetLabel => offsetLabel ?? label; public string OffsetLabelCap => OffsetLabel.CapitalizeFirst(); public override IEnumerable ConfigErrors() { foreach (string item in base.ConfigErrors()) { yield return item; } if (capacityFactors != null) { foreach (PawnCapacityFactor capacityFactor in capacityFactors) { if (capacityFactor.weight > 1f) { yield return defName + " has activity factor with weight > 1"; } } } if (parts == null) { yield break; } for (int i = 0; i < parts.Count; i++) { foreach (string item2 in parts[i].ConfigErrors()) { yield return defName + " has error in StatPart " + parts[i].ToString() + ": " + item2; } } } public string ValueToString(float val, ToStringNumberSense numberSense = ToStringNumberSense.Absolute, bool finalized = true) { return Worker.ValueToString(val, finalized, numberSense); } public static StatDef Named(string defName) { return DefDatabase.GetNamed(defName); } public override void PostLoad() { base.PostLoad(); if (parts != null) { List partsCopy = parts.ToList(); parts.SortBy((StatPart x) => 0f - x.priority, (StatPart x) => partsCopy.IndexOf(x)); } } public T GetStatPart() where T : StatPart { return parts.OfType().FirstOrDefault(); } public bool CanShowWithLoadedMods() { if (!showIfModsLoaded.NullOrEmpty()) { for (int i = 0; i < showIfModsLoaded.Count; i++) { if (!ModsConfig.IsActive(showIfModsLoaded[i])) { return false; } } } if (!showIfModsLoadedAny.NullOrEmpty()) { bool result = false; for (int j = 0; j < showIfModsLoadedAny.Count; j++) { if (ModsConfig.IsActive(showIfModsLoadedAny[j])) { result = true; break; } } return result; } return true; } private static void PopulateMutableStats() { mutableStats = new HashSet(); foreach (TraitDef item in DefDatabase.AllDefsListForReading) { foreach (TraitDegreeData degreeData in item.degreeDatas) { AddStatsFromModifiers(degreeData.statOffsets); AddStatsFromModifiers(degreeData.statFactors); } } foreach (HediffDef item2 in DefDatabase.AllDefsListForReading) { if (item2.stages == null) { continue; } foreach (HediffStage stage in item2.stages) { AddStatsFromModifiers(stage.statOffsets); AddStatsFromModifiers(stage.statFactors); if (stage.statOffsetEffectMultiplier != null) { mutableStats.Add(stage.statOffsetEffectMultiplier); } if (stage.statFactorEffectMultiplier != null) { mutableStats.Add(stage.statFactorEffectMultiplier); } if (stage.capacityFactorEffectMultiplier != null) { mutableStats.Add(stage.capacityFactorEffectMultiplier); } } } foreach (PreceptDef item3 in DefDatabase.AllDefsListForReading) { AddStatsFromModifiers(item3.statOffsets); AddStatsFromModifiers(item3.statFactors); if (item3.roleEffects != null) { foreach (RoleEffect roleEffect in item3.roleEffects) { if (roleEffect is RoleEffect_PawnStatOffset roleEffect_PawnStatOffset) { mutableStats.Add(roleEffect_PawnStatOffset.statDef); } if (roleEffect is RoleEffect_PawnStatFactor roleEffect_PawnStatFactor) { mutableStats.Add(roleEffect_PawnStatFactor.statDef); } } } if (item3.abilityStatFactors == null) { continue; } foreach (AbilityStatModifiers abilityStatFactor in item3.abilityStatFactors) { AddStatsFromModifiers(abilityStatFactor.modifiers); } } foreach (GeneDef item4 in DefDatabase.AllDefsListForReading) { AddStatsFromModifiers(item4.statOffsets); AddStatsFromModifiers(item4.statFactors); if (item4.conditionalStatAffecters == null) { continue; } foreach (ConditionalStatAffecter conditionalStatAffecter in item4.conditionalStatAffecters) { AddStatsFromModifiers(conditionalStatAffecter.statOffsets); AddStatsFromModifiers(conditionalStatAffecter.statFactors); } } foreach (ThingDef item5 in DefDatabase.AllDefsListForReading) { AddStatsFromModifiers(item5.equippedStatOffsets); if (!item5.HasAssignableCompFrom(typeof(CompFacility))) { continue; } CompProperties_Facility compProperties = item5.GetCompProperties(); if (compProperties?.statOffsets != null) { AddStatsFromModifiers(compProperties.statOffsets); } if (!(compProperties is CompProperties_FacilityQualityBased compProperties_FacilityQualityBased)) { continue; } foreach (StatDef key in compProperties_FacilityQualityBased.statOffsetsPerQuality.Keys) { mutableStats.Add(key); } } foreach (WeaponTraitDef item6 in DefDatabase.AllDefsListForReading) { AddStatsFromModifiers(item6.equippedStatOffsets); } foreach (LifeStageDef item7 in DefDatabase.AllDefsListForReading) { AddStatsFromModifiers(item7.statFactors); AddStatsFromModifiers(item7.statOffsets); } foreach (InspirationDef item8 in DefDatabase.AllDefsListForReading) { AddStatsFromModifiers(item8.statOffsets); AddStatsFromModifiers(item8.statFactors); } static void AddStatsFromModifiers(List mods) { if (mods != null) { mutableStats.AddRange(mods.Select((StatModifier mod) => mod.stat)); } } } public bool IsImmutable() { if (workerClass != typeof(StatWorker)) { return false; } if (!skillNeedOffsets.NullOrEmpty() || !skillNeedFactors.NullOrEmpty()) { return false; } if (!capacityOffsets.NullOrEmpty() || !capacityFactors.NullOrEmpty()) { return false; } if (!statFactors.NullOrEmpty()) { return false; } if (!parts.NullOrEmpty()) { return false; } if (!postProcessStatFactors.NullOrEmpty()) { return false; } if (mutableStats.Contains(this)) { return false; } return true; } public static void SetImmutability() { PopulateMutableStats(); foreach (StatDef item in DefDatabase.AllDefsListForReading) { item.immutable = item.IsImmutable(); item.Worker.SetCacheability(item.immutable); } } public static void ResetStaticData() { mutableStats = null; foreach (StatDef item in DefDatabase.AllDefsListForReading) { item.immutable = false; item.Worker.DeleteStatCache(); } } } ``` --- **文件路径:** `C:\Steam\steamapps\common\RimWorld\Data\Core\Defs\Stats\Stats_Building_Special.xml` **相似度:** 0.5742 ```xml WorkToBuild The base amount of work it takes to build a structure, once all materials are gathered.\n\nThe work required to deconstruct the structure is also based on this. Building 1 0 WorkAmount 300 false true 3101 ``` --- **文件路径:** `C:\Steam\steamapps\common\RimWorld\Data\Royalty\Defs\Stats\Stats_Basics_Special.xml` **相似度:** 0.5197 ```xml MeditationPlantGrowthOffset An offset applied to the growth rate of plants, like anima grass, from meditation. This value can change based on the number of artificial buildings nearby. Meditation 0 false false false 4000 PercentZero
  • 27.9
  • (0, 0.0)
  • (5, -0.08)
  • (10, -0.15)
  • (50, -0.3)
  • ```