Skip to content

Commit

Permalink
1.4.7 Development (#265)
Browse files Browse the repository at this point in the history
* first fix

* little changes

---------

Co-authored-by: Hazzer <[email protected]>
  • Loading branch information
Hazzer and Hazzer authored May 4, 2023
1 parent 27ca9d4 commit bd2a1a5
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 21 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 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 @@ -35,7 +35,7 @@
</modDependencies>

<description>
Version 1.4.6
Version 1.4.7

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.6-orange.svg?style=flat" alt="v1.4.6" />
<img src="https://img.shields.io/badge/version-1.4.7-orange.svg?style=flat" alt="v1.4.7" />
</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 @@ -86,6 +86,7 @@ public enum Version
v1_4_3,
v1_4_4,
v1_4_5,
v1_4_6
v1_4_6,
v1_4_7
}
}
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_6;
public const string versionString = "1.4.6";
public const Version versionNumber = Version.v1_4_7;
public const string versionString = "1.4.7";

public static Version VersionOfSaveFile { get; set; }

Expand Down
48 changes: 32 additions & 16 deletions Source/HarmonyPatches/Patches_LaborArea/Patch_Scanner_HasJob.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using HarmonyLib;
using PrisonLabor.Core;
using PrisonLabor.Core.AI.WorkGivers;
using PrisonLabor.Core.Other;
using RimWorld;
using System;
using System.Collections.Generic;
Expand All @@ -12,25 +13,40 @@

namespace PrisonLabor.HarmonyPatches.Patches_LaborArea
{
[HarmonyPatch]
class Patch_Scanner_HasJob
[HarmonyPatch]
class Patch_Scanner_HasJob
{
static IEnumerable<MethodBase> TargetMethods()
{
static IEnumerable<MethodBase> TargetMethods()
{
return Assembly.GetAssembly(typeof(WorkGiver_Scanner)).GetTypes()
.Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(WorkGiver_Scanner)) && myType != typeof(WorkGiver_Supervise) && myType != typeof(WorkGiver_Warden))
.SelectMany(type => type.GetMethods())
.Where(method => method.Name.Equals("HasJobOnThing"))
.Cast<MethodBase>();
}
return Assembly.GetAssembly(typeof(WorkGiver_Scanner)).GetTypes()
.Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(WorkGiver_Scanner)) && myType != typeof(WorkGiver_Supervise) && myType != typeof(WorkGiver_Warden))
.SelectMany(type => type.GetMethods())
.Where(method => method.Name.Equals("HasJobOnThing"))
.Cast<MethodBase>();
}

static bool Postfix(bool __result, WorkGiver_Scanner __instance, Pawn pawn, Thing t, bool forced = false)
static bool Postfix(bool __result, WorkGiver_Scanner __instance, Pawn pawn, Thing t, bool forced = false)
{
if (__result && t != null)
{
WorkTypeDef workType = AdjustWorkType(__instance);
return workType == null ? __result : PrisonLaborUtility.CanWorkHere(t.Position, pawn, workType);
}
return __result;
}

private static WorkTypeDef AdjustWorkType(WorkGiver_Scanner instance)
{
if (instance.def == null)
{
if (instance is WorkGiver_Repair)
{
if (__result && t != null )
{
return PrisonLaborUtility.CanWorkHere(t.Position, pawn, __instance.def.workType);
}
return __result;
return WorkTypeDefOf.Construction;
}
DebugLogger.warn($"Work giver scanner without def: {instance.GetType().FullName}");
return null;
}
return instance.def.workType;
}
}
}
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.7" silent="true"/>
<patch version="1.4.6" silent="true"/>
<patch version="1.4.5" silent="true"/>
<patch version="1.4.4" silent="true"/>
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.7
- Fixes for Vultures from "Reinforced Mechanoid 2"
1.4.6
- Chinese translation update (https://github.com/shiuanyue)
- Mechanitor and Mechs should be assignable from bills menu
Expand Down

0 comments on commit bd2a1a5

Please sign in to comment.