AI_PRO/TractorAction.py

20 lines
777 B
Python
Raw Normal View History

2021-03-29 13:06:57 +02:00
from Main import TractorLoad
2021-03-29 14:33:16 +02:00
from Main.TractorLoad import TillageUnit
2021-03-29 13:06:57 +02:00
2021-03-29 14:33:16 +02:00
def action(field, tractor, tillageUnit):
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 14:33:16 +02:00
elif isinstance(tractor.hitch, TillageUnit) and tillageUnit.load == "Fertilizer" and field.state == "toFertilize":
2021-03-29 13:06:57 +02:00
return "toSeed"
2021-03-29 14:33:16 +02:00
elif isinstance(tractor.hitch, TillageUnit) and tillageUnit.load == "Seeds" and field.state == "toSeed":
2021-03-29 13:06:57 +02:00
return "toWater"
2021-03-29 14:33:16 +02:00
elif isinstance(tractor.hitch, TillageUnit) and tillageUnit.load == "Water" and field.state == "toWater":
2021-03-29 13:06:57 +02:00
return "toCut"
2021-03-29 14:33:16 +02:00
elif isinstance(tractor.hitch, TillageUnit) and tillageUnit.load == "Nothing" and field.state == "toPlow":
2021-03-29 13:06:57 +02:00
return "toFertilize"