Several JoyGiverDefs do not have JobDefs

Started by System.Linq, July 15, 2017, 06:32:53 PM

Previous topic - Next topic

System.Linq

Some JoyGiverDefs do not have JobDefs assigned to them, like this one:


  <JoyGiverDef>
    <defName>SocialRelax</defName>
    <giverClass>JoyGiver_SocialRelax</giverClass>
    <baseChance>4</baseChance>
    <joyKind>Social</joyKind>
  </JoyGiverDef>


Presumably, the reason for this is that the JoyGiver class references the JobDef directly:
job = new Job(JobDefOf.SocialRelax, compGatherSpot.parent, t);

However, this makes it almost impossible to match a JoyGiver to a JobDef. This means that if you only have a Job, you cannot determine which JoyGiver it came from. Which means that you cannot re-issue that Job to another pawn using TryGiveJobFromJoyGiverDefDirect(). This makes it impossible to duplicate jobs like SocialRelax which have a target (like a chair) that is reserved by one pawn, if you wanted another pawn to choose a different chair.

ison

I think it's fine. Not all joy givers have to have a job def assigned. E.g. what if a joy giver could give 2 different job defs based on some condition? Even if all joy givers had a job def assigned, then it still wouldn't be possible to tell for sure that a job was given by this joy giver and not by some other think node. That being said, I've added jobDef to SocialRelax just so it follows the pattern. Thanks for reporting.