public GasPropertiesStats(GasProperties p)
 {
     this.blockTurretTracking = p.blockTurretTracking;
     this.accuracyPenalty     = p.accuracyPenalty;
     this.expireSeconds       = new MinMaxFloatStats(p.expireSeconds);
     this.rotationSpeed       = p.rotationSpeed;
 }
        public PlantPropertiesStats(PlantProperties p)
        {
            this.wildClusterRadius          = p.wildClusterRadius;
            this.wildClusterWeight          = p.wildClusterWeight;
            this.wildOrder                  = p.wildOrder;
            this.wildEqualLocalDistribution = p.wildEqualLocalDistribution;
            this.cavePlant                  = p.cavePlant;
            this.cavePlantWeight            = p.cavePlantWeight;
            this.sowWork                 = p.sowWork;
            this.sowMinSkill             = p.sowMinSkill;
            this.blockAdjacentSow        = p.blockAdjacentSow;
            this.mustBeWildToSow         = p.mustBeWildToSow;
            this.harvestWork             = p.harvestWork;
            this.harvestYield            = p.harvestYield;
            this.harvestTag              = p.harvestTag;
            this.harvestMinGrowth        = p.harvestMinGrowth;
            this.harvestAfterGrowth      = p.harvestAfterGrowth;
            this.harvestFailable         = p.harvestFailable;
            this.growDays                = p.growDays;
            this.lifespanDaysPerGrowDays = p.lifespanDaysPerGrowDays;
            this.growMinGlow             = p.growMinGlow;
            this.growOptimalGlow         = p.growOptimalGlow;
            this.fertilityMin            = p.fertilityMin;
            this.fertilitySensitivity    = p.fertilitySensitivity;
            this.dieIfLeafless           = p.dieIfLeafless;
            this.neverBlightable         = p.neverBlightable;
            this.interferesWithRoof      = p.interferesWithRoof;
            this.purpose                 = p.purpose;
            this.topWindExposure         = p.topWindExposure;
            this.maxMeshCount            = p.maxMeshCount;
            //this.leaflessGraphicPath = GetLeaflessGraphicPath(p);
            //this.immatureGraphicPath = GetImmatureGraphicPath(p);
            this.dropLeaves                 = p.dropLeaves;
            this.dieFromToxicFallout        = p.dieFromToxicFallout;
            this.autoHarvestable            = p.autoHarvestable;
            this.humanFoodPlant             = p.humanFoodPlant;
            this.treeLoversCareIfChopped    = p.treeLoversCareIfChopped;
            this.allowAutoCut               = p.allowAutoCut;
            this.dieIfNoSunlight            = p.dieIfNoSunlight;
            this.treeCategory               = p.treeCategory;
            this.showGrowthInInspectPane    = p.showGrowthInInspectPane;
            this.minSpacingBetweenSamePlant = p.minSpacingBetweenSamePlant;

            if (p.visualSizeRange != null)
            {
                this.visualSizeRange = new MinMaxFloatStats(p.visualSizeRange);
            }

            Util.AssignDefStat(p.harvestedThingDef, out this.harvestedThingDef);
            //Util.AssignDefStat(p.soundHarvesting, out this.soundHarvesting);
            //Util.AssignDefStat(p.soundHarvestFinish, out this.soundHarvestFinish);
            Util.AssignDefStat(p.burnedThingDef, out this.burnedThingDef);

            Util.Populate(out this.sowTags, p.sowTags);
            Util.Populate(out this.wildBiomes, p.wildBiomes, (v) => new FloatValueDefStat <BiomeDef>(v.biome, v.commonality));
            this.sowResearchPrerequisites = Util.CreateDefStatList(p.sowResearchPrerequisites);
        }
