Space Engineers

Space Engineers

Not enough ratings
Smart Miner Assist
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
2.369 KB
15 Sep, 2015 @ 11:02am
1 Change Note ( view )

Subscribe to download
Smart Miner Assist

Description
This Script is an ultimate tool to make your basic Mining ship a LOT more useful.

In short, what it does is:
1. Share ore between ship drills equally (for every conveyor grid within your ship)
2. Output percentages of storage volume occupied (separately for every conveyor grid you have)
3. Share Uranium between all the reactors equally (large reactors get more, small - less)


How to use:
1. build a miner ship -- i'm sure you can do this without additional hints :p
2. build a computer aboard the ship and fill the script in.
-- launching computer will share uranium and ore once, you can stop at that if you wish

3. build a timer block, press "Setup Action" and set it to "run" computer with mining script. Timeout is value of your choice. You can set it to 1 or to 2 or to 5, i wouldn't recommend any higher because drills usually get filled up quick, and unless you want to stop at 80-90% of drill capacity when mining, you need to share values frequently.
-- you can stop here as well, Smart Miner Assist script will do all the job you need, except showing the capacity status

4. build a Text Panel block, make sure it's owner is same as computer owner, which is you. Once launched the script will automaticly grab the panel and start outputting capacity percentages over every grid onto the screen. There, you're ready to go mining without worrying about losing half the ores to some drill that works faster than others.

Useless Note. For your convenience when first launched, computer will automaticly find and occupy one Text panel and one Timer block, rename it to "MinerText" and "MinerTimer", and use it afterwards.

Developer Note. Most of the code here is actually working on separating your ship from station or other ships you are docked to, as well as separating every grid within ship, so if you have 4 reactors on one side, and 4 more on another, they will not try to shuffle uran between one another, they'll work only within their groups, so you can rest assured. Same goes for Drills.



Further improvements and current problems.

1. Currently if you build a timer block or a text panel after launching the script, they will not bind to the script automaticly, because are already cached to "missing", thus you would require to... well restart the world or the computer to make it find them.

2. Dispite occupying a timer and renaming it, I've been kinda lazy to automaticly SetupAction onto the timer. It shouldn't be too hard, but you know... lazy. :)

3. What the mod reaaaaally misses to make it perfect, is automatic unload function for when you dock onto a larger ship or station. I've been thinking about making it, but... well.. look up pt. 2 ;) -- lazy

Have fun using it :)



Note to programmers.

Had to look into a lot of things while i've been writing this script, and wrote every function except for the execute myself. Within the code you will find how to:
- retrieving occupied and max capacity of containers
- passing items from one container to another
- retrieving type of IMyTerminalBlock, as well as subtype aka (Reactor, Refinery, SmallShipSmallReactor, SmallShipLargeReactor)
- alternative way of filtering a block collection by multiple types
- filtering blocks within one power grid (aka different ships connected with connectors)
- filtering conveyor networks within one grid
What i couldn't find out, is:
- how to get volume from Amount for InventoryItem, not sure if it's possible, thus i had to just use constant values for ore/uraniumIngot.

Feel free to dig in the code and learn some of these aspects for yourself. If you plan to use large portions of the code for your own need, also feel free to do so, althou it would flatter me, if you put a copyright somwhere ;).
1 Comments
Chaos Legion 30 Oct, 2018 @ 5:10pm 
Any chance to get uodate ?