SHOW:
|
|
- or go back to the newest paste.
| 1 | - | local targets = {'-4,0,5', '-5,-1,5', '-5,1,5', '-6,-1,5', '-6,1,5', '-7,-1,5', '-7,1,5', '-8,0,5'}
|
| 1 | + | local targets = {'-1,-1,-1', '-1,-1,-2', '-1,-1,-3', '-1,-1,0', '-2,-1,-4', '-2,0,-1', '-2,0,-2', '-2,0,-3', '-2,0,0'}
|
| 2 | ||
| 3 | os.loadAPI('ocs/apis/sensor')
| |
| 4 | - | local prox, monitor = sensor.wrap('right'), peripheral.wrap('bottom')
|
| 4 | + | local prox, monitor = sensor.wrap('top'), peripheral.find('monitor')
|
| 5 | ||
| 6 | - | local currentRMFurnaces, trueEmcValue, lastRMFurnaces, currentSecond, maxStacks = 0, 0, 0, 0, 6912*#targets |
| 6 | + | local currentRMFurnaces, trueEmcValue, lastRMFurnaces, currentSecond = 0, 0, 0, 0 |
| 7 | ||
| 8 | function initiate() | |
| 9 | monitor.setTextScale(1.5) | |
| 10 | while true do | |
| 11 | loop() | |
| 12 | currentSecond = currentSecond + 1 | |
| 13 | sleep(1) | |
| 14 | end | |
| 15 | end | |
| 16 | ||
| 17 | function loop() | |
| 18 | -- Every 2 Seconds to reduce amount of sensor calls and potentially limit lag | |
| 19 | if ( currentSecond % 2 == 0 ) then | |
| 20 | -- Probe Sensors | |
| 21 | currentRMFurnaces = 0 | |
| 22 | for index, target in ipairs(targets) do | |
| 23 | local targetDetails = prox.getTargetDetails(target) | |
| 24 | if ( targetDetails and targetDetails.Name == 'Crystal Chest' ) then | |
| 25 | for slot, item in ipairs(targetDetails.Slots) do | |
| 26 | if ( item.Name == 'Red Matter Furnace') then | |
| 27 | currentRMFurnaces = currentRMFurnaces + item.Size | |
| 28 | end | |
| 29 | end | |
| 30 | end | |
| 31 | end | |
| 32 | ||
| 33 | -- Calculate EMC Per Second | |
| 34 | local emcPerSecond = math.floor((currentRMFurnaces-lastRMFurnaces) * 10059784)/5 | |
| 35 | local rmCountString = 'Furnaces: '..(currentRMFurnaces > 64 and math.floor(currentRMFurnaces / 64)..' stacks & ' or '')..(currentRMFurnaces % 64)..' items' | |
| 36 | local storedEMC = currentRMFurnaces * 10059784 | |
| 37 | ||
| 38 | - | -- Calculate percentage |
| 38 | + | |
| 39 | - | local percentageStored = math.ceil((currentRMFurnaces/maxStacks) * 100) .. '%' |
| 39 | + | |
| 40 | ||
| 41 | monitor.clear() | |
| 42 | monitor.setCursorPos(2,4) | |
| 43 | monitor.write('EMC Rate: '..trueEmcValue..' per/s')
| |
| 44 | monitor.setCursorPos(2,5) | |
| 45 | - | monitor.setCursorPos(2,3) |
| 45 | + | |
| 46 | monitor.setCursorPos(2,6) | |
| 47 | monitor.write('Stored EMC: '..storedEMC)
| |
| 48 | lastRMFurnaces = currentRMFurnaces | |
| 49 | end | |
| 50 | end | |
| 51 | ||
| 52 | - | monitor.write('Percentage: '..percentageStored)
|
| 52 | + |