#pragma warning restore CS0649 public override bool ApplyWorker(XmlDocument xml) { bool flag = false; for (int i = 0; i < mods.Count; i++) { if (ModLister.GetActiveModWithIdentifier(mods[i]) != null) { flag = true; break; } } if (flag) { if (match != null) { return(match.Apply(xml)); } } else if (nomatch != null) { return(nomatch.Apply(xml)); } return(true); }
public override void PostMapGenerate(Map map) { if (Find.TickManager.TicksGame > 5f) { return; } StructureLayoutDef structureLayoutDef; if (ModLister.GetActiveModWithIdentifier("EdB.PrepareCarefully") != null) { structureLayoutDef = PrepareCarefully_Util.pcScenariosSave.First().Key; nearMapCenter = PrepareCarefully_Util.pcScenariosSave.First().Value; } else { structureLayoutDef = chooseFrom.RandomElement(); } KCSG_Utilities.HeightWidthFromLayout(structureLayoutDef, out int h, out int w); CellRect cellRect = this.CreateCellRect(map, h, w); foreach (List <string> item in structureLayoutDef.layouts) { KCSG_Utilities.GenerateRoomFromLayout(item, cellRect, map, structureLayoutDef); } FloodFillerFog.DebugRefogMap(map); }
public static bool Prefix(ThoughtDef mem, Pawn ___pawn) { if (mem != ThoughtDef.Named("SoakingWet")) { if (ModLister.GetActiveModWithIdentifier("ReGrowth.BOTR.Core") == null || (mem != DefDatabase <ThoughtDef> .GetNamedSilentFail("RG_Wet") && mem != DefDatabase <ThoughtDef> .GetNamedSilentFail("RG_ExtremelyWet"))) { return(true); } } if (ModSettings_WaterIsCold.coldWater) { AddHediff(___pawn); } if (ModLister.GetActiveModWithIdentifier("VanillaExpanded.VanillaTraitsExpanded") != null) { if (___pawn.story.traits.HasTrait(DefDatabase <TraitDef> .GetNamedSilentFail("VTE_ChildOfSea"))) { return(true); } } if (ModSettings_WaterIsCold.disableWetAlways) { return(false); } if (ModSettings_WaterIsCold.disableWetNever) { return(true); } if (ModSettings_WaterIsCold.disableWetWarm) { return(___pawn.Map.mapTemperature.OutdoorTemp <= 26); } return(___pawn.jobs.curJob?.def != DefOf_WaterIsCold.WIC_Swim); }
static bool Prepare() { Utils.Mess(Utils.DBF.Settings, "Patch to check if overCapacity? " + Settings.checkOverCapacity); if (!Settings.checkOverCapacity) { return(false); } // Other mods with storage don't have the CompDeepStorage, so I can't test if they're // over capacity too. // Turn this off (hard) for Project Rim Factory - otherwise pawns may get stuck in loop if (ModLister.GetActiveModWithIdentifier("spdskatr.projectrimfactory") != null) { return(false); } // Turn this off (hard) for Project Rim Factory - lite (which has storage too) if (ModLister.GetActiveModWithIdentifier("zymex.prf.lite") != null) { return(false); } // Turn this off (hard) for Extended Storage (if players want to be crazy and try both) if (ModLister.GetActiveModWithIdentifier("Skullywag.ExtendedStorage") != null) { return(false); } return(true); }
/// <summary> /// Applies harmony patches on startup. /// </summary> /// <param name="harmony">Our instance of harmony to patch with.</param> public Cutebold_Patch_Stats(Harmony harmony) { var settings = Cutebold_Assemblies.CuteboldSettings; if (settings.extraYield && ModLister.GetActiveModWithIdentifier("syrchalis.harvestyieldpatch") == null) { if (settings.eyeAdaptation) { adaptation = true; // Insert Dark Adaptation bonus yield explination harmony.Patch(AccessTools.Method(typeof(StatWorker), "GetExplanationUnfinalized"), postfix: new HarmonyMethod(typeof(Cutebold_Patch_Stats), "CuteboldGetExplanationUnfinalizedPostfix")); } if (settings.altYield) // Use Postfixes { // Tweaks Mining Yield for Cutebolds harmony.Patch(AccessTools.Method(typeof(Mineable), "TrySpawnYield"), postfix: new HarmonyMethod(typeof(Cutebold_Patch_Stats), "CuteboldTrySpawnYieldMiningPostfix")); // Tweaks Harvist Yield for Cutebolds harmony.Patch(AccessTools.Method(typeof(JobDriver_PlantWork), "MakeNewToils"), postfix: new HarmonyMethod(typeof(Cutebold_Patch_Stats), "CuteboldMakeNewToilsPlantWorkPostfix")); } else // Use Transpilers { // Tweaks Mining Yield for Cutebolds harmony.Patch(AccessTools.Method(typeof(Mineable), "TrySpawnYield"), transpiler: new HarmonyMethod(typeof(Cutebold_Patch_Stats), "CuteboldTrySpawnYieldMiningTranspiler")); // Tweaks Harvist Yield for Cutebolds var plantWorkToilMethod = AccessTools.GetDeclaredMethods(typeof(JobDriver_PlantWork).GetNestedTypes(AccessTools.all).First()).ElementAt(1); harmony.Patch(plantWorkToilMethod, transpiler: new HarmonyMethod(typeof(Cutebold_Patch_Stats), "CuteboldMakeNewToilsPlantWorkTranspiler")); } // Edits the stats in the stat bio window to be the correct value. harmony.Patch(AccessTools.Method(typeof(StatsReportUtility), "StatsToDraw", new[] { typeof(Thing) }), postfix: new HarmonyMethod(typeof(Cutebold_Patch_Stats), "CuteboldStatsToDrawPostfix")); } }
public ModMain(ModContentPack content) : base(content) { settings = GetSettings <TenantsSettings>(); SettingsHelper.LatestVersion = settings; currentVersion = VersionFromManifest.GetVersionFromModMetaData(ModLister.GetActiveModWithIdentifier("Mlie.Tenants")); }
public override void Tick() { base.Tick(); if (base.Wearer == null) { return; } if (this.Wearer.kindDef == PawnKindDefOf.WildMan) { this.Destroy(DestroyMode.Vanish); return; } if (this.Wearer.Faction == null) { this.Destroy(DestroyMode.Vanish); return; } if (this.Wearer.kindDef.defaultFactionType != PSFDefOf.Polaribloc_SecuirityForce) { this.Destroy(DestroyMode.Vanish); return; } if (this.Wearer != null) { if (ModLister.GetActiveModWithIdentifier("Vanya.Polarisbloc.CoreLab") != null) { this.Wearer.health.AddHediff(HediffDef.Named("PolarisCombatChip_Currency"), this.Wearer.health.hediffSet.GetBrain(), null); } BodyPartRecord eye = this.GetEye(); if (eye != null) { this.Wearer.health.AddHediff(HediffDef.Named("BionicEye"), eye, null); } BodyPartRecord leg = this.GetLeg(); if (leg != null) { this.Wearer.health.AddHediff(HediffDef.Named("BionicLeg"), leg, null); } if (this.Wearer.health.hediffSet.hediffs.Find(x => x.TryGetComp <HediffComp_Cartridge>() != null) == null) { Hediff hediff = HediffMaker.MakeHediff(PolarisblocDefOf.Hediff_PloarisCartridge, this.Wearer, null); this.Wearer.health.AddHediff(hediff); } CombatEnhancingDrugsApply(this.Wearer); foreach (Apparel ap in this.Wearer.apparel.WornApparel) { CompBiocodable compBiocodable = ap.TryGetComp <CompBiocodable>(); if (compBiocodable != null && !compBiocodable.Biocoded) { compBiocodable.CodeFor(this.Wearer); } } this.Wearer.apparel.Remove(this); this.Destroy(DestroyMode.Vanish); return; } }
public ClimateCycle(ModContentPack content) : base(content) { currentVersion = VersionFromManifest.GetVersionFromModMetaData( ModLister.GetActiveModWithIdentifier("Mlie.ClimateCyclePlusPlus")); settings = GetSettings <CycleSettings>(); GameCondition_ClimateCyclePlusPlus.settings = settings; }
public static bool Prepare() { if (ModLister.GetActiveModWithIdentifier("netrve.dsgui") != null) { return(false); } return(true); }
static Main() { var harmony = new Harmony("com.rimworld.mod.factioncontrol"); harmony.PatchAll(Assembly.GetExecutingAssembly()); IsConfigMapsLoaded = ModLister.GetActiveModWithIdentifier("configurablemaps.kv.rw") != null; IsRandomGoodwillLoaded = ModLister.GetActiveModWithIdentifier("randomgoodwill.kv.rw") != null; }
public DogsMateMod(ModContentPack content) : base(content) { instance = this; currentVersion = VersionFromManifest.GetVersionFromModMetaData(ModLister.GetActiveModWithIdentifier("Mlie.DogsMate")); var harmony = new Harmony(nameof(DogsMateMod)); harmony.PatchAll(); }
/// <summary> /// Constructor /// </summary> /// <param name="content"></param> public TabSortingMod(ModContentPack content) : base(content) { instance = this; tabsScrollPosition = new Vector2(0, 0); optionsScrollPosition = new Vector2(0, 0); currentVersion = VersionFromManifest.GetVersionFromModMetaData(ModLister.GetActiveModWithIdentifier("Mlie.TabSorting")); }
static CE_Compat() { IsCEInstalled = ModLister.GetActiveModWithIdentifier("CETeam.CombatExtended") != null; if (IsCEInstalled) { AmmoDefType = GenTypes.GetTypeInAnyAssembly("CombatExtended.AmmoDef"); method = GenTypes.GetTypeInAnyAssembly("CombatExtended.AmmoUtility")?.GetMethod("GetProjectileReadout", BindingFlags.Public | BindingFlags.Static); } }
public ColonistBarHidingMod(ModContentPack content) : base(content) { string packageId = "Azelion.SortColonistBar"; if (ModLister.GetActiveModWithIdentifier(packageId) != null) { sortColonistBarIsLoaded = true; } }
static BestMix_Initializer() { LongEventHandler.QueueLongEvent(Setup, "LibraryStartup", false, null); BestMixUtility.IsCEActive = ModLister.GetActiveModWithIdentifier("CETeam.CombatExtended") != null; BestMixUtility.IsSoftBedsActive = ModLister.GetActiveModWithIdentifier("JPT.SoftWarmBeds") != null; BestMixUtility.softness = DefDatabase <StatDef> .GetNamed(BestMixUtility.SoftnessStat, false); BestMixUtility.protElectric = DefDatabase <StatDef> .GetNamed(BestMixUtility.ProtElectricStat, false); }
public static void Patch() { if (ModLister.GetActiveModWithIdentifier("Dylan.CSL") != null) { var maxLevel = AccessTools.Property(typeof(Need_Food), nameof(Need_Food.MaxLevel)).GetGetMethod(); maxLevel.Unpatch(HarmonyPatchType.Prefix, "Children"); maxLevel.Patch(prefix: typeof(CSL).Method(nameof(MaxLevel_Pre)).ToHarmonyMethod()); Log.Message($"[ExperimentalOptimizations] Children.ChildrenHarmony.Need_Food_Patch:MaxLevel_Pre fixed"); } }
static bool Prepare(HarmonyInstance instance) { if (ModLister.GetActiveModWithIdentifier("netrve.dsgui") != null) { return(false); } Utils.Warn(RightClickMenu, "Loading AddJobGiverWorkOrders menu code: " + Settings.useDeepStorageRightClickLogic); return(Settings.useDeepStorageRightClickLogic); }
public static bool Prepare() { if (ModLister.GetActiveModWithIdentifier("LWM.DeepStorage") != null) { checkIHoldMultipleThings = true; Log.Message("SatisfiedStorage _ Activating compatibility for LWM.DeepStorage"); } // If other storage mods don't work, add the test here: return(true); }
public CompactHediffsMod(ModContentPack content) : base(content) { settings = GetSettings <CompactHediffs_Settings>(); var harmony = new Harmony("PeteTimesSix.CompactHediffs"); harmony.PatchAll(Assembly.GetExecutingAssembly()); pawnmorpherLoaded = ModLister.GetActiveModWithIdentifier("tachyonite.pawnmorpher") != null | ModLister.GetActiveModWithIdentifier("tachyonite.pawnmorpherpublic") != null; eliteBionicsLoaded = ModLister.GetActiveModWithIdentifier("V1024.EBFramework") != null; }
public CRC_Loader(ModContentPack content) : base(content) { harmony = new Harmony("net.marvinkosh.rimworld.mod.combatreadinesscheck"); currentVersion = VersionFromManifest.GetVersionFromModMetaData( ModLister.GetActiveModWithIdentifier("Mlie.CombatReadinessCheck")); settings = GetSettings <CRC_Settings>(); PatchMap(); PatchCaravan(); PatchDefaultThreatPointsNow(); }
static KanbanStockpileLoader() { var harmony = new Harmony("net.ubergarm.rimworld.mods.kanbanstockpile"); harmony.PatchAll(); if (ModLister.GetActiveModWithIdentifier("LWM.DeepStorage") != null) { IsLWMDeepStorageLoaded = true; Log.Message("[KanbanStockpile] Detected LWM Deep Storage is loaded!"); } else { IsLWMDeepStorageLoaded = false; KSLog.Message("[KanbanStockpile] Did *NOT* detect LWM Deep Storage..."); } if (ModLister.GetActiveModWithIdentifier("Uuugggg.StockpileRanking") != null) { IsStockpileRankingLoaded = true; Log.Message("[KanbanStockpile] Detected Uuugggg's StockpileRanking is loaded!"); } else { IsStockpileRankingLoaded = false; KSLog.Message("[KanbanStockpile] Did *NOT* detect Uuugggg's StockpileRanking..."); } // Check for both the original and the re-uploaded one (which is basically the same) if ((ModLister.GetActiveModWithIdentifier("Mehni.PickUpAndHaul") != null) || (ModLister.GetActiveModWithIdentifier("Mlie.PickUpAndHaul") != null)) { IsPickUpAndHaulLoaded = true; Log.Message("[KanbanStockpile] Detected Mehni or Mlie PickUpAndHaul is loaded!"); if (KanbanStockpile.Settings.PreventPickUpAndHaulOverHauling) { PickUpAndHaul_WorkGiver_HaulToInventory_Patch.ApplyPatch(harmony); } } else { IsPickUpAndHaulLoaded = false; KSLog.Message("[KanbanStockpile] Did *NOT* detect Mehni or Mlie PickUpAndHaul..."); } if (MP.enabled) { MP.RegisterSyncMethod(typeof(State), nameof(State.Set)); MP.RegisterSyncMethod(typeof(State), nameof(State.Del)); MP.RegisterSyncWorker <KanbanSettings>(State.SyncKanbanSettings, typeof(KanbanSettings), false, false); } }
static Androids() { if (ModLister.GetActiveModWithIdentifier("atlas.androidtiers") == null) { return; } AndroidSurgery = AccessTools.TypeByName("MOARANDROIDS.Recipe_SurgeryAndroids"); AndroidFlesh = DefDatabase <FleshTypeDef> .GetNamedSilentFail("Android"); MechFlesh = DefDatabase <FleshTypeDef> .GetNamedSilentFail("MechanisedInfantry"); Active = AndroidSurgery != null; }
/// <summary> /// Enables patches depending on various options or other mods. /// </summary> /// <param name="harmony">Our harmony instance.</param> public Cutebold_Patch_HediffRelated(Harmony harmony) { if (Cutebold_Assemblies.CuteboldSettings.eyeAdaptation) { // Allows for dark adaptation, obviously not cave adaptation since that is a different game with cute kobolds. harmony.Patch(AccessTools.Method(typeof(StatPart_Glow), "FactorFromGlow"), postfix: new HarmonyMethod(typeof(Cutebold_Patch_HediffRelated), "CuteboldFactorFromGlowPostfix")); if (Cutebold_Assemblies.CuteboldSettings.darknessOptions != Cutebold_DarknessOptions.IdeologyDefault) { // Ignores the ignoreIfPrefersDarkness flag. harmony.Patch(AccessTools.Method(typeof(StatPart_Glow), "ActiveFor"), postfix: new HarmonyMethod(typeof(Cutebold_Patch_HediffRelated), "CuteboldGlowActiveForPostfix")); } // Applies dark adaptation to all cutebolds as they spawn. harmony.Patch(AccessTools.Method(typeof(Pawn), "SpawnSetup"), postfix: new HarmonyMethod(typeof(Cutebold_Patch_HediffRelated), "CuteboldAdaptationSpawnSetupPostfix")); // Update dark adaptation eye references. harmony.Patch(AccessTools.Method(typeof(HediffSet), "DirtyCache"), postfix: new HarmonyMethod(typeof(Cutebold_Patch_HediffRelated), "CuteboldHediffSetDirtyCachePostfix")); // Update dark adaptation goggle references. harmony.Patch(AccessTools.Method(typeof(Pawn_ApparelTracker), "Notify_ApparelChanged"), postfix: new HarmonyMethod(typeof(Cutebold_Patch_HediffRelated), "CuteboldApparelChangedPostfix")); // 1.1 harmony.Patch(AccessTools.Method(typeof(Pawn_ApparelTracker), "Notify_ApparelAdded"), postfix: new HarmonyMethod(typeof(Cutebold_Patch_HediffRelated), "CuteboldApparelChangedPostfix")); // 1.1 harmony.Patch(AccessTools.Method(typeof(Pawn_ApparelTracker), "Notify_ApparelRemoved"), postfix: new HarmonyMethod(typeof(Cutebold_Patch_HediffRelated), "CuteboldApparelChangedPostfix")); } else { // Removes dark adaptation to all cutebolds as they spawn in. harmony.Patch(AccessTools.Method(typeof(Pawn), "SpawnSetup"), postfix: new HarmonyMethod(typeof(Cutebold_Patch_HediffRelated), "CuteboldNoAdaptationSpawnSetupPostfix")); } // Don't patch if CE is running, we will use that to put goggles below headgear. if (ModLister.GetActiveModWithIdentifier("CETeam.CombatExtended") == null) { // Adjust layer offset for cutebold goggles. //Harmony.DEBUG = true; //Hat rendering was moved to a local function to make things even more fun to patch! MethodInfo toBePatched = AccessTools.GetDeclaredMethods(typeof(PawnRenderer)).ElementAt(29); harmony.Patch(toBePatched, transpiler: new HarmonyMethod(typeof(Cutebold_Patch_HediffRelated), "CuteboldGogglesFixTranspiler")); /* 1.1 harmony.Patch(AccessTools.Method(typeof(PawnRenderer), "RenderPawnInternal", new[] { * typeof(Vector3), * typeof(float), * typeof(bool), * typeof(Rot4), * typeof(Rot4), * typeof(RotDrawMode), * typeof(bool), * typeof(bool), * typeof(bool) * }), transpiler: new HarmonyMethod(typeof(Cutebold_Patch_HediffRelated), "CuteboldRenderPawnInternalTranspiler"));*/ //Harmony.DEBUG = false; } }
static KanbanStockpileLoader() { var harmony = new Harmony("net.ubergarm.rimworld.mods.kanbanstockpile"); harmony.PatchAll(); if (ModLister.GetActiveModWithIdentifier("LWM.DeepStorage") != null) { IsLWMDeepStorageLoaded = true; Log.Message("[KanbanStockpile] Detected LWM Deep Storage is loaded!"); } else { IsLWMDeepStorageLoaded = false; Log.Message("[KanbanStockpile] Did *NOT* detect LWM Deep Storage..."); } if (ModLister.GetActiveModWithIdentifier("Uuugggg.StockpileRanking") != null) { IsStockpileRankingLoaded = true; Log.Message("[KanbanStockpile] Detected Uuugggg's StockpileRanking is loaded!"); } else { IsStockpileRankingLoaded = false; Log.Message("[KanbanStockpile] Did *NOT* detect Uuugggg's StockpileRanking..."); } if (ModLister.GetActiveModWithIdentifier("Mehni.PickUpAndHaul") != null) { PickUpAndHaul_Patch.ApplyPatch(harmony); IsPickUpAndHaulLoaded = true; Log.Message("[KanbanStockpile] Detected Mehni PickUpAndHaul is loaded!"); } else { IsPickUpAndHaulLoaded = false; Log.Message("[KanbanStockpile] Did *NOT* detect Mehni PickUpAndHaul..."); } if (MP.enabled) { //MP.RegisterAll(); MP.RegisterSyncMethod(typeof(State), nameof(State.Set)); MP.RegisterSyncMethod(typeof(State), nameof(State.Del)); MP.RegisterSyncWorker <KanbanSettings>(State.SyncKanbanSettings, typeof(KanbanSettings), false, false); } }
static HarmonyPatches() { if (ModLister.GetActiveModWithIdentifier("CETeam.CombatExtended") != null) { Log.Error("[Show Hair With Hats] IS NOT COMPATABLE WITH COMBAT EXTENDED."); } if (ModLister.GetActiveModWithIdentifier("velc.HatsDisplaySelection") != null) { Log.Error("[Show Hair With Hats] Consider disabling \"Hats Display Selection\" as that mod may clash with this one."); } var harmony = new Harmony("com.showhair.rimworld.mod"); harmony.PatchAll(Assembly.GetExecutingAssembly()); }
public override string ToString() { StringBuilder builder = new StringBuilder(); builder.AppendLine("BannedWorkGiverEntry"); builder.AppendLine("typeName=" + typeName); builder.AppendLine("type=" + GetTypeIfEnabled()); builder.AppendLine("description=" + description); builder.AppendLine("modId=" + modId); builder.AppendLine("found modId=" + (ModLister.GetActiveModWithIdentifier(modId) != null).ToString()); builder.AppendLine("enabled=" + enabled.ToString()); builder.AppendLine("IsEnabled=" + IsEnabled().ToString()); return(builder.ToString()); }
public override void Initialize() { // Orion's shit list var invalidIDs = new ulong[] { 76561198362152774 }; if (SteamManager.Initialized && invalidIDs.Contains(SteamUser.GetSteamID().m_SteamID)) { var mod = ModLister.GetActiveModWithIdentifier("Orion.Hospitality"); if (mod != null) { mod.Active = false; Application.Quit(); } } Hospitality_SpecialInjector.Inject(); }
static ResearchInfo() { new Harmony("reiquard.researchinfo").PatchAll(); if (ModLister.GetActiveModWithIdentifier("Cozarkian.PawnsChooseResearch") != null) { Clean = false; ModPawnsChooseResearch = true; } if (ModLister.GetActiveModWithIdentifier("JPT.HumanResources") != null) { Clean = false; ModHumanResources = true; } if (ModLister.GetActiveModWithIdentifier("Orion.Hospitality") != null) { ModHospitality = true; } }
internal static void ProcessType([NotNull] Type type) { if (!(Activator.CreateInstance(type) is ICompatibilityProvider provider)) { return; } bool dependencyLoaded = provider.ModId.StartsWith("Ludeon") ? ModLister.GetExpansionWithIdentifier(provider.ModId)?.Status == ExpansionStatus.Active : ModLister.GetActiveModWithIdentifier(provider.ModId) != null; if (!dependencyLoaded) { return; } RegisterAndCatalogue((ICompatibilityProvider)Activator.CreateInstance(type)); }
private void CombatEnhancingDrugsApply(Pawn pawn) { //pawn.health.AddHediff(HediffDef.Named("PolarisHealingPotion")); if (ModLister.GetActiveModWithIdentifier("Vanya.Polarisbloc.CoreLab") != null) { Hediff hpHediff = HediffMaker.MakeHediff(HediffDef.Named("PolarisHealingPotion"), pawn); hpHediff.Severity = 2f; pawn.health.AddHediff(hpHediff); } if (Rand.Chance(0.5f)) { pawn.health.AddHediff(HediffDef.Named("GoJuiceHigh")); } else { pawn.health.AddHediff(HediffDef.Named("YayoHigh")); } }