planetaryProductionSystemContentPiece.py (2517B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\agencyNew\contentPieces\planetaryProductionSystemContentPiece.py 2 import telemetry 3 import evetypes 4 import uthread2 5 from eve.client.script.ui.shared.agencyNew import agencyConst 6 from eve.client.script.ui.shared.agencyNew.contentPieces.baseContentPiece import BaseContentPiece 7 from eve.client.script.ui.shared.agencyNew.contentPieces.planetaryProductionPlanetContentPiece import PlanetaryProductionPlanetContentPiece 8 from signals import Signal 9 10 class PlanetaryProductionSystemContentPiece(BaseContentPiece): 11 contentType = agencyConst.CONTENTTYPE_PLANETARYPRODUCTION 12 13 def __init__(self, planetItemIDsInSystem, desiredPlanetTypes, *args, **kwargs): 14 super(PlanetaryProductionSystemContentPiece, self).__init__(*args, **kwargs) 15 self.mapSvc = sm.GetService('map') 16 self.isSystemColonizedByMe = False 17 self.planetContentPieces = None 18 self.planetContentPiecesReadySignal = Signal(signalName='planetContentPiecesReadySignal') 19 self.isSystemWithinScanRange, self.isSystemUnscannable = sm.GetService('planetSvc').IsSystemWithinScanRange(self.solarSystemID) 20 self.planetItemIDsInSystem = planetItemIDsInSystem 21 self.desiredPlanetTypes = desiredPlanetTypes 22 self.filteredPlanets = [] 23 uthread2.StartTasklet(self.ConstructPlanetContentPieces) 24 25 @telemetry.ZONE_METHOD 26 def ConstructPlanetContentPieces(self): 27 self.planetContentPieces = filter(None, [ self.ConstructPlanetContentPiece(planetItemID) for planetItemID in self.planetItemIDsInSystem ]) 28 self.planetContentPiecesReadySignal() 29 30 @telemetry.ZONE_METHOD 31 def ConstructPlanetContentPiece(self, planetItemID): 32 planetItem = self.mapSvc.GetItem(planetItemID) 33 if planetItem.typeID not in self.desiredPlanetTypes: 34 self.filteredPlanets.append(planetItem) 35 return 36 return PlanetaryProductionPlanetContentPiece(solarSystemID=self.solarSystemID, itemID=planetItem.itemID, locationID=planetItem.locationID, position=(planetItem.x, planetItem.y, planetItem.z), typeID=planetItem.typeID, groupID=evetypes.GetGroupID(planetItem.typeID), planetName=planetItem.itemName) 37 38 @telemetry.ZONE_METHOD 39 def IsSystemColonizedByMe(self): 40 if not self.isSystemColonizedByMe: 41 self.isSystemColonizedByMe = any((planet.IsColonizedByMe() for planet in self.planetContentPieces)) 42 return self.isSystemColonizedByMe