diff --git a/About/About.xml b/About/About.xml index e916ccc..56cd918 100644 --- a/About/About.xml +++ b/About/About.xml @@ -3,10 +3,11 @@ Jaxe.PawnRules Pawn Rules Jaxe - 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. + Mod Version: 1.5.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. Rules presets and defaults can be imported and exported between games.
  • 1.1
  • 1.2
  • +
  • 1.3
  • diff --git a/Legacy/1.1-1.2/Assemblies/PawnRules.xml b/Legacy/1.1-1.2/Assemblies/PawnRules.xml new file mode 100644 index 0000000..42e118d --- /dev/null +++ b/Legacy/1.1-1.2/Assemblies/PawnRules.xml @@ -0,0 +1,243 @@ + + + + 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. + + + diff --git a/README.md b/README.md index 48330b0..fd6c1d0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Pawn Rules -![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) +![Mod Version](https://img.shields.io/badge/Mod_Version-1.5.0-blue.svg) +![RimWorld Version](https://img.shields.io/badge/Built_for_RimWorld-1.3-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 7453216..e2ba146 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_NewTemp(plan, _selected == plan)) { _selected = plan; } + if (_listing.RadioButton(plan, _selected == plan)) { _selected = plan; } } } else diff --git a/Source/Mod.cs b/Source/Mod.cs index 9c7870b..26ab03c 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.4"; + public const string Version = "1.5.0"; public static readonly DirectoryInfo ConfigDirectory = new DirectoryInfo(Path.Combine(GenFilePaths.ConfigFolderPath, Id)); diff --git a/Source/Patch/RimWorld_GenConstruct_CanConstruct.cs b/Source/Patch/RimWorld_GenConstruct_CanConstruct.cs index 33e0a15..6a3eaaa 100644 --- a/Source/Patch/RimWorld_GenConstruct_CanConstruct.cs +++ b/Source/Patch/RimWorld_GenConstruct_CanConstruct.cs @@ -6,7 +6,7 @@ namespace PawnRules.Patch { - [HarmonyPatch(typeof(GenConstruct), "CanConstruct")] + [HarmonyPatch(typeof(GenConstruct), "CanConstruct", typeof(Thing), typeof(Pawn), typeof(bool), typeof(bool))] internal static class RimWorld_GenConstruct_CanConstruct { private static void Postfix(ref bool __result, Thing t, Pawn p, bool checkSkills = true, bool forced = false) @@ -15,7 +15,7 @@ private static void Postfix(ref bool __result, Thing t, Pawn p, bool checkSkills var rules = p.GetRules(); if ((rules == null) || rules.AllowArtisan || !checkSkills) { return; } - + if (!(t.def.entityDefToBuild is ThingDef thingDef) || !thingDef.HasComp(typeof(CompQuality))) { return; } if (forced && !JobFailReason.HaveReason && !rules.AllowArtisan) { JobFailReason.Is(Lang.Get("Rules.NotArtisanReason"), Lang.Get("Rules.NotArtisanJob", t.LabelCap)); } diff --git a/Source/Patch/RimWorld_Pawn_GuestTracker_SetGuestStatus.cs b/Source/Patch/RimWorld_Pawn_GuestTracker_SetGuestStatus.cs index 8c12f0a..99a2c35 100644 --- a/Source/Patch/RimWorld_Pawn_GuestTracker_SetGuestStatus.cs +++ b/Source/Patch/RimWorld_Pawn_GuestTracker_SetGuestStatus.cs @@ -8,11 +8,10 @@ namespace PawnRules.Patch [HarmonyPatch(typeof(Pawn_GuestTracker), "SetGuestStatus")] internal static class RimWorld_Pawn_GuestTracker_SetGuestStatus { - private static void Prefix(Pawn_GuestTracker __instance, Faction newHost, bool prisoner = false) + private static void Prefix(Pawn_GuestTracker __instance, Faction newHost, GuestStatus guestStatus = GuestStatus.Guest) { if (!Registry.IsActive) { return; } - - Registry.FactionUpdate(Traverse.Create(__instance).Field("pawn").Value, newHost, !prisoner); + Registry.FactionUpdate(Traverse.Create(__instance).Field("pawn").Value, newHost, guestStatus == GuestStatus.Guest); } } } diff --git a/Source/PawnRules.csproj b/Source/PawnRules.csproj index f0c3352..9a07692 100644 --- a/Source/PawnRules.csproj +++ b/Source/PawnRules.csproj @@ -116,9 +116,6 @@ - - -\.gitignore - -\About\About.xml @@ -128,6 +125,9 @@ -\Languages\English\Keyed\Keys.xml + + -\loadFolders.xml + \ No newline at end of file diff --git a/loadFolders.xml b/loadFolders.xml new file mode 100644 index 0000000..33a98cd --- /dev/null +++ b/loadFolders.xml @@ -0,0 +1,13 @@ + + +
  • /
  • +
  • Legacy/1.1-1.2
  • + + +
  • /
  • +
  • Legacy/1.1-1.2
  • +
    + +
  • /
  • +
    +