structureFittingController.py (2978B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\fittingScreen\structureFittingController.py 2 from eve.client.script.ui.shared.fittingScreen.fittingSlotController import ShipFittingSlotController 3 import carbonui.const as uiconst 4 from eve.client.script.ui.shared.fittingScreen.slotControllerGhostFittingExtension import UnfitFromSlot 5 from eve.client.script.util.eveMisc import GetRemoveServiceConfirmationQuestion, GetOfflineServiceConfirmationQuestion 6 from eve.common.script.sys.eveCfg import IsControllingStructure 7 from inventorycommon.const import serviceSlotFlags 8 from localization import GetByLabel 9 from player_messaging.client.ui_message import prompt_player_fsd_dialog 10 11 class StructureFittingServiceSlotController(ShipFittingSlotController): 12 13 def UnfitModule(self, *args): 14 if self.IsSimulated(): 15 return UnfitFromSlot(None, self.GetModule()) 16 module = self.GetModule() 17 if module is None: 18 return 19 parentID = self.GetParentID() 20 if parentID is None: 21 return 22 if IsControllingStructure(): 23 sm.GetService('structureControl').CheckCanDisableServiceModule(self.GetModule()) 24 questionPath, params = GetRemoveServiceConfirmationQuestion(self.GetModuleTypeID()) 25 ret = prompt_player_fsd_dialog(questionPath, params=params, buttons=uiconst.YESNO) 26 if ret != uiconst.ID_YES: 27 return 28 invCache = sm.GetService('invCache') 29 shipInv = invCache.GetInventoryFromId(parentID, locationID=session.structureid) 30 shipInv.Add(self.GetModuleID(), parentID, qty=None, flag=const.flagHangar) 31 32 def ToggleOnlineModule(self): 33 if not self.IsOnlineable(): 34 return False 35 if self.IsOnline(): 36 if not self.IsSimulated(): 37 sm.GetService('structureControl').CheckCanDisableServiceModule(self.GetModule()) 38 questionPath, params = GetOfflineServiceConfirmationQuestion(self.GetModuleTypeID()) 39 numOnlineServiceModules = 0 40 for module in self.parentController.GetFittedModules(): 41 if module.flagID in serviceSlotFlags and module.IsOnline(): 42 numOnlineServiceModules += 1 43 44 if numOnlineServiceModules == 1: 45 params['extraWarningText'] = GetByLabel('UI/Structures/OfflineLastServiceModuleWarning') + '<br>' 46 else: 47 params['extraWarningText'] = '' 48 ret = prompt_player_fsd_dialog(questionPath, params=params, buttons=uiconst.YESNO) 49 if ret != uiconst.ID_YES: 50 return 51 self.OfflineModule() 52 else: 53 self.OnlineModule() 54 if self.IsSimulated(): 55 sm.GetService('ghostFittingSvc').SendFittingSlotsChangedEvent() 56 57 def _ShouldContinueAfterOfflineWarning(self): 58 return True