Beispiel #1
0
        // Token: 0x06000019 RID: 25 RVA: 0x00003520 File Offset: 0x00001720
        internal static void ProximityStatSet(Thing thing, Pawn pawn)
        {
            ThingComp thingComp = pawn?.TryGetComp <ProximityData>();

            if (thingComp == null)
            {
                return;
            }

            var proximityData = (ProximityData)thingComp;

            var proxQualFactor = ProxGlobals.GetProxQualFactor(thing);

            if (ProximityGet.GetProxMoveSpeedOffSet(thing.def) != 0f)
            {
                proximityData.MoveSpeedOffSet +=
                    proxQualFactor * ProximityGet.GetProxMoveSpeedOffSet(thing.def);
            }

            if (ProximityGet.GetProxGlobalLearningFactorOffSet(thing.def) != 0f)
            {
                proximityData.GlobalLearningFactorOffSet +=
                    proxQualFactor * ProximityGet.GetProxGlobalLearningFactorOffSet(thing.def);
            }

            if (ProximityGet.GetProxNegotiationAbilityOffSet(thing.def) != 0f)
            {
                proximityData.NegotiationAbilityOffSet +=
                    proxQualFactor * ProximityGet.GetProxNegotiationAbilityOffSet(thing.def);
            }

            if (ProximityGet.GetProxPsychicSensitivityOffSet(thing.def) != 0f)
            {
                proximityData.PsychicSensitivityOffSet +=
                    proxQualFactor * ProximityGet.GetProxPsychicSensitivityOffSet(thing.def);
            }

            if (ProximityGet.GetProxSocialImpactOffSet(thing.def) != 0f)
            {
                proximityData.SocialImpactOffSet +=
                    proxQualFactor * ProximityGet.GetProxSocialImpactOffSet(thing.def);
            }

            if (ProximityGet.GetProxToxicSensitivityOffSet(thing.def) != 0f)
            {
                proximityData.ToxicSensitivityOffSet +=
                    proxQualFactor * ProximityGet.GetProxToxicSensitivityOffSet(thing.def);
            }

            if (ProximityGet.GetProxComfyTemperatureMinOffSet(thing.def) != 0f)
            {
                proximityData.ComfyTemperatureMinOffSet +=
                    proxQualFactor * ProximityGet.GetProxComfyTemperatureMinOffSet(thing.def);
            }

            if (ProximityGet.GetProxComfyTemperatureMaxOffSet(thing.def) != 0f)
            {
                proximityData.ComfyTemperatureMaxOffSet +=
                    proxQualFactor * ProximityGet.GetProxComfyTemperatureMaxOffSet(thing.def);
            }

            if (ProximityGet.GetProxAimingDelayFactorOffSet(thing.def) != 0f)
            {
                proximityData.AimingDelayFactorOffSet +=
                    proxQualFactor * ProximityGet.GetProxAimingDelayFactorOffSet(thing.def);
            }

            if (ProximityGet.GetProxShootingAccuracyPawnOffSet(thing.def) != 0f)
            {
                proximityData.ShootingAccuracyPawnOffSet +=
                    proxQualFactor * ProximityGet.GetProxShootingAccuracyPawnOffSet(thing.def);
            }

            if (ProximityGet.GetProxMeleeDodgeChanceOffSet(thing.def) != 0f)
            {
                proximityData.MeleeDodgeChanceOffSet +=
                    proxQualFactor * ProximityGet.GetProxMeleeDodgeChanceOffSet(thing.def);
            }

            if (ProximityGet.GetProxMeleeHitChanceOffSet(thing.def) != 0f)
            {
                proximityData.MeleeHitChanceOffSet +=
                    proxQualFactor * ProximityGet.GetProxMeleeHitChanceOffSet(thing.def);
            }

            if (ProximityGet.GetProxImmunityGainSpeedOffSet(thing.def) != 0f)
            {
                proximityData.ImmunityGainSpeedOffSet +=
                    proxQualFactor * ProximityGet.GetProxImmunityGainSpeedOffSet(thing.def);
            }

            if (ProximityGet.GetProxMedicalTendSpeedOffSet(thing.def) != 0f)
            {
                proximityData.MedicalTendSpeedOffSet +=
                    proxQualFactor * ProximityGet.GetProxMedicalTendSpeedOffSet(thing.def);
            }

            if (ProximityGet.GetProxMedicalTendQualityOffSet(thing.def) != 0f)
            {
                proximityData.MedicalTendQualityOffSet +=
                    proxQualFactor * ProximityGet.GetProxMedicalTendQualityOffSet(thing.def);
            }

            if (ProximityGet.GetProxMedicalOperationSpeedOffSet(thing.def) != 0f)
            {
                proximityData.MedicalOperationSpeedOffSet +=
                    proxQualFactor * ProximityGet.GetProxMedicalOperationSpeedOffSet(thing.def);
            }

            if (ProximityGet.GetProxMedicalSurgerySuccessChanceOffSet(thing.def) != 0f)
            {
                proximityData.MedicalSurgerySuccessChanceOffSet += proxQualFactor *
                                                                   ProximityGet
                                                                   .GetProxMedicalSurgerySuccessChanceOffSet(
                    thing.def);
            }

            if (ProximityGet.GetProxAnimalGatherSpeedOffSet(thing.def) != 0f)
            {
                proximityData.AnimalGatherSpeedOffSet +=
                    proxQualFactor * ProximityGet.GetProxAnimalGatherSpeedOffSet(thing.def);
            }

            if (ProximityGet.GetProxAnimalGatherYieldOffSet(thing.def) != 0f)
            {
                proximityData.AnimalGatherYieldOffSet +=
                    proxQualFactor * ProximityGet.GetProxAnimalGatherYieldOffSet(thing.def);
            }

            if (ProximityGet.GetProxConstructionSpeedOffSet(thing.def) != 0f)
            {
                proximityData.ConstructionSpeedOffSet +=
                    proxQualFactor * ProximityGet.GetProxConstructionSpeedOffSet(thing.def);
            }

            if (ProximityGet.GetProxConstructSuccessChanceOffSet(thing.def) != 0f)
            {
                proximityData.ConstructSuccessChanceOffSet += proxQualFactor *
                                                              ProximityGet.GetProxConstructSuccessChanceOffSet(
                    thing.def);
            }

            if (ProximityGet.GetProxEatingSpeedOffSet(thing.def) != 0f)
            {
                proximityData.EatingSpeedOffSet +=
                    proxQualFactor * ProximityGet.GetProxEatingSpeedOffSet(thing.def);
            }

            if (ProximityGet.GetProxHuntingStealthOffSet(thing.def) != 0f)
            {
                proximityData.HuntingStealthOffSet +=
                    proxQualFactor * ProximityGet.GetProxHuntingStealthOffSet(thing.def);
            }

            if (ProximityGet.GetProxMiningSpeedOffSet(thing.def) != 0f)
            {
                proximityData.MiningSpeedOffSet +=
                    proxQualFactor * ProximityGet.GetProxMiningSpeedOffSet(thing.def);
            }

            if (ProximityGet.GetProxPlantHarvestYieldOffSet(thing.def) != 0f)
            {
                proximityData.PlantHarvestYieldOffSet +=
                    proxQualFactor * ProximityGet.GetProxPlantHarvestYieldOffSet(thing.def);
            }

            if (ProximityGet.GetProxPlantWorkSpeedOffSet(thing.def) != 0f)
            {
                proximityData.PlantWorkSpeedOffSet +=
                    proxQualFactor * ProximityGet.GetProxPlantWorkSpeedOffSet(thing.def);
            }

            if (ProximityGet.GetProxResearchSpeedOffSet(thing.def) != 0f)
            {
                proximityData.ResearchSpeedOffSet +=
                    proxQualFactor * ProximityGet.GetProxResearchSpeedOffSet(thing.def);
            }

            if (ProximityGet.GetProxSmoothingSpeedOffSet(thing.def) != 0f)
            {
                proximityData.SmoothingSpeedOffSet +=
                    proxQualFactor * ProximityGet.GetProxSmoothingSpeedOffSet(thing.def);
            }

            if (ProximityGet.GetProxTameAnimalChanceOffSet(thing.def) != 0f)
            {
                proximityData.TameAnimalChanceOffSet +=
                    proxQualFactor * ProximityGet.GetProxTameAnimalChanceOffSet(thing.def);
            }

            if (ProximityGet.GetProxTrainAnimalChanceOffSet(thing.def) != 0f)
            {
                proximityData.TrainAnimalChanceOffSet +=
                    proxQualFactor * ProximityGet.GetProxTrainAnimalChanceOffSet(thing.def);
            }

            if (ProximityGet.GetProxWorkSpeedGlobalOffSet(thing.def) != 0f)
            {
                proximityData.WorkSpeedGlobalOffSet +=
                    proxQualFactor * ProximityGet.GetProxWorkSpeedGlobalOffSet(thing.def);
            }

            if (ProximityGet.GetProxButcheryFleshSpeedOffSet(thing.def) != 0f)
            {
                proximityData.ButcheryFleshSpeedOffSet +=
                    proxQualFactor * ProximityGet.GetProxButcheryFleshSpeedOffSet(thing.def);
            }

            if (ProximityGet.GetProxButcheryMechanoidSpeedOffSet(thing.def) != 0f)
            {
                proximityData.ButcheryMechanoidSpeedOffSet += proxQualFactor *
                                                              ProximityGet.GetProxButcheryMechanoidSpeedOffSet(
                    thing.def);
            }

            if (ProximityGet.GetProxButcheryFleshEfficiencyOffSet(thing.def) != 0f)
            {
                proximityData.ButcheryFleshEfficiencyOffSet += proxQualFactor *
                                                               ProximityGet
                                                               .GetProxButcheryFleshEfficiencyOffSet(
                    thing.def);
            }

            if (ProximityGet.GetProxButcheryMechanoidEfficiencyOffSet(thing.def) != 0f)
            {
                proximityData.ButcheryMechanoidEfficiencyOffSet += proxQualFactor *
                                                                   ProximityGet
                                                                   .GetProxButcheryMechanoidEfficiencyOffSet(
                    thing.def);
            }

            if (ProximityGet.GetProxCookSpeedOffSet(thing.def) != 0f)
            {
                proximityData.CookSpeedOffSet +=
                    proxQualFactor * ProximityGet.GetProxCookSpeedOffSet(thing.def);
            }

            if (ProximityGet.GetProxDrugCookingSpeedOffSet(thing.def) != 0f)
            {
                proximityData.DrugCookingSpeedOffSet +=
                    proxQualFactor * ProximityGet.GetProxDrugCookingSpeedOffSet(thing.def);
            }

            if (ProximityGet.GetProxDrugSynthesisSpeedOffSet(thing.def) != 0f)
            {
                proximityData.DrugSynthesisSpeedOffSet +=
                    proxQualFactor * ProximityGet.GetProxDrugSynthesisSpeedOffSet(thing.def);
            }

            if (ProximityGet.GetProxFixBrokenDownBuildingSuccessChanceOffSet(thing.def) != 0f)
            {
                proximityData.FixBrokenDownBuildingSuccessChanceOffSet += proxQualFactor *
                                                                          ProximityGet
                                                                          .GetProxFixBrokenDownBuildingSuccessChanceOffSet(
                    thing.def);
            }

            if (ProximityGet.GetProxSmeltingSpeedOffSet(thing.def) != 0f)
            {
                proximityData.SmeltingSpeedOffSet +=
                    proxQualFactor * ProximityGet.GetProxSmeltingSpeedOffSet(thing.def);
            }

            if (ProximityGet.GetProxGeneralLaborSpeedOffSet(thing.def) != 0f)
            {
                proximityData.GeneralLaborSpeedOffSet +=
                    proxQualFactor * ProximityGet.GetProxGeneralLaborSpeedOffSet(thing.def);
            }
        }
