OrionFive / Hospitality

Orion's "Hospitality" and more
https://www.patreon.com/orionmods
GNU General Public License v3.0
91 stars 52 forks source link

Hospitality: Deep Storage causes endless browsing #574

Closed OrionFive closed 3 years ago

OrionFive commented 3 years ago

Guests keep looking but won't buy.

christophkogler commented 3 years ago

Not sure what this means - are they infinitely stuck browsing wares? Or is browsing wares supposed to always or mostly cause them to buy? I have LWM's Deep Storage and haven't noticed anything that seems to be problematic, like infinite browsing.

JobGiver_BrowseItem doesn't seem to enforce purchasing itself, it just goes to something and runs GetJoyFromCellIfPosible. I don't really understand how Rimworlds code works, but is that meant to then activate JoyGiver_BuyStuff? It doesn't check if they can afford to buy a thing, just that something is buyable in general, before assigning a browse job (line 54-66), so if they can't purchase could they kind of get stuck in a loop until the browse gets interrupted by another job or different joy source?

I do sometimes see them sit there and browse for quite a while, but normally when a colonist comes to charm them they move on again, and I have a lot of recreation sources that seem to draw them away. They seem to stop browsing to go do other things fairly quickly.

OrionFive commented 3 years ago

@SomeoneCrazy, how it works is that when they decide to go shopping, they pick five random items on sale. They order them by how much they would buy them. If there is one they can afford and they like more than a specific threshold, they go and "check it out", which results in a purchase if nothing changes. If none of the items satisfies, they just go browse there. When the job ends after a short time, any other job can happen, including the same one again.

The job system is pretty complex and it took me a long time to wrap my head around it.

OrionFive commented 3 years ago

But yeah, maybe something causes the browse job to never end, or nothing causes it to ever end (and it's buggy and has to be interrupted to work).

christophkogler commented 3 years ago

The browsing job doesn't end, it checks for job overrides every 100 ticks. default complete mode is set to never. could try delay instead with a hundred ticks, to ensure they at least have started a new browse job?

I wish I knew how to work with Rimworld mods better. Trying to build a change to test, instead of just throwing ideas that may be useless, but I keep getting an error and breaking the game just trying to build from the repository code. I'm not doing it right. Will figure it out eventually, though.

(Specifically, [HugsLib][ERR] Hospitality caused an exception during OnDefsLoaded: System.FieldAccessException: Field RimWorld.MainButtonDef:icon' is inaccessible from methodHospitality.HospitalityModBase:UpdateMainButtonIcon ()', if you have run into this before.)

OrionFive commented 3 years ago

Well if you wanna help, I can step you through it some time.I sure as hell could use some help.I'd have to check what ends the job. There's probably some end condition somewhere.

OrionFive commented 3 years ago

I wish I knew how to work with Rimworld mods better. Trying to build a change to test, instead of just throwing ideas that may be useless, but I keep getting an error and breaking the game just trying to build from the repository code. I'm not doing it right. Will figure it out eventually, though.

(Specifically, [HugsLib][ERR] Hospitality caused an exception during OnDefsLoaded: System.FieldAccessException: Field RimWorld.MainButtonDef:icon' is inaccessible from methodHospitality.HospitalityModBase:UpdateMainButtonIcon ()', if you have run into this before.)

I found what probably tripped up your building. You'll have to build as release, not debug.

OrionFive commented 3 years ago

I've added a minimum and maximum duration for browsing. Let's see if that solves the issue.

OrionFive commented 3 years ago

I've tried it. It does not solve endless browsing, since they just start a new browsing job when the previous one ends.

OrionFive commented 3 years ago

From what I can tell, endless browsing is caused by guests wanting something like what they're looking at, but not that thing. For example, if they're looking to stock up on food, beer technically is consumable and has nutrition and qualifies, but doesn't satisfy their expectations for eating. And browsing doesn't take into account that they've looked at something recently (in case circumstances change, like they suddenly get hungry). So if they're hungry, and all you have is beer, they'll be "stuck" browsing.

OrionFive commented 3 years ago

Okay, I've now created a cache of the last 5 locations that have been browsed. If they don't satisfy, they won't be browsed by the same pawn again.