Yes I remember that episode.
Updated code, still alpha, code untested
## Install Cloak
##
## By JB2005 & Tethys
##
## v0.2
##
## Change Log:
##
## - Replaced Button Script (QBautostart must be installed for this script to work, Ambiguity relies on QBReplacement being installed!)
## - Added a Check:
## - If a Cloaking Device is installed, the button fails and hides itself
## - When the Player Ship Changes, it checks if it has a cloaking device and hides / reveals the button
## - Added some comments to show what we've done (for the benefit of uploading this file to BCC!
##
## v0.2.1
##
## Change Log:
## - Changed PrependChild to AddChild (Moves to the Bottom of Brex's Screen)
## - Added Countdown Timer (def Countdown1 + def Countdown2) - each is called after 1 second and drops 1 second from a global property.
## Once pCounter reaches 0, it adds a Cloaking Device!
## v0.2.2
##
## Change Log:
## - Changed pCounter from 10 (seconds) to a multiplied value for installation time based upon subsystem max condition and repair complexity.
## - Moved def AddWarpCore to keep the file organized. (It's going to get a lot longer before its finished)
## v0.2.3
##
## Change Log:
## - Added imports for Tactical menu so we can get our Infiltration Team coded, so we can steal subsystems
## - Added some defs for the Infiltration Team
## - pCounter is now based on the MaxCondition and RepairComplexity of the ship from which it was stolen
## - Removed (def Countdown2) and other duplicate counters and adjusted the calls accordingly (changed some names for easier searching);
## Only one Countdown def is needed to loop back to itself until *Counter = 0
## -
## -
## -
## ToDo:
## * Add imports for subsystems
## * Link GetMaxCondition and GetRepairComplexity to their own descriptors
## * Rewrite pCounter again with above imports
## * Change name of pCounter to pCloakCounter as we will probably be adding more unique globals for p(Subsystem)Counter for each subsystem
## * Begin writing additional defs for additional subsystems to install
## * Change (pTargetattr.GetShields().GetCurShields(App.ShieldClass.FRONT_SHIELDS) < 800000): back to < 800
## * Change (pMission.GetFriendlyGroup().IsNameInGroup(pTarget.GetName())): back to #GetEnemyGroup
import App
import MissionLib
import Libs.LibEngineering
import Lib.LibEngineering
import Bridge.BridgeUtils
from Libs.LibQBautostart import *
# Mod Info Block. Used for MP loading.
MODINFO = { "Author": "JB2005 & Tethys",
"Version": "0.2.3",
"License": "GPL",
"Description": "Install Cloaking Device",
"needBridge": 0
}
#pXOMenu = Lib.LibEngineering.GetBridgeMenu("XO")
pBrexMenu = Lib.LibEngineering.GetBridgeMenu("Engineering")
pFelixMenu = Lib.LibEngineering.GetBridgeMenu("Tactical")
GOTO_ENGINEERING = App.Mission_GetNextEventType()
pGame = App.Game_GetCurrentGame()
pEpisode = pGame.GetCurrentEpisode()
pMission = pEpisode.GetCurrentMission()
pPlayer = pGame.GetPlayer()
pTarget = pPlayer.GetTarget()
pCoreCounter = None
pCounter = None
pInfiCounter = None
pCloakButton = None
pWarpButton = None
pReset = None
pSendButton = None
pRecallButton = None
pCloakData = None
def init():
global pCloakButton, pWarpButton, pReset, pSendButton, pRecallButton, pCloakData
pMenu = App.STMenu_CreateW(App.TGString("Fabrications")) #WIP, will contain subsystem blueprint data stolen from other ships
pBrexMenu.AddChild(pMenu)
pTacMenu = App.STMenu_CreateW(App.TGString("Away Team")) #WIP
pFelixMenu.AddChild(pTacMenu)
pInfiMenu = App.STMenu_CreateW(App.TGString("Infiltrate")) #WIP
pTacMenu.AddChild(pInfiMenu)
pSubsMenu = App.STMenu_CreateW(App.TGString("Available Data")) #WIP, will contain available subsystem data to steal from other ships
pInfiMenu.AddChild(pSubsMenu)
# pReset = Lib.LibEngineering.CreateMenuButton("Reset List", "Engineering", __name__ + ".ResetList", ToButton = pMenu)
pCloakButton = Lib.LibEngineering.CreateMenuButton("Cloaking Device", "Engineering", __name__ + ".ButtonTimer", ToButton = pMenu) #add an install simulation timer
pWarpButton = Lib.LibEngineering.CreateMenuButton("Warp Core", "Engineering", __name__ + ".CoreTimer", ToButton = pMenu) #add an install simulation timer
pSendButton = Lib.LibEngineering.CreateMenuButton("Send Team", "Tactical", __name__ + ".CheckPossible", ToButton = pInfiMenu) #send the away team
pRecallButton = Lib.LibEngineering.CreateMenuButton("Recall Team", "Tactical", __name__ + ".RecallTeam", ToButton = pTacMenu) #recall the away team
pCloakData = Lib.LibEngineering.CreateMenuButton("Cloak Data", "Tactical", __name__ + ".CloakData", ToButton = pSubsMenu) #data button for target cloaking device
# pShieldData = Lib.LibEngineering.CreateMenuButton("Shield Data", "Tactical", __name__ + ".ShieldData", ToButton = pSubsMenu) #data button for target shield generator
# pTractorData = Lib.LibEngineering.CreateMenuButton("Tractor Data", "Tactical", __name__ + ".TractorData", ToButton = pSubsMenu) #data button for target tractor beams
# pWeaponData = Lib.LibEngineering.CreateMenuButton("Weapon Data", "Tactical", __name__ + ".WeaponData", ToButton = pSubsMenu) #data button for target weapons
# pEngineData = Lib.LibEngineering.CreateMenuButton("Engine Data", "Tactical", __name__ + ".EngineData", ToButton = pSubsMenu) #data button for target engines
# pCoreData = Lib.LibEngineering.CreateMenuButton("Core Data", "Tactical", __name__ + ".CoreData", ToButton = pSubsMenu) #data button for target power core (we probably wont use this one)
# pShieldData.SetNotVisible()
# pTractorData.SetNotVisible()
# pWeaponData.SetNotVisible()
# pEngineData.SetNotVisible()
# pCoreData.SetNotVisible()
pRecallButton.SetDisabled()
pCloakData.SetNotVisible()
pCloakButton.SetNotVisible()
pWarpButton.SetNotVisible()
App.g_kEventManager.AddBroadcastPythonFuncHandler(App.ET_SET_PLAYER, pMission, __name__ + ".CheckShip")
App.g_kEventManager.AddBroadcastPythonFuncHandler(App.ET_OBJECT_EXPLODING, pMission, __name__ + ".ShipExploding")
def CheckPossible(pObject, pEvent):
# Need some checks here for target so we can allow or disallow the transport
pGame = App.Game_GetCurrentGame()
pEpisode = pGame.GetCurrentEpisode()
pMission = pEpisode.GetCurrentMission()
pPlayer = pGame.GetPlayer()
pTarget = pPlayer.GetTarget()
pTargetCast = App.ShipClass_Cast(pPlayer.GetTarget())
pTargetattr = App.ShipClass_Cast(pTarget)
# pCloakingDevice = pPlayer.GetCloakingSubsystem()
# pWarpCore = pPlayer.GetPowerSubsystem()
if not (pTarget): #No target, get us out of here
pSound = App.TGSound_Create("sfx/Maelstrom/Episode 7/Mission 2/E7M2L067.mp3", "NoLock", 0)
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("NoLock")
return
if (Distance(pTarget) > 300): #Test Distance
pSound = App.TGSound_Create("sfx/Maelstrom/Episode 7/Mission 2/E7M2L0672.mp3", "TooFar", 0)
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("TooFar")
print("Target is too far away: can't Transport")
return # try to find an offline Shield
if (pMission.GetFriendlyGroup().IsNameInGroup(pTarget.GetName())): #GetEnemyGroup
if (pTargetattr.GetShields() != None):
if (pTargetattr.GetShields().GetCurShields(App.ShieldClass.FRONT_SHIELDS) < 800000):
print ("Front Shield is Offline...beaming")
elif (pTargetattr.GetShields().GetCurShields(App.ShieldClass.REAR_SHIELDS) < 800000):
print ("After Shield is Offline...beaming")
elif (pTargetattr.GetShields().GetCurShields(App.ShieldClass.TOP_SHIELDS) < 800000):
print ("Top Shield is Offline...beaming")
elif (pTargetattr.GetShields().GetCurShields(App.ShieldClass.BOTTOM_SHIELDS) < 800000):
print ("Bottom Shield is Offline...beaming")
elif (pTargetattr.GetShields().GetCurShields(App.ShieldClass.LEFT_SHIELDS) < 800000):
print ("Left Shield is Offline...beaming")
elif (pTargetattr.GetShields().GetCurShields(App.ShieldClass.RIGHT_SHIELDS) < 800000):
print ("Right Shield is Offline...beaming")
else:
print ("No offline Shield...sorry")
pSound = App.TGSound_Create("sfx/Maelstrom/Episode 7/Mission 2/E7M2L0673.mp3", "CantLock", 0)
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("CantLock")
return
# We have disabled their shield generator. Transport over
pSound = App.TGSound_Create("sfx/Bridge/Crew/Tactical/gt018.mp3", "Locked", 0)
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("Locked")
pInstallTimer = MissionLib.CreateTimer(Libs.LibEngineering.GetEngineeringNextEventType(), __name__ + ".InfiltrationTeam", App.g_kUtopiaModule.GetGameTime() + 2, 0, 0)
def InfiltrationTeam(pObject, pEvent):
global pInfiCounter, pTargetName
pPlayer = MissionLib.GetPlayer()
pTarget = pPlayer.GetTarget()
pTargetattr = App.ShipClass_Cast(pTarget)
pTargetName = pTargetattr.GetName() #Use the name of the target to make things look better :P
# Lets give our team 30 seconds to come up with the blueprints for the system
# We could base this counter on something like Sensor subsystem GetCondition (this way you can reduce your InfiTime by damaging the Sensor subsystem) or something similar -Tethys
pInfiCounter = 30
MissionLib.TextBanner(None, App.TGString("Infiltrating " + str(pTargetName) + ": " + str(pInfiCounter) + " Seconds Remaining"), 0.35, 0.1, 0.9, 12, 1, 0)
pSound = App.TGSound_Create("sfx/Bridge/Crew/Engineering/LoweringShields.mp3", "Lowering", 0)
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("Lowering")
#Send Team disabled, cant send another team
pSendButton.SetDisabled() #Send Team
pBeamingTimer = MissionLib.CreateTimer(Libs.LibEngineering.GetEngineeringNextEventType(), __name__ + ".BeamingSFX", App.g_kUtopiaModule.GetGameTime() + 1.5, 0, 0)
pInfiTimer = MissionLib.CreateTimer(Libs.LibEngineering.GetEngineeringNextEventType(), __name__ + ".InfiCounter", App.g_kUtopiaModule.GetGameTime() + 1, 0, 0)
def InfiCounter(pObject,pEvent):
if pInfiCounter == 0:
AddStealableSystems()
return 0 #End this def here. This is why we only need the one countdown def -Tethys
else:
global pInfiCounter
pInfiCounter = pInfiCounter - 1
MissionLib.TextBanner(None, App.TGString("Infiltrating " + str(pTargetName) + ": " + str(pInfiCounter) + " Seconds Remaining"), 0.35, 0.1, 0.9, 12, 1, 0)
# Call this def again, until pInfiCounter = 0, then AddStealableSystems and end the loop -Tethys
pInstallTimer = MissionLib.CreateTimer(Libs.LibEngineering.GetEngineeringNextEventType(), __name__ + ".InfiCounter", App.g_kUtopiaModule.GetGameTime() + 1, 0, 0)
def AddStealableSystems():
pPlayer = MissionLib.GetPlayer()
pTarget = pPlayer.GetTarget()
pTargetCast = App.ShipClass_Cast(pPlayer.GetTarget())
pTargetattr = App.ShipClass_Cast(pTarget)
pSound = App.TGSound_Create("sfx/Maelstrom/Episode 5/Mission 4/E5M4FelixComm2.mp3", "StandingBy", 0)
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("StandingBy")
# Found out this stuff here resets the entire ship including all the shield and hull values. No good :( we wanna keep those for a linear gameplay -Tethys
# pShip = pGame.GetPlayer()
# pGame.SetPlayer(pShip)
if not (pTargetattr.GetCloakingSubsystem() != None): #it must not have one
pCloakData.SetNotVisible() #No Mr.Data :(
pRecallButton.SetEnabled() #Allow Recall Team
# pOtherData.SetNotVisible()
# pSubsMenu.ResizeToContents()
return
elif (pTargetattr.GetCloakingSubsystem() != None): #if target has cloaking subsystem
pCloakData.SetVisible() #Mr.Data
pSubsMenu.ResizeToContents()
# pOtherData.SetVisible()
# pTacMenu.ResizeToContents()
return
def CloakData(pObject, pEvent):
pSound = App.TGSound_Create("sfx/Maelstrom/Episode 6/Mission 1/E6M1SavoyHail1.mp3", "IncomingHail", 0)
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("IncomingHail")
pDataTimer = MissionLib.CreateTimer(Libs.LibEngineering.GetEngineeringNextEventType(), __name__ + ".CloakData1", App.g_kUtopiaModule.GetGameTime() + 5, 0, 0)
# pBeepTimer = MissionLib.CreateTimer(Libs.LibEngineering.GetEngineeringNextEventType(), __name__ + ".BeepSounds2", App.g_kUtopiaModule.GetGameTime() + 3.5, 0, 0)
# pBeepTimer = MissionLib.CreateTimer(Libs.LibEngineering.GetEngineeringNextEventType(), __name__ + ".BeepSounds2", App.g_kUtopiaModule.GetGameTime() + 3.5, 0, 0)
pCloakData.SetNotVisible()
pSubsMenu.ResizeToContents()
def CloakData1(pObject, pEvent):
pGame = App.Game_GetCurrentGame()
pEpisode = pGame.GetCurrentEpisode()
pMission = pEpisode.GetCurrentMission()
pPlayer = pGame.GetPlayer()
pCloakingDevice = pPlayer.GetCloakingSubsystem()
pSound = App.TGSound_Create("sfx/Maelstrom/Episode 5/Mission 4/E5M4FelixComm2.mp3", "StandingBy", 0)
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("StandingBy")
if pCloakingDevice: #If we have a cloak, disallow cloak data and allow us to beam back
pCloakButton.SetNotVisible() #We already have a cloaking device, no reason to install another
pRecallButton.SetEnabled() #Allow us to transport back
# pSubsMenu.ResizeToContents()
return #end
if not pCloakingDevice: #We don't have a cloaking device, make the button so we can install one
pCloakButton.SetVisible() #Engineering you get to work now
pRecallButton.SetEnabled() #Allow us to transport back
# pSubsMenu.SetVisible()
# pSubsMenu.ResizeToContents()
return #end
def RecallTeam(pObject, pEvent):
# We could get fancy here and require the target shields to remain down to beam back, or we can simply say that Felix downloaded the
# shield frequency and bypassed the shields for transport. Regardless, we will probably need to be within 50 km... so we need our Distance...
pBeepTimer = MissionLib.CreateTimer(Libs.LibEngineering.GetEngineeringNextEventType(), __name__ + ".BeepSounds", App.g_kUtopiaModule.GetGameTime() + 0, 0, 0)
pBeepTimer = MissionLib.CreateTimer(Libs.LibEngineering.GetEngineeringNextEventType(), __name__ + ".BeepSounds1", App.g_kUtopiaModule.GetGameTime() + 1.5, 0, 0)
pRecallTimer = MissionLib.CreateTimer(Libs.LibEngineering.GetEngineeringNextEventType(), __name__ + ".RecallActions", App.g_kUtopiaModule.GetGameTime() + 2.5, 0, 0)
def RecallActions(pObject, pEvent):
pSound = App.TGSound_Create("sfx/Maelstrom/Episode 7/Mission 6/E7M6L048.mp3", "Aboard", 0) #E7M6L048
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("Aboard")
pRecallButton.SetDisabled()
pSendButton.SetEnabled()
pBeamingTimer = MissionLib.CreateTimer(Libs.LibEngineering.GetEngineeringNextEventType(), __name__ + ".BeamingSFX", App.g_kUtopiaModule.GetGameTime() + 1.5, 0, 0)
def ButtonTimer(pObject, pEvent):
global pCounter
# Begin importing stuff for pCounter dynamic value; based on pTarget cloaking device subsystem
pPlayer = MissionLib.GetPlayer()
pTarget = pPlayer.GetTarget()
pTargetCast = App.ShipClass_Cast(pPlayer.GetTarget())
pTargetattr = App.ShipClass_Cast(pTarget)
pTCloak = pTargetattr.GetCloakingSubsystem()
MaxCond = pTCloak.GetMaxCondition()
RepairComp = pTCloak.GetRepairComplexity()
#pCounter = 10 #Can we make this dependent on subsystem max health * subsystem repair complexity?
pCounter = (0.01 * MaxCond * RepairComp) #Bob the Builder said Yes We Can!
# #pCounter must be fractional since MaxCond * RepairComp will produce insanely high numbers causing realistic install
# #times (we need to multiply by fractions of 1 for ease of gameplay)
# #If MaxCond = 3000.000000
# #If RepairComp = 7.000000
# #If Fractional = 0.01
# #For example if: pCounter = (0.01 * GetMaxCondition * GetRepairComplexity)
# #pCounter = 210 #(3.5 minutes)
# #For example if: pCounter = (0.02 * GetMaxCondition * GetRepairComplexity)
# #pCounter = 420 #(7 minutes) A far more realistic install time in relation to cooldown times of countless mods :)
# #For example if: pCounter = (0.03 * GetMaxCondition * GetRepairComplexity)
# #pCounter = 630 #(10.5 minutes) #You could go up to 0.05 but it makes a 17 minute install time.
MissionLib.TextBanner(None, App.TGString("Installating Cloaking Device: " + str(pCounter) + " Seconds Remaining"), 0.35, 0.1, 0.9, 12, 1, 0)
pSound = App.TGSound_Create("sfx/Bridge/Crew/Engineering/ge151.mp3", "EngTeamGo", 0)
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("EngTeamGo")
# Disable all the buttons, we only have so many engineers...
pCloakButton.SetDisabled()
pWarpButton.SetDisabled()
pInstallTimer = MissionLib.CreateTimer(Libs.LibEngineering.GetEngineeringNextEventType(), __name__ + ".CloakCounter", App.g_kUtopiaModule.GetGameTime() + 1, 0, 0)
def CloakCounter(pObject,pEvent):
# if pCounter == 1:
# Get the current states of all our subsystems...
# PlayerCurrentValues()
if pCounter == 0:
AddCloakingDevice()
pCloakButton.SetEnabled()
pWarpButton.SetEnabled()
return 0
else:
global pCounter
pCounter = pCounter - 1
MissionLib.TextBanner(None, App.TGString("Installating Cloaking Device: " + str(pCounter) + " Seconds Remaining"), 0.35, 0.1, 0.9, 12, 1, 0)
pInstallTimer = MissionLib.CreateTimer(Libs.LibEngineering.GetEngineeringNextEventType(), __name__ + ".CloakCounter", App.g_kUtopiaModule.GetGameTime() + 1, 0, 0)
def AddCloakingDevice():
pSound = App.TGSound_Create("sfx/Bridge/Crew/Engineering/ge111.mp3", "EngTeamDone", 0)
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("EngTeamDone")
#Loads our new Hardpoint on top of the existing hardpoint - use once only!
pCloakingDevice = pPlayer.GetCloakingSubsystem()
if pCloakingDevice:
pCloakButton.SetNotVisible()
pBrexMenu.SetVisible()
return
else:
pPropertySet = pPlayer.GetPropertySet()
mod = __import__('Custom.QBautostart.CloakingDevice')
mod.LoadPropertySet(pPropertySet)
pPlayer.SetupProperties()
#Reload the Player Ship - fully integrates the new component! (but also kills gameplay, we need to fix the subsystems)
pShip = pGame.GetPlayer()
pGame.SetPlayer(pShip)
pCloakButton.SetNotVisible()
pBrexMenu.SetVisible()
# Put all our subsystem values back to what they were before we got reset (WIP)
# FixPlayerSubsystems()
"""def FixPlayerSubsystems(pObject, pEvent):
def PlayerCurrentValues(pObject, pEvent):
global
pGame = App.Game_GetCurrentGame()
pEpisode = pGame.GetCurrentEpisode()
pMission = pEpisode.GetCurrentMission()
pPlayer = pGame.GetPlayer()"""
def CoreTimer(pObject, pEvent):
global pCoreCounter
#pCounter = 10 #Can we make this dependent on subsystem max health * subsystem repair complexity?
pCoreCounter = (0.001 * 5000.000000 * 2.200000) #(For now we add the static value of the stock cloaking device rather than import it; we can do that later)
# #pCounter must be fractional since MaxCond * RepairComp will produce insanely high numbers causing realistic install
# #times (we need to multiply by fractions of 1 for ease of gameplay)
# #If MaxCond = 3000.000000
# #If RepairComp = 7.000000
# #For example if: pCounter = (0.01 * GetMaxCondition * GetRepairComplexity)
# #pCounter = 210 #(3.5 minutes)
# #For example if: pCounter = (0.02 * GetMaxCondition * GetRepairComplexity)
# #pCounter = 420 #(7 minutes) A far more realistic install time in relation to cooldown times of countless mods :)
# #For example if: pCounter = (0.03 * GetMaxCondition * GetRepairComplexity)
# #pCounter = 630 #(10.5 minutes) #You could go up to 0.05 but it makes a 17 minute install time.
MissionLib.TextBanner(None, App.TGString("Installating Warp Core " + str(pCounter) + " Seconds Remaining"), 0.35, 0.1, 0.9, 12, 1, 0)
pSound = App.TGSound_Create("sfx/Bridge/Crew/Engineering/ge151.mp3", "EngTeamGo", 0)
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("EngTeamGo")
# Disable all the buttons, we only have so many engineers...
pCloakButton.SetDisabled()
pWarpButton.SetDisabled()
pInstallTimer = MissionLib.CreateTimer(Libs.LibEngineering.GetEngineeringNextEventType(), __name__ + ".CoreCounter", App.g_kUtopiaModule.GetGameTime() + 1, 0, 0)
def CoreCounter(pObject,pEvent):
if pCoreCounter == 0:
AddWarpCore()
pCloakButton.SetEnabled()
pWarpButton.SetEnabled()
return 0
else:
global pCoreCounter
pCoreCounter = pCoreCounter - 1
MissionLib.TextBanner(None, App.TGString("Installating Warp Core " + str(pCoreCounter) + " Seconds Remaining"), 0.35, 0.1, 0.9, 12, 1, 0)
pInstallTimer = MissionLib.CreateTimer(Libs.LibEngineering.GetEngineeringNextEventType(), __name__ + ".CoreCounter", App.g_kUtopiaModule.GetGameTime() + 1, 0, 0)
def AddWarpCore():
pSound = App.TGSound_Create("sfx/Bridge/Crew/Engineering/ge111.mp3", "EngTeamDone", 0)
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("EngTeamDone")
#Loads our new Hardpoint on top of the existing hardpoint - use once only!
pWarpCore = pPlayer.GetPowerSubsystem()
if pWarpCore:
pWarpButton.SetNotVisible()
pBrexMenu.SetVisible()
return
else:
pPropertySet = pPlayer.GetPropertySet()
mod = __import__('Custom.QBautostart.WarpCore')
mod.LoadPropertySet(pPropertySet)
pPlayer.SetupProperties()
#Reload the Player Ship - fully integrates the new component!
pShip = pGame.GetPlayer()
pGame.SetPlayer(pShip)
pWarpButton.SetNotVisible()
pBrexMenu.SetVisible()
# Get the Distance between the Player and pObject
def Distance(pObject):
debug(__name__ + ", Distance")
# pPlayer = App.Game_GetCurrentGame().GetPlayer()
vDifference = pObject.GetWorldLocation()
vDifference.Subtract(pPlayer.GetWorldLocation())
return vDifference.Length()
# Organize our sound effects...
def BeamingSFX(pObject, pEvent):
pSound = App.TGSound_Create("sfx/Interface/new_game3.wav", "Beaming", 0)
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("Beaming")
def BeepSounds(pObject, pEvent):
pSound = App.TGSound_Create("sfx/KM/computerbeep_33.wav", "Beeps", 0)
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("Beeps")
def BeepSounds1(pObject, pEvent):
pSound = App.TGSound_Create("sfx/KM/computerbeep_7.mp3", "Beeps1", 0)
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("Beeps1")
def BeepSounds2(pObject, pEvent):
pSound = App.TGSound_Create("sfx/KM/computer_activate.mp3", "Beeps2", 0)
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("Beeps2")
pSound = App.TGSound_Create("sfx/KM/computer_activate.mp3", "Beeps2a", 0)
pSound.SetSFX(0)
pSound.SetInterface(1)
App.g_kSoundManager.PlaySound("Beeps2a")
def ResetList(pObject, pEvent):
# This little bit of scripting checks when the player ship changes if a cloaking device is present - and if it is, gets rid of the button
# If there isn't one, it makes / keeps the button visible
# The code now also checks for subsystem presence on the target ship, and only allows us to install one if the target has one -Tethys
# Code needed for chance for success/failure, to tie in to Marines (Infiltration Teams) -Tethys
# This def may become obsolete soon... Button is disabled via init def
pGame = App.Game_GetCurrentGame()
pPlayer = pGame.GetPlayer()
pPlayerName = pPlayer.GetName()
pTarget = pPlayer.GetTarget()
pTargetCast = App.ShipClass_Cast(pPlayer.GetTarget())
pTargetattr = App.ShipClass_Cast(pTarget)
pCloakingDevice = pPlayer.GetCloakingSubsystem()
pWarpCore = pPlayer.GetPowerSubsystem()
# if not pTarget: #No target, get us out of here
# return
# if pTarget: #target confirmed, do stuff, and then continue on
# pTargetSubsystem = pTargetattr.GetCloakingSubsystem()
# if not pTargetSubsystem: #There is no cloaking device here, get us out of here
# pCloakButton.SetNotVisible()
# pMenu.ResizeToContents()
# return
# if pTargetSubsystem: #Subsystem present, do our thing
# pCloakingDevice = pPlayer.GetCloakingSubsystem()
# if not pCloakingDevice: #We don't have a cloaking device, make the button so we can install one
# pCloakButton.SetVisible()
# pBrexMenu.SetVisible()
# pMenu.ResizeToContents()
# return
# if not pCloakingDevice:
# pCloakButton.SetVisible()
# pBrexMenu.SetVisible()
# return
if not pWarpCore:
pWarpButton.SetVisible()
pBrexMenu.SetVisible()
return
if not pWarpCore.IsOn():
pWarpButton.SetVisible()
pBrexMenu.SetVisible()
return
if pWarpCore.IsDisabled():
pWarpButton.SetVisible()
pBrexMenu.SetVisible()
return
else:
pCloakButton.SetNotVisible()
pWarpButton.SetNotVisible()
pBrexMenu.SetVisible()
#pBrexMenu.SetNotVisible()
# Reset our counters when our condition changes
def CheckCounter(pObject, pEvent):
global pCounter
pCounter = 0
pTop = App.TopWindow_GetTopWindow()
pSubtitle = pTop.FindMainWindow(App.MWT_SUBTITLE)
pSubtitle.SetNotVisible()
def CheckInfiCounter(pObject, pEvent):
global pInfiCounter
pInfiCounter = 0
pTop = App.TopWindow_GetTopWindow()
pSubtitle = pTop.FindMainWindow(App.MWT_SUBTITLE)
pSubtitle.SetNotVisible()
# Handle our functions
def CheckShip(pObject, pEvent):
# This little bit of scripting checks when the player ship changes if a cloaking device is present - and if it is, gets rid of the button
# If there isn't one, it makes / keeps the button visible
pGame = App.Game_GetCurrentGame()
pPlayer = pGame.GetPlayer()
pPlayerName = pPlayer.GetName()
pCloakingDevice = pPlayer.GetCloakingSubsystem()
pWarpCore = pPlayer.GetPowerSubsystem()
if pCloakingDevice:
pCloakButton.SetNotVisible()
InstallCloakReset(None, None)
# pBrexMenu.SetNotVisible()
return
if pWarpCore:
pWarpButton.SetNotVisible()
# InstallCloakReset(None, None)
# pBrexMenu.SetNotVisible()
return
if pWarpCore.IsOn():
pWarpButton.SetNotVisible()
InstallCloakReset(None, None)
# pBrexMenu.SetNotVisible()
return
if not pWarpCore.IsDisabled():
pWarpButton.SetNotVisible()
InstallCloakReset(None, None)
# pBrexMenu.SetNotVisible()
return
else:
pCloakButton.SetVisible()
pWarpButton.SetVisible()
InstallCloakReset(None, None)
# pBrexMenu.SetVisible()
#pBrexMenu.SetNotVisible()
def ShipExploding(pObject, pEvent):
pPlayer = App.Game_GetCurrentGame().GetPlayer()
# Get the ship that is exploding.
pShip = App.ShipClass_Cast(pEvent.GetDestination())
if (pShip != None):
iShipID = pShip.GetObjID()
if pPlayer and pShip.GetName() == pPlayer.GetName():
# It's us. Reset.
InstallCloakReset(None, None)
def InstallCloakReset(pObject, pEvent):
global CheckCounter, CheckInfiCounter
pGame = App.Game_GetCurrentGame()
pEpisode = pGame.GetCurrentEpisode()
pMission = pEpisode.GetCurrentMission()
# delete enable button timer
# try:
# App.g_kTimerManager.DeleteTimer(EnableTimer.GetObjID())
# App.g_kRealtimeTimerManager.DeleteTimer(EnableTimer.GetObjID())
# EnableTimer = None
# except:
# pass
# reenable buttons
pSendButton.SetEnabled()
CheckCounter(None, None)
CheckInfiCounter(None, None)
# reset our end combat handelers
pSaffiQB = GetMenuButton("Commander", "End Combat")
pSaffiQBR = GetQBRMenuButton("Commander", "Configure")
pSIQB = GetMenuButton("Science", "Special Options")
pSIQBR = GetQBRMenuButton("Science", "Special Options")
if pSaffiQB:
pSaffiQB.RemoveHandlerForInstance(App.ET_ST_BUTTON_CLICKED, __name__ + ".InstallCloakReset")
if pSIQB:
pSIQB.RemoveHandlerForInstance(App.ET_ST_BUTTON_CLICKED, __name__ + ".InstallCloakReset")
if pSaffiQBR:
pSaffiQBR.RemoveHandlerForInstance(App.ET_ST_BUTTON_CLICKED, __name__ + ".InstallCloakReset")
if pSIQBR:
pSIQBR.RemoveHandlerForInstance(App.ET_ST_BUTTON_CLICKED, __name__ + ".InstallCloakReset")
App.g_kEventManager.RemoveBroadcastHandler(App.ET_OBJECT_EXPLODING, pMission, __name__ + ".ShipExploding")
App.g_kEventManager.RemoveBroadcastHandler(App.ET_SET_PLAYER, pMission, __name__ + ".InstallCloakReset")
Revised: Jan 9 2020