forked from DylanTaylor1/GTNH-CropAutomation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscanner.lua
60 lines (48 loc) · 1.54 KB
/
scanner.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
local component = require('component')
local sides = require('sides')
local config = require('config')
local geolyzer = component.geolyzer
local function scan()
local rawResult = geolyzer.analyze(sides.down)
-- AIR
if rawResult.name == 'minecraft:air' or rawResult.name == 'GalacticraftCore:tile.brightAir' then
return {isCrop=true, name='air'}
elseif rawResult.name == 'IC2:blockCrop' then
-- EMPTY CROP STICK
if rawResult['crop:name'] == nil then
return {isCrop=true, name='emptyCrop'}
-- FILLED CROP STICK
else
return {
isCrop=true,
name = rawResult['crop:name'],
gr = rawResult['crop:growth'],
ga = rawResult['crop:gain'],
re = rawResult['crop:resistance'],
tier = rawResult['crop:tier']
}
end
-- RANDOM BLOCK
else
return {isCrop=false, name='block'}
end
end
local function isWeed(crop, farm)
if farm == 'working' then
return crop.name == 'weed' or
crop.name == 'Grass' or
crop.gr > config.workingMaxGrowth or
crop.re > config.workingMaxResistance or
(crop.name == 'venomilia' and crop.gr > 7)
elseif farm == 'storage' then
return crop.name == 'weed' or
crop.name == 'Grass' or
crop.gr > config.storageMaxGrowth or
crop.re > config.storageMaxResistance or
(crop.name == 'venomilia' and crop.gr > 7)
end
end
return {
scan = scan,
isWeed = isWeed
}