Skip to content

Commit f8ecf63

Browse files
committed
Update to 1.6
1 parent 9bf3e3d commit f8ecf63

10 files changed

Lines changed: 49 additions & 28 deletions
4 KB
Binary file not shown.

1.6/Assemblies/PickUpAndHaul.dll

59 KB
Binary file not shown.

About/About.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<li>1.3</li>
1010
<li>1.4</li>
1111
<li>1.5</li>
12+
<li>1.6</li>
1213
</supportedVersions>
1314
<packageId>Mehni.PickUpAndHaul</packageId>
1415
<modDependenciesByVersion>
@@ -52,6 +53,14 @@
5253
<downloadUrl>https://github.com/pardeike/HarmonyRimWorld/releases/latest</downloadUrl>
5354
</li>
5455
</v1.5>
56+
<v1.6>
57+
<li>
58+
<packageId>brrainz.harmony</packageId>
59+
<displayName>Harmony</displayName>
60+
<steamWorkshopUrl>steam://url/CommunityFilePage/2009463077</steamWorkshopUrl>
61+
<downloadUrl>https://github.com/pardeike/HarmonyRimWorld/releases/latest</downloadUrl>
62+
</li>
63+
</v1.6>
5564
</modDependenciesByVersion>
5665
<loadAfter>
5766
<li>brrainz.harmony</li>

Source/IHoldMultipleThings/IHoldMultipleThings.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
<Optimize>true</Optimize>
1010
<DebugType>none</DebugType>
1111
<ErrorReport>prompt</ErrorReport>
12-
<OutputPath>..\..\1.5\Assemblies\</OutputPath>
12+
<OutputPath>..\..\1.6\Assemblies\</OutputPath>
1313
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
1414
<PublicizeAsReferenceAssemblies>false</PublicizeAsReferenceAssemblies>
1515
<WarningLevel>5</WarningLevel>
1616
</PropertyGroup>
1717
<ItemGroup>
18-
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4062" />
18+
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.6.4518" />
1919
</ItemGroup>
2020
</Project>

