def createBuilding(self, team,pos): '''add a building to the given team''' building = Building() building.team = team building.position =pos bid = id(building) building.building_id = 0 self.buildings[bid] = building return building
def createBuilding(self, team,pos): '''add a building to the given team''' building = Building() building.team = team building.position =pos bid = id(building) building.building_id = Environment.NEXT_BUILDING_ID Environment.NEXT_BUILDING_ID = Environment.NEXT_BUILDING_ID + 1 self.buildings[bid] = building return building
def createBuilding(self, team, position): if (self.rp.position - position) < 6: return None for b in self.buildings.itervalues(): if (team == b.team) and (b.position - position) < 6: return None building = Building() building.team = team building.position = position bid = id(building) self.buildings[bid] = building building.onDestroyed.addCallback(self.destroyBuilding) for o in self.observers: o.callRemote('createBuilding', bid, building) return building