-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweirdsubstance.py
More file actions
52 lines (37 loc) · 1.01 KB
/
weirdsubstance.py
File metadata and controls
52 lines (37 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import mover
def autoFarm():
if( num_unlocked(Unlocks.Fertilizer) == 0 ):
return False
if( num_items(Items.Fertilizer) == 0 ):
return False
if( mover.usedWorldSize != get_world_size() ):
mover.init()
moveForward = True
mover.moveToPos( mover.getZigZagStartPos() )
while( True ):
if( moveForward ):
if( num_items(Items.Fertilizer) == 0 ):
moveForward = not moveForward
else:
harvest()
plantEntity = None
groundTarget = Grounds.Grassland
if( num_items(Items.Hay) > 0 ):
plantEntity = Entities.Grass
groundTarget = Grounds.Soil
if( get_ground_type() != groundTarget ):
till()
if( plantEntity != None ):
plant(plantEntity)
use_item(Items.Fertilizer)
else:
harvest()
pos = (get_pos_x(), get_pos_y(), moveForward)
moveDirection = mover.zigZagDict[pos]
if( moveDirection == None ):
if( moveForward == False):
break #back at starting point
moveForward = not moveForward
if( moveDirection != None ):
move(moveDirection)
return True