Example #1
0
 def __init__(self, id, type):
     self.id = id
     self.type = type
     self.position = coordinate.fromStruct(AICore.GetPos(id))
     self.currentlyWorkedOn = False
     self.isComplete = False
     self.isBusy = False
Example #2
0
 def run(self):
     #Checks if currently pathfinding
     if (self.canMove):
         #Checks if within search area, goes to next state if not
         if (self.lastPosition.x > self.maxThreshold.x
                 or self.lastPosition.y > self.maxThreshold.y
                 or self.lastPosition.x < self.minThreshold.x
                 or self.lastPosition.y < self.minThreshold.y):
             self.machine.nextState()
         else:
             #Calculates new position and pathfinds there
             self.canMove = False
             self.lastPosition.x = max(
                 min(self.lastPosition.x + self.dx, self.max.x), self.min.x)
             self.lastPosition.y = max(
                 min(self.lastPosition.y + self.dy, self.max.y), self.min.y)
             AICore.MoveTo(self.machine.id, self.lastPosition.x,
                           self.lastPosition.y)
Example #3
0
def onMessage():
    message = AICore.GetMessage()
    overseer.onMessage(message)
Example #4
0
 def enter(self):
     self.lastPosition = coordinate.fromStruct(
         AICore.GetPos(self.machine.id))
Example #5
0
 def enter(self):
     AICore.MoveTo(self.machine.id, self.destination.x, self.destination.y)
Example #6
0
 def run(self):
     #self.tick += 1
     if (self.canAttack):
         self.canAttack = False
         self.enter()
         AICore.Attack(self.machine.id, self.target)
Example #7
0
 def enter(self):
     AICore.Attack(self.machine.id, self.target)
     pass
Example #8
0
 def enter(self):
     AICore.Craft(self.machine.id, self.building.id)
Example #9
0
 def enter(self):
     AICore.Build(self.machine.id, self.building.id)
Example #10
0
 def enter(self):
     AICore.Upgrade(self.machine.id, self.goalType, self.upgradeLocation)
     self.machine.autoFlee = False
     pass
Example #11
0
 def enter(self):
     AICore.HarvestResource(self.machine.id, self.objectToHarvest)
Example #12
0
 def spawnWorksite(type, pos):
     AICore.SpawnWorksite(type.value, int(pos.x), int(pos.y))