Skip to content

Commit

Permalink
AllowTool stuff, compiled dll in release
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehni committed Oct 26, 2018
1 parent 4ffadbb commit 2cfb7aa
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
Binary file modified Assemblies/PickUpAndHaul.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion Source/PickUpAndHaul/ExtendedStorage_Support.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static bool CapacityAtEx(ThingDef def, IntVec3 storeCell, Map map, out in
if (thing.Position == storeCell) continue;

ExtendedStorage.Building_ExtendedStorage storage = thing as ExtendedStorage.Building_ExtendedStorage;

if(storage.StoredThingTotal == 0)
capacity = (int)(def.stackLimit * storage.GetStatValue(ExtendedStorage.DefReferences.Stat_ES_StorageFactor));
else
Expand Down
2 changes: 1 addition & 1 deletion Source/PickUpAndHaul/HarmonyPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static HarmonyPatches()
//}
//catch (TypeLoadException) { }

Verse.Log.Message("PickUpAndHaul v0.1.0.4 welcomes you to RimWorld with pointless logspam.");
Verse.Log.Message("PickUpAndHaul v0.1.0.5 welcomes you to RimWorld with pointless logspam.");
harmony.PatchAll();
}

Expand Down
4 changes: 2 additions & 2 deletions Source/PickUpAndHaul/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.4")]
[assembly: AssemblyFileVersion("0.1.0.692")]
[assembly: AssemblyVersion("0.1.0.5")]
[assembly: AssemblyFileVersion("0.1.0.714")]
15 changes: 11 additions & 4 deletions Source/PickUpAndHaul/WorkGiver_HaulToInventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,17 @@ public override bool HasJobOnThing(Pawn pawn, Thing thing, bool forced)
public override Job JobOnThing(Pawn pawn, Thing thing, bool forced = false)
{
//bulky gear (power armor + minigun) so don't bother.
if (MassUtility.GearMass(pawn) / MassUtility.Capacity(pawn) >= 0.8f) return null;

if (!GoodThingToHaul(thing, pawn) || !HaulAIUtility.PawnCanAutomaticallyHaulFast(pawn, thing, forced)) return null;
if (MassUtility.GearMass(pawn) / MassUtility.Capacity(pawn) >= 0.8f)
return null;

DesignationDef HaulUrgentlyDesignation = DefDatabase<DesignationDef>.GetNamed("HaulUrgentlyDesignation", false);

//This WorkGiver gets hijacked by AllowTool and expects us to urgently haul corpses.
if (ModCompatibilityCheck.AllowToolIsActive && thing is Corpse && pawn.Map.designationManager.DesignationOn(thing)?.def == HaulUrgentlyDesignation && HaulAIUtility.PawnCanAutomaticallyHaulFast(pawn, thing, forced))
return HaulAIUtility.HaulToStorageJob(pawn, thing);

if (!GoodThingToHaul(thing, pawn) || !HaulAIUtility.PawnCanAutomaticallyHaulFast(pawn, thing, forced))
return null;

StoragePriority currentPriority = StoreUtility.CurrentStoragePriorityOf(thing);
if (StoreUtility.TryFindBestBetterStoreCellFor(thing, pawn, pawn.Map, currentPriority, pawn.Faction, out IntVec3 storeCell, true))
Expand Down Expand Up @@ -90,7 +98,6 @@ public override Job JobOnThing(Pawn pawn, Thing thing, bool forced = false)
Log.Message($"{pawn} job found to haul: {thing} to {storeCell}:{capacityStoreCell}, looking for more now");

//Find extra things than can be hauled to inventory, queue to reserve them
DesignationDef HaulUrgentlyDesignation = DefDatabase<DesignationDef>.GetNamed("HaulUrgentlyDesignation", false);
bool isUrgent = false;
if (ModCompatibilityCheck.AllowToolIsActive &&
pawn.Map.designationManager.DesignationOn(thing)?.def == HaulUrgentlyDesignation)
Expand Down

0 comments on commit 2cfb7aa

Please sign in to comment.