From 9b75da63acc1e10ea2e185498439fa787b4d64fc Mon Sep 17 00:00:00 2001 From: v7eZ3t Date: Mon, 29 Mar 2021 13:32:51 +0200 Subject: [PATCH] v. 1.10 --- Field.py | 2 +- TractorAction.py | 3 --- main.py | 8 +++++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Field.py b/Field.py index 6194dd6..352e53d 100644 --- a/Field.py +++ b/Field.py @@ -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 diff --git a/TractorAction.py b/TractorAction.py index 0083bf6..47b879e 100644 --- a/TractorAction.py +++ b/TractorAction.py @@ -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" - - diff --git a/main.py b/main.py index b5f2993..7afa8b3 100644 --- a/main.py +++ b/main.py @@ -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)