diff --git a/About/About.xml b/About/About.xml index 56f186e..5f76212 100644 --- a/About/About.xml +++ b/About/About.xml @@ -4,6 +4,6 @@ Pawn Rules Jaxe 0.19.0 - Mod Version: 1.0.9\n\n\nPawn Rules is a mod that allows custom rules to be assigned individually to your colonists, animals, guests and prisoners.\n\nCurrently the following rules can be applied:\n\n- Disallow certain foods\n- Disallow bonding with certain animals\n- Disallow new romances\n- Disallow constructing items that have a quality level\n\nAny of these rules can be disabled and hidden from the rules window. + Mod Version: 1.1.0\n\n\nPawn Rules is a mod that allows custom rules to be assigned individually to your colonists, animals, guests and prisoners.\n\nCurrently the following rules can be applied:\n\n- Disallow certain foods\n- Disallow bonding with certain animals\n- Disallow new romances\n- Disallow constructing items that have a quality level\n\nAny of these rules can be disabled and hidden from the rules window. https://ludeon.com/forums/index.php?topic=43086.0 diff --git a/About/ModSync.xml b/About/ModSync.xml index 9c1d833..0cf11cb 100644 --- a/About/ModSync.xml +++ b/About/ModSync.xml @@ -3,7 +3,7 @@ 59f538ed-f86d-4506-a4a5-7e9faaa37508 Pawn Rules - v1.0.9 + v1.1.0 False Jaxe-Dev diff --git a/README.md b/README.md index 9b4cde0..55911ee 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Pawn Rules -![](https://img.shields.io/badge/Version-1.0.9-brightgreen.svg) +![](https://img.shields.io/badge/Version-1.1.0-brightgreen.svg) Built for **RimWorld B19**\ Powered by **Harmony**\ @@ -42,22 +42,22 @@ Supports addons created by other modders by allowing easy creation of new rule o ------------ -The following original methods are patched using Harmony: +The following base methods are patched with Harmony: ```C# -RimWorld.FoodUtility.BestFoodSourceOnMap : Prefix -RimWorld.FoodUtility.BestFoodInInventory : Prefix -RimWorld.FoodUtility.TryFindBestFoodSourceFor : Prefix -RimWorld.GenConstruct.CanConstruct : Postfix -RimWorld.InteractionWorker_RomanceAttempt.RandomSelectionWeight : Prefix -RimWorld.InteractionWorker_RomanceAttempt.SuccessChance : Prefix -RimWorld.JobGiver_PackFood.IsGoodPackableFoodFor : Postfix -RimWorld.JoyGiver_Ingest.CanIngestForJoy : Prefix -RimWorld.Pawn_GuestTracker.SetGuestStatus : Prefix -RimWorld.PawnUtility.TrySpawnHatchedOrBornPawn : Postfix -RimWorld.RelationsUtility.TryDevelopBondRelation : Prefix -Verse.Game.FinalizeInit : Postfix -Verse.Pawn.GetGizmos : Postfix -Verse.Pawn.Kill : Postfix -Verse.Pawn.SetFaction : Prefix -Verse.PawnGenerator.GeneratePawn : Postfix +Prefix : RimWorld.FoodUtility.BestFoodSourceOnMap +Prefix : RimWorld.FoodUtility.BestFoodInInventory +Prefix : RimWorld.FoodUtility.TryFindBestFoodSourceFor +Postfix : RimWorld.GenConstruct.CanConstruct +Prefix : RimWorld.InteractionWorker_RomanceAttempt.RandomSelectionWeight +Prefix : RimWorld.InteractionWorker_RomanceAttempt.SuccessChance +Postfix : RimWorld.JobGiver_PackFood.IsGoodPackableFoodFor +Prefix : RimWorld.JoyGiver_Ingest.CanIngestForJoy +Prefix : RimWorld.Pawn_GuestTracker.SetGuestStatus +Postfix : RimWorld.PawnUtility.TrySpawnHatchedOrBornPawn +Prefix : RimWorld.RelationsUtility.TryDevelopBondRelation +Postfix : Verse.Game.FinalizeInit +Postfix : Verse.Pawn.GetGizmos +Postfix : Verse.Pawn.Kill +Prefix : Verse.Pawn.SetFaction +Postfix : Verse.PawnGenerator.GeneratePawn ``` diff --git a/Source/Data/Registry.cs b/Source/Data/Registry.cs index 1de4bb4..2a8c73d 100644 --- a/Source/Data/Registry.cs +++ b/Source/Data/Registry.cs @@ -165,7 +165,11 @@ public static Rules GetOrDefaultRules(Pawn pawn) public static void ReplaceRules(Pawn pawn, Rules rules) => Instance._rules[pawn] = rules; public static void ReplaceDefaultRules(PawnType type, Rules rules) => Instance._defaults[type] = rules; - private static void ChangeTypeOrCreateRules(Pawn pawn, PawnType type) => Instance._rules[pawn] = GetDefaultRules(type); + private static void ChangeTypeOrCreateRules(Pawn pawn, PawnType type) + { + if (type == pawn.GetTargetType()) { return; } + Instance._rules[pawn] = GetDefaultRules(type); + } public static Rules CloneRules(Pawn original, Pawn cloner) { @@ -187,16 +191,17 @@ public static void DeleteRules(Pawn pawn) public static void FactionUpdate(Thing thing, Faction newFaction, bool? guest = null) { - if (!(thing is Pawn pawn) || !pawn.Spawned || pawn.Dead) { return; } + if (!(thing is Pawn pawn) || pawn.Dead) { return; } + var oldFaction = guest == null ? pawn.Faction : pawn.HostFaction; PawnType type; if (newFaction == Faction.OfPlayer) { - if ((guest == null) || pawn.IsColonistPlayerControlled) { type = pawn.RaceProps.Animal ? PawnType.Animal : PawnType.Colonist; } + if ((guest == null) || (pawn.Faction == Faction.OfPlayer)) { type = pawn.RaceProps.Animal ? PawnType.Animal : PawnType.Colonist; } else { type = guest.Value ? PawnType.Guest : PawnType.Prisoner; } } - else if ((guest == null ? pawn.Faction : pawn.HostFaction) == Faction.OfPlayer) + else if ((oldFaction == Faction.OfPlayer) && (newFaction != null)) { DeleteRules(pawn); return; @@ -212,7 +217,7 @@ public static void DeactivateMod() ModsConfig.SetActive(Mod.ContentPack.Identifier, false); - var runningMods = PrivateAccess.Verse_LoadedModManager_RunningMods(); + var runningMods = Access.Field_Verse_LoadedModManager_RunningMods_Get(); runningMods.Remove(Mod.ContentPack); var addonMods = new StringBuilder(); diff --git a/Source/Data/RestrictionTemplate.cs b/Source/Data/RestrictionTemplate.cs index 57b5611..39ddc4f 100644 --- a/Source/Data/RestrictionTemplate.cs +++ b/Source/Data/RestrictionTemplate.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using PawnRules.Patch; using Verse; namespace PawnRules.Data @@ -28,7 +27,7 @@ private static RestrictionTemplate GetFoodsCategorized(Restriction restriction) foreach (var food in FoodCache) { - var category = food.GetCategoryLabel(); + var category = GetCategoryLabel(food); if (!list.ContainsKey(category)) { list[category] = new Category(category); } list[category].Members.Add(new Toggle(food, restriction.Allows(food))); @@ -75,6 +74,8 @@ public static RestrictionTemplate Build(RestrictionType type, Restriction restri return type == RestrictionType.Bonding ? GetAnimalsCategorized(restriction) : null; } + private static string GetCategoryLabel(ThingDef self) => self.category == ThingCategory.Item ? self.FirstThingCategory.LabelCap : self.category.ToString(); + public class Category { public string Label { get; } diff --git a/Source/Mod.cs b/Source/Mod.cs index 4b622a3..5323177 100644 --- a/Source/Mod.cs +++ b/Source/Mod.cs @@ -7,7 +7,7 @@ internal class Mod : Verse.Mod public const string Id = "PawnRules"; public const string Name = "Pawn Rules"; public const string Author = "Jaxe"; - public const string Version = "1.0.9"; + public const string Version = "1.1.0"; public static ModContentPack ContentPack { get; private set; } diff --git a/Source/Patch/Access.cs b/Source/Patch/Access.cs new file mode 100644 index 0000000..b2efeea --- /dev/null +++ b/Source/Patch/Access.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using Harmony; +using RimWorld; +using Verse; +using Verse.AI; + +namespace PawnRules.Patch +{ + internal static class Access + { + private static readonly MethodInfo Method_RimWorld_FoodUtility_BestPawnToHuntForPredator = AccessTools.Method(typeof(FoodUtility), "BestPawnToHuntForPredator"); + private static readonly MethodInfo Method_RimWorld_FoodUtility_GetMaxRegionsToScan = AccessTools.Method(typeof(FoodUtility), "GetMaxRegionsToScan"); + private static readonly MethodInfo Method_RimWorld_FoodUtility_IsFoodSourceOnMapSociallyProper = AccessTools.Method(typeof(FoodUtility), "IsFoodSourceOnMapSociallyProper"); + private static readonly MethodInfo Method_RimWorld_FoodUtility_SpawnedFoodSearchInnerScan = AccessTools.Method(typeof(FoodUtility), "SpawnedFoodSearchInnerScan"); + private static readonly FieldInfo Field_RimWorld_FoodUtility_Filtered = AccessTools.Field(typeof(FoodUtility), "filtered"); + private static readonly FieldInfo Field_RimWorld_Pawn_GuestTracker_Pawn = AccessTools.Field(typeof(Pawn_GuestTracker), "pawn"); + private static readonly FieldInfo Field_Verse_LoadedModManager_RunningMods = AccessTools.Field(typeof(LoadedModManager), "runningMods"); + + public static Pawn Method_RimWorld_FoodUtility_BestPawnToHuntForPredator_Call(Pawn predator, bool forceScanWholeMap) => (Pawn) Method_RimWorld_FoodUtility_BestPawnToHuntForPredator.Invoke(null, new object[] { predator, forceScanWholeMap }); + public static int Method_RimWorld_FoodUtility_GetMaxRegionsToScan_Call(Pawn getter, bool forceScanWholeMap) => (int) Method_RimWorld_FoodUtility_GetMaxRegionsToScan.Invoke(null, new object[] { getter, forceScanWholeMap }); + public static bool Method_RimWorld_FoodUtility_IsFoodSourceOnMapSociallyProper_Call(Thing thing, Pawn getter, Pawn eater, bool allowSociallyImproper) => (bool) Method_RimWorld_FoodUtility_IsFoodSourceOnMapSociallyProper.Invoke(null, new object[] { thing, getter, eater, allowSociallyImproper }); + public static Thing Method_RimWorld_FoodUtility_SpawnedFoodSearchInnerScan_Call(Pawn eater, IntVec3 root, List searchSet, PathEndMode peMode, TraverseParms traverseParams, float maxDistance = 9999f, Predicate validator = null) => (Thing) Method_RimWorld_FoodUtility_SpawnedFoodSearchInnerScan.Invoke(null, new object[] { eater, root, searchSet, peMode, traverseParams, maxDistance, validator }); + public static HashSet Field_RimWorld_FoodUtility_Filtered_Get() => (HashSet) Field_RimWorld_FoodUtility_Filtered.GetValue(null); + public static Pawn Field_RimWorld_Pawn_GuestTracker_Pawn_Get(Pawn_GuestTracker instance) => (Pawn) Field_RimWorld_Pawn_GuestTracker_Pawn.GetValue(instance); + public static List Field_Verse_LoadedModManager_RunningMods_Get() => (List) Field_Verse_LoadedModManager_RunningMods.GetValue(null); + } +} diff --git a/Source/Patch/Extensions.cs b/Source/Patch/Extensions.cs index aa740df..688dea4 100644 --- a/Source/Patch/Extensions.cs +++ b/Source/Patch/Extensions.cs @@ -11,16 +11,11 @@ internal static class Extensions public static string Italic(this string self) => "" + self + ""; public static string Bold(this string self) => "" + self + ""; - public static string GetCategoryLabel(this ThingDef self) => self.category == ThingCategory.Item ? self.FirstThingCategory.LabelCap : self.category.ToString(); - public static Rect AdjustedBy(this Rect self, float x, float y, float width, float height) => new Rect(self.x + x, self.y + y, self.width + width, self.height + height); - public static int LastIndex(this Array self) => self.Length - 1; - public static int ToInt(this string self, int defaultValue = 0) => int.TryParse(self, out var result) ? result : defaultValue; public static float ToFloat(this string self, float defaultValue = 0f) => float.TryParse(self, out var result) ? result : defaultValue; public static bool CanHaveRules(this Pawn self) => (self != null) && !self.Dead && (self.GetTargetType() != null); - public static PawnType GetTargetType(this Pawn self) { if (self == null) { return null; } @@ -30,6 +25,8 @@ public static PawnType GetTargetType(this Pawn self) return null; } + public static Rect AdjustedBy(this Rect self, float x, float y, float width, float height) => new Rect(self.x + x, self.y + y, self.width + width, self.height + height); + public static Rect[] GetHGrid(this Rect self, float spacing, params float[] widths) { var unfixedCount = 0; diff --git a/Source/Patch/PrivateAccess.cs b/Source/Patch/PrivateAccess.cs deleted file mode 100644 index fb61f2b..0000000 --- a/Source/Patch/PrivateAccess.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using Harmony; -using RimWorld; -using Verse; -using Verse.AI; - -namespace PawnRules.Patch -{ - internal static class PrivateAccess - { - private static readonly MethodInfo Method_RimWorld_FoodUtility_BestPawnToHuntForPredator = AccessTools.Method(typeof(FoodUtility), "BestPawnToHuntForPredator"); - private static readonly MethodInfo Method_RimWorld_FoodUtility_GetMaxRegionsToScan = AccessTools.Method(typeof(FoodUtility), "GetMaxRegionsToScan"); - private static readonly MethodInfo Method_RimWorld_FoodUtility_IsFoodSourceOnMapSociallyProper = AccessTools.Method(typeof(FoodUtility), "IsFoodSourceOnMapSociallyProper"); - private static readonly MethodInfo Method_RimWorld_FoodUtility_SpawnedFoodSearchInnerScan = AccessTools.Method(typeof(FoodUtility), "SpawnedFoodSearchInnerScan"); - private static readonly FieldInfo Field_RimWorld_FoodUtility_Filtered = AccessTools.Field(typeof(FoodUtility), "filtered"); - private static readonly FieldInfo Field_Verse_LoadedModManager_RunningMods = AccessTools.Field(typeof(LoadedModManager), "runningMods"); - - public static Pawn RimWorld_FoodUtility_BestPawnToHuntForPredator(Pawn predator, bool forceScanWholeMap) => (Pawn) Method_RimWorld_FoodUtility_BestPawnToHuntForPredator.Invoke(null, new object[] { predator, forceScanWholeMap }); - public static int RimWorld_FoodUtility_GetMaxRegionsToScan(Pawn getter, bool forceScanWholeMap) => (int) Method_RimWorld_FoodUtility_GetMaxRegionsToScan.Invoke(null, new object[] { getter, forceScanWholeMap }); - public static bool RimWorld_FoodUtility_IsFoodSourceOnMapSociallyProper(Thing thing, Pawn getter, Pawn eater, bool allowSociallyImproper) => (bool) Method_RimWorld_FoodUtility_IsFoodSourceOnMapSociallyProper.Invoke(null, new object[] { thing, getter, eater, allowSociallyImproper }); - public static Thing RimWorld_FoodUtility_SpawnedFoodSearchInnerScan(Pawn eater, IntVec3 root, List searchSet, PathEndMode peMode, TraverseParms traverseParams, float maxDistance = 9999f, Predicate validator = null) => (Thing) Method_RimWorld_FoodUtility_SpawnedFoodSearchInnerScan.Invoke(null, new object[] { eater, root, searchSet, peMode, traverseParams, maxDistance, validator }); - public static HashSet RimWorld_FoodUtility_Filtered() => (HashSet) Field_RimWorld_FoodUtility_Filtered.GetValue(null); - public static List Verse_LoadedModManager_RunningMods() => (List) Field_Verse_LoadedModManager_RunningMods.GetValue(null); - } -} diff --git a/Source/Patch/RimWorld_FoodUtility_BestFoodSourceOnMap.cs b/Source/Patch/RimWorld_FoodUtility_BestFoodSourceOnMap.cs index ba3cd21..76cd918 100644 --- a/Source/Patch/RimWorld_FoodUtility_BestFoodSourceOnMap.cs +++ b/Source/Patch/RimWorld_FoodUtility_BestFoodSourceOnMap.cs @@ -42,13 +42,13 @@ private static bool Prefix(ref Thing __result, Pawn getter, Pawn eater, bool des } if (thing is Building_NutrientPasteDispenser nutrientPasteDispenser) { - if (!allowDispenserFull || !getterCanManipulate || (ThingDefOf.MealNutrientPaste.ingestible.preferability < minPref) || (ThingDefOf.MealNutrientPaste.ingestible.preferability > maxPref) || !eater.RaceProps.CanEverEat(ThingDefOf.MealNutrientPaste) || ((thing.Faction != getter.Faction) && (thing.Faction != getter.HostFaction)) || (!allowForbidden && thing.IsForbidden(getter)) || !nutrientPasteDispenser.powerComp.PowerOn || (!allowDispenserEmpty && !nutrientPasteDispenser.HasEnoughFeedstockInHoppers()) || !thing.InteractionCell.Standable(thing.Map) || !PrivateAccess.RimWorld_FoodUtility_IsFoodSourceOnMapSociallyProper(thing, getter, eater, allowSociallyImproper) || getter.IsWildMan() || !getter.Map.reachability.CanReachNonLocal(getter.Position, new TargetInfo(thing.InteractionCell, thing.Map), PathEndMode.OnCell, TraverseParms.For(getter, Danger.Some))) + if (!allowDispenserFull || !getterCanManipulate || (ThingDefOf.MealNutrientPaste.ingestible.preferability < minPref) || (ThingDefOf.MealNutrientPaste.ingestible.preferability > maxPref) || !eater.RaceProps.CanEverEat(ThingDefOf.MealNutrientPaste) || ((thing.Faction != getter.Faction) && (thing.Faction != getter.HostFaction)) || (!allowForbidden && thing.IsForbidden(getter)) || !nutrientPasteDispenser.powerComp.PowerOn || (!allowDispenserEmpty && !nutrientPasteDispenser.HasEnoughFeedstockInHoppers()) || !thing.InteractionCell.Standable(thing.Map) || !Access.Method_RimWorld_FoodUtility_IsFoodSourceOnMapSociallyProper_Call(thing, getter, eater, allowSociallyImproper) || getter.IsWildMan() || !getter.Map.reachability.CanReachNonLocal(getter.Position, new TargetInfo(thing.InteractionCell, thing.Map), PathEndMode.OnCell, TraverseParms.For(getter, Danger.Some))) { Profiler.EndSample(); return false; } } - else if ((thing.def.ingestible.preferability < minPref) || (thing.def.ingestible.preferability > maxPref) || !eater.RaceProps.WillAutomaticallyEat(thing) || !thing.def.IsNutritionGivingIngestible || !thing.IngestibleNow || (!allowCorpse && thing is Corpse) || (!allowDrug && thing.def.IsDrug) || (!allowForbidden && thing.IsForbidden(getter)) || (!desperate && thing.IsNotFresh()) || thing.IsDessicated() || !PrivateAccess.RimWorld_FoodUtility_IsFoodSourceOnMapSociallyProper(thing, getter, eater, allowSociallyImproper) || (!getter.AnimalAwareOf(thing) && !forceScanWholeMap) || !getter.CanReserve((LocalTargetInfo) thing)) + else if ((thing.def.ingestible.preferability < minPref) || (thing.def.ingestible.preferability > maxPref) || !eater.RaceProps.WillAutomaticallyEat(thing) || !thing.def.IsNutritionGivingIngestible || !thing.IngestibleNow || (!allowCorpse && thing is Corpse) || (!allowDrug && thing.def.IsDrug) || (!allowForbidden && thing.IsForbidden(getter)) || (!desperate && thing.IsNotFresh()) || thing.IsDessicated() || !Access.Method_RimWorld_FoodUtility_IsFoodSourceOnMapSociallyProper_Call(thing, getter, eater, allowSociallyImproper) || (!getter.AnimalAwareOf(thing) && !forceScanWholeMap) || !getter.CanReserve((LocalTargetInfo) thing)) { Profiler.EndSample(); return false; @@ -63,7 +63,7 @@ private static bool Prefix(ref Thing __result, Pawn getter, Pawn eater, bool des if (getter.RaceProps.Humanlike) { - bestThing = PrivateAccess.RimWorld_FoodUtility_SpawnedFoodSearchInnerScan(eater, getter.Position, getter.Map.listerThings.ThingsMatching(req), PathEndMode.ClosestTouch, TraverseParms.For(getter), 9999f, foodValidator); + bestThing = Access.Method_RimWorld_FoodUtility_SpawnedFoodSearchInnerScan_Call(eater, getter.Position, getter.Map.listerThings.ThingsMatching(req), PathEndMode.ClosestTouch, TraverseParms.For(getter), 9999f, foodValidator); if (allowHarvest && getterCanManipulate) { @@ -93,16 +93,16 @@ bool Validator(Thing thing) } else { - var maxRegionsToScan = PrivateAccess.RimWorld_FoodUtility_GetMaxRegionsToScan(getter, forceScanWholeMap); - PrivateAccess.RimWorld_FoodUtility_Filtered().Clear(); + var maxRegionsToScan = Access.Method_RimWorld_FoodUtility_GetMaxRegionsToScan_Call(getter, forceScanWholeMap); + Access.Field_RimWorld_FoodUtility_Filtered_Get().Clear(); foreach (var thing in GenRadial.RadialDistinctThingsAround(getter.Position, getter.Map, 2f, true)) { - if (thing is Pawn pawn && (pawn != getter) && pawn.RaceProps.Animal && (pawn.CurJob != null) && (pawn.CurJob.def == JobDefOf.Ingest) && pawn.CurJob.GetTarget(TargetIndex.A).HasThing) { PrivateAccess.RimWorld_FoodUtility_Filtered().Add(pawn.CurJob.GetTarget(TargetIndex.A).Thing); } + if (thing is Pawn pawn && (pawn != getter) && pawn.RaceProps.Animal && (pawn.CurJob != null) && (pawn.CurJob.def == JobDefOf.Ingest) && pawn.CurJob.GetTarget(TargetIndex.A).HasThing) { Access.Field_RimWorld_FoodUtility_Filtered_Get().Add(pawn.CurJob.GetTarget(TargetIndex.A).Thing); } } var flag = !allowForbidden && ForbidUtility.CaresAboutForbidden(getter, true) && (getter.playerSettings?.EffectiveAreaRestrictionInPawnCurrentMap != null); - var predicate = (Predicate) (thing => foodValidator(thing) && !PrivateAccess.RimWorld_FoodUtility_Filtered().Contains(thing) && (thing is Building_NutrientPasteDispenser || (thing.def.ingestible.preferability > FoodPreferability.DesperateOnly)) && !thing.IsNotFresh()); + var predicate = (Predicate) (thing => foodValidator(thing) && !Access.Field_RimWorld_FoodUtility_Filtered_Get().Contains(thing) && (thing is Building_NutrientPasteDispenser || (thing.def.ingestible.preferability > FoodPreferability.DesperateOnly)) && !thing.IsNotFresh()); var position1 = getter.Position; var map1 = getter.Map; var thingReq1 = req; @@ -112,7 +112,7 @@ bool Validator(Thing thing) bestThing = GenClosest.ClosestThingReachable(position1, map1, thingReq1, PathEndMode.ClosestTouch, traverseParams1, 9999f, validator1, null, 0, maxRegionsToScan, false, RegionType.Set_Passable, ignoreEntirelyForbiddenRegions1); - PrivateAccess.RimWorld_FoodUtility_Filtered().Clear(); + Access.Field_RimWorld_FoodUtility_Filtered_Get().Clear(); if (bestThing == null) { diff --git a/Source/Patch/RimWorld_FoodUtility_TryFindBestFoodSourceFor.cs b/Source/Patch/RimWorld_FoodUtility_TryFindBestFoodSourceFor.cs index 271fa6c..1a61ccb 100644 --- a/Source/Patch/RimWorld_FoodUtility_TryFindBestFoodSourceFor.cs +++ b/Source/Patch/RimWorld_FoodUtility_TryFindBestFoodSourceFor.cs @@ -84,7 +84,7 @@ private static bool Prefix(ref bool __result, Pawn getter, Pawn eater, bool desp } if ((foodSource1 == null) && (getter == eater) && (getter.RaceProps.predator || (getter.IsWildMan() && !getter.IsPrisoner))) { - var huntForPredator = PrivateAccess.RimWorld_FoodUtility_BestPawnToHuntForPredator(getter, forceScanWholeMap); + var huntForPredator = Access.Method_RimWorld_FoodUtility_BestPawnToHuntForPredator_Call(getter, forceScanWholeMap); if (huntForPredator != null) { foodSource = huntForPredator; diff --git a/Source/Patch/RimWorld_Pawn_GuestTracker_SetGuestStatus.cs b/Source/Patch/RimWorld_Pawn_GuestTracker_SetGuestStatus.cs index 5b43f22..9a839de 100644 --- a/Source/Patch/RimWorld_Pawn_GuestTracker_SetGuestStatus.cs +++ b/Source/Patch/RimWorld_Pawn_GuestTracker_SetGuestStatus.cs @@ -1,7 +1,6 @@ using Harmony; using PawnRules.Data; using RimWorld; -using Verse; namespace PawnRules.Patch { @@ -11,7 +10,8 @@ internal static class RimWorld_Pawn_GuestTracker_SetGuestStatus private static void Prefix(Pawn_GuestTracker __instance, Faction newHost, bool prisoner = false) { if (!Registry.IsActive) { return; } - Registry.FactionUpdate(Traverse.Create(__instance).Field("pawn").GetValue(), newHost, !prisoner); + + Registry.FactionUpdate(Access.Field_RimWorld_Pawn_GuestTracker_Pawn_Get(__instance), newHost, !prisoner); } } } diff --git a/Source/PawnRules.csproj b/Source/PawnRules.csproj index 4d085ee..68f5ec1 100644 --- a/Source/PawnRules.csproj +++ b/Source/PawnRules.csproj @@ -82,7 +82,7 @@ - + @@ -124,9 +124,6 @@ -\Languages\English\Keyed\PawnRules.xml Designer - - -\Textures\PawnRules\EditRules.png - diff --git a/Source/Properties/AssemblyInfo.cs b/Source/Properties/AssemblyInfo.cs index a3ce1d7..f968766 100644 --- a/Source/Properties/AssemblyInfo.cs +++ b/Source/Properties/AssemblyInfo.cs @@ -2,8 +2,8 @@ using PawnRules; [assembly: AssemblyTitle(Mod.Id)] -[assembly: AssemblyCompany(Mod.Author)] [assembly: AssemblyProduct(Mod.Id)] +[assembly: AssemblyCompany(Mod.Author)] [assembly: AssemblyCopyright("© " + Mod.Author)] -[assembly: AssemblyVersion(Mod.Version)] -[assembly: AssemblyFileVersion(Mod.Version)] +[assembly: AssemblyVersion(Mod.Version + ".0")] +[assembly: AssemblyFileVersion(Mod.Version + ".0")]