Is it possible to limit interactions to pawns with certain relationships?

Started by yamgo, June 30, 2020, 05:21:24 AM

Previous topic - Next topic

yamgo

I'd like to add some new interactions to the game, which could easily be done with the <InteractionDef>, but based on existing mods and the Core interactions_social.xml, I can't find a method to limit interactions to pawns with specific relationships (e.g. lovers, family, etc.).
Does someone know a way to achieve this? Thank you.

LWM

I know Rational Romance adds dates, and those only happen between lovers/etc.

I know "Animals are fun" added taking your animals for walks, and I think it only works for bonded animals?

So I would look at those two mods, see how they did it.

LWM


yamgo

Still looking for help on this. I've looked through Rational Romance's source code (https://github.com/emipa606/RationalRomance/blob/master/Source/Rainbeau's%20Rational%20Romance/MyClass.cs), but couldn't find anything that helped me. There is a JobDriver_ProposeDate that is used, but there isn't any declaration of a certain relationship between the pawns.

I'd really appreciate some help because I think the romance interactions in this game need some improvements.

GhostData

Quote from: yamgo on September 22, 2020, 06:09:27 AM
Still looking for help on this. I've looked through Rational Romance's source code (https://github.com/emipa606/RationalRomance/blob/master/Source/Rainbeau's%20Rational%20Romance/MyClass.cs), but couldn't find anything that helped me. There is a JobDriver_ProposeDate that is used, but there isn't any declaration of a certain relationship between the pawns.

I'd really appreciate some help because I think the romance interactions in this game need some improvements.

InteractionDefs may have a worker associated with the workerClass field. It takes a InteractionWorker class which can be used to define who can perform the interaction by overriding RandomSelectionWeight. Interactions are just the quick social bubbles that popup when pawns chat though, so they aren't exactly complex.

You can use a WorkGiver to assign a job to a pawn as well, WorkGiver_Scanner will poll to see if there is a valid job to be assigned. A collection of toils allows for jobs to be much more complex - Move to lover, collectively move to designated date spot, trigger some interactions, wait X ticks, date complete.
There are a lot of mechanisms in WorkGiver to control who can take a job and when. Personally, I don't know what the correct mechanism is, but I use HasJobOnThing to to filter out pawns who can take the job, and valid targets for the pawn.
The downside to using a scanner is that it will always be looking for someone to give the job to, so it can be a performance hit. You can override ShouldSkip to more quickly determine if a job is valid - scan the map for a lover pawn, if none exists return false so we don't try to assign any jobs.
Again, I don't know if this is the correct way, it's just how I've been using it.

Oof. Just looked at the source code you linked. That fat class gives me physical pain.
Checkout JobDriver_JobDateFollow and the Lead job for examples from that mod.