Esempio n. 1
0
 internal static void Postfix(ref bool __result, IntVec3 c, ThingDef plantDef, Map map)
 {
     if (__result && plantDef.HasModExtension <DM_ModExtension>())
     {
         DM_ModExtension ext  = plantDef.GetModExtension <DM_ModExtension>();
         Tile            tile = Find.WorldGrid[map.Tile];
         Log.Message("rainrate is " + map.weatherManager.curWeather.rainRate);
         if (tile.rainfall < ext.minRainfall || tile.rainfall > ext.maxRainfall || tile.temperature < ext.minTemperature || tile.temperature > ext.maxTemperature)
         {
             __result = false;
             return;
         }
         if (ext.needsRain && map.weatherManager.curWeather.rainRate < 1)
         {
             __result = false;
             return;
         }
         if (__result == false)
         {
             return;
         }
         if (ext.needsRain && map.weatherManager.curWeather.rainRate >= 1)
         {
             GenSpawn.Spawn(plantDef, c, map);
             __result = false;
         }
     }
 }
        /// <summary>
        /// Using the new ApparelExtension, we can have a string based apparel check.
        /// </summary>
        /// <param name="A"></param>
        /// <param name="B"></param>
        /// <param name="body"></param>
        /// <param name="__result"></param>
        public static void Post_CanWearTogether(ThingDef A, ThingDef B, BodyDef body, ref bool __result)
        {
            try
            {
                if (A == null || B == null || body == null || __result == true)
                {
                    return;
                }
                var aHasExt = A.HasModExtension <ApparelExtension>();
                var bHasExt = B.HasModExtension <ApparelExtension>();
                if (aHasExt && bHasExt)
                {
                    var aExt  = A.GetModExtension <ApparelExtension>();
                    var bExt  = B.GetModExtension <ApparelExtension>();
                    var check = new HashSet <string>();
                    if (aExt.coverage?.Count > 0)
                    {
                        for (int i = 0; i < aExt.coverage.Count; i++)
                        {
                            var coverageItem = aExt.coverage[i].ToLowerInvariant();
                            if (!check.Contains(coverageItem))
                            {
                                check.Add(coverageItem);
                            }
                            else
                            {
                                Log.Warning("JecsTools :: ApparelExtension :: Warning:: " + A.label +
                                            " has multiple of the same tags.");
                                return;
                            }
                        }
                    }

                    if (bExt.coverage?.Count > 0)
                    {
                        for (int j = 0; j < bExt.coverage.Count; j++)
                        {
                            var coverageItem = bExt.coverage[j].ToLowerInvariant();
                            if (!check.Contains(coverageItem))
                            {
                                check.Add(coverageItem);
                            }
                            else
                            {
                                __result = false;
                                break;
                            }
                        }
                    }
                }
                else if ((aHasExt && !bHasExt) || (!aHasExt && bHasExt))
                {
                    __result = true;
                }
            }
            catch (Exception e)
            {
                Log.Message(e.ToString());
            }
        }
Esempio n. 3
0
 internal static void Postfix(ref float __result, ThingDef plant, Map ___map)
 {
     if (plant.HasModExtension <Biomes_PlantControl>())
     {
         __result = ___map.Biome.CommonalityOfPlant(plant);
     }
 }
Esempio n. 4
0
 public static int OPBombGetDmg(ThingDef thingdef)
 {
     if (thingdef.HasModExtension <OPBombDefs>())
     {
         return(thingdef.GetModExtension <OPBombDefs>().OPBombDmg);
     }
     return(25);
 }
Esempio n. 5
0
 public static int OPBombGetBlastMaxRadius(ThingDef thingdef)
 {
     if (thingdef.HasModExtension <OPBombDefs>())
     {
         return(thingdef.GetModExtension <OPBombDefs>().OPBombBlastMaxRadius);
     }
     return(6);
 }
Esempio n. 6
0
 public static int OPBombGetImpactRadius(ThingDef thingdef)
 {
     if (thingdef.HasModExtension <OPBombDefs>())
     {
         return(thingdef.GetModExtension <OPBombDefs>().OPBombImpactRadius);
     }
     return(12);
 }
Esempio n. 7
0
 public static string OPToxicGetHediff(ThingDef thingdef)
 {
     if (thingdef.HasModExtension <OPToxicDefs>())
     {
         return(thingdef.GetModExtension <OPToxicDefs>().OPToxicHediff);
     }
     return(null);
 }
 public static int OPBeamGetNumFires(ThingDef thingdef)
 {
     if (thingdef.HasModExtension <OPBeamDefs>())
     {
         return(thingdef.GetModExtension <OPBeamDefs>().OPBeamNumFirePts);
     }
     return(3);
 }
 public static float OPBeamGetDmgFact(ThingDef thingdef)
 {
     if (thingdef.HasModExtension <OPBeamDefs>())
     {
         return(thingdef.GetModExtension <OPBeamDefs>().OPBeamDmgFactor);
     }
     return(1f);
 }
 public static float OPBeamGetRadius(ThingDef thingdef)
 {
     if (thingdef.HasModExtension <OPBeamDefs>())
     {
         return(thingdef.GetModExtension <OPBeamDefs>().OPBeamRadius);
     }
     return(8f);
 }