Source/PickUpAndHaul/HarmonyPatches.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public static bool SkipCorpses_Prefix(WorkGiver_Haul __instance, ref bool __resu
136136
public static IEnumerable<CodeInstruction> JobGiver_Haul_TryGiveJob_Transpiler(IEnumerable<CodeInstruction> instructions)
137137
=> instructions.MethodReplacer(HaulAIUtility.HaulToStorageJob, HaulToStorageJobByRace);
138138

139-
public static Job HaulToStorageJobByRace(Pawn p, Thing t) => Settings.IsAllowedRace(p.RaceProps) ? HaulToInventoryJob(p, t, false) : HaulAIUtility.HaulToStorageJob(p, t);
139+
public static Job HaulToStorageJobByRace(Pawn p, Thing t, bool forced) => Settings.IsAllowedRace(p.RaceProps) ? HaulToInventoryJob(p, t, forced) : HaulAIUtility.HaulToStorageJob(p, t, forced);
140140
private static Func<Pawn, Thing, bool, Job> HaulToInventoryJob => _haulToInventoryJob ??= new(((WorkGiver_Scanner)DefDatabase<WorkGiverDef>.GetNamed("HaulToInventory").Worker).JobOnThing);
141141
private static Func<Pawn, Thing, bool, Job> _haulToInventoryJob;
142142

Source/PickUpAndHaul/JobDriver_HaulToInventory.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public override IEnumerable<Toil> MakeNewToils()
6565
//This will technically release the reservations in the queue, but what can you do
6666
if (thing.Spawned)
6767
{
68-
var haul = HaulAIUtility.HaulToStorageJob(actor, thing);
68+
var haul = HaulAIUtility.HaulToStorageJob(actor, thing, actor.CurJob.playerForced);
6969
if (haul?.TryMakePreToilReservations(actor, false) ?? false)
7070
{
7171
actor.jobs.jobQueue.EnqueueFirst(haul, JobTag.Misc);
@@ -154,7 +154,7 @@ public Toil CheckForOverencumberedForCombatExtended()
154154

155155
if (!(MassUtility.EncumbrancePercent(actor) <= 0.9f && !ceOverweight))
156156
{
157-
var haul = HaulAIUtility.HaulToStorageJob(actor, nextThing);
157+
var haul = HaulAIUtility.HaulToStorageJob(actor, nextThing, curJob.playerForced);
158158
if (haul?.TryMakePreToilReservations(actor, false) ?? false)
159159
{
160160
//note that HaulToStorageJob etc doesn't do opportunistic duplicate hauling for items in valid storage. REEEE
@@ -166,4 +166,4 @@ public Toil CheckForOverencumberedForCombatExtended()
166166

167167
return toil;
168168
}
169-
}
169+
}

Source/PickUpAndHaul/JobDriver_UnloadYourHauledInventory.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ private Toil ReleaseReservation()
6464
{
6565
initAction = () =>
6666
{
67-
if (pawn.Map.reservationManager.ReservedBy(job.targetB, pawn, pawn.CurJob)
68-
&& !ModCompatibilityCheck.HCSKIsActive)
67+
if (pawn.Map.reservationManager.ReservedBy(job.targetB, pawn, pawn.CurJob))
6968
{
7069
pawn.Map.reservationManager.Release(job.targetB, pawn, pawn.CurJob);
7170
}
@@ -131,7 +130,7 @@ private Toil FindTargetOrDrop(HashSet<Thing> carriedThings)
131130

132131
var currentPriority = StoragePriority.Unstored; // Currently in pawns inventory, so it's unstored
133132
if (StoreUtility.TryFindBestBetterStorageFor(unloadableThing.Thing, pawn, pawn.Map, currentPriority,
134-
pawn.Faction, out var cell, out var destination))
133+
pawn.Faction, out var cell, out var destination))
135134
{
136135
job.SetTarget(TargetIndex.A, unloadableThing.Thing);
137136
if (cell == IntVec3.Invalid)

Source/PickUpAndHaul/ModCompatibilityCheck.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ public static class ModCompatibilityCheck
77

88
public static bool AllowToolIsActive { get; } = ModsConfig.ActiveModsInLoadOrder.Any(m => m.Name == "Allow Tool");
99

10-
public static bool ExtendedStorageIsActive { get; } = ModsConfig.ActiveModsInLoadOrder.Any(m => m.Name == "ExtendedStorageFluffyHarmonised")
10+
public static bool ExtendedStorageIsActive
11+
{
12+
get;
13+
} = ModsConfig.ActiveModsInLoadOrder.Any(m => m.Name == "ExtendedStorageFluffyHarmonised")
1114
|| ModsConfig.ActiveModsInLoadOrder.Any(m => m.Name == "Extended Storage")
1215
|| ModsConfig.ActiveModsInLoadOrder.Any(m => m.Name == "Core SK");
13-
14-
public static bool HCSKIsActive { get; } = ModsConfig.ActiveModsInLoadOrder.Any(m => m.Name == "Core SK");
15-
}
16+
}

Source/PickUpAndHaul/PickUpAndHaul.csproj

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,37 @@
99
<Optimize>true</Optimize>
1010
<DebugType>none</DebugType>
1111
<ErrorReport>prompt</ErrorReport>
12-
<OutputPath>..\..\1.5\Assemblies\</OutputPath>
12+
<OutputPath>..\..\1.6\Assemblies\</OutputPath>
1313
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
1414
<PublicizeAsReferenceAssemblies>false</PublicizeAsReferenceAssemblies>
1515
<WarningLevel>5</WarningLevel>
1616
</PropertyGroup>
1717
<ItemGroup>
18-
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4063" />
19-
<PackageReference Include="Lib.Harmony" Version="2.3.3" ExcludeAssets="runtime" />
20-
<PackageReference Include="Krafs.Publicizer" Version="2.0.1">
18+
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.6.4518" />
19+
<PackageReference Include="Lib.Harmony" Version="2.3.6" ExcludeAssets="runtime" />
20+
<PackageReference Include="Krafs.Publicizer" Version="2.3.0">
2121
<PrivateAssets>all</PrivateAssets>
2222
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2323
</PackageReference>
2424
<Publicize Include="Assembly-CSharp" />
25-
<!--<Reference Include="CombatExtended">
26-
<HintPath>..\..\..\1631756268\Assemblies\CombatExtended.dll</HintPath>
27-
<Private>False</Private>
28-
</Reference>-->
2925
<Reference Include="IHoldMultipleThings">
30-
<HintPath>..\..\1.5\Assemblies\IHoldMultipleThings.dll</HintPath>
26+
<HintPath>..\..\1.6\Assemblies\IHoldMultipleThings.dll</HintPath>
27+
</Reference>
28+
<!--Reference Include="Assembly-CSharp">
29+
<HintPath>..\..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
30+
<Private>False</Private>
31+
</Reference>
32+
<Reference Include="UnityEngine.CoreModule">
33+
<HintPath>..\..\..\..\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
34+
<Private>False</Private>
35+
</Reference>
36+
<Reference Include="UnityEngine.IMGUIModule">
37+
<HintPath>..\..\..\..\RimWorldWin64_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
38+
<Private>False</Private>
3139
</Reference>
40+
<Reference Include="UnityEngine.TextRenderingModule">
41+
<HintPath>..\..\..\..\RimWorldWin64_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
42+
<Private>False</Private>
43+
</Reference-->
3244
</ItemGroup>
3345
</Project>

Source/PickUpAndHaul/WorkGiver_HaulToInventory.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static bool OkThingToHaul(Thing t, Pawn pawn)
3030

3131
public override IEnumerable<Thing> PotentialWorkThingsGlobal(Pawn pawn)
3232
{
33-
var list = pawn.Map.listerHaulables.ThingsPotentiallyNeedingHauling();
33+
var list = pawn.Map.listerHaulables.ThingsPotentiallyNeedingHauling().ToList();
3434
Comparer.rootCell = pawn.Position;
3535
list.Sort(Comparer);
3636
return list;
@@ -68,7 +68,7 @@ public override Job JobOnThing(Pawn pawn, Thing thing, bool forced = false)
6868
|| !IsNotCorpseOrAllowed(thing) //This WorkGiver gets hijacked by AllowTool and expects us to urgently haul corpses.
6969
|| MassUtility.WillBeOverEncumberedAfterPickingUp(pawn, thing, 1)) //https://github.com/Mehni/PickUpAndHaul/pull/18
7070
{
71-
return HaulAIUtility.HaulToStorageJob(pawn, thing);
71+
return HaulAIUtility.HaulToStorageJob(pawn, thing, forced);
7272
}
7373

7474
var map = pawn.Map;
@@ -84,7 +84,7 @@ public override Job JobOnThing(Pawn pawn, Thing thing, bool forced = false)
8484
//Don't multi-haul food to hoppers.
8585
if (HaulToHopperJob(thing, targetCell, map))
8686
{
87-
return HaulAIUtility.HaulToStorageJob(pawn, thing);
87+
return HaulAIUtility.HaulToStorageJob(pawn, thing, forced);
8888
}
8989
else
9090
{
@@ -114,7 +114,7 @@ var capacityStoreCell
114114

115115
if (capacityStoreCell == 0)
116116
{
117-
return HaulAIUtility.HaulToStorageJob(pawn, thing);
117+
return HaulAIUtility.HaulToStorageJob(pawn, thing, forced);
118118
}
119119

120120
var job = JobMaker.MakeJob(PickUpAndHaulJobDefOf.HaulToInventory, null, storeTarget); //Things will be in queues
@@ -190,7 +190,7 @@ bool Validator(Thing t)
190190
}
191191
while ((nextThing = GetClosestAndRemove(lastThing.Position, map, haulables, PathEndMode.ClosestTouch,
192192
TraverseParms.For(pawn), distanceToSearchMore, Validator)) != null);
193-
193+
194194
if (nextThing == null)
195195
{
196196
skipCells = null;
@@ -651,4 +651,4 @@ public static bool TryFindBestBetterNonSlotGroupStorageFor(Thing t, Pawn carrier
651651
public static class PickUpAndHaulDesignationDefOf
652652
{
653653
public static DesignationDef haulUrgently = DefDatabase<DesignationDef>.GetNamedSilentFail("HaulUrgentlyDesignation");
654-
}
654+
}

0 commit comments

Comments
 (0)