Making colonists follow drug policies during working hours?

Started by Wiggly_Penelopede, July 12, 2019, 05:37:45 AM

Previous topic - Next topic

Wiggly_Penelopede

As I've started to get in to the drug side of the game, I've noticed that colonists behave in some pretty annoying ways with regards to priorities...
They will not carry out "use drugs according to schedule" policies unless they are assigned to Recreation or Anything. This is problematic for a couple of reasons. Firstly because, when I assign them to use social drugs below a certain mood threshold, I usually want them doing it when they're grumpy out in the field, not chilling back at home, and secondly because this has led to situations where someone on luci runs out while working and goes berserk before I can react. (I do have them keep some with them at all times, but that doesn't always work properly.)

So basically, I'm trying to tweak the AI's priorities so they will respect scheduled drug policies while assigned to anything but Sleep. Problem is, I don't even know where to begin with this. What little experience I have with coding is Python and Lua, so XML and C# are pretty alien to me, but if I could possibly fix this I'm willing to learn up a bit on either or both of these. So my question is: How advanced would it be to change something like this? Could it be done with XML alone, or would I need C# too? From digging around, the only leads I've been able to find are...

  <ThinkTreeDef>
    <defName>MainColonistBehaviorCore</defName>
    <thinkRoot Class="ThinkNode_Tagger">
      <tagToGive>SatisfyingNeeds</tagToGive> <!-- note that JobGiver_Work will assign its own tag -->
      <subNodes>
        <li Class="ThinkNode_PrioritySorter">
          <subNodes>
            <li Class="JobGiver_GetFood"/>
            <li Class="JobGiver_GetRest"/>
            <li Class="JobGiver_SatisfyChemicalNeed"/>
            <li Class="JobGiver_TakeDrugsForDrugPolicy"/>
            <li Class="ThinkNode_Priority_GetJoy">
              <subNodes>
                <li Class="JobGiver_GetJoy"/>

                <li Class="JobGiver_GetJoyInBed"/>
              </subNodes>
            </li>
            <li Class="JobGiver_Work"/>
          </subNodes>
        </li>
      </subNodes>
    </thinkRoot>
  </ThinkTreeDef>
in defs/ThinkTreeDefs/SubTrees_Misc

and

namespace Verse.AI
{
public static class ThinkNodePriority
{
public const float Food = 9.5f;

public const float DrugDesire = 9.25f;

public const float AssignedWork = 9f;

public const float Rest = 8f;

public const float DrugPolicySchedule = 7.5f;

public const float AssignedJoy = 7f;

public const float AnythingJoy = 6f;

public const float AnythingWork = 5.5f;

public const float AvoidIdle_SleepAssignmentWork = 3f;

public const float AvoidIdle = 2f;
}
}


I would be super grateful if someone could provide me with some advice or direction here.