Esempio n. 11
0
 public static float OPToxicGetSev(ThingDef thingdef)
 {
     if (thingdef.HasModExtension <OPToxicDefs>())
     {
         return(thingdef.GetModExtension <OPToxicDefs>().OPToxicSeverity);
     }
     return(0f);
 }
Esempio n. 12
0
 public static int OPToxicGetSevUpVal(ThingDef thingdef)
 {
     if (thingdef.HasModExtension <OPToxicDefs>())
     {
         return(thingdef.GetModExtension <OPToxicDefs>().OPSevUpTickPeriod);
     }
     return(120);
 }
Esempio n. 13
0
        // Token: 0x0600002B RID: 43 RVA: 0x00004A68 File Offset: 0x00002C68
        public static float GetProxShootingAccuracyPawnOffSet(ThingDef thingdef)
        {
            if (thingdef.HasModExtension <ProximityDefs>())
            {
                return(new float?(thingdef.GetModExtension <ProximityDefs>().ProxShootingAccuracyPawnOffSet).Value);
            }

            return(0f);
        }
Esempio n. 14
0
        // Token: 0x06000023 RID: 35 RVA: 0x00004848 File Offset: 0x00002A48
        public static float GetProxGlobalLearningFactorOffSet(ThingDef thingdef)
        {
            if (thingdef.HasModExtension <ProximityDefs>())
            {
                return(new float?(thingdef.GetModExtension <ProximityDefs>().ProxGlobalLearningFactorOffSet).Value);
            }

            return(0f);
        }
Esempio n. 15
0
        // Token: 0x0600002A RID: 42 RVA: 0x00004A24 File Offset: 0x00002C24
        public static float GetProxComfyTemperatureMaxOffSet(ThingDef thingdef)
        {
            if (thingdef.HasModExtension <ProximityDefs>())
            {
                return(new float?(thingdef.GetModExtension <ProximityDefs>().ProxComfyTemperatureMaxOffSet).Value);
            }

            return(0f);
        }
Esempio n. 16
0
        // Token: 0x06000022 RID: 34 RVA: 0x00004804 File Offset: 0x00002A04
        public static float GetProxMoveSpeedOffSet(ThingDef thingdef)
        {
            if (thingdef.HasModExtension <ProximityDefs>())
            {
                return(new float?(thingdef.GetModExtension <ProximityDefs>().ProxMoveSpeedOffSet).Value);
            }

            return(0f);
        }
Esempio n. 17
0
        // Token: 0x06000051 RID: 81 RVA: 0x00005474 File Offset: 0x00003674
        public static int GetProxRange(ThingDef thingdef)
        {
            if (thingdef.HasModExtension <ProximityDefs>())
            {
                return(new int?(thingdef.GetModExtension <ProximityDefs>().ProxRange).Value);
            }

            return(0);
        }
Esempio n. 18
0
        // Token: 0x06000044 RID: 68 RVA: 0x0000510C File Offset: 0x0000330C
        public static float GetProxButcheryFleshEfficiencyOffSet(ThingDef thingdef)
        {
            if (thingdef.HasModExtension <ProximityDefs>())
            {
                return(new float?(thingdef.GetModExtension <ProximityDefs>().ProxButcheryFleshEfficiencyOffSet).Value);
            }

            return(0f);
        }
Esempio n. 19
0
        // Token: 0x0600003F RID: 63 RVA: 0x00004FB8 File Offset: 0x000031B8
        public static float GetProxTrainAnimalChanceOffSet(ThingDef thingdef)
        {
            if (thingdef.HasModExtension <ProximityDefs>())
            {
                return(new float?(thingdef.GetModExtension <ProximityDefs>().ProxTrainAnimalChanceOffSet).Value);
            }

            return(0f);
        }
Esempio n. 20
0
        public static void SetMenuHidden(this ThingDef def, bool value)
        {
            isMenuHiddenArray[def.index] = value;

            if (def.HasModExtension <ThingDefExtensionCE>()) // Check if this def has ThingDefExtensionCE
            {
                def.GetModExtension <ThingDefExtensionCE>().MenuHidden = value;
            }
        }
