Skip to content

Commit

Permalink
Hotfix
Browse files Browse the repository at this point in the history
- fixed that new subscribers see all "old player" messages
- fixed reserving food for prisoners
- fixed "work settings not initialized" error
  • Loading branch information
Aviuz committed Jul 16, 2017
1 parent 759fd1d commit ec66797
Show file tree
Hide file tree
Showing 11 changed files with 712 additions and 30 deletions.
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<name>Prison Labor (Alpha)</name>
<author>Avius</author>
<targetVersion>0.17.0</targetVersion>
<description>Version 0.5
<description>Version 0.5a

This mod force prisoners to work if Prisoner Interaction is set to "Force to work".
Prisoner must be fed, and rested, or he(she) will refuse to work. Currently prisoners can only cook, mine, cut plants, craft, haul, clean and grow low-skilled plants.
Expand Down
Binary file modified Assemblies/PrisonLabor.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# PrisonLabor
Prison Labor mod for "RimWorld" game

## Version 0.5
## Version 0.5a

## Description
This mod force prisoners to work if Prisoner Interaction is set to "Work".
Expand Down
5 changes: 1 addition & 4 deletions Source/HarmonyPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,7 @@ public static IEnumerable<Pawn> Pawns(MainTabWindow mainTabWindow)
foreach (Pawn pawn in Find.VisibleMap.mapPawns.PrisonersOfColony)
if (pawn.guest.interactionMode == DefDatabase<PrisonerInteractionModeDef>.GetNamed("PrisonLabor_workOption"))
{
if (!pawn.workSettings.EverWork)
pawn.workSettings.EnableAndInitialize();
foreach(WorkTypeDef def in PrisonerWorkDisabledUtility.DisabledWorks)
pawn.workSettings.Disable(def);
PrisonerWorkDisabledUtility.initWorkSettings(pawn);
yield return pawn;
}
}
Expand Down
2 changes: 2 additions & 0 deletions Source/Initialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ static Initialization()

private static void checkVersion()
{
if (PrisonLaborPrefs.Version == 0)
PrisonLaborPrefs.Version = version;
if (PrisonLaborPrefs.Version < 3)
{
// only way to check if mod was installed before
Expand Down
1 change: 1 addition & 0 deletions Source/JobGiver_Labor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public override ThinkResult TryIssueJobPackage(Pawn pawn, JobIssueParams jobPara
pawn.mindState.priorityWork.Clear();
}
//Work prisoners will do
PrisonerWorkDisabledUtility.initWorkSettings(pawn);
List<WorkGiver> workList = pawn.workSettings.WorkGiversInOrderNormal;
workList.RemoveAll(workGiver => workGiver.def.defName == "GrowerSow");
pawn.needs.TryGetNeed<Need_Laziness>().Enabled = false;
Expand Down
1 change: 1 addition & 0 deletions Source/PrisonLabor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<Compile Include="Need_Laziness.cs" />
<Compile Include="PrisonerFoodReservation.cs" />
<Compile Include="PrisonerWorkDisabledUtility.cs" />
<Compile Include="Tweaks\FoodUtility_Tweak.cs" />
<Compile Include="Tweaks\JobDriver_FoodDeliver_Tweak.cs" />
<Compile Include="Tweaks\JobDriver_Mine_Tweak.cs" />
<Compile Include="JobDriver_Supervise.cs" />
Expand Down
8 changes: 8 additions & 0 deletions Source/PrisonerWorkDisabledUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,13 @@ public static bool Disabled(Pawn p, WorkTypeDef wt)
else
return false;
}

public static void initWorkSettings(Pawn pawn)
{
if (!pawn.workSettings.EverWork)
pawn.workSettings.EnableAndInitialize();
foreach (WorkTypeDef def in PrisonerWorkDisabledUtility.DisabledWorks)
pawn.workSettings.Disable(def);
}
}
}
662 changes: 662 additions & 0 deletions Source/Tweaks/FoodUtility_Tweak.cs

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions Source/Tweaks/WorkGiver_Warden_DeliverFood_Tweak.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
}
Thing thing;
ThingDef def;
if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn2, pawn2.needs.food.CurCategory == HungerCategory.Starving, out thing, out def, false, true, false, false, false))
//Tweak: changes way of finding food
if (!FoodUtility_Tweak.TryFindBestFoodSourceFor(pawn, pawn2, pawn2.needs.food.CurCategory == HungerCategory.Starving, out thing, out def, false, true, false, false, false))
{
return null;
}
Expand All @@ -46,7 +47,7 @@ public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
}
return new Job(DefDatabase<JobDef>.GetNamed("PrisonLabor_DeliverFood_Tweak"), thing, pawn2)
{
count = FoodUtility.WillIngestStackCountOf(pawn2, def),
count = FoodUtility_Tweak.WillIngestStackCountOf(pawn2, def),
targetC = RCellFinder.SpotToChewStandingNear(pawn2, thing)
};
}
Expand Down
54 changes: 32 additions & 22 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
Changelog:
0.5
- added growing to available jobs
- added prisoner work priorities to "Work" tab
- food is no longer reserved in prison cell unless is brought by warden
- food is now delivered by Wardens even if prisoner get out of his prison cell
- disabled passive "Laziness" when prisoner have no work to do
0.4
- added "Laziness" bar in "Needs" tab
- fixed plant cut / harvest result being forbidden
- added German translation
0.3b
- fixed "Forbidden" bug
0.3a
- wardens no longer watch over hungry or tired prisoners
0.3
- added work of Warden type that supervise prisoners
- prisoners will get lazy
- added version checker
- added stat laziness
- added "Work" prisoner interaction mode
0.2a
- added tutorial in "LearningHelper"
0.5a
- fixed that new subscribers see all "old player" messages
- fixed reserving food for prisoners
- fixed "work settings not initialized" error

0.5
- added growing to available jobs
- added prisoner work priorities to "Work" tab
- food is no longer reserved in prison cell unless is brought by warden
- food is now delivered by Wardens even if prisoner get out of his prison cell
- disabled passive "Laziness" when prisoner have no work to do

0.4
- added "Laziness" bar in "Needs" tab
- fixed plant cut / harvest result being forbidden
- added German translation

0.3b
- fixed "Forbidden" bug

0.3a
- wardens no longer watch over hungry or tired prisoners

0.3
- added work of Warden type that supervise prisoners
- prisoners will get lazy
- added version checker
- added stat laziness
- added "Work" prisoner interaction mode

0.2a
- added tutorial in "LearningHelper"

0 comments on commit ec66797

Please sign in to comment.