Code Monkey home page Code Monkey logo

rimworld-while-youre-up's People

Contributors

codeoptimist avatar marr75 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rimworld-while-youre-up's Issues

Oppotunity equip tool

This is from a feedback from SurvivalTools.

Current situation:
Pawns go directly to perform jobs. The current implementation in SurvivalTools is to occasionally optimize tool loadout. From the feedback on the mod, they would appreciate an opportunistic job of picking up the tools before performing the job as well.

If you need any changes to SurvivalTools and helper functions to make this functionality let me know.

Oct 24 3.2.1 Update

If possible, could you please update the repository to the current Steam version? If so, thanks!

Include CodeOptimist namespace

Seems you have a common set of "CodeOptimist" namespaced code that is required to compile this project (Transpiler, Helper, CodeInstructionComparer, etc.). It's trivial to go get that code from the assembly so I can compile locally/fork, but some structure and comments are lost and I end up with a local fork that will always have miscellaneous differences from the remote (because of the copy-pasted common classes).

Other options would be to factor it out into its own project and distribute the DLL or host the code in a repo.

This is the main reason I used the web interface to open that PR a few weeks ago - my local copy was messy from the classes I grabbed out of dnSpy.

Conflict with Misc. Robots++

Just added Jobs of opportunity and had the problem that a OmniBot from Misc. Robots++ tried to HaulToInventory and destroy the items while doing that.
I guess OmniBot's don't have an Inventory.

JobDriver threw exception in initAction for pawn OmniBot 1 driver=JobDriver_HaulToInventory (toilIndex=2) driver.job=(HaulToInventory (Job_967051) A=Thing_Steel130646 B=(82, 0, 175))
System.NullReferenceException: Object reference not set to an instance of an object
at PickUpAndHaul.JobDriver_HaulToInventory+<>c__DisplayClass1_0.b__2 () [0x00096] in :0
at Verse.AI.JobDriver.TryActuallyStartNextToil () [0x001df] in <0ee2c524c4be441e9b7f8bfcb20aca6f>:0
Verse.Log:DMD<DMD<Warning_Patch1>?1440368896::Warning_Patch1>(String, Boolean)
Verse.AI.JobUtility:DMD<DMD<TryStartErrorRecoverJob_Patch0>?1841142144::TryStartErrorRecoverJob_Patch0>(Pawn, String, Exception, JobDriver)
Verse.AI.JobDriver:TryActuallyStartNextToil()
Verse.AI.JobDriver:ReadyForNextToil()
Verse.AI.JobDriver:Notify_PatherArrived()
Verse.AI.Pawn_PathFollower:PatherArrived()
Verse.AI.Pawn_PathFollower:DMD<DMD<TryEnterNextPathCell_Patch0>?-697242368::TryEnterNextPathCell_Patch0>(Pawn_PathFollower)
Verse.AI.Pawn_PathFollower:PatherTick()
Verse.Pawn:DMD<DMD<Tick_Patch1>?511785472::Tick_Patch1>(Pawn)
AIRobot.X2_AIRobot:Tick()
Verse.TickList:Tick()
Verse.TickManager:DoSingleTick()
Verse.TickManager:TickManagerUpdate()
Verse.Game:UpdatePlay()
Verse.Root_Play:DMD<DMD<Update_Patch1>?1510671104::Update_Patch1>(Root_Play)

HugsLib+Jobs of opportunity error

So, I have been getting a ton of error messages and I think the cause may be jobs of opportunity...this is the error I found when loading my mod list:

[HugsLib][warn] Missing enum setting labels for enum JobsOfOpportunity.JobsOfOpportunity+Hauling+HaulProximities
Verse.Log:Verse.Log.Warning_Patch1(String, Boolean)
HugsLib.Utils.ModLogger:Warning(String, Object[])
HugsLib.Settings.ModSettingsPack:GetHandle(String, String, String, HaulProximities, ValueIsValid, String)
JobsOfOpportunity.JobsOfOpportunity:g__GetSettingHandle|24_0(String, HaulProximities, ValueIsValid, ShouldDisplay, String)
JobsOfOpportunity.JobsOfOpportunity:DefsLoaded()
HugsLib.HugsLibController:OnDefsLoaded()
HugsLib.HugsLibController:LoadReloadInitialize()
Verse.LongEventHandler:RunEventFromAnotherThread(Action)
Verse.<>c:b__27_0()
System.Threading.ThreadHelper:ThreadStart_Context(Object)
System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object)
System.Threading.ThreadHelper:ThreadStart()

