forked from s452751/AI_PRO
63 lines
1.8 KiB
Python
63 lines
1.8 KiB
Python
from Main.TractorLoad import TractorTrailer
|
|
from Main.constants import HORIZONTAL_TILES_NUMBER, VERTICAL_TILES_NUMBER
|
|
|
|
|
|
class Tractor:
|
|
def __init__(self, __horizontal_index, __vertical_index, __hitch, __header, __fuel_tank):
|
|
self.__horizontal_index = __horizontal_index
|
|
self.__vertical_index = __vertical_index
|
|
self.__hitch = __hitch
|
|
self.__header = __header
|
|
self.__fuel_tank = __fuel_tank
|
|
|
|
@property
|
|
def horizontal_index(self):
|
|
return self.__horizontal_index
|
|
|
|
@horizontal_index.setter
|
|
def horizontal_index(self, horizontal_index):
|
|
if self.__horizontal_index < 1 or self.__horizontal_index >= HORIZONTAL_TILES_NUMBER - 1:
|
|
self.__horizontal_index = horizontal_index
|
|
|
|
@property
|
|
def vertical_index(self):
|
|
return self.__vertical_index
|
|
|
|
@vertical_index.setter
|
|
def vertical_index(self, vertical_index):
|
|
if self.__vertical_index < 1 or self.__vertical_index >= VERTICAL_TILES_NUMBER - 1:
|
|
self.__vertical_index = vertical_index
|
|
|
|
@property
|
|
def hitch(self):
|
|
return self.__hitch
|
|
|
|
@hitch.setter
|
|
def hitch(self, hitch):
|
|
if hitch is "Tillage unit" or "Crop Trailer" or TractorTrailer or "Nothing":
|
|
self.__hitch = hitch
|
|
|
|
@property
|
|
def fuel_tank(self):
|
|
return self.__fuel_tank
|
|
|
|
def __fuel_tank(self, fuel_tank):
|
|
if 0 < fuel_tank < 100:
|
|
self.__fuel_tank = fuel_tank
|
|
|
|
def fill_tank(self):
|
|
self.__fuel_tank(100)
|
|
|
|
def reduce_fuel(self):
|
|
if 0 < self.fuel_tank < 100:
|
|
self.__fuel_tank = self.__fuel_tank - 1
|
|
|
|
@property
|
|
def header(self):
|
|
return self.__header
|
|
|
|
@header.setter
|
|
def header(self, header):
|
|
if header is True or False:
|
|
self.__header = header
|