Hello,
I was attempting to combine Treefarm Lite with the mod "Magnets, Motors, Transformers, and More!" which adds a 10% chance to mine Resin from trees, but I learned that both mods had issues working together. After delving into the Treefarm code I learned that the output of a tree farm is not actually related to the minable output of the trees a farm grows so I could farm trees all day but never actually get any of the new Resin from that mod.
It seems the output of harvesting a tree is the result of the field "output" in the table "global.tf.seedPrototypes.<treeType>". I found this perplexing, and I couldn't find a reason why this was so. If anybody knows why it was done this way please let me know!
However, since I couldn't find such a reason I rewrote the harvesting function to base the output on the mature trees minable properties in its prototype. For vanilla this doesn't change the behavior at all. I also double checked the prototype definitions for mature trees in DyTech just to make sure this change wouldn't break the special trees it has, and it doesn't seem like it will.
This will, however, fix any mods that are not written with TreeFarm in mind that add resources to the games tree types. On the down side, it adds a failure case. It cannot handle mining more resource types from a mature tree than the farm has result inventory slots. I upped the result inventory slots to 4 to help prevent issues if mods add several possible items to tree mining. If, however, the amount of minable item types mined exceeds the number of output slots the script will immediately error out.
Let me know what you think.
General Compatibility Patch
General Compatibility Patch
- Attachments
-
- Treefarm-Lite_0.3.6.diff.gz
- (928 Bytes) Downloaded 138 times
Re: General Compatibility Patch
An interesting idea. There was no issue with adding inventory slots to the treefarms? I was under the impression furnaces needed a specific number of inventory slots. Also, did you apply this change to the mk2 fields as well?
Re: General Compatibility Patch
So where do we put this to make it work?
Re: General Compatibility Patch
I'm still pretty new to modding this game so I was unaware of any potential problems with upping the result inventory slots. It seems to work OK with my limited testing thus far.Blu3wolf wrote:An interesting idea. There was no issue with adding inventory slots to the treefarms? I was under the impression furnaces needed a specific number of inventory slots. Also, did you apply this change to the mk2 fields as well?
As for the mk2 fields, I haven't gotten to them yet. However, if I understand them correctly they work by marking the mature trees for deconstruction by logistics bots. I think in that case the tree objects mineable properties will be respected. This does need to be verified, and I'll attempt to do so probably this weekend.
This file is a unified diff designed to be used to modify an existing file. On unix based systems the "patch" command does this. I'm not sure what software is available for Windows platforms. Maybe somebody else can assist?Ralord89 wrote:So where do we put this to make it work?
Alternatively, you can try manually applying the changes in the diff file.