Best way to replace JobGiver_Haul in Animal ThinkTreeDefs?

Started by Jamestec, October 17, 2016, 08:46:20 AM

Previous topic - Next topic

Jamestec

What is the best way of replacing JobGiver_Haul in Animal ThinkTreeDefs?

I have thought of the following options:

  • Do the detour thing with JobGiver_Haul.TryGiveJob(), the only method it has.
  • Do the detour thing with JobGiver_Haul.TryGiveJob(), BUT always give null job. Make a SubTree with insertTab Animal_PreWander to handle hauling.
  • Make a SubTree thing with insertTag Animal_PreMain, make its treeRoot class to always give true and then subNodes are the same thing following the modder hook Animal_PreMain in Animal ThinkTreeDefs until after <!-- Trained behavior: Haul--> and just replace the class in our SubTree. Look at my prototype here: http://pastebin.com/QVKYYyDn

Edit: alternatively to 3, do the same thing but make each a separate SubTree instead of subNodes.

Dingo

I think detouring the jobgiver directly (so that would be #1?) is probably the simplest/best way to do it.

1000101

Detours should be avoided unless all other, better options (and all other options are better) have been exhausted.

Detours are intended to be a "last resort, nothing else can achieve the goal I am aiming for."

If using some XML to fix it doesn't work (and you may need to clone the entire sub-tree to do it) then it's time to start looking at other solutions.

Final note, there are two mods already which will allow you to control the animal hauling.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

Dingo

If you use XML to override the ThinkTree you're doing something inherently incompatible while overriding a specific job is compatible with mods that do change the ThinkTree for broader purposes... I'm sure CCL offers a good solution to this.

1000101

CCL adds additional injection points in the think trees as well as a mechanic to detour methods.  That being said, I still advocate avoiding detours unless no other option exists.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

RawCode

hooks are not last resort, you do not need to limit yourself.
just do what you want in way you like, don't waste time on "better solutions".

when (if) some issue appear later, in form of compatability or stability issue, you will fix it later.

trying to make everything "perfect" initially will have "bad" results.