Skip to content

Commit

Permalink
version 1.3.10 (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hazzer authored Apr 18, 2022
1 parent 9a47195 commit 67e97b6
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 16 deletions.
Binary file modified 1.3/Assemblies/PrisonLabor.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</li>
</modDependencies>

<description>Version 1.3.9
<description>Version 1.3.10

This mod force prisoners to work. To enable this feature prisoners must have "Force to work" option checked ("Prisoner" tab). Prison labor needs management that consist:
- Motivation - prisoners need to be motivated by presence of colonists. Wardens have new job - supervising prisoners. Low motivation can lead to revolts.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>
<p align="center">
<a href="https://github.com/Aviuz/PrisonLabor/releases">
<img src="https://img.shields.io/badge/version-1.3.9-orange.svg?style=flat" alt="v1.3.9" />
<img src="https://img.shields.io/badge/version-1.3.10-orange.svg?style=flat" alt="v1.3.10" />
</a>
</p>

Expand Down
6 changes: 3 additions & 3 deletions Source/Core/AI/WorkGivers/WorkGivers_ManipulatePrisoner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
return null;
if (prisoner.Downed || !pawn.CanReserve(t, 1, -1, null, false) || !prisoner.Awake())
return null;
if (pawn.IsPrisoner)
if (pawn.IsPrisoner || !pawn.health.capacities.CapableOf(PawnCapacityDefOf.Talking))
return null;


if (PrisonLaborUtility.RecruitInLaborEnabled(prisoner))
{
return new Job(JobDefOf.PrisonerAttemptRecruit, t);
}
if (PrisonLaborUtility.ConvertInLaborEnabled(prisoner))
if (PrisonLaborUtility.ConvertInLaborEnabled(pawn, prisoner))
{
return new Job(JobDefOf.PrisonerConvert, t);
}
if (PrisonLaborUtility.EnslaveInLaborEnabled(prisoner))
if (PrisonLaborUtility.EnslaveInLaborEnabled(pawn, prisoner))
{
return new Job(JobDefOf.PrisonerEnslave, t);
}
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Meta/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public enum Version
v1_3_6,
v1_3_7,
v1_3_8,
v1_3_9
v1_3_9,
v1_3_10
}
}
4 changes: 2 additions & 2 deletions Source/Core/Meta/VersionUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace PrisonLabor.Core.Meta
{
class VersionUtility
{
public const Version versionNumber = Version.v1_3_9;
public const string versionString = "1.3.9";
public const Version versionNumber = Version.v1_3_10;
public const string versionString = "1.3.10";

public static Version VersionOfSaveFile { get; set; }

Expand Down
20 changes: 13 additions & 7 deletions Source/Core/PrisonLaborUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,31 @@ public static bool LaborEnabled(this Pawn pawn)

public static bool RecruitInLaborEnabled(Pawn pawn)
{
if (pawn.guest.interactionMode == PL_DefOf.PrisonLabor_workAndRecruitOption && pawn.guest.ScheduledForInteraction && pawn.health.capacities.CapableOf(PawnCapacityDefOf.Talking))
if (pawn.guest.interactionMode == PL_DefOf.PrisonLabor_workAndRecruitOption && pawn.guest.ScheduledForInteraction)
{
return true;
}

return false;
}

public static bool ConvertInLaborEnabled(Pawn pawn)
public static bool ConvertInLaborEnabled(Pawn doer, Pawn prisoner)
{
if (pawn.guest.interactionMode == PL_DefOf.PrisonLabor_workAndConvertOption && pawn.guest.ScheduledForInteraction && pawn.health.capacities.CapableOf(PawnCapacityDefOf.Talking))
if (prisoner.guest.interactionMode == PL_DefOf.PrisonLabor_workAndConvertOption && prisoner.guest.ScheduledForInteraction
&& prisoner.Ideo != doer.Ideo && doer.Ideo == prisoner.guest.ideoForConversion)
{
return true;

}
return false;
}

public static bool EnslaveInLaborEnabled(Pawn pawn)
public static bool EnslaveInLaborEnabled(Pawn doer, Pawn prisoner)
{
if (pawn.guest.interactionMode == PL_DefOf.PrisonLabor_workAndEnslaveOption && pawn.guest.ScheduledForInteraction && pawn.health.capacities.CapableOf(PawnCapacityDefOf.Talking))
if (prisoner.guest.interactionMode == PL_DefOf.PrisonLabor_workAndEnslaveOption && prisoner.guest.ScheduledForInteraction
&& new HistoryEvent(HistoryEventDefOf.EnslavedPrisoner, doer.Named(HistoryEventArgsNames.Doer)).Notify_PawnAboutToDo_Job())
{
return true;

}
return false;
}
public static bool WorkTime(Pawn pawn)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using HarmonyLib;
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;

namespace PrisonLabor.HarmonyPatches.Patches_Food
{
[HarmonyPatch(typeof(Pawn_FoodRestrictionTracker))]
[HarmonyPatch("GetCurrentRespectedRestriction")]
class Patch_EnableRespectingFoodPolicies
{
static FoodRestriction Postfix(FoodRestriction __result, Pawn_FoodRestrictionTracker __instance, Pawn getter)
{
if (__result == null)
{
if (__instance.pawn.IsPrisonerOfColony && __instance.pawn == getter)
{
return __instance.CurrentFoodRestriction;
}
}
return __result;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static IEnumerable<MethodBase> TargetMethods()
return Assembly.GetAssembly(typeof(WorkGiver_Scanner)).GetTypes()
.Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(WorkGiver_Scanner)))
.SelectMany(type => type.GetMethods())
.Where(method => method.Name.Equals("PotentialWorkThingsGlobal") || method.Name.Equals("ShouldSkip"))
.Where(method => method.Name.Equals("PotentialWorkThingsGlobal") || method.Name.Equals("ShouldSkip") || method.Name.Equals("HasJobOnThing"))
.Distinct()
.Cast<MethodBase>();
}
Expand Down
1 change: 1 addition & 0 deletions Source/Organizer/NewsFeed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<!-- [img] ... [/img] for image (inside name of file) -->
<!-- [gap] for gap -->
<patches>
<patch version="1.3.10" silent="true"/>
<patch version="1.3.9" silent="true"/>
<patch version="1.3.8" silent="true"/>
<patch version="1.3.7" silent="true"/>
Expand Down
1 change: 1 addition & 0 deletions Source/PrisonLabor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
<Compile Include="HarmonyPatches\Patches_Food\AddCustomFoodReservation.cs" />
<Compile Include="HarmonyPatches\Patches_Food\DeliverEvenOutsidePrisonCell.cs" />
<Compile Include="HarmonyPatches\Patches_Food\FoodUtility_IsFoodSourceOnMapSociallyProper.cs" />
<Compile Include="HarmonyPatches\Patches_Food\Patch_EnableRespectingFoodPolicies.cs" />
<Compile Include="HarmonyPatches\Patches_Food\ReserveFoodForPrisonerAfterDropping.cs" />
<Compile Include="HarmonyPatches\Patches_Food\ReservedByPrisonerPatch.cs" />
<Compile Include="HarmonyPatches\Patches_Food\StopIfPrisonerCanGetFoodByHimself.cs" />
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
Changelog:
1.3.10
- Motivated prisoners should respect food polices
- Fixed: prisoner should be able to use scanners
- Fixed: warden interaction with prisoners (converting already converted prisoners, interacting with prisoners not capable to talking)
1.3.9
- Prisoner labor area fixes
1.3.8
Expand Down

0 comments on commit 67e97b6

Please sign in to comment.