Skip to content

Commit

Permalink
Updated for 1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
emipa606 committed Mar 21, 2024
1 parent fd7654a commit 5426b54
Show file tree
Hide file tree
Showing 25 changed files with 291 additions and 141 deletions.
Binary file added 1.5/Assemblies/CustomPrisonerInteractions.dll
Binary file not shown.
Binary file added 1.5/Assemblies/VersionFromManifest.dll
Binary file not shown.
14 changes: 14 additions & 0 deletions 1.5/Defs/UpdateInfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Defs>
<TabulaRasa.UpdateDef Abstract="true" Name="CustomPrisonerInteractions_UpdateInfoBase">
<linkUrl>https://steamcommunity.com/sharedfiles/filedetails/?id=2841231775</linkUrl>
<banner>UpdateInfo/CustomPrisonerInteractions</banner>
</TabulaRasa.UpdateDef>
<TabulaRasa.UpdateDef ParentName="CustomPrisonerInteractions_UpdateInfoBase">
<defName>CustomPrisonerInteractions_1_4_4</defName>
<date>2023/8/19</date>
<content>Added two new options for releasing prisoners:
Release when no longer guilty, to make them serve time for their crimes
Release when able to walk, if you dont want to wait for them to be healthy</content>
</TabulaRasa.UpdateDef>
</Defs>
4 changes: 4 additions & 0 deletions About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<supportedVersions>
<li>1.3</li>
<li>1.4</li>
<li>1.5</li>
</supportedVersions>
<modDependencies>
<li>
Expand Down Expand Up @@ -101,7 +102,10 @@ Since modding is just a hobby for me I expect no donations to keep modding. If y
[*] For best support, please use the Discord-channel for error-reporting.
[*] Do not report errors by making a discussion-thread, I get no notification of that.
[*] If you have the solution for a problem, please post it to the GitHub repository.
[*] Use [url=https://github.com/RimSort/RimSort/releases/latest]RimSort[/url] to sort your mods
[/list]

[url=https://steamcommunity.com/sharedfiles/filedetails/changelog/2841231775][img]https://img.shields.io/github/v/release/emipa606/CustomPrisonerInteractions?label=latest%20version&amp;style=plastic&amp;labelColor=0070cd&amp;color=white[/img][/url]</description>
<modIconPath IgnoreIfNoMatchingField="True">ModIcon/CustomPrisonerInteractions</modIconPath>
<modVersion IgnoreIfNoMatchingField="True">1.5.0</modVersion>
</ModMetaData>
3 changes: 3 additions & 0 deletions About/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog for CustomPrisonerInteractions

1.5.0 - Updated for 1.5


1.4.5 - Fixed default-values being applied inconsistently


Expand Down
2 changes: 1 addition & 1 deletion About/Manifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>CustomPrisonerInteractions</identifier>
<version>1.4.5</version>
<version>1.5.0</version>
<dependencies />
<incompatibleWith />
<loadBefore />
Expand Down
2 changes: 1 addition & 1 deletion About/ModSync.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ModSyncNinjaData>
<ID>74b7df5b-73c0-4825-884b-61df997d22b7</ID>
<ModName>Custom Prisoner Interactions</ModName>
<Version>1.4.5</Version>
<Version>1.5.0</Version>
<SaveBreaking>False</SaveBreaking>
<Host name="Github">
<Owner>emipa606</Owner>
Expand Down
Binary file modified About/Preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
142 changes: 64 additions & 78 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,79 @@
# CustomPrisonerInteractions
![Image](https://i.imgur.com/iCj5o7O.png)


Adds various extra options to the prisoner Interactions for Converting and Releasing prisoners.

So I've previously made some different prisoner interraction-mods and since the total number of different options started getting out of hand I combined them into this mod. The original mods will stay around as long as anyone still wants to use them but this mod has the same features as the others combined plus some improvements.

The original mods added extra prisoner interraction choices and since only the option for selecting ideology to convert to was visible when choosing the vanilla Convert-choice the process for selecting ideology for the custom convert-options was a bit difficult if you had colonies with multiple ideologies.
This mod instead adds an option-button for the Convert and the Release-choice so all vanilla options regarding Ideology will also be visible.

The other difference is that this mod enables you to select options per prisoner. So you can for example select to release a hurt prisoner without waiting for them to be healthy without changing any global options.
There is also options in the mod-settings if you want to change what option is set by default.

The mod adds these options for Releasing prisoners:
[litst]
- When healthy - wait until they are considered healthy
- When able to walk- wait until they can walk again
- When no longer guilty- wait until they are no longer considered guilty for a crime



It also adds the following options for the Convert option


- Recruit after
- Lower resistance first
- Lower resistance first, Recruit after
- Enslave after
- Lower will first
- Lower will first, Enslave after
- Release after
- Lower resistance first, Release after
- Execute after
- Lower resistance first, Execute after
Adds various extra options to the prisoner Interactions for Converting and Releasing prisoners.



You can use this mod without owning Ideology, as it will still show for the release-option.

If you have suggestions for more options, please leave a comment and Ill see if I can add them to the mod.

- https://steamcommunity.com/sharedfiles/filedetails/?edit=true&id=2841412975]Chinese translation by Chiwei
- Supports the work and convert action added by https://steamcommunity.com/sharedfiles/filedetails/?id=1899474310]Prison Labor

This mod replaces the following mods
So I've previously made some different prisoner interraction-mods and since the total number of different options started getting out of hand I combined them into this mod. The original mods will stay around as long as anyone still wants to use them but this mod has the same features as the others combined plus some improvements.


- https://steamcommunity.com/sharedfiles/filedetails/?id=2702584632]Convert Then Recruit
- https://steamcommunity.com/sharedfiles/filedetails/?id=2705395014]Convert Then Enslave
- https://steamcommunity.com/sharedfiles/filedetails/?id=2838846353]Convert Then Release
- https://steamcommunity.com/sharedfiles/filedetails/?id=2506029522]Release When Healthy
The original mods added extra prisoner interraction choices and since only the option for selecting ideology to convert to was visible when choosing the vanilla Convert-choice the process for selecting ideology for the custom convert-options was a bit difficult if you had colonies with multiple ideologies.
This mod instead adds an option-button for the Convert and the Release-choice so all vanilla options regarding Ideology will also be visible.

The other difference is that this mod enables you to select options per prisoner. So you can for example select to release a hurt prisoner without waiting for them to be healthy without changing any global options.
There is also options in the mod-settings if you want to change what option is set by default.

The mod adds these options for Releasing prisoners:
[litst]
- When healthy - wait until they are considered healthy
- When able to walk- wait until they can walk again
- When no longer guilty- wait until they are no longer considered guilty for a crime



It also adds the following options for the Convert option


- Recruit after
- Lower resistance first
- Lower resistance first, Recruit after
- Enslave after
- Lower will first
- Lower will first, Enslave after
- Release after
- Lower resistance first, Release after
- Execute after
- Lower resistance first, Execute after



You can use this mod without owning Ideology, as it will still show for the release-option.

If you have suggestions for more options, please leave a comment and Ill see if I can add them to the mod.

- https://steamcommunity.com/sharedfiles/filedetails/?edit=true&id=2841412975]Chinese translation by Chiwei
- Supports the work and convert action added by https://steamcommunity.com/sharedfiles/filedetails/?id=1899474310]Prison Labor

This mod replaces the following mods


- https://steamcommunity.com/sharedfiles/filedetails/?id=2702584632]Convert Then Recruit
- https://steamcommunity.com/sharedfiles/filedetails/?id=2705395014]Convert Then Enslave
- https://steamcommunity.com/sharedfiles/filedetails/?id=2838846353]Convert Then Release
- https://steamcommunity.com/sharedfiles/filedetails/?id=2506029522]Release When Healthy



NOTICE: If any of your current prisoners have any of the custom interactions added by the above mods, please change these to the ”No action” setting before switching to this mod as the game will have trouble showing the prisoner tab if the selected saved action is missing.



NOTICE: If any of your current prisoners have any of the custom interactions added by the above mods, please change these to the ”No action” setting before switching to this mod as the game will have trouble showing the prisoner tab if the selected saved action is missing.

[table]
[tr]
[td]https://dsc.gg/mlie]![Image](https://i.imgur.com/zdzzBrc.png)
[/td]
[td]https://github.com/emipa606/CustomPrisonerInteractions]![Image](https://i.imgur.com/kTkpTOE.png)
[/td]
[/tr]
[tr]
[td]![Image](https://i.imgur.com/WjDSfUn.png)
[/td]
[td]![Image](https://i.imgur.com/h5VwTNL.png)
[/td]
[/tr]
[/table]

![Image](https://i.imgur.com/Ds0rBAD.png)

Since modding is just a hobby for me I expect no donations to keep modding. If you still want to show your support you can gift me anything from my https://store.steampowered.com/wishlist/id/Mlie]Wishlist or buy me a cup of tea.


Since modding is just a hobby for me I expect no donations to keep modding. If you still want to show your support you can gift me anything from my https://store.steampowered.com/wishlist/id/Mlie]Wishlist or buy me a cup of tea.

https://ko-fi.com/G2G55DDYD]![Image](https://i.imgur.com/VWG0yff.png)




![Image](https://i.imgur.com/5xwDG6H.png)



- See if the the error persists if you just have this mod and its requirements active.
- If not, try adding your other mods until it happens again.
- Post your error-log using https://steamcommunity.com/workshop/filedetails/?id=818773962]HugsLib or the standalone https://steamcommunity.com/sharedfiles/filedetails/?id=2873415404]Uploader and command Ctrl+F12
- For best support, please use the Discord-channel for error-reporting.
- Do not report errors by making a discussion-thread, I get no notification of that.
- If you have the solution for a problem, please post it to the GitHub repository.


- See if the the error persists if you just have this mod and its requirements active.
- If not, try adding your other mods until it happens again.
- Post your error-log using https://steamcommunity.com/workshop/filedetails/?id=818773962]HugsLib or the standalone https://steamcommunity.com/sharedfiles/filedetails/?id=2873415404]Uploader and command Ctrl+F12
- For best support, please use the Discord-channel for error-reporting.
- Do not report errors by making a discussion-thread, I get no notification of that.
- If you have the solution for a problem, please post it to the GitHub repository.
- Use https://github.com/RimSort/RimSort/releases/latest]RimSort to sort your mods



Expand Down
6 changes: 3 additions & 3 deletions Source/CustomPrisonerInteractions.csproj.oldversioncscproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputPath>..\..\1.3\Assemblies</OutputPath>
<TargetFramework>net472</TargetFramework>
<OutputPath>..\..\1.4\Assemblies</OutputPath>
<TargetFramework>net48</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<DebugType>None</DebugType>
<LangVersion>latest</LangVersion>
<FileVersion>1.3.7</FileVersion>
<FileVersion>1.4.5</FileVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref">
Expand Down
96 changes: 95 additions & 1 deletion Source/CustomPrisonerInteractions/CustomPrisonerInteractions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public enum ExtraMode
ReleaseWhenNotGuilty
}

public static readonly FieldInfo InteractionModeField;

private static readonly Dictionary<Map, ExtraInteractionsTracker> ExtraInteractionsTrackers =
new Dictionary<Map, ExtraInteractionsTracker>();

Expand All @@ -36,12 +38,104 @@ public enum ExtraMode
static CustomPrisonerInteractions()
{
var harmony = new Harmony("Mlie.CustomPrisonerInteractions");
InteractionModeField = AccessTools.Field(typeof(Pawn_GuestTracker), "interactionMode");
harmony.PatchAll(Assembly.GetExecutingAssembly());
if (CustomPrisonerInteractionsMod.instance.Settings.DefaultNewValue == null)
{
CustomPrisonerInteractionsMod.instance.Settings.DefaultNewValue =
PrisonerInteractionModeDefOf.NoInteraction;
PrisonerInteractionModeDefOf.MaintainOnly;
}
}

private static bool ColonyHasAnyBloodfeeder(Map map)
{
if (!ModsConfig.BiotechActive)
{
return false;
}

foreach (var item in map.mapPawns.FreeColonistsAndPrisonersSpawned)
{
if (item.IsBloodfeeder())
{
return true;
}
}

return false;
}

private static bool IsStudiable(Pawn pawn)
{
if (!ModsConfig.AnomalyActive)
{
return false;
}

if (!pawn.TryGetComp<CompStudiable>(out var comp) || !comp.EverStudiable())
{
return false;
}

if (pawn.kindDef.studiableAsPrisoner)
{
return !pawn.everBrainWiped;
}

return false;
}

public static bool CanUseExtraMode(Pawn pawn, ExtraMode mode)
{
if (!pawn.guest.Recruitable && mode is ExtraMode.Recruit or ExtraMode.ReduceResistanceThenRecruit)
{
return false;
}

return !pawn.IsWildMan() || mode is not (ExtraMode.Recruit or ExtraMode.ReduceResistanceThenRecruit
or ExtraMode.ReduceResistance or ExtraMode.ReduceResistanceThenKill
or ExtraMode.ReduceResistanceThenRelease);
}

public static bool CanUsePrisonerInteractionMode(Pawn pawn, PrisonerInteractionModeDef mode)
{
if (!pawn.guest.Recruitable && mode.hideIfNotRecruitable)
{
return false;
}

if (pawn.IsWildMan() && !mode.allowOnWildMan)
{
return false;
}

if (mode.hideIfNoBloodfeeders && pawn.MapHeld != null && !ColonyHasAnyBloodfeeder(pawn.MapHeld))
{
return false;
}

if (mode.hideOnHemogenicPawns && ModsConfig.BiotechActive && pawn.genes != null &&
pawn.genes.HasGene(GeneDefOf.Hemogenic))
{
return false;
}

if (!mode.allowInClassicIdeoMode && Find.IdeoManager.classicMode)
{
return false;
}

if (!ModsConfig.AnomalyActive)
{
return true;
}

if (mode.hideIfNotStudiableAsPrisoner && !IsStudiable(pawn))
{
return false;
}

return !mode.hideIfGrayFleshNotAppeared || Find.Anomaly.hasSeenGrayFlesh;
}

internal static ExtraInteractionsTracker GetExtraInteractionsTracker(this Map map)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputPath>..\..\1.4\Assemblies</OutputPath>
<OutputPath>..\..\1.5\Assemblies</OutputPath>
<TargetFramework>net48</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<DebugType>None</DebugType>
<LangVersion>latest</LangVersion>
<FileVersion>1.4.5</FileVersion>
<FileVersion>1.5.0</FileVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref">
<Version>*</Version>
<Version>1.5.4041-beta</Version>
<ExcludeAssets>runtime</ExcludeAssets>
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ public override void DoSettingsWindowContents(Rect rect)
if (listing_Standard.ButtonText("CPI.change".Translate()))
{
var list = new List<FloatMenuOption>();
foreach (var interactionModeDef in DefDatabase<PrisonerInteractionModeDef>.AllDefsListForReading.OrderBy(
def => def.listOrder))
foreach (var interactionModeDef in DefDatabase<PrisonerInteractionModeDef>.AllDefsListForReading
.Where(def => !def.isNonExclusiveInteraction).OrderBy(
def => def.listOrder))
{
list.Add(new FloatMenuOption(interactionModeDef.LabelCap,
delegate { Settings.DefaultNewValue = interactionModeDef; },
Expand Down
Loading

0 comments on commit 5426b54

Please sign in to comment.