Beispiel #2
0
        // Token: 0x06000017 RID: 23 RVA: 0x000030FC File Offset: 0x000012FC
        public override void CompTick()
        {
            if (Find.TickManager.TicksGame <= ProxTick)
            {
                return;
            }

            ProximityStatReset(Pawn);
            if (Pawn.Map != null)
            {
                var list = GenRadial
                           .RadialDistinctThingsAround(Pawn.Position, Pawn.Map, ProxGlobals.closeRange, true).ToList();
                if (list.Count > 0)
                {
                    foreach (var thing in list)
                    {
                        if (!ProxGlobals.IsNearThingValid(thing, Pawn) || !ProxGlobals.NearThingEffects(thing, Pawn))
                        {
                            continue;
                        }

                        var proxRange = ProximityGet.GetProxRange(thing.def);
                        if (!ProxGlobals.NearThingInRange(thing, Pawn, proxRange))
                        {
                            continue;
                        }

                        ProxGlobals.ProximityHediffEffect(thing, Pawn);
                        ProximityStatSet(thing, Pawn);
                    }
                }

                if (ProxGlobals.UseTerrain)
                {
                    var list2 = GenRadial.RadialCellsAround(Pawn.Position, ProxGlobals.closeRange, true).ToList();
                    if (list2.Count > 0)
                    {
                        for (var j = 0; j < list2.Count; j++)
                        {
                            var terrainDef = list2[j].InBounds(Pawn.Map) ? list2[j].GetTerrain(Pawn.Map) : null;
                            if (terrainDef == null || !list2[j].InBounds(Pawn.Map) ||
                                !ProxGlobals.IsTerrainValid(terrainDef, Pawn) ||
                                !ProxGlobals.TerrainEffects(terrainDef, list2[j], Pawn))
                            {
                                continue;
                            }

                            var tproxRange = ProximityGet.GetTProxRange(terrainDef);
                            if (!ProxGlobals.TerrainInRange(terrainDef, list2[j], Pawn, tproxRange))
                            {
                                continue;
                            }

                            ProxGlobals.ProximityTerrainHediffEffect(terrainDef, list2[j], Pawn);
                            ProximityTStatSet(terrainDef, list2[j], Pawn);
                        }
                    }
                }
            }

            ProxTick = Find.TickManager.TicksGame + ProxGlobals.ExtendTicks();
        }