StarOS: drill

Part drill (2 ports) or drill_mk2 (2 ports): same module, one of the two. See the overview.

drill.dig() records one dig of the deposit under the cell where the robot ends the turn, into the hopper.

drill tonnes power reaches
drill up to 2 150 W surface layer
drill_mk2 up to 3 250 W all layers

The number of ore units depends on the grade: a tonne at the ore's reference grade is one unit.

Script errors (the whole script fails): no hopper, or no ore on the cell where the robot starts the turn. So do not move onto ore and dig in the same turn.

Failed actions (an action_failed event): hopper full, deposit empty, deposit too deep for this tier, drill worn out, not enough power. A worn drill digs half; attach a drill_bit to restore it.

def tick():
    # Only on an ore cell, with a hopper attached.
    if hopper.free() > 400:
        drill.dig()