AI_PRO/TractorAction.py
2021-03-29 14:33:16 +02:00

20 lines
777 B
Python

from Main import TractorLoad
from Main.TractorLoad import TillageUnit
def action(field, tractor, tillageUnit):
if tractor.header and tractor.hitch == "Crop Trailer" and field.state == "toCut":
return "toPlow"
elif isinstance(tractor.hitch, TillageUnit) and tillageUnit.load == "Fertilizer" and field.state == "toFertilize":
return "toSeed"
elif isinstance(tractor.hitch, TillageUnit) and tillageUnit.load == "Seeds" and field.state == "toSeed":
return "toWater"
elif isinstance(tractor.hitch, TillageUnit) and tillageUnit.load == "Water" and field.state == "toWater":
return "toCut"
elif isinstance(tractor.hitch, TillageUnit) and tillageUnit.load == "Nothing" and field.state == "toPlow":
return "toFertilize"