def PickTargetSubsystemFromList(self, lSubsystems): debug(__name__ + ", PickTargetSubsystemFromList") if len(lSubsystems) == 1: return lSubsystems[0] # Loop through and rate the subsystems, and choose the one # with the highest rating. pTarget = None fTargetRating = None for pSubsystem in lSubsystems: # If it's already our target, that affects our decision. fIsTargetRating = 0.0 if self.idTargetedSubsystem == pSubsystem.GetObjID(): fIsTargetRating = 1.0 # If it's healthy/unhealthy, that affects our decision. fHealthyRating = pSubsystem.GetConditionPercentage() # If it's disabled, that affects our decision. fDisabledRating = pSubsystem.IsDisabled() # Find this subsystem's overall rating... fRating = 0.0 for fValue, fScale in ( ( fIsTargetRating, 1.0 ), ( fHealthyRating, -1.0 ), ( fDisabledRating, -1.0 ) ): fRating = fRating + (fValue * fScale) if (pTarget is None) or (fRating > fTargetRating): pTarget = pSubsystem fTargetRating = fRating return pTarget
def SetToggleLaunchButton(): debug(__name__ + ", SetToggleLaunchButton") global ButtonToggleLaunchType, launchTypeSave, launchTypeSaveNum, pLaunchButton, ShuttleLaunchShip pLaunchShip = MissionLib.GetShip(ShuttleLaunchShip) pFTBCarrier = ftb.ShipManager.GetShip(pLaunchShip) if not hasattr(pFTBCarrier, "GetLaunchers"): # Our previous Ship maybe destroyed or is not configured to have Shuttles pShipMenu.SetName(App.TGString("None" + " " + "Selected")) return pFTBLauncher = pFTBCarrier.GetLaunchers() numTypes = len(pFTBLauncher) launcherIndex = 0 # cycle our whole Shuttle Type list for index in range( numTypes): launchType = pFTBLauncher[index].GetLaunchType() numLaunches = pFTBLauncher[index].GetNumLaunches(launchType) buttonLabel = launchType + ": " + str(numLaunches) ButtonToggleLaunchType.SetName(App.TGString(buttonLabel)) launcherIndex = index # Test if the the Start Button is disabled but we still have Shuttles if (numLaunches > 0 and not pLaunchButton[launcherIndex].IsEnabled()): # Now lets make the launching Framework operational again. launcher = ftb.LauncherManager.GetLauncher(ftb.FTB_MissionLib.GetFirstShuttleBayName(), pLaunchShip) if launcher: pLaunchButton[launcherIndex].SetEnabled() launcher.SetClearToLaunch(1) # Saves the vars. We can use them for testing later. launchTypeSave = launchType launchTypeSaveNum = numLaunches
def MPSetShipAttributes(pShip, iShipFromID): debug(__name__ + ", MPSetShipAttributes") if App.g_kUtopiaModule.IsHost(): if gdShipAttrs.has_key(iShipFromID): RestoreShipAttributes(pShip, gdShipAttrs[iShipFromID]) else: # Setup the stream. # Allocate a local buffer stream. kStream = App.TGBufferStream() # Open the buffer stream with a 256 byte buffer. kStream.OpenBuffer(256) # Write relevant data to the stream. # First write message type. kStream.WriteChar(chr(SET_GET_SHIP_ATTR_MSG)) # send Message kStream.WriteInt(1) # set kStream.WriteInt(pShip.GetObjID()) kStream.WriteInt(iShipFromID) pMessage = App.TGMessage_Create() # Yes, this is a guaranteed packet pMessage.SetGuaranteed(1) # Okay, now set the data from the buffer stream to the message pMessage.SetDataFromStream(kStream) # Send the message to everybody but me. Use the NoMe group, which # is set up by the multiplayer game. pNetwork = App.g_kUtopiaModule.GetNetwork() if not App.IsNull(pNetwork): pNetwork.SendTGMessage(pNetwork.GetHostID(), pMessage) # We're done. Close the buffer. kStream.CloseBuffer()
def StopTowing(self, pShip): # Stop the towing updates. #debug("StopTowing. Map is " + str(g_dTowingToToweeMatches)) debug(__name__ + ", StopTowing") App.g_kTimerManager.DeleteTimer( self.idTowTimer ) # Remove the instance handlers on our ship. pShip.RemoveHandlerForInstance(App.ET_DELETE_OBJECT_PUBLIC, __name__ + ".TowingShipDeleted") pShip.RemoveHandlerForInstance(App.ET_ENTERED_SET, __name__ + ".TowingShipEnteredSet") try: pTarget = App.ObjectClass_GetObjectByID(pShip.GetContainingSet(), g_dTowingToToweeMatches[pShip.GetObjID()]) # Remove this pair from the dictionary. We're done with it. del g_dTowingToToweeMatches[pShip.GetObjID()] except KeyError: pTarget = None if pTarget: pTarget.RemoveHandlerForInstance(ET_TOW_INCREMENT, __name__ + ".TowIncrement") # work around crash in DamageableObject_Cast pTarget = App.ObjectClass_GetObjectByID(None, pTarget.GetObjID()) if not pTarget: return pDamTarget = App.DamageableObject_Cast(pTarget) pShip.EnableCollisionsWith(pDamTarget, 1)
def LaunchShip( pObject, pEvent): debug(__name__ + ", LaunchShip") global pLaunchButton, launchTypeSave, launchTypeSaveNum, ShuttleLaunchShip, pShipMenu pLaunchShip = MissionLib.GetShip(ShuttleLaunchShip) pFTBCarrier = ftb.ShipManager.GetShip(pLaunchShip) if not pFTBCarrier: # Our previous Ship maybe destroyed pShipMenu.SetName(App.TGString("None" + " " + "Selected")) return if pLaunchShip.IsCloaked(): # No we can't launch Ships while cloaked print("Sorry, can't launch while cloaked") return if not hasattr(pFTBCarrier, "GetLaunchers"): # Our previous Ship maybe destroyed or is not configured to have Shuttles pShipMenu.SetName(App.TGString("None" + " " + "Selected")) return pFTBLauncher = pFTBCarrier.GetLaunchers()[0] sShipName = pFTBLauncher.GetLaunchType() # test for the right selection here. if (launchTypeSaveNum != pFTBLauncher.GetNumLaunches(sShipName) or str(launchTypeSave) != str(sShipName)): ToggleLaunchType(None, None) return ftb.FTB_MissionLib.LaunchShip(pLaunchShip) if( pFTBLauncher.HasMoreLaunches( sShipName) == 0): pFTBLauncher.NextLaunchType() launchTypeSave = pFTBLauncher SetToggleLaunchButton() pLaunchButton[0].SetDisabled()
def MultiPlayerEnableCollisionWith(pObject1, pObject2, CollisionOnOff): # Setup the stream. # Allocate a local buffer stream. debug(__name__ + ", MultiPlayerEnableCollisionWith") kStream = App.TGBufferStream() # Open the buffer stream with a 256 byte buffer. kStream.OpenBuffer(256) # Write relevant data to the stream. # First write message type. kStream.WriteChar(chr(NO_COLLISION_MESSAGE)) # send Message kStream.WriteInt(pObject1.GetObjID()) kStream.WriteInt(pObject2.GetObjID()) kStream.WriteInt(CollisionOnOff) pMessage = App.TGMessage_Create() # Yes, this is a guaranteed packet pMessage.SetGuaranteed(1) # Okay, now set the data from the buffer stream to the message pMessage.SetDataFromStream(kStream) # Send the message to everybody but me. Use the NoMe group, which # is set up by the multiplayer game. # TODO: Send it to asking client only pNetwork = App.g_kUtopiaModule.GetNetwork() if not App.IsNull(pNetwork): if App.g_kUtopiaModule.IsHost(): pNetwork.SendTGMessageToGroup("NoMe", pMessage) else: pNetwork.SendTGMessage(pNetwork.GetHostID(), pMessage) # We're done. Close the buffer. kStream.CloseBuffer()
def GetStatusInfo(self): debug(__name__ + ", GetStatusInfo") return "ConditionInSet(%s, %s) is %s" % ( self.sObjectName, self.sSetName, ("False", "True")[self.pCodeCondition.GetStatus()], )
def StopFiring(self): debug(__name__ + ", StopFiring") pTarget = self.GetTarget() if pTarget: for pWeaponSystem in self.lWeapons: pWeaponSystem.StopFiringAtTarget(pTarget)
def Accept(pObject, pEvent): debug(__name__ + ", Accept") global pMainPane, pPane # A bugfix try: pGame = App.Game_GetCurrentGame() pEpisode = pGame.GetCurrentEpisode() pMission = pEpisode.GetCurrentMission() App.g_kEventManager.RemoveBroadcastHandler(ET_ACCEPT, pMission, __name__ + ".Accept") App.g_kEventManager.RemoveBroadcastHandler(ET_DECLINE, pMission, __name__ + ".Decline") except: pass pTCW = App.TacticalControlWindow_GetTacticalControlWindow() # New way of getting rid of a window, destroy it. App.g_kFocusManager.RemoveAllObjectsUnder(pPane) pTCW.DeleteChild(pPane) pPane = None pMainPane = None MissionTittle(None, None) MissionInitiate(None, None)
def UsePlayerSettings(self, bDisableOnly = 0): debug(__name__ + ", UsePlayerSettings") self.SetAttackDisabled(not bDisableOnly) self.SetAttackWithoutValidSubsystems(not bDisableOnly) self.bHighPower = not bDisableOnly self.bChangePowerSetting = 0 self.bHullSelectedChooseAlternate = bDisableOnly
def SetTarget(self, sName): debug(__name__ + ", SetTarget") "Change to a new target." self.StopFiring() self.sTarget = sName self.idTargetedSubsystem = None
def SetEnabled(self, bEnabled): debug(__name__ + ", SetEnabled") if self.bEnabled != bEnabled: if self.bEnabled: self.StopFiring() self.bEnabled = bEnabled
def CodeAISet(self): # Further initialization we can do once our self.pCodeAI # member has been set. # Register external functions. debug(__name__ + ", CodeAISet") self.pCodeAI.RegisterExternalFunction("SetTarget", { "Name" : "SetTarget" } )
def MPCreateTorp(sShipName, pos, pcTorpScriptName, pTargetObjID, pTargetSubsystemObjID): debug(__name__ + ", MPCreateTorp") pShip = MissionLib.GetShip(sShipName) if pShip: pSet = pShip.GetContainingSet() #print("Status: ", pShip.GetName(), "fires on", App.ShipClass_GetObjectByID(None, pTargetObjID)) FireTorpFromPoint(None, pos, pcTorpScriptName, pShip.GetObjID(), pTargetObjID, pTargetSubsystemObjID, 0.0, pSet.GetName())
def GetShuttlesInBay(sFiringShipName = None): debug(__name__ + ", GetShuttlesInBay") if not sFiringShipName: sFiringShipName = App.Game_GetCurrentPlayer().GetName() pCarrier = ftb.ShipManager.GetShip(MissionLib.GetShip(sFiringShipName)) if not hasattr(pCarrier, "GetLaunchers"): return pLaunchers = pCarrier.GetLaunchers() numTypes = len( pLaunchers) numLaunches = 0 for index in range( numTypes): launchType = pLaunchers[index].GetLaunchType() """if (string.find(str(launchType), 'Mine') == -1): numLaunches = pLaunchers[index].GetNumLaunches( launchType) else: numLaunches = 0""" launchType = pLaunchers[index].NextLaunchType() firstlaunchType = None i = 0 while (launchType != firstlaunchType): print launchType, pLaunchers[index].GetNumLaunches(launchType), firstlaunchType if (launchType != firstlaunchType): #and string.find(str(launchType), 'Mine') == -1): numLaunches = numLaunches + pLaunchers[index].GetNumLaunches(launchType) if (i == 0): firstlaunchType = launchType launchType = pLaunchers[index].NextLaunchType() if ( i > 10 ): # This makes sure the Game is not crashing if we have 0 Shuttles in Bay. return 0 i = i + 1 return numLaunches
def MissionInitiate(pObject, pEvent): # Grab some values debug(__name__ + ", MissionInitiate") pGame = App.Game_GetCurrentGame() pEpisode = pGame.GetCurrentEpisode() pMission = pEpisode.GetCurrentMission() MissionLib.CreateTimer(DS9FXMenuLib.GetNextEventType(), __name__ + ".DisableDS9FXMenuButtons", App.g_kUtopiaModule.GetGameTime() + 10, 0, 0) # Start up a Mission Placement Handler App.g_kEventManager.AddBroadcastPythonFuncHandler(App.ET_ENTERED_SET, pMission, __name__ + ".MissionPlacement") App.g_kEventManager.AddBroadcastPythonFuncHandler(App.ET_ENTERED_SET, pMission, __name__ + ".DisableButtons") App.g_kEventManager.AddBroadcastPythonFuncHandler(App.ET_OBJECT_EXPLODING, pMission, __name__ + ".PlayerExploding") if pIntroVid == 1: # Play the DS9FX Intro Movie from Custom.DS9FX.DS9FXVids import DS9FXIntroVideo DS9FXIntroVideo.PlayMovieSeq(None, None) else: pass
def IncreaseShuttleCount(ShipType, sFiringShipName = None): debug(__name__ + ", IncreaseShuttleCount") verbose_print("Trying to increase Shuttle Count") if (sFiringShipName == None): verbose_print("Problem: No Firing Ship - Using Players Ship as default") sFiringShipName = MissionLib.GetPlayer() pShip = MissionLib.GetShip(sFiringShipName) pCarrier = ftb.ShipManager.GetShip(pShip) ShuttleCount = ShuttlesInBayOfThisType(ShipType, sFiringShipName) verbose_print("ShipType:", ShipType, "ShipCount1: ", ShuttleCount) sBay = GetFirstShuttleBayName(sFiringShipName) if hasattr(pCarrier, "dShuttleToBay") and pCarrier.dShuttleToBay.has_key(ShipType): sBay = pCarrier.dShuttleToBay[ShipType] launcher = ftb.LauncherManager.GetLauncher(sBay, pShip) if ShuttleCount == 0: launcher.AddLaunchable(ShipType, "ftb.friendlyAI", 1) launcher.SetClearToLaunch(1) else: launcher.AddLaunchable(ShipType, "ftb.friendlyAI", ShuttleCount + 1) launcher.SetClearToLaunch(1) # and finally reload the Button - yeah we fixed the damm Problem! ftb.LaunchShipHandlers.SetToggleLaunchButton() verbose_print("ShipCount2: ", ShuttlesInBayOfThisType(ShipType, sFiringShipName))
def Quit(): debug(__name__ + ", Quit") global pMainPane, pPane if not pPane == None: # A bugfix try: pGame = App.Game_GetCurrentGame() pEpisode = pGame.GetCurrentEpisode() pMission = pEpisode.GetCurrentMission() App.g_kEventManager.RemoveBroadcastHandler(ET_ACCEPT, pMission, __name__ + ".Accept") App.g_kEventManager.RemoveBroadcastHandler(ET_DECLINE, pMission, __name__ + ".Decline") except: pass pTCW = App.TacticalControlWindow_GetTacticalControlWindow() # Destroy the window App.g_kFocusManager.RemoveAllObjectsUnder(pPane) pTCW.DeleteChild(pPane) pPane = None
def StartWindow(): # Bring up the modal dialog debug(__name__ + ", StartWindow") pTopWindow = App.TopWindow_GetTopWindow() pOptionsWindow = pTopWindow.FindMainWindow(App.MWT_OPTIONS) pModalDialogWindow = App.ModalDialogWindow_Cast(pTopWindow.FindMainWindow(App.MWT_MODAL_DIALOG)) # Define events pCloseEvent = App.TGStringEvent_Create() pCloseEvent.SetEventType(ET_CLOSE) pCloseEvent.SetString("Closing") pCloseEvent.SetDestination(pOptionsWindow) # Load the database pDatabase = App.g_kLocalizationManager.Load("data/TGL/DS9FXPromptDatabase.tgl") pTitle = pDatabase.GetString("Title") pText = pDatabase.GetString("Text") pClose = pDatabase.GetString("Close") # Unload database App.g_kLocalizationManager.Unload(pDatabase) # Run the dialog window pModalDialogWindow.Run(pTitle, pText, pClose, pCloseEvent, None, None)
def HandleKeyboard(pPane, pEvent): debug(__name__ + ", HandleKeyboard") global SeqID # Basically this is from main menu KeyType = pEvent.GetKeyState() CharCode = pEvent.GetUnicode() # Check if esc key was pressed if KeyType == App.TGKeyboardEvent.KS_KEYUP: if (CharCode == App.WC_ESCAPE): pSequence = App.TGSequence_Cast(App.TGObject_GetTGObjectPtr(SeqID)) try: pSequence.Skip() except: pass SeqID = App.NULL_ID BackToNormal(None) pEvent.SetHandled() if (pEvent.EventHandled() == 0): pPane.CallNextHandler(pEvent)
def TowingShipEnteredSet(pTowingShip, pEvent): debug(__name__ + ", TowingShipEnteredSet") try: # Look for this ship in the Towing to Towee dictionary. try: idTowee = g_dTowingToToweeMatches[pTowingShip.GetObjID()] except KeyError: return # Get the towed object. pTowTarget = App.ObjectClass_GetObjectByID(None, idTowee) if not pTowTarget: return # Get the set we were just moved into. pSet = pTowingShip.GetContainingSet() if pSet: # Move the towed ship into the new set. Don't # touch it if it's not in a set, though, because # that probably means it's in the process of being # deleted. pTowSet = pTowTarget.GetContainingSet() if pTowSet and (pTowSet.GetName() != pSet.GetName()): # debug("Warp, event handler moving object %s after object %s, from set %s to set %s" % # (pTowTarget.GetName(), pTowingShip.GetName(), pTowSet.GetName(), pSet.GetName())) pTowSet.RemoveObjectFromSet(pTowTarget.GetName()) pSet.AddObjectToSet(pTowTarget, pTowTarget.GetName()) # Always call the next handler before we exit. finally: pTowingShip.CallNextHandler(pEvent)
def ExitMovie(pAction): # Grab some values again and switch out of movie mode debug(__name__ + ", ExitMovie") App.g_kMovieManager.SwitchOutOfMovieMode() pTopWindow = App.TopWindow_GetTopWindow() if (pTopWindow == None): return None pTopWindow.SetVisible() # Restore all options back to default pTopWindow.DisableOptionsMenu(0) pTopWindow.AllowMouseInput(1) # Game unpaused App.g_kUtopiaModule.Pause(0) # Music Enabled App.g_kMusicManager.SetEnabled(1) try: # A hack bugfix pTop = App.TopWindow_GetTopWindow() pTop.ForceBridgeVisible() pTop.ForceTacticalVisible() except: pass return 0
def CreateMenu(sNewMenuName, sBridgeMenuName): debug(__name__ + ", CreateMenu") pMenu = GetBridgeMenu(sBridgeMenuName) pNewMenu = App.STMenu_Create(sNewMenuName) pMenu.PrependChild(pNewMenu) return pNewMenu
def MissionStart(): #### REGISTER EVENT HANDLERS #App.ET_INPUT_CLEAR_SECONDARY_TARGETS = ftb.FTB_MissionLib.GetFTBNextEventType() #App.ET_INPUT_TOGGLE_SECONDARY_TARGET = ftb.FTB_MissionLib.GetFTBNextEventType() debug(__name__ + ", MissionStart") lEventHandlerMap = ( (App.ET_INPUT_CLEAR_SECONDARY_TARGETS, __name__ + ".ClearSecondaryTargets"), (App.ET_INPUT_TOGGLE_SECONDARY_TARGET, __name__ + ".ToggleSecondaryTarget"), (App.ET_INPUT_FIRE_TERTIARY, __name__ + ".FireTertiaryWeaponsOnList"), (App.ET_INPUT_FIRE_SECONDARY, __name__ + ".FireSecondaryWeaponsOnList"), (App.ET_INPUT_FIRE_PRIMARY, __name__ + ".FirePrimaryWeaponsOnList"), ) for eType, sFunc in lEventHandlerMap: App.g_kEventManager.AddBroadcastPythonFuncHandler( eType, App.Game_GetCurrentGame(), sFunc) # Buttons pMenu = ftb.GUIUtils.GetTacticalMenu() pSTMenu = App.STMenu_CreateW(App.TGString("Secondary Targetting")) if pSTMenu: pMenu.AddChild(pSTMenu) pTakeTargetButton = ftb.GUIUtils.CreateIntButton("take secondary Target", App.ET_INPUT_TOGGLE_SECONDARY_TARGET, MissionLib.GetMission(), 0) pSTMenu.PrependChild(pTakeTargetButton) pclearTargetsButton = ftb.GUIUtils.CreateIntButton("clear sec Targets", App.ET_INPUT_CLEAR_SECONDARY_TARGETS, MissionLib.GetMission(), 0) pSTMenu.PrependChild(pclearTargetsButton)
def ObjectKilledHandler(pObject, pEvent): debug(__name__ + ", ObjectKilledHandler") pKilledObject = pEvent.GetDestination() if pKilledObject.IsTypeOf(App.CT_SHIP): pShip = App.ShipClass_Cast(pKilledObject) ftb.ShipManager.RemoveShip(pShip) pObject.CallNextHandler(pEvent)
def GetScriptFromSpecies (iSpecies): debug(__name__ + ", GetScriptFromSpecies") if (iSpecies <= 0 or iSpecies >= MAX_SYSTEMS): return None pSpecTuple = kSpeciesTuple [iSpecies] return pSpecTuple [1]
def DeleteObjectFromSet(pSet, pShip): debug(__name__ + ", DeleteObjectFromSet") pShip.SetDead() pShip.SetDeleteMe(1) pSet.DeleteObjectFromSet(pShip.GetName()) pNetwork = App.g_kUtopiaModule.GetNetwork() # Now send a message to everybody else that the score was updated. # allocate the message. pMessage = App.TGMessage_Create() pMessage.SetGuaranteed(1) # Yes, this is a guaranteed packet # Setup the stream. kStream = App.TGBufferStream() # Allocate a local buffer stream. kStream.OpenBuffer(Multiplayer.MissionShared.NET_BUFFER_SIZE) # Open the buffer stream with byte buffer. # Write relevant data to the stream. # First write message type. kStream.WriteChar(chr(DELETE_OBJECT_FROM_SET_MSG)) kStream.WriteInt(pShip.GetObjID()) # Okay, now set the data from the buffer stream to the message pMessage.SetDataFromStream(kStream) if not App.IsNull(pNetwork): if App.g_kUtopiaModule.IsHost(): pNetwork.SendTGMessageToGroup("NoMe", pMessage) else: pNetwork.SendTGMessage(pNetwork.GetHostID(), pMessage) # We're done. Close the buffer. kStream.CloseBuffer()
def GetShuttleOEP(pShip): # Find any object emitter properties on the ship. debug(__name__ + ", GetShuttleOEP") pPropSet = pShip.GetPropertySet() pEmitterInstanceList = pPropSet.GetPropertiesByType(App.CT_OBJECT_EMITTER_PROPERTY) pEmitterInstanceList.TGBeginIteration() iNumItems = pEmitterInstanceList.TGGetNumItems() pLaunchProperty = None for i in range(iNumItems): pInstance = pEmitterInstanceList.TGGetNext() # Check to see if the property for this instance is a shuttle # emitter point. pProperty = App.ObjectEmitterProperty_Cast(pInstance.GetProperty()) if (pProperty != None): # If we have the right type of OEP, bail now if (pProperty.GetEmittedObjectType() == App.ObjectEmitterProperty.OEP_SHUTTLE): pLaunchProperty = pProperty break pEmitterInstanceList.TGDoneIterating() pEmitterInstanceList.TGDestroy() return(pLaunchProperty)
def SendMessageToHost(pMessage, kStream): debug(__name__ + ", SendMessageToHost") pNetwork = App.g_kUtopiaModule.GetNetwork() pMessage.SetDataFromStream(kStream) if not App.IsNull(pNetwork): pNetwork.SendTGMessage(pNetwork.GetHostID(), pMessage) kStream.CloseBuffer()
def PulseFire(pShip, pTarget, pTargetSubsystem, pSet): debug(__name__ + ", PulseFire") if pTarget: pTargetObjID = pTarget.GetObjID() else: pTargetObjID = App.NULL_ID # no dummy fire if not pTarget: return if pTargetSubsystem: pTargetSubsystemObjID = pTargetSubsystem.GetObjID() else: pTargetSubsystemObjID = App.NULL_ID pPulseSystem = pShip.GetPulseWeaponSystem() if not pPulseSystem or not pPulseSystem.IsOn(): return for pChild in range(pPulseSystem.GetNumChildSubsystems()): pLauncher=App.PulseWeapon_Cast(pPulseSystem.GetChildSubsystem(pChild)) if pTarget and not pLauncher.IsInArc(pTarget.GetWorldLocation()): continue if pLauncher.GetChargeLevel() >= pLauncher.GetMinFiringCharge() and not pLauncher.IsDumbFire(): pLauncher.SetChargeLevel(pLauncher.GetChargeLevel() - pLauncher.GetNormalDischargeRate()) if App.g_kUtopiaModule.IsMultiplayer(): # inform other hosts MPSendTorpMessage(pShip.GetName(), pLauncher.GetWorldLocation(), pLauncher.GetProperty().GetModuleName(), pTargetObjID, pTargetSubsystemObjID) FireTorpFromPoint(None, pLauncher.GetWorldLocation(), pLauncher.GetProperty().GetModuleName(), pShip.GetObjID(), pTargetObjID, pTargetSubsystemObjID, 0.0, pSet.GetName())