Пример #3
0
        public StorytellerCompPropertiesStats(StorytellerCompProperties p)
        {
            this.compClass = p.compClass.FullName;

            this.minDaysPassed = p.minDaysPassed;
            this.minIncChancePopulationIntentFactor = p.minIncChancePopulationIntentFactor;

            Util.Populate(out allowedTargetTags, p.allowedTargetTags, d => new DefStat <IncidentTargetTagDef>(d));
            Util.Populate(out disallowedTargetTags, p.disallowedTargetTags, d => new DefStat <IncidentTargetTagDef>(d));

            switch (this.compClass)
            {
            case "RimWorld.StorytellerComp_CategoryIndividualMTBByBiome":
                if (p is StorytellerCompProperties_CategoryIndividualMTBByBiome cb)
                {
                    this.category = Util.AssignDefStat(cb.category);
                    this.applyCaravanVisibility = cb.applyCaravanVisibility;
                }
                break;

            case "RimWorld.StorytellerComp_CategoryMTB":
                if (p is StorytellerCompProperties_CategoryMTB cm)
                {
                    this.category = Util.AssignDefStat(cm.category);
                    this.mtbDays  = cm.mtbDays;
                    this.mtbDaysFactorByDaysPassedCurve = Util.Assign(cm.mtbDaysFactorByDaysPassedCurve, v => new SimpleCurveStats(v));
                }
                break;

            case "RimWorld.StorytellerComp_DeepDrillInfestation":
                if (p is StorytellerCompProperties_DeepDrillInfestation cd)
                {
                    this.baseMtbDaysPerDrill = cd.baseMtbDaysPerDrill;
                }
                break;

            case "RimWorld.StorytellerComp_Disease":
                if (p is StorytellerCompProperties_Disease d)
                {
                    this.category = Util.AssignDefStat(d.category);
                }
                break;

            case "RimWorld.StorytellerComp_FactionInteraction":
                if (p is StorytellerCompProperties_FactionInteraction fi)
                {
                    this.incident             = Util.AssignDefStat(fi.incident);
                    this.baseIncidentsPerYear = fi.baseIncidentsPerYear;
                    this.minSpacingDays       = fi.minSpacingDays;
                    this.minDanger            = fi.minDanger;
                    this.fullAlliesOnly       = fi.fullAlliesOnly;
                }
                break;

            case "RimWorld.StorytellerComp_OnOffCycle":
                if (p is StorytellerCompProperties_OnOffCycle ooc)
                {
                    this.category          = Util.AssignDefStat(GetCategory(ooc));
                    this.onDays            = ooc.onDays;
                    this.offDays           = ooc.offDays;
                    this.minSpacingDays    = ooc.minDaysPassed;
                    this.numIncidentsRange = Util.Assign(ooc.numIncidentsRange, v => new MinMaxFloatStats(v));
                    this.acceptFractionByDaysPassedCurve         = Util.Assign(ooc.acceptFractionByDaysPassedCurve, v => new SimpleCurveStats(v));
                    this.acceptPercentFactorPerThreatPointsCurve = Util.Assign(ooc.acceptPercentFactorPerThreatPointsCurve, v => new SimpleCurveStats(v));
                    this.incident = Util.AssignDefStat(ooc.incident);
                    // TODO this.applyRaidBeaconThreatMtbFactor = ooc.applyRaidBeaconThreatMtbFactor;
                    this.forceRaidEnemyBeforeDaysPassed = ooc.forceRaidEnemyBeforeDaysPassed;
                }
                break;

            case "RimWorld.StorytellerComp_RandomMain":
                if (p is StorytellerCompProperties_RandomMain rm)
                {
                    this.mtbDays = rm.mtbDays;
                    Util.Populate(out this.categoryWeights, rm.categoryWeights, v => new FloatValueDefStat <IncidentCategoryDef>(v.category, v.weight));
                    this.maxThreatBigIntervalDays  = rm.maxThreatBigIntervalDays;
                    this.randomPointsFactorRange   = Util.Assign(rm.randomPointsFactorRange, v => new MinMaxFloatStats(v));
                    this.skipThreatBigIfRaidBeacon = rm.skipThreatBigIfRaidBeacon;
                }
                break;

            case "RimWorld.StorytellerComp_SingleMTB":
                if (p is StorytellerCompProperties_SingleMTB smtb)
                {
                    this.incident = Util.AssignDefStat(smtb.incident);
                    this.mtbDays  = smtb.mtbDays;
                }
                break;

            case "RimWorld.StorytellerComp_Triggered":
                if (p is StorytellerCompProperties_Triggered t)
                {
                    this.incident   = Util.AssignDefStat(t.incident);
                    this.delayTicks = t.delayTicks;
                }
                break;

            case "RimWorld.StorytellerCompProperties_RefiringUniqueQuest":
                if (p is StorytellerCompProperties_RefiringUniqueQuest ruq)
                {
                    this.incident        = Util.AssignDefStat(ruq.incident);
                    this.refireEveryDays = ruq.refireEveryDays;
                }
                break;

            case "RimWorld.StorytellerCompProperties_SingleOnceFixed":
                if (p is StorytellerCompProperties_SingleOnceFixed sof)
                {
                    this.incident            = Util.AssignDefStat(sof.incident);
                    this.fireAfterDaysPassed = sof.fireAfterDaysPassed;
                }
                break;

            case "RimWorld.StorytellerComp_ClassicIntro":
            case "RimWorld.StorytellerComp_ShipChunkDrop":
            case "RimWorld.StorytellerCompProperties_RandomQuest":
            case "RimWorld.StorytellerComp_SingleOnceFixed":
            case "RimWorld.StorytellerComp_RefiringUniqueQuest":
            case "RimWorld.StorytellerComp_ThreatsGenerator":
            case "RimWorld.StorytellerComp_RandomQuest":
                // Do nothing
                break;

            default:
                Log.Warning("Unknown StorytellerProperty type of " + this.compClass);
                break;
            }
        }