Beispiel #1
0
    def __init__(self):
        self.id = Entity.IDs
        Entity.IDs += random.randint(1,
                                     8)  # Prevent guessing of id assignments

        self.messageQueue = MessageQueue()
        self.health = PlayerStat(100)
        self.energy = PlayerStat(0)
        self.energyRechargeRate = 0  # Amount of Energy Recovered Per Second
        self.timealive = 0
        self.TTL = None  # None means will live 'forever', otherwise if timealive > TTL (time to live), then the object will be automatically cleaned up in gameloop and destroyed.

        self.in_celestialbody = [
        ]  # keeps track of celestial bodies this object is in
        self.destroyed = False  # keeps track of if the object has been destroyed and needs to be removed from the world in the next gameloop.
Beispiel #2
0
 def setCommandBufferSize(self, size):
     old = self.commandQueue[:]
     self.commandQueue = MessageQueue(size)
     self.commandQueue.extend(old)
Beispiel #3
0
 def __init__(self, parent, size):
     self.__parent = parent
     self.__queue = MessageQueue(size)
     self.__queueSemaphore = threading.Semaphore()