Space Engineers

Space Engineers

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

订阅以下载
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 and GOAT sorter
There is a new version of IIM called GOAT Sorter that does understand seeds and can probably do eveything this script does and more, depending on how that goes I may retire this script https://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=3581915365

A lot of what this mod does could theoretically also be done with Isy's Inventory Manager (IIM), 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



43 条留言
WardenWolf 12 月 2 日 下午 5:51 
@Bystander I don't think the lag is with your script. I had lag for a while with my own automated setup. The lag seems to be on detecting a subgrid for seed drop if your grid is already complex. There are other ways around it, though. Such as having a small-grid that periodically connects to a connector under it with an event controller to recharge its battery but otherwise just "exists" to be detected.
Bystander  [作者] 12 月 1 日 上午 3:52 
I wonder if it's throwing an exception, did you see anything unusual in the output? You don't have hundreds of half finished blocks or something?
Lathana 11 月 26 日 下午 9:13 
Yea, its pretty clear, turning the PB off stops immediately and back on its a few seconds until it starts again. Tried on 2 different friends server boxes, it wasn't until the second one when I figured out what it was coming from. I thought it was odd since it didn't seem to be all that complex considering the other mods and scripts we run.
Bystander  [作者] 11 月 23 日 下午 8:59 
@Lathana, unfortunately 1.6s is the slowest update rate. See normalUpdateFrequency near the top of the script, it should be set to Update100. (Every 100 frames).
I'm surprised it is generating lag tbh, it's not doing anything complex. Planting automation mod does a lot more work. Can you confirm turning the PB off stops the lag?
Lathana 11 月 21 日 下午 1:38 
So I've noticed with this script running on my friends multiplayer server, theres a bit of a rubber-banding that happens when this script updates (the 1.6 second run). I was wonderin if theres a way to increase the update time, or something to reduce the processing needs. (I'm no techie really I just noticed the issue)
WardenWolf 11 月 11 日 下午 2:01 
I think there's still a purpose for this script. IIM and GOAT are kind of overreaching and require a lot of specific setup. This is quick and easy to setup, and the fact that it puts ONE seed in each connector is nice; it almost negates the need for the connector Drop Item part of the Farming Automation mod as you could theoretically rapidly toggle Throw Out with only one seed.
Bystander  [作者] 11 月 10 日 上午 4:23 
Added a note about GOAT sorter, which is a modern rewrite of IIM that understands seeds. GOAT should be able to handle the same things as this script plus a lot more. This script was intended as a quick stop gap, so I may retire it in time.
https://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=3581915365
Bystander  [作者] 11 月 8 日 上午 5:03 
Heh fancy!
My cheap and cheerfull version in the thumbnail was just a rotisserie on a rotor. A line of conveyor junctions with connectors (ejecting) facing out on one side and collectors facing out the opposite way, just rotate the skewer on a timer block and trigger eject on the connectors. Needs a lot of components and takes space, but works.
WardenWolf 11 月 5 日 下午 6:14 
It's both tougher and easier than you would think. There are NO AI blocks involved whatsoever, and only 1 Event Controller; it's running on a track so you literally just set the propulsion for the wheels. What surprised me was that the game didn't treat + and - propulsion the same on left and right wheels so I had to use positive on one side and negative on the other. At the end of its run, a sensor just triggers a timer block that reverses the propulsion and turns the sensor that controls the seed droppers on. This sensor is set to detect Small Ship. In this case, "Small Ship" is actually a small rotor head. A line of rotors under the floor, with the same spacing as the planters. The purpose is to give a detectable gap between each activation point, and the small rotor head gives it a very precise target to trigger on. So that's how it knows when to trigger; it's detecting something precise under the floor.
aantono 11 月 5 日 下午 3:41 
@Warden, do you think you could publish a blueprint or maybe even a how-to video explaining how to build and configure it? Would really help the noobs like me! 🙏