Skip to content

Commit

Permalink
Merge pull request #257 from Aviuz/recreation-fixes
Browse files Browse the repository at this point in the history
1.4.2
  • Loading branch information
Hazzer authored Oct 28, 2022
2 parents 9fb37b6 + 7cfcbd5 commit 0d108fc
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 20 deletions.
Binary file modified 1.4/Assemblies/PrisonLabor.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified 1.4/Kijin/Assemblies/PrisonLaborKijinCompatibility.dll
Binary file not shown.
Binary file modified 1.4/Quarry/Assemblies/PrisonLaborQuarryCompatibility.dll
Binary file not shown.
Binary file modified 1.4/Therapy/Assemblies/PrisonLaborTherapyCompatibility.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 @@ -34,7 +34,7 @@
</modDependencies>

<description>
Version 1.4.1
Version 1.4.2

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.4.1-orange.svg?style=flat" alt="v1.4.1" />
<img src="https://img.shields.io/badge/version-1.4.2-orange.svg?style=flat" alt="v1.4.2" />
</a>
</p>

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 @@ -81,6 +81,7 @@ public enum Version
v1_3_10,
v1_3_11,
v1_4_0,
v1_4_1
v1_4_1,
v1_4_2
}
}
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
{
public class VersionUtility
{
public const Version versionNumber = Version.v1_4_1;
public const string versionString = "1.4.1";
public const Version versionNumber = Version.v1_4_2;
public const string versionString = "1.4.2";

public static Version VersionOfSaveFile { get; set; }

Expand Down
27 changes: 12 additions & 15 deletions Source/Core/Recreation/RecreationUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Verse.AI;
using Verse;
using PrisonLabor.Core.Needs;
using PrisonLabor.Core.Other;

namespace PrisonLabor.Core.Recreation
{
Expand All @@ -28,18 +29,19 @@ public static bool PrisonerJoyTickCheckEnd(Pawn pawn, JoyTickFullJoyAction fullJ
}
extraJoyGainFactor *= joySource.GetStatValue(StatDefOf.JoyGainFactor);
}
Need need = GetPrisonerNeed(pawn);
if (need == null && !curJob.doUntilGatheringEnded)
Need treatment = pawn.needs.TryGetNeed<Need_Treatment>();

if (treatment == null && pawn.needs.joy == null && !curJob.doUntilGatheringEnded )
{
pawn.jobs.curDriver.EndJobWith(JobCondition.InterruptForced);
DebugLogger.debug("[PL] Both need null. Returning false.");
return false;
}

if (pawn.needs.joy != null && curJob.doUntilGatheringEnded)
{
//if somehow prisoner has joy need by other mods.
pawn.needs.joy?.GainJoy(extraJoyGainFactor * curJob.def.joyGainRate * 0.36f / 2500f, curJob.def.joyKind);
}

//if somehow prisoner has joy need by other mods.
pawn.needs.joy?.GainJoy(extraJoyGainFactor * curJob.def.joyGainRate * 0.36f / 2500f, curJob.def.joyKind);



if (curJob.def.joySkill != null)
Expand All @@ -51,7 +53,7 @@ public static bool PrisonerJoyTickCheckEnd(Pawn pawn, JoyTickFullJoyAction fullJ
pawn.jobs.curDriver.EndJobWith(JobCondition.InterruptForced);
return true;
}
if (need.CurLevel > 0.9999f && !curJob.doUntilGatheringEnded)
if ((NeedLevelFull(treatment) || NeedLevelFull(pawn.needs.joy)) && !curJob.doUntilGatheringEnded)
{
switch (fullJoyAction)
{
Expand All @@ -66,14 +68,9 @@ public static bool PrisonerJoyTickCheckEnd(Pawn pawn, JoyTickFullJoyAction fullJ
return false;
}

private static Need GetPrisonerNeed(Pawn pawn)
private static bool NeedLevelFull(Need need)
{
Need need = pawn.needs.TryGetNeed<Need_Treatment>();
if (need == null)
{
need = pawn.needs.TryGetNeed<Need_Joy>();
}
return need;
return need != null && need.CurLevel > 0.9999f;
}
}
}
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.4.2" silent="true"/>
<patch version="1.4.1" silent ="false">
<title>Prison Labor v 1.4.1</title>
<items>
Expand Down
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Changelog:
1.4.2
- Recreation fixes
1.4.1
- Added Work and bloodfeed interaction for biotech dlc
- Added Work and hemogen farm interaction for biotech dlc
Expand Down

0 comments on commit 0d108fc

Please sign in to comment.