Esempio n. 21
0
        // Token: 0x06000058 RID: 88 RVA: 0x0000567C File Offset: 0x0000387C
        public static bool GetProxAlly(ThingDef thingdef)
        {
            if (!thingdef.HasModExtension <ProximityDefs>())
            {
                return(false);
            }

            _ = thingdef.GetModExtension <ProximityDefs>().ProxAlly;
            return(new bool?(thingdef.GetModExtension <ProximityDefs>().ProxAlly).Value);
        }
Esempio n. 22
0
        // Token: 0x0600004E RID: 78 RVA: 0x000053B2 File Offset: 0x000035B2
        public static string GetProxHediff(ThingDef thingdef)
        {
            if (!thingdef.HasModExtension <ProximityDefs>() ||
                thingdef.GetModExtension <ProximityDefs>().ProxHediff == null)
            {
                return("");
            }

            return(thingdef.GetModExtension <ProximityDefs>().ProxHediff);
        }
Esempio n. 23
0
        // Token: 0x06000049 RID: 73 RVA: 0x00005260 File Offset: 0x00003460
        public static float GetProxFixBrokenDownBuildingSuccessChanceOffSet(ThingDef thingdef)
        {
            if (thingdef.HasModExtension <ProximityDefs>())
            {
                return(new float?(
                           thingdef.GetModExtension <ProximityDefs>().ProxFixBrokenDownBuildingSuccessChanceOffSet).Value);
            }

            return(0f);
        }
Esempio n. 24
0
        // Token: 0x0600005F RID: 95 RVA: 0x00005890 File Offset: 0x00003A90
        public static List <string> GetProxEquipped(ThingDef thingdef)
        {
            if (!thingdef.HasModExtension <ProximityDefs>() ||
                thingdef.GetModExtension <ProximityDefs>().ProxEquipped == null)
            {
                return(null);
            }

            return(thingdef.GetModExtension <ProximityDefs>().ProxEquipped);
        }
Esempio n. 25
0
        // Token: 0x06000032 RID: 50 RVA: 0x00004C44 File Offset: 0x00002E44
        public static float GetProxMedicalSurgerySuccessChanceOffSet(ThingDef thingdef)
        {
            if (thingdef.HasModExtension <ProximityDefs>())
            {
                return(new float?(thingdef.GetModExtension <ProximityDefs>().ProxMedicalSurgerySuccessChanceOffSet)
                       .Value);
            }

            return(0f);
        }
            public static int AdjustedDrawOrder(int original, ThingDef apparelDef)
            {
                // If the apparel def has this mod's ThingDefExtension (essentially a flag), add 1 to the draw order
                if (apparelDef.HasModExtension <ThingDefExtension>())
                {
                    return(original + (VisiblePantsSettings.drawPantsOver ? 1 : -1));
                }

                return(original);
            }
Esempio n. 27
0
 static void Postfix(ThingDef plantDef, Map map, ref bool __result)
 {
     if (__result)
     {
         if (plantDef.HasModExtension <ZTB_AllowedRange>())
         {
             ZTB_AllowedRange allowedRange = plantDef.GetModExtension <ZTB_AllowedRange>();
             __result = allowedRange.IsAllowedIn(map);
         }
     }
 }
        public override IEnumerable <string> ConfigErrors(ThingDef parentDef)
        {
            foreach (var item in base.ConfigErrors(parentDef))
            {
                yield return(item);
            }

            if (!parentDef.HasModExtension <Extension>())
            {
                yield return($"Materials with the ShowAlloyInfo component should also have the RimForge.Extension ModExtension. ({parentDef.LabelCap})");
            }
        }
Esempio n. 29
0
        static bool Prefix(ref bool __result, ThingDef plantDef, IntVec3 c, Map map)
        {
            if (plantDef.HasModExtension <ZTB_AllowedRange>())
            {
                ZTB_AllowedRange allowedRange = plantDef.GetModExtension <ZTB_AllowedRange>();
                __result = allowedRange.IsAllowedIn(map);

                // This is intentional. If this filter allows the plant, the parent method still needs to run.
                return(__result);
            }

            return(true);
        }
Esempio n. 30
0
 public static void AddWeaponAssociation(ThingDef weapon)
 {
     if (!SettingsHelper.LatestVersion.AssociationDictionary.ContainsKey(weapon.defName))
     {
         if (weapon.HasModExtension <AmmoExtension>())
         {
             SettingsHelper.LatestVersion.AssociationDictionary.Add(weapon.defName, weapon.GetModExtension <AmmoExtension>().ammo);
         }
         else
         {
             SettingsHelper.LatestVersion.AssociationDictionary.Add(weapon.defName, WeaponTranslationCheck(weapon));
         }
     }
 }