This commit is contained in:
v7eZ3t 2021-03-29 13:32:51 +02:00
parent 91106af2a8
commit 9b75da63ac
3 changed files with 8 additions and 5 deletions

View File

@ -10,5 +10,5 @@ class Field:
@state.setter
def state(self, state):
if state == 0 or state == 1 or state == 2 or state == 3 or state == 4:
if state == "toPlow" or state == "toWater" or state == "toSeed" or state == "toFertilize" or state == "toCut":
self.__state = state

View File

@ -2,7 +2,6 @@ from Main import TractorLoad
def action(field, tractor):
if tractor.header and tractor.hitch == "Crop Trailer":
return "toPlow"
@ -17,5 +16,3 @@ def action(field, tractor):
elif tractor.hitch == "Tillage Unit" and TractorLoad.TillageUnitLoad == "None":
return "toFertilize"

View File

@ -33,7 +33,13 @@ while working:
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE:
field = board[tractor.horizontal_index][tractor.vertical_index]
field = action(field, tractor)
print(action(field, tractor))
field.state = action(field, tractor)
#print(field.state)
if event.key == pygame.K_q:
tractor.hitch = "Crop Trailer"
if event.key == pygame.K_w:
tractor.header = True
horizontal_change, vertical_change = driving.manualTurning(event, tractor.horizontal_index,
tractor.vertical_index, horizontal_change,
vertical_change)