CodeOptimist/rimworld-while-youre-up

Opportunity hauling: Look for closest valid stockpile to position instead of best

Closed this issue · 1 comments

Implementation:

  • copy Rimworld.StoreUtility.TryFindBestBetterStoreCellFor() and Rimworld.StoreUtility.TryFindBestBetterStoreCellForWorker
  • replace check (int)priority < (int)foundPriority with distance < foundDistance in TryFindBestBetterStoreCellFor
  • Replace TryFindBestBetterStoreCellForWorker to look for minimum of carrier.PositionHeld and destination
  • Optional: on the haulpath, every 2*cutoff radius cells add to the search radius in the replacement of TryFindBestBetterStoreCellForWorker.

TestBench:

  • Quickload colony
  • Make a low priority stockpile near job destination
  • Make a higher priority stockpile far away (beyond your cutoff radius)
  • Check for opportunity

Potential problems:

  • Search can become expensive when a lot of stockpiles are created.

(Copied from the discord. I'll give it a try as well once I've finished writing my AutoPatcher and ToolsFramework mods)

Integrated ony my own. Would be interesting to implement a central framework instead.