From 5de5ba65bc358fed3cb65639dd1b4ff582888729 Mon Sep 17 00:00:00 2001 From: Jaxe <42095078+Jaxe-Dev@users.noreply.github.com> Date: Thu, 20 Aug 2020 10:41:45 +0800 Subject: [PATCH] v1.4.4 - Added support for RimWorld 1.2 - Removed support for RimWorld 1.0 --- About/About.xml | 30 ++-- LoadFolders.xml | 14 -- README.md | 6 +- Source/Interface/Dialog_Plans.cs | 2 +- Source/Mod.cs | 2 +- Source/Patch/Access.cs | 20 +-- Source/PawnRules.csproj | 11 +- v1.1/Assemblies/PawnRules.xml | 243 ------------------------------- 8 files changed, 32 insertions(+), 296 deletions(-) delete mode 100644 LoadFolders.xml delete mode 100644 v1.1/Assemblies/PawnRules.xml diff --git a/About/About.xml b/About/About.xml index 2843ca1..e916ccc 100644 --- a/About/About.xml +++ b/About/About.xml @@ -3,24 +3,20 @@ Jaxe.PawnRules Pawn Rules Jaxe - Mod Version: 1.4.3\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. Rules presets and defaults can be imported and exported between games. + Mod Version: 1.4.4\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. Rules presets and defaults can be imported and exported between games. -
  • 1.0
  • 1.1
  • +
  • 1.2
  • - - -
  • - brrainz.harmony - Harmony - steam://url/CommunityFilePage/2009463077 - https://github.com/pardeike/HarmonyRimWorld/releases/latest -
  • -
    -
    - - -
  • brrainz.harmony
  • -
    -
    + +
  • + brrainz.harmony + Harmony + steam://url/CommunityFilePage/2009463077 + https://github.com/pardeike/HarmonyRimWorld/releases/latest +
  • +
    + +
  • brrainz.harmony
  • +
    diff --git a/LoadFolders.xml b/LoadFolders.xml deleted file mode 100644 index 9c8a7ad..0000000 --- a/LoadFolders.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - -
  • -
  • v1.1
  • -
    - -
  • -
    - -
  • -
  • v1.1
  • -
    -
    diff --git a/README.md b/README.md index 28f7818..48330b0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Pawn Rules -![Mod Version](https://img.shields.io/badge/Mod_Version-1.4.3-blue.svg) -![RimWorld Version](https://img.shields.io/badge/Built_for_RimWorld-1.1-blue.svg) -![Harmony Version](https://img.shields.io/badge/Powered_by_Harmony-2.0-blue.svg)\ +![Mod Version](https://img.shields.io/badge/Mod_Version-1.4.4-blue.svg) +![RimWorld Version](https://img.shields.io/badge/Built_for_RimWorld-1.2-blue.svg) +![Harmony Version](https://img.shields.io/badge/Powered_by_Harmony-2.x-blue.svg)\ ![Steam Subscribers](https://img.shields.io/badge/dynamic/xml.svg?label=Steam+Subscribers&query=//table/tr[2]/td[1]&colorB=blue&url=https://steamcommunity.com/sharedfiles/filedetails/%3Fid=1499843448&suffix=+total) ![GitHub Downloads](https://img.shields.io/github/downloads/Jaxe-Dev/PawnRules/total.svg?colorB=blue&label=GitHub+Downloads) diff --git a/Source/Interface/Dialog_Plans.cs b/Source/Interface/Dialog_Plans.cs index e2ba146..7453216 100644 --- a/Source/Interface/Dialog_Plans.cs +++ b/Source/Interface/Dialog_Plans.cs @@ -60,7 +60,7 @@ protected override void DoContent(Rect rect) _listing.Begin(vGrid[1], true); foreach (var plan in _plans) { - if (_listing.RadioButton(plan, _selected == plan)) { _selected = plan; } + if (_listing.RadioButton_NewTemp(plan, _selected == plan)) { _selected = plan; } } } else diff --git a/Source/Mod.cs b/Source/Mod.cs index 99f1d3c..9c7870b 100644 --- a/Source/Mod.cs +++ b/Source/Mod.cs @@ -12,7 +12,7 @@ internal class Mod : Verse.Mod { public const string Id = "PawnRules"; public const string Name = "Pawn Rules"; - public const string Version = "1.4.3"; + public const string Version = "1.4.4"; public static readonly DirectoryInfo ConfigDirectory = new DirectoryInfo(Path.Combine(GenFilePaths.ConfigFolderPath, Id)); diff --git a/Source/Patch/Access.cs b/Source/Patch/Access.cs index d5e6243..dc0c748 100644 --- a/Source/Patch/Access.cs +++ b/Source/Patch/Access.cs @@ -10,16 +10,16 @@ namespace PawnRules.Patch { internal static class Access { - 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"); + private static readonly MethodInfo MethodRimWorldFoodUtilityGetMaxRegionsToScan = AccessTools.Method(typeof(FoodUtility), "GetMaxRegionsToScan"); + private static readonly MethodInfo MethodRimWorldFoodUtilityIsFoodSourceOnMapSociallyProper = AccessTools.Method(typeof(FoodUtility), "IsFoodSourceOnMapSociallyProper"); + private static readonly MethodInfo MethodRimWorldFoodUtilitySpawnedFoodSearchInnerScan = AccessTools.Method(typeof(FoodUtility), "SpawnedFoodSearchInnerScan"); + private static readonly FieldInfo FieldRimWorldFoodUtilityFiltered = AccessTools.Field(typeof(FoodUtility), "filtered"); + private static readonly FieldInfo FieldVerseLoadedModManagerRunningMods = AccessTools.Field(typeof(LoadedModManager), "runningMods"); - 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 List Field_Verse_LoadedModManager_RunningMods_Get() => (List) Field_Verse_LoadedModManager_RunningMods.GetValue(null); + public static int Method_RimWorld_FoodUtility_GetMaxRegionsToScan_Call(Pawn getter, bool forceScanWholeMap) => (int) MethodRimWorldFoodUtilityGetMaxRegionsToScan.Invoke(null, new object[] { getter, forceScanWholeMap }); + public static bool Method_RimWorld_FoodUtility_IsFoodSourceOnMapSociallyProper_Call(Thing thing, Pawn getter, Pawn eater, bool allowSociallyImproper) => (bool) MethodRimWorldFoodUtilityIsFoodSourceOnMapSociallyProper.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) MethodRimWorldFoodUtilitySpawnedFoodSearchInnerScan.Invoke(null, new object[] { eater, root, searchSet, peMode, traverseParams, maxDistance, validator }); + public static HashSet Field_RimWorld_FoodUtility_Filtered_Get() => (HashSet) FieldRimWorldFoodUtilityFiltered.GetValue(null); + public static List Field_Verse_LoadedModManager_RunningMods_Get() => (List) FieldVerseLoadedModManagerRunningMods.GetValue(null); } } diff --git a/Source/PawnRules.csproj b/Source/PawnRules.csproj index 7a4f998..f0c3352 100644 --- a/Source/PawnRules.csproj +++ b/Source/PawnRules.csproj @@ -17,17 +17,17 @@ none true - ..\v1.1\Assemblies\ + ..\Assemblies\ TRACE prompt 4 false - ..\v1.1\Assemblies\PawnRules.xml + ..\Assemblies\PawnRules.xml 1591 - - packages\Lib.Harmony.2.0.0.8\lib\net472\0Harmony.dll + + packages\Lib.Harmony.2.0.2\lib\net472\0Harmony.dll False @@ -128,9 +128,6 @@ -\Languages\English\Keyed\Keys.xml - - -\LoadFolders.xml - \ No newline at end of file diff --git a/v1.1/Assemblies/PawnRules.xml b/v1.1/Assemblies/PawnRules.xml deleted file mode 100644 index 42e118d..0000000 --- a/v1.1/Assemblies/PawnRules.xml +++ /dev/null @@ -1,243 +0,0 @@ - - - - PawnRules - - - - - The base class of a rules option handle. - - - - - Called when the button for this option is clicked. Setting the value must be handled by the delegate. Unused if this option does not implement a button widget. - - The pawn being displayed when the button was clicked. - Currently unused but as practice return true if the value was changed. - - - - Called when the button for this option is clicked in the default rules dialog. Setting the value must be handled by the delegate. Unused if this option does not implement a button widget. - - The target of the default rule. - Currently unused but as practice return true if the value was changed. - - - - Called when the button for this option is clicked. Unused if this option does not implement a button widget. - - - - - Called when the button for this option is clicked in the default rules dialog. Unused if this option does not implement a button widget. - - - - - Used to see if a given pawn has this option. - - The pawn to query. - - - - - Provides a handle for a rules option. This class may not be instantiated manually, create a to add one. - - The value type. - - - - This is called when the value of the option is changing for a pawn. Unused if the option implements a button. - - The pawn whose rule option is being changed. - The original value of the option. - The new value of the option entered in the rules dialog. - The return value will be the value set for the option. - - - - This is called when the value of the option is changing for a preset. Unused if the option implements a button. - - The target of the preset that is being changed. - The original value of the option. - The new value of the option entered in the rules dialog. - The return value will be the value set for the option. - - - - This is called when the value of the option is changing for a pawn. Unused if option option implements a button. - - - - - This is called when the value of the option is changing for a preset type. Unused if the option implements a button. - - - - - Gets or sets the displayed label of this option. - - - - - Gets or sets the tooltip of this option. - - - - - Gets the value of this option for the given pawn. - - The pawn to get the value from. - The value returned if unable to retrieve the option. - Returns the value if the option is found or if not. - - - - Gets the default value of this option for the given target. - - The default rules target to get the value from. - The value returned if unable to retrieve the option. - Returns the value if the option is found or if not. - - - - Sets the value of this option for the given pawn. - - The pawn to set the value to. - The new value for the option. - Returns true if the option was successfully set. - - - - Used to set the target type of the pawn that a rule will be applied to. Multiple flags may be set. - - - - - For all colonists part of the player's faction. - - - - - For all animals part of the player's faction. - - - - - For all guests that are currently staying with the player's faction. - - - - - For all prisoners that are being held by the player's faction. - - - - - Provides a link to Pawn Rules and is used to add options to the rules dialog. - - - - - Initializes a link to Pawn Rules. Only one plugin per mod is allowed. - - - - - Adds a new Toggle to the Rules dialog that sets a . - - The key used in the save file. Will be automatically prefixed with your Mod Identifier. - The type(s) of pawns this option will apply to. - The label of the widget displayed. - The tooltip displayed for the widget. - This is the default value if is false or no default rules exist when a pawn is first given rules. - If set to false it cannot be used in a preset. - Returns a handle for this option. - - - - Adds a new Entry to the Rules dialog that sets a value. - - The key used in the save file. Will be automatically prefixed with your Mod Identifier. - The type(s) of pawns this option will apply to. - The label of the widget displayed. - The tooltip displayed for the widget. - This is the default value if is false or no default rules exist when a pawn is first given rules. - If set to false it cannot be used in a preset. - Returns a handle for this option. - - - - Adds a new Entry to the Rules dialog that sets an value. - - The key used in the save file. Will be automatically prefixed with your Mod Identifier. - The type(s) of pawns this option will apply to. - The label of the widget displayed. - The tooltip displayed for the widget. - This is the default value if is false or no default rules exist when a pawn is first given rules. - If set to false it cannot be used in a preset. - Returns a handle for this option. - - - - Adds a new Entry to the Rules dialog that sets a value. - - The key used in the save file. Will be automatically prefixed with your Mod Identifier. - The type(s) of pawns this option will apply to. - The label of the widget displayed. - The tooltip displayed for the widget. - This is the default value if is false or no default rules exist when a pawn is first given rules. - If set to false it cannot be used in a preset. - Returns a handle for this option. - - - - Adds a new Button to the Rules dialog that sets a value. Buttons require to be used to set the value. - - The key used in the save file. Will be automatically prefixed with your Mod Identifier. - The type(s) of pawns this option will apply to. - The label of the widget displayed. - The tooltip displayed for the widget. - This is the default value if is false or no default rules exist when a pawn is first given rules. - If set to false it cannot be used in a preset. - Returns a handle for this option. - - - - Adds a new Button to the Rules dialog that sets a value. Buttons require to be used to set the value. - - The key used in the save file. Will be automatically prefixed with your Mod Identifier. - The type(s) of pawns this option will apply to. - The label of the widget displayed. - The tooltip displayed for the widget. - This is the default value if is false or no default rules exist when a pawn is first given rules. - If set to false it cannot be used in a preset. - Returns a handle for this option. - - - - Adds a new Button to the Rules dialog that sets an value. Buttons require to be used to set the value. - - The key used in the save file. Will be automatically prefixed with your Mod Identifier. - The type(s) of pawns this option will apply to. - The label of the widget displayed. - The tooltip displayed for the widget. - This is the default value if is false or no default rules exist when a pawn is first given rules. - If set to false it cannot be used in a preset. - Returns a handle for this option. - - - - Adds a new Button to the Rules dialog that sets a value. Buttons to be used to set the value. - - The key used in the save file. Will be automatically prefixed with your Mod Identifier. - The type(s) of pawns this option will apply to. - The label of the widget displayed. - The tooltip displayed for the widget. - This is the default value if is false or no default rules exist when a pawn is first given rules. - If set to false it cannot be used in a preset. - Returns a handle for this option. - - -