Jump to content

Feature request - Multiple farmers/farm

Pending 0.4.2

MoonDoggy
MoonDoggy

Posted

 

Hi — thanks for PersonalFarmer, it does a lot of work on our server. We love it!

What we'd like: the ability to run more than one farmer at a single farm (one tool cupboard). Our farms have grown past what a single bot can keep serviced, and a second farmer on the same base would be a lot tidier than splitting the farm in two.

I had a read through 0.4.2 first to see whether it was already configurable. It looks structural rather than a setting, so here is what I found in case it saves you time:

  1. dataFarms is a Dictionary<ulong, DataFarm> keyed by cupboard net ID (line 1420). Registering a second bag at the same cupboard overwrites the first record via the indexer assignment at line 4476.

  2. Save files are named by cupboard ID (SaveDataFarms, line 1524), and the cupboard ID is not stored inside DataFarm — it is implied by the filename. So any change here is a data-format migration as well.

  3. FarmManager resolves its own data from the cupboard it is attached to: Data = instance.dataFarms[netId] in Awake() (line 4658). Externally the farm is found with TryGetComponent<FarmManager>(cup, out var farm) (lines 4251, 4284, 4288, 15897), which returns only the first component — so two managers on one cupboard would both resolve to the same farm.

For what it is worth, the approach that looked cleanest from outside: key dataFarms by bag net ID instead (each farmer already has its own bag via IdBag), store the cupboard ID inside DataFarm, and migrate existing files by reading the cupboard ID from the old filename. That leaves one design question that is really yours — with two farmers on a cupboard, which one does the UI open: a picker, or a separate UI per bag?

Separately, a small thing spotted while reading. The per-type limit check at line 4486 is:

if (currentCount > botSetup.CreateFarmer.MaxFarmers)

which allows MaxFarmers + 1 farmers of that type. I think that wants >=.

Happy to test a build if you ever pick this up. No hurry — and thanks again for the plugin.

About Us

Codefling is the largest marketplace for plugins, maps, tools, and more, making it easy for customers to discover new content and for creators to monetize their work.

Downloads
3.3m
Total downloads
Customers
12.4k
Customers served
Files Sold
175.8k
Total sales
Payments
3.8m
Processed total
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.