diff --git a/About/About.xml b/About/About.xml
index 2361cba..c61240e 100644
--- a/About/About.xml
+++ b/About/About.xml
@@ -7,6 +7,7 @@
1.1
1.2
1.3
+ 1.4
Heremeus.MedicalDissection
Medical Dissection adds a dissection table to the game, allowing your doctors to train on human corpses. You can add the mod to an existing save.
@@ -20,7 +21,7 @@ Feature overview
- A corpse can only be dissected once (A "Allow dissected" and "Allow not dissected" filter can help you to set up your storages and butcher bills efficiently)
- Custom thoughts and tales
-v2.6
+v2.8
diff --git a/About/Manifest.xml b/About/Manifest.xml
index 91f704c..54f9045 100644
--- a/About/Manifest.xml
+++ b/About/Manifest.xml
@@ -1,7 +1,7 @@
MedicalDissection
- 2.6
+ 2.8
HugsLib
Harmony
diff --git a/About/Version.xml b/About/Version.xml
index 4745ebb..99f2dd2 100644
--- a/About/Version.xml
+++ b/About/Version.xml
@@ -7,7 +7,7 @@
- 9.0.0
+ 10.0.0
UnlimitedHugs/RimworldHugsLibChecker
\ No newline at end of file
diff --git a/Common/Defs/WorkTypeDefs/WorkTypes.xml b/Common/Defs/WorkTypeDefs/WorkTypes.xml
index 84b73e5..33cece4 100644
--- a/Common/Defs/WorkTypeDefs/WorkTypes.xml
+++ b/Common/Defs/WorkTypeDefs/WorkTypes.xml
@@ -8,7 +8,6 @@
Train Medicine by dissecting corpses.\n(Medical Dissection mod)
dissect
478
- true
Medicine
diff --git a/LoadFolders.xml b/LoadFolders.xml
index 62f299d..3dee349 100644
--- a/LoadFolders.xml
+++ b/LoadFolders.xml
@@ -14,4 +14,9 @@
Common
v1.3
+
+ /
+ Common
+ v1.4
+
\ No newline at end of file
diff --git a/Source/HMDissection/Dissection.cs b/Source/HMDissection/Dissection.cs
index 903b74f..47203b4 100644
--- a/Source/HMDissection/Dissection.cs
+++ b/Source/HMDissection/Dissection.cs
@@ -34,15 +34,15 @@ public Dissection() : base()
Singleton = this;
}
- public override void StaticInitialize()
- {
- base.StaticInitialize();
- HarmonyPatches.Patch();
+ public override void Initialize()
+ {
+ base.Initialize();
+ HarmonyPatches.Patch();
}
public override void DefsLoaded()
{
- Log.Message("Medical Dissection v2.5 loaded");
+ Log.Message("Medical Dissection v2.8 loaded");
expHandle = Settings.GetHandle("expPerCorpse", "Dissection_ExpSetting_title".Translate(), "Dissection_ExpSetting_desc".Translate(), 3000, Validators.IntRangeValidator(0, 1000000));
expHandle.SpinnerIncrement = 100;
ignoreDailyLimitHandle = Settings.GetHandle("ignoreDailyLimit", "Dissection_DailyLimitSetting_title".Translate(), "Dissection_DailyLimitSetting_desc".Translate(), false);
diff --git a/Source/HMDissection/DissectionDefOf.cs b/Source/HMDissection/DissectionDefOf.cs
index d1bcd28..0a4e6cf 100644
--- a/Source/HMDissection/DissectionDefOf.cs
+++ b/Source/HMDissection/DissectionDefOf.cs
@@ -22,5 +22,6 @@ public static class DissectionDefOf
public static HediffDef DissectedHediff;
public static BodyPartDef Lung;
public static JobDef DoDissectionBill;
+ public static WorkTypeDef MedicalTraining;
}
}
diff --git a/Source/HMDissection/HMDissection.csproj b/Source/HMDissection/HMDissection.csproj
index 3f72bd2..9c848a8 100644
--- a/Source/HMDissection/HMDissection.csproj
+++ b/Source/HMDissection/HMDissection.csproj
@@ -1,83 +1,84 @@
-
-
-
-
- Debug
- AnyCPU
- {5E782404-F6C3-41C0-9B55-B10DB1145145}
- Library
- Properties
- HMDissection
- HMDissection
- v4.7.2
- 512
-
-
-
- false
- none
- false
- ..\..\v1.3\Assemblies\
- DEBUG;TRACE
- prompt
- 4
- false
-
-
- none
- true
- ..\..\v1.3\Assemblies\
- TRACE
- prompt
- 4
- false
-
-
-
- packages\Lib.Harmony.2.1.0\lib\net472\0Harmony.dll
- False
-
-
- ..\..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll
- False
-
-
- packages\UnlimitedHugs.Rimworld.HugsLib.9.0.0\lib\net472\HugsLib.dll
- False
-
-
-
-
-
-
-
-
-
- ..\..\..\..\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll
- False
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ Debug
+ AnyCPU
+ {5E782404-F6C3-41C0-9B55-B10DB1145145}
+ Library
+ Properties
+ HMDissection
+ HMDissection
+ v4.7.2
+ 512
+
+
+
+ false
+ none
+ false
+ ..\..\v1.4\Assemblies\
+ DEBUG;TRACE
+ prompt
+ 4
+ false
+
+
+ none
+ true
+ ..\..\v1.4\Assemblies\
+ TRACE
+ prompt
+ 4
+ false
+
+
+
+ ..\References\0Harmony.dll
+ False
+
+
+ ..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\Assembly-CSharp.dll
+ False
+
+
+ ..\References\HugsLib.dll
+ False
+
+
+
+
+
+
+
+
+
+ ..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -->
\ No newline at end of file
diff --git a/Source/HMDissection/HarmonyPatches.cs b/Source/HMDissection/HarmonyPatches.cs
index 9a3ec65..1c99940 100644
--- a/Source/HMDissection/HarmonyPatches.cs
+++ b/Source/HMDissection/HarmonyPatches.cs
@@ -33,6 +33,16 @@ public static void Patch()
HarmonyMethod prefixmethod = new HarmonyMethod(typeof(HarmonyPatches).GetMethod("Notify_Resurrected_Prefix"));
harmony.Patch(targetMethod, prefixmethod);
+ // Set dissection work type priority based on medicine passion for starting pawns
+ targetMethod = AccessTools.Method(typeof(GameInitData), "PrepForMapGen");
+ postfixmethod = new HarmonyMethod(typeof(WorkSettingsPatches).GetMethod("PrepForMapGen_Postfix"));
+ harmony.Patch(targetMethod, null, postfixmethod);
+
+ // Set dissection work type priority based on medicine passion for new pawns
+ targetMethod = AccessTools.Method(typeof(Pawn_WorkSettings), "EnableAndInitialize");
+ postfixmethod = new HarmonyMethod(typeof(WorkSettingsPatches).GetMethod("EnableAndInitialize_Postfix"));
+ harmony.Patch(targetMethod, null, postfixmethod);
+
// Patch HasJobOnThing for Harvest Organs Post Morten to stop duplicate work givers
if (ModsConfig.ActiveModsInLoadOrder.Any(m => m.Name.Contains("Harvest Organs Post Mortem")))
{
diff --git a/Source/HMDissection/JobDriver_DoDissectionBill.cs b/Source/HMDissection/JobDriver_DoDissectionBill.cs
index 2e9da6d..67f3264 100644
--- a/Source/HMDissection/JobDriver_DoDissectionBill.cs
+++ b/Source/HMDissection/JobDriver_DoDissectionBill.cs
@@ -49,7 +49,7 @@ protected override IEnumerable MakeNewToils()
yield return gotoBillGiver;
// Strip body
- Toil doDissectionRecipeWork = Toils_Dissection.DoDissectionRecipeWork().FailOnDespawnedNullOrForbiddenPlacedThings().FailOnCannotTouch(TargetIndex.A, PathEndMode.InteractionCell);
+ Toil doDissectionRecipeWork = Toils_Dissection.DoDissectionRecipeWork().FailOnDespawnedNullOrForbiddenPlacedThings(TargetIndex.A).FailOnCannotTouch(TargetIndex.A, PathEndMode.InteractionCell);
yield return Toils_Jump.JumpIf(doDissectionRecipeWork, () =>
{
LocalTargetInfo targetInfo = job.GetTarget(TargetIndex.B);
diff --git a/Source/HMDissection/Toils_Dissection.cs b/Source/HMDissection/Toils_Dissection.cs
index e276935..cefe6ce 100644
--- a/Source/HMDissection/Toils_Dissection.cs
+++ b/Source/HMDissection/Toils_Dissection.cs
@@ -136,7 +136,7 @@ public static Toil FinishRecipeAndStartStoringCorpse(TargetIndex corpseIndex)
}
else
{
- Log.ErrorOnce("Unknown store mode", 9158246, false);
+ Log.ErrorOnce("Unknown store mode", 9158246);
}
if (bestStoreCell.IsValid)
@@ -167,7 +167,7 @@ public static Toil PlaceHauledThingInCell(TargetIndex cellInd, Toil nextToilOnPl
IntVec3 cell = curJob.GetTarget(cellInd).Cell;
if (actor.carryTracker.CarriedThing == null)
{
- Log.Error(actor + " tried to place hauled thing in cell but is not hauling anything.", false);
+ Log.Error(actor + " tried to place hauled thing in cell but is not hauling anything.");
return;
}
SlotGroup slotGroup = actor.Map.haulDestinationManager.SlotGroupAt(cell);
@@ -231,7 +231,7 @@ public static Toil PlaceHauledThingInCell(TargetIndex cellInd, Toil nextToilOnPl
" near ",
actor.Position,
". Destroying. This should never happen!"
- }), false);
+ }));
actor.carryTracker.CarriedThing.Destroy(DestroyMode.Vanish);
}
}
@@ -322,7 +322,7 @@ public static Toil JumpToCollectNextIntoHandsForBill(Toil gotoGetTargetToil, Tar
Pawn actor = toil.actor;
if (actor.carryTracker.CarriedThing == null)
{
- Log.Error("JumpToAlsoCollectTargetInQueue run on " + actor + " who is not carrying something.", false);
+ Log.Error("JumpToAlsoCollectTargetInQueue run on " + actor + " who is not carrying something.");
return;
}
if (actor.carryTracker.Full)
diff --git a/Source/HMDissection/WorkSettingsPatches.cs b/Source/HMDissection/WorkSettingsPatches.cs
new file mode 100644
index 0000000..cdc1342
--- /dev/null
+++ b/Source/HMDissection/WorkSettingsPatches.cs
@@ -0,0 +1,40 @@
+using RimWorld;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Verse;
+
+namespace HMDissection
+{
+ public static class WorkSettingsPatches
+ {
+
+ public static void EnableAndInitialize_Postfix(Pawn ___pawn)
+ {
+ SetDissectionPriorityForPassionatedPawns(___pawn);
+ }
+
+ public static void PrepForMapGen_Postfix(List ___startingAndOptionalPawns)
+ {
+ // Set priority for medical training if the pawn has a passion for medicine
+ // This way the pawn will practice medicine by default, even if it has 0 medicine skill
+ foreach (Pawn pawn in ___startingAndOptionalPawns)
+ {
+ SetDissectionPriorityForPassionatedPawns(pawn);
+ }
+ }
+
+ private static void SetDissectionPriorityForPassionatedPawns(Pawn pawn)
+ {
+ // Set priority for medical training if the pawn has a passion for medicine
+ // This way the pawn will practice medicine by default, even if it has 0 medicine skill
+ Passion? passion = pawn?.skills?.GetSkill(SkillDefOf.Medicine)?.passion;
+ if (passion.HasValue && passion.Value != Passion.None)
+ {
+ pawn.workSettings?.SetPriority(DissectionDefOf.MedicalTraining, 3);
+ }
+ }
+ }
+}
diff --git a/Source/References/0Harmony.dll b/Source/References/0Harmony.dll
new file mode 100644
index 0000000..86fc5eb
Binary files /dev/null and b/Source/References/0Harmony.dll differ
diff --git a/Source/References/HugsLib.dll b/Source/References/HugsLib.dll
new file mode 100644
index 0000000..7abbf13
Binary files /dev/null and b/Source/References/HugsLib.dll differ
diff --git a/v1.4/Assemblies/HMDissection.dll b/v1.4/Assemblies/HMDissection.dll
new file mode 100644
index 0000000..37168f2
Binary files /dev/null and b/v1.4/Assemblies/HMDissection.dll differ