2021-03-29 20:51:47 +02:00
|
|
|
from TractorLoad import TillageUnit
|
2021-03-29 13:06:57 +02:00
|
|
|
|
|
|
|
|
2021-03-29 19:15:36 +02:00
|
|
|
def action(field, tractor):
|
2021-03-29 14:33:16 +02:00
|
|
|
if tractor.header and tractor.hitch == "Crop Trailer" and field.state == "toCut":
|
2021-03-29 13:06:57 +02:00
|
|
|
return "toPlow"
|
|
|
|
|
2021-03-29 21:40:55 +02:00
|
|
|
elif isinstance(tractor.hitch, TillageUnit) and tractor.hitch.load == "Nothing" and field.state == "toPlow":
|
2021-03-29 13:06:57 +02:00
|
|
|
return "toWater"
|
|
|
|
|
2021-03-29 19:15:36 +02:00
|
|
|
elif isinstance(tractor.hitch, TillageUnit) and tractor.hitch.load == "Water" and field.state == "toWater":
|
2021-03-29 21:40:55 +02:00
|
|
|
return "toSeed"
|
2021-03-29 13:06:57 +02:00
|
|
|
|
2021-03-29 21:40:55 +02:00
|
|
|
elif isinstance(tractor.hitch, TillageUnit) and tractor.hitch.load == "Seeds" and field.state == "toSeed":
|
2021-03-29 13:06:57 +02:00
|
|
|
return "toFertilize"
|
2021-03-29 19:15:36 +02:00
|
|
|
|
2021-03-29 21:40:55 +02:00
|
|
|
elif isinstance(tractor.hitch, TillageUnit) and tractor.hitch.load == "Fertilizer" and field.state == "toFertilize":
|
|
|
|
return "toCut"
|
2021-03-29 19:15:36 +02:00
|
|
|
|
2021-03-29 21:59:19 +02:00
|
|
|
|
2021-03-29 19:15:36 +02:00
|
|
|
def chooseToolset(tractor, tillageUnit, set):
|
|
|
|
if set == 0:
|
|
|
|
tractor.hitch = tillageUnit
|
|
|
|
tractor.hitch.load = "Nothing"
|
|
|
|
if set == 1:
|
|
|
|
tractor.hitch = tillageUnit
|
2021-03-29 21:59:19 +02:00
|
|
|
tractor.hitch.load = "Water"
|
2021-03-29 19:15:36 +02:00
|
|
|
if set == 2:
|
|
|
|
tractor.hitch = tillageUnit
|
|
|
|
tractor.hitch.load = "Seeds"
|
|
|
|
if set == 3:
|
|
|
|
tractor.hitch = tillageUnit
|
2021-03-29 21:59:19 +02:00
|
|
|
tractor.hitch.load = "Fertilizer"
|
2021-03-29 19:15:36 +02:00
|
|
|
if set == 4:
|
|
|
|
tractor.header = True
|
|
|
|
tractor.hitch = "Crop Trailer"
|
|
|
|
|
|
|
|
return tractor, tillageUnit
|