Feature request: opportunistic cleaning

Cleaning is a very quick task in RimWorld and the game really shows its rear-end when pawns are walking halfway across the map from mining to clean one spot at the home base, then going back to mine again, rinse and repeat, then getting a breakdown because they spent too much walking outside in a loop while it was hot/raining... Sure that's the worst-case-scenario but it can and does happen!

Opportunistic cleaning would simply be: when a pawn starts and/or stops a task, it looks nearby (perhaps anywhere on the same room?) for cleaning spots and if it finds any, does those immediately as priority work. Minimal impact on their actual jobs but huge benefit for dedicated cleaners who now don't need to come all the way down to clean that room because it's taken care of already.

Players who don't like that approach could have multiple ways of avoiding it:

  1. Turn Opportunistic Cleaning off (should be straightforward to provide a setting for this, I'd imagine)
  2. Disable "cleaning" for pawns they don't want to be cleaning opportunistically so they only focus on their actual jobs. This permits players to further configure the behavior on a unit-by-unit basis as pawns that aren't assigned to cleaning (Work tab) should never do opportunistic cleaning. Simple, flexible and intuitive solution, hopefully, for the best of both worlds!

Love your mod, thank you for taking up the work Tynan left (very) half-done before deciding to move on to DLC to get more money rather than improving the base game... I hope this feature request is relevant and in the spirit of your mod!

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

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)

Error from PUAH+

Error copy
Exception in Verse.MapComponentUtility.MapComponentTick: System.NullReferenceException: Object reference not set to an instance of an object
at Verse.AI.JobQueue.Clear (Verse.Pawn pawn, System.Boolean canReturnToPool) [0x0001d] in <1782cb69665b4d3abcdadb97df9ae541>:0
at Verse.AI.Pawn_JobTracker.ClearQueuedJobs (System.Boolean canReturnToPool) [0x00016] in <1782cb69665b4d3abcdadb97df9ae541>:0
- postfix CodeOptimist.WhileYoureUp: Void JobsOfOpportunity.Mod+Pawn_JobTracker__ClearQueuedJobs_Patch:ClearSpecialHaul(Pawn ___pawn)
at Verse.AI.Pawn_JobTracker.StopAll (System.Boolean ifLayingKeepLaying, System.Boolean canReturnToPool) [0x00023] in <1782cb69665b4d3abcdadb97df9ae541>:0
at RocketMan.WarmUpMapComponent.PopPawnsPosition () [0x000b4] in <7a8ab9cb2c09473dbae0cb7e27def2bf>:0
at RocketMan.WarmUpMapComponent.MapComponentTick () [0x00026] in <7a8ab9cb2c09473dbae0cb7e27def2bf>:0
at Verse.MapComponentUtility.MapComponentTick (Verse.Map map) [0x00016] in <1782cb69665b4d3abcdadb97df9ae541>:0
- transpiler net.pardeike.rimworld.lib.harmony: IEnumerable1 VisualExceptions.ExceptionsAndActivatorHandler:Transpiler(IEnumerable1 instructions, MethodBase original)

Log
https://gist.github.com/3e85ffb3cabdd13e8aa53d6f3de20802

Mod list
https://rentry.co/977g5

Savegame
https://easyupload.io/lxh5h1

Case where opportune hauling should not occur

I had a pawn far in the field (next to stone chunks), he wanted to do stonecutting but instead of taking the chunk directly next to him, he chose to opportune haul an random item to a stockpile near the workstation, then run all the way back to where he started to begin the stone-cutting task. Any chance that this can be improved?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.