Space Engineers

Space Engineers

评价数不足
Seed Stocker (A mod to help with Planting Automation)
   
奖励
收藏
已收藏
取消收藏
文件大小
发表于
更新日期
334.096 KB
9 月 28 日 上午 12:43
10 月 19 日 上午 12:00
6 项改动说明 ( 查看 )

订阅以下载
Seed Stocker (A mod to help with Planting Automation)

描述
This is a simple in game script that you run in a programmable block.

I wrote it to simplify farming automation when using the Planting Automation mod https://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=3568982238.

It handles stocking connectors on your grid with single seeds, these can then be ejected onto a farm plot below which if you have Planting Automation installed will then plant them. It will also find seeds in your network, prioritizing collector blocks first. Finally if no seeds are available it will locate a Food Processor and order more seeds (assumes you have the food item already).

To be clear it doesn't eject seeds for you, that's an engineering task for you to figure out.

The intended usage pattern here is that it puts a single seed into a connector if it finds one empty. You move the connector over a farm plot and trigger the Drop Item action added by Planting Automation. You then move a collector over the farm plot, this recycles the seed if it didn't plant and the script will find it again.

As stated above. if it runs out of seeds it will automatically make more using a food processor.

Usage

Subscribe to the mod and add the script to a programmable block in game.

Create groups of connectors and name the groups:
FruitSeedEjectors - fruit seeds will be sent to these connectors etc
GrainSeedEjectors
VegetableSeedEjectors
MushroomSporeEjectors

Other Options

Ignoring Grids
By default the script will search all grids including connected grids (ships), you can disable this by setting:
ignoreOtherGrids = true; near the top.

Seed Store
You can also have the grid do seed housekeeping at regular intervals. It will find all seeds (that aren't in the ejectors) and move them all to a single place. This is off by default. Set:
seedTidyUp = true;
Then create a group with a single cargo container in it and name the group "SeedStorage".

This is particularly useful as the collectors will collect seeds and dump them in random inventories.

BackStock
Stock levels, this is useful if you're using a single block system that passes over the farm plots. The script is "Just in time" by default. What this means is that if it runs out of seeds, it will order more then come back later to put them in connectors. That can take many seconds and the script only runs every 1.6s, so it's easy to miss the next plot.

To maintain a backstock of seeds set "seedsToBackstock" to the amount you want. This runs at the same frequency as the tidy up code (every 12.8s).
Alternatively for finer control over vanilla seed stocks see "fruitSeedsToBackstock" etc.

Learning seeds from other mods
You can put the script into learning mode by specifying "LearnMode" in the Run options and hitting Run. In this mode a set of instructions will be displayed on the main screen and console, it will pick the first Food Processor and watch it. Just follow the instructions on the screen.
On success or failure the script will halt, so you need to remove the "LearnMode" option and run it again.
The discovered seed will create a new ejector group, you'll see the correct name on the screen. (see image above).
Tested with Engineered Coffee and Potato VI-X so far.
Warning: If you put some other food item to production instead of a seed, that will be remembered too, it will even deliver it to the ejectors. The script will warn you if it thinks it isn't a seed, but will allow it as I can't be certain some mod won't break the rules.
If you want to abort learning mode simply recompile and run with no command option.

To clear learned seeds, run with the parameter "ClearLearned".

Final note about IIM
A lot of what this mod does could theoretically also be done with Isy's Inventory Manager, except currently it doesn't understand seeds and it won't order up new seeds.
You can semi fix this by manually specifying seeds in a "special" custom list on a connector, but it still won't order seeds for you. Hence why I wrote this.
The correct keys in Isy format are:
SeedItem/Fruit
SeedItem/Mushrooms
SeedItem/Vegetables
SeedItem/Grain

21 条留言
Bystander  [作者] 6 小时以前 
@Lost, and just to check, the lag goes away if you turn the programmable block off? One thing I would say is that Planting Automation mod does a lot of work times the number of farm plots in the entire world. A lot more than this script. It basically regularly checks the space above every farm plot for floating objects - which is a physics check. You could try disabling Planting Automation and see if the lag reduces.
Lost 9 小时以前 
@Bystander no or very few docked ships, quite a large base with maybe ~20 large containers (modded ~7mil ltr) and maybe another dozen of the terminal style boxes (mostly drop off points, so mostly empty). Base was running IIM but no other scripts. I had a stable setup with 8x ejectors with on occasional lag, but when I expended that to a large setup the lag became noticeable. My original intention was to go to ~400 farm plots with 216 ejectors, but I didn't manage to get a single side of that setup (27 ejectors) to work reliably.
Bystander  [作者] 10 月 22 日 上午 7:44 
@WardenWolf, yeah that will probably happen. Seed Tidy up mode may help.
WardenWolf 10 月 21 日 下午 8:08 
I noticed it has some difficulty generating seeds if the Food Processors it's trying to use for seed processing are completely full, even if there are others with available inventory space on the conveyor system. It causes some strange behavior.
Bystander  [作者] 10 月 20 日 上午 3:35 
@Lost, just to check, you don't have thousands of cargo containers on your grid? Possibly in docked ships? If so try setting "ignoreOtherGrids". How many Valid Inventories does it show on the screen?
Bystander  [作者] 10 月 20 日 上午 3:20 
@Lost, I'm surprised it's causing you lag. I do quite a bit to reduce lag - it's certainly doing a lot less than say IIM. I initialize as infrequently as I can - this remembers the current connectors, storage inventories and Food Processors. The script itself only runs every 1.6s and the heavy duty stuff (tidy up and backstock) only run every 12s or so.
Do you see an errors on the screen or console? If you turn the programmable block off, does the lag go away?
Bystander  [作者] 10 月 20 日 上午 3:14 
@jokerace45 You control exactly what type of seed is sent to a connector, it's not random. It's done through named groups, so say you pick 8 connectors and add them to a group named "FruitSeedEjectors", you'll only get fruit seeds in those connectors.
Bystander  [作者] 10 月 20 日 上午 3:12 
@Caazego It already loops through a list of known types (did you update?). The script can't self modify to be clear and even if it could, there is no way to iterate the seed blueprints from the Ingame API - hence this is similar to the way it's done in IIM. I have to witness a seed being made to learn it.
Lost 10 月 19 日 下午 11:00 
Getting lots of lag when using larger farms. My test farm had 16 connectors and that worked but with some lag, anything over that then the script either hangs (Takes longer than 3s, and stops) or causes so much lag the game in unplayable. Only customisation I made were to change the seed group/storage names.
jokerace45 10 月 19 日 下午 2:50 
It sounds like this is all random production. Can you label a connector to always use only one type of seed. Then you could have dedicated farming areas.