How to pull the mass of a subgrid (or total mass of all connected grids) into a programmable block script?
Related to another question about how thrusters interact with subgrids, I've decided that this is an excuse to try learning C# Scripting for the Programmable Block (PB).
My plan is to have a pair of thrusters tasked to the PB, which will monitor the mass of the subgrids and set the thrust override for those two thrusters accordingly. This should roughly cancel out the variable mass of the drills as they go about their business. I figure I'll also have it monitoring the drill mass and automatically turn off the drills when they're full. (Why not, right?)
I've looked over the API information, but I'm new enough to this kind of coding that I'm not entirely sure what I'm even looking for, so I'm looking for a place to start:
What would the line of code be to take the mass of a subgrid(s) to assign it to a float variable?
Pictures about "How to pull the mass of a subgrid (or total mass of all connected grids) into a programmable block script?"
Space Engineers Tutorial: Intro to Scripts with Automatic LCDs by MMaster (survival tutorials, tips)
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Ketut Subiyanto, Mo7sen Mohammad, Brett Sayles, Wendy Wei