def removeEntity(self, entity=None): activeEntity = Machine.removeEntity(self, entity) scrapQuantity=self.scrapRng.generateNumber() activeEntity.numberOfUnits-=int(scrapQuantity) # the scrapQuantity should be integer at whatever case if activeEntity.numberOfUnits<0: activeEntity.numberOfUnits==0 return activeEntity
def removeEntity(self, entity=None): activeEntity = Machine.removeEntity(self, entity) scrapQuantity = self.scrapRng.generateNumber() activeEntity.numberOfUnits -= int( scrapQuantity ) # the scrapQuantity should be integer at whatever case if activeEntity.numberOfUnits < 0: activeEntity.numberOfUnits == 0 return activeEntity
def removeEntity(self, entity=None): receiverObject=self.receiver activeEntity=Machine.removeEntity(self, entity) #run the default method removeReceiver=True # search in the internalQ. If an entity has the same receiver do not remove for ent in self.Res.users: nextObjectIds=ent.remainingRoute[0].get('stationIdsList',[]) if receiverObject.id in nextObjectIds: removeReceiver=False # if not entity had the same receiver then the receiver will be removed if removeReceiver: self.next.remove(receiverObject) return activeEntity