rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.DeletePatrolpoint(self.jnum,"Debris")
self.DeletePatrolPoint(self.jnum,"Debris")
def FinishedPatrol (self): if (self.jnum<len(self.patrolpoints)): jpoint =self.patrolpoints[self.jnum] if (jpoint.isNull()): self.DeletePatrolpoint(self.jnum,"Debris") else: if (self.you.getSignificantDistance (jpoint)<self.distance): self.DeletePatrolPoint(self.jnum,jpoint.getName()) else: self.jnum+=1 else: self.jnum...
pass
self.last_ship=0 self.quantity=4 self.price_instability=0.01
def __init__(self): pass #does nothing; all variables are set in the 3 lines above
Base.Message("So far you have served our interests well. If you accept this contract you will go now to the Adams sector and destroy a cargo ship enroute to the Defiance system. It is loaded with political prisoners who have been illegally freed. These felons must not make it to Defiance alive or they will spark the re...
Base.Message("So far you have served our interests well. If you accept this contract you will go now to the Adams sector and destroy a cargo ship enroute to the Defiance system. It is loaded with political prisoners who have been illegally freed. These felons must not make it to Defiance alive or they will spark the re...
def AssignMission (): fixers.DestroyActiveButtons () fixers.CreateChoiceButtons(Base.GetCurRoom(),[ fixers.Choice("bases/fixers/yes.spr","bases/fixers/iso_antagonist_mission.py","Accept This Agreement"), fixers.Choice("bases/fixers/no.spr","bases/fixers/iso_antagonist_decline.py","Decline This Agreement")])
Base.Message("Now the stakes are higher. My elite force had planned to assault a ISO stronghold in the Defiance system, but we cannot account for such numbers. However, we will send in a larger ship that will assist you in destroying the last vestiges of the ISO defense force. Once this is secured perhaps they will li...
Base.Message("Now the stakes are higher. My elite force had planned to assault a ISO stronghold in the Defiance system, but we cannot account for such numbers. However, we will send in a larger ship that will assist you in destroying the last vestiges of the ISO defense force. Once this is secured perhaps they will li...
def AssignMission (): fixers.DestroyActiveButtons () fixers.CreateChoiceButtons(Base.GetCurRoom(),[ fixers.Choice("bases/fixers/yes.spr","bases/fixers/iso_antagonist_mission.py","Accept This Agreement"), fixers.Choice("bases/fixers/no.spr","bases/fixers/iso_antagonist_decline.py","Decline This Agreement")])
if (carg.GetQuantity()==0):
if (carg.GetQuantity()==0 or category==''):
def __init__ (self,factionname, numsystemsaway, cargoquantity, missiondifficulty, creds, launchoncapship, time_to_complete, category,jumps=(),var_to_set=''): Director.Mission.__init__(self); self.you=VS.Unit() self.base=VS.Unit() self.arrived=0 self.var_to_set=var_to_set self.mplay="all"
def __init__ (self,factionname, numsystemsaway, cargoquantity, missiondifficulty, creds, launchoncapship, time_to_complete, category,jumps=()):
def SetVar (val): if (self.var_to_set!=''): quest.removeQuest (self.you.isPlayerStarship(),self.var_to_set,val) def __init__ (self,factionname, numsystemsaway, cargoquantity, missiondifficulty, creds, launchoncapship, time_to_complete, category,jumps=(),var_to_set=''):
def endbriefing(self): self.adjsys.endbriefing() del self.briefgametime
self.SetVar(-1)
def takeCargoAndTerminate (self,you, remove): removenum=0 #if you terminate without remove, you are SKREWED if (remove): removenum=you.removeCargo(self.cargoname,self.quantity,1) print "removed %d" % removenum mpart=VS.GetMasterPartList() newcarg=mpart.GetCargo(self.cargoname) newcarg.SetQuantity(removenum) self.base.a...
nextsystem=syslist[vsrandom.randrange(0,max)]
nextsystem=syslist[vsrandom.randrange(0,len(syslist))]
def getAdjacentSystems (currentsystem, sysaway, jumps=(),preferredfaction=''): """returns a tuple in the format ("[lastsystem]",(system1,system2,system3,...))""" if preferredfaction=='': preferredfaction=VS.GetGalaxyProperty(currentsystem,"faction") max=VS.GetNumAdjacentSystems(currentsystem) if ((sysaway<=0) or (max<=...
,(0.3,"player","VAR_aggressor_FG Strikes Civilian Transport in VAR_system_system!\\The VAR_aggressor_FGtype mercillessly struck down the VAR_defender_FG VAR_defender_FGtype in a surprise raid. The flightgroup was carrying VAR_defender_nicks tourists, and antiquities on an intersystem taxi service when, without warning...
,(0.3,"player","VAR_aggressor_FG Strikes Civilian Transport in VAR_system_system!\\The VAR_aggressor_FGtype mercillessly struck down the VAR_defender_FG VAR_defender_FGtype in a surprise raid. The flightgroup was carrying VAR_defender_nicks tourists, and antiquities on an intersystem taxi service when, without warning...
def allNews():
,"bad" : [(0.3,"all","VAR_aggressor_possessive Strike Fleet Lost!\\The VAR_aggressor_government has been forced to admit the loss of its Strike Fleet in the VAR_system_system System. While pursuing a VAR-defender_possessive raiding party, the strike fleet encountered unexpected VAR_defender_nicks resistance. After exc...
,"bad" : [(0.3,"all","VAR_aggressor_possessive Strike Fleet Lost!\\The VAR_aggressor_government has been forced to admit the loss of its Strike Fleet in the VAR_system_system System. While pursuing a VAR_defender_possessive raiding party, the strike fleet encountered unexpected VAR_defender_nicks resistance. After exc...
def allNews():
def int getNumPlayers ()(a=None,b=None,c=None,d=None,e=None,f=None,g=None,h=None,i=None,j=None): print "int getNumPlayers ()"
def getNumPlayers (a=None,b=None,c=None,d=None,e=None,f=None,g=None,h=None,i=None,j=None): print "getNumPlayers"
def int getNumPlayers ()(a=None,b=None,c=None,d=None,e=None,f=None,g=None,h=None,i=None,j=None): print "int getNumPlayers ()" return 1
return Vector(0,0,0)
return (0,0,0)
def LocalCoordinates(self,un): print "LocalCoordinates" return Vector(0,0,0)
return QVector(0,0,0)
return (0,0,0)
def PositionITTS(self,local_posit,speed): print "PositionITTS" return QVector(0,0,0)
return QVector(0,0,0)
return (0,0,0)
def Position(self): print "Position" return QVector(0,0,0)
return QVector(0,0,0)
return (0,0,0)
def LocalPosition(self): print "LocalPosition" return QVector(0,0,0)
return Vector(0,0,0)
return (0,0,0)
def ClampThrust(self,thrust,afterburn): print "ClampThrust" return Vector(0,0,0)
return Vector(0,0,0)
return (0,0,0)
def ClampVelocity(self,velocity,afterburn): print "ClampVelocity" return Vector(0,0,0)
return Vector(0,0,0)
return (0,0,0)
def ClampAngVel(self,vel): print "ClampAngVel" return Vector(0,0,0)
return Vector(0,0,0)
return (0,0,0)
def ClampTorque(self,torque): print "ClampTorque" return Vector(0,0,0)
return Vector(0,0,0)
return (0,0,0)
def UpCoordinateLevel(self,v): print "UpCoordinateLevel" return Vector(0,0,0)
return Vector(0,0,0)
return (0,0,0)
def DownCoordinateLevel(self,v): print "DownCoordinateLevel" return Vector(0,0,0)
return Vector(0,0,0)
return (0,0,0)
def ToLocalCoordinates(self,v): print "ToLocalCoordinates" return Vector(0,0,0)
return Vector(0,0,0)
return (0,0,0)
def ToWorldCoordinates(self,v): print "ToWorldCoordinates" return Vector(0,0,0)
return Vector(0,0,0)
return (0,0,0)
def GetAngularVelocity(self): print "GetAngularVelocity" return Vector(0,0,0)
return Vector(0,0,0)
return (0,0,0)
def GetVelocity(self): print "GetVelocity" return Vector(0,0,0)
,"aggressor_fg" : aggressor_flightgroup ,"aggressor_type":aggressor_type ,"defender_fg" : defender_flightgroup ,"defender_type": defender_type
,"aggressorFG" : aggressor_flightgroup ,"aggressorFGtype":aggressor_type ,"defenderFG" : defender_flightgroup ,"defenderFGtype": defender_type
def makeDynamicNews (type_event,stage_event,aggressor,defender,success ,scale_event,system,keyword,aggressor_flightgroup,aggressor_type, defender_flightgroup, defender_type):
isSig=0
def loop (self): isSig=0 enemy=VS.Unit() if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): enemy=self.enemy if (not self.istarget): curun=VS.getUnit(curiter) if (enemy): if (curun==enemy): enemy.setTarget(you) curiter+=1 if (you.isNull()): Lose(1) return if (enemy.isNull()): Win(you,1) return elif (sel...
self.randint=random.randomint(0,50) self.significant = unit.getJumpPoint(randint) if (self.significant.isNull ()): self.significant =VS.getPlayer()
localdestination=self.significant.getName() self.adjsys=go_somewhere_significant(self.you,0,500) VS.IOmessage (0,"bounty mission",self.mplay,"You must destroy the %s unit in this system." % (self.newship)) self.obj=VS.addObjective("Destroy the %s unit" % (self.newship)) if (runaway): VS.IOmessage (3,"bounty mission",se...
def loop (self): isSig=0 enemy=VS.Unit() if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): enemy=self.enemy if (not self.istarget): curun=VS.getUnit(curiter) if (enemy): if (curun==enemy): enemy.setTarget(you) curiter+=1 if (you.isNull()): Lose(1) return if (enemy.isNull()): Win(you,1) return elif (sel...
self.significant =VS.getContainer(significant) isSig=1 if (self.significant.isNull()): print "aborting" VS.terminateMission (0) else: localdestination=self.significant.getName() VS.IOmessage (0,"bounty mission",self.mplay,"You must destroy the %s unit in this system." % (self.newship)) self.adjsys=go_somewhere_signifi...
VS.IOmessage (3,"bounty mission",self.mplay,"Scanners are picking up a metallic object!") VS.IOmessage (4,"bounty mission",self.mplay,"Coordinates appear near %s" % (localdestination))
def loop (self): isSig=0 enemy=VS.Unit() if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): enemy=self.enemy if (not self.istarget): curun=VS.getUnit(curiter) if (enemy): if (curun==enemy): enemy.setTarget(you) curiter+=1 if (you.isNull()): Lose(1) return if (enemy.isNull()): Win(you,1) return elif (sel...
self.significant=VS.Unit()
def __init__ (self,minnumsystemsaway, maxnumsystemsaway, creds, run_away, shipdifficulty, tempfaction): Director.Mission.__init__ (self) self.newship="" self.mplay="all" self.istarget=0 self.obj=0 self.curiter=0 self.arrived=0 self.faction = tempfaction self.difficulty = shipdifficulty self.runaway=run_away self.cred=c...
VS.IOmessage (2,"bounty mission",self.mplay,"Once there, you must destroy a %s unit." % (self.faction)) VS.IOmessage (3,"bounty mission",self.mplay,"You will then %.2f credits as your reward (if you survive)." % (self.cred)) VS.IOmessage (4,"bounty mission",self.mplay,"
VS.IOmessage (1,"bounty mission",self.mplay,"Once there, you must destroy a %s unit." % (self.faction)) VS.IOmessage (2,"bounty mission",self.mplay,"You will then %.2f credits as your reward (if you survive)." % (self.cred)) VS.IOmessage (3,"bounty mission",self.mplay,"
def __init__ (self,minnumsystemsaway, maxnumsystemsaway, creds, run_away, shipdifficulty, tempfaction): Director.Mission.__init__ (self) self.newship="" self.mplay="all" self.istarget=0 self.obj=0 self.curiter=0 self.arrived=0 self.faction = tempfaction self.difficulty = shipdifficulty self.runaway=run_away self.cred=c...
if (self.arrived==3): if (not self.istarget): curun=VS.getUnit(self.curiter) if (self.enemy): if (curun==self.enemy): self.enemy.setTarget(self.you) self.curiter+=1 if (self.enemy.isNull()): self.Win(self.you,1) return elif (self.arrived==2): if (VS.getSystemFile()==self.adjsys.DestinationSystem()): self.arrived=3 else...
if (self.arrived==2): if (not self.runaway): if (not self.istarget): if (self.enemy): curun=VS.getUnit(self.curiter) self.curiter+=1 if (curun==self.enemy): self.enemy.SetTarget(self.you) elif (curun.isNull()): self.curiter=0
def Execute (self): isSig=0 if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): if (not self.istarget): curun=VS.getUnit(self.curiter) if (self.enemy): if (curun==self.enemy): self.enemy.setTarget(self.you) self.curiter+=1 if (self.enemy.isNull()): self.Win(self.you,1) return elif (self.arrived==2): if (...
significant=self.significant
significant=self.adjsys.SignificantUnit()
def Execute (self): isSig=0 if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): if (not self.istarget): curun=VS.getUnit(self.curiter) if (self.enemy): if (curun==self.enemy): self.enemy.setTarget(self.you) self.curiter+=1 if (self.enemy.isNull()): self.Win(self.you,1) return elif (self.arrived==2): if (...
self.newship=faction_ships.getRandomFighter(faction) self.enemy=launch.launch_wave_around_unit("Base",self.faction,self.newship,"default",1+self.difficulty,3000.0,4000.0,self.significant)
self.newship=faction_ships.getRandomFighter(self.faction) self.enemy=launch.launch_wave_around_unit("Base",self.faction,self.newship,"default",1+self.difficulty,3000.0,4000.0,significant)
def Execute (self): isSig=0 if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): if (not self.istarget): curun=VS.getUnit(self.curiter) if (self.enemy): if (curun==self.enemy): self.enemy.setTarget(self.you) self.curiter+=1 if (self.enemy.isNull()): self.Win(self.you,1) return elif (self.arrived==2): if (...
self.enemy.SetTarget(significant) self.enemy.Jump() self.arrived=2 else: self.arrived=3
self.enemy.SetTarget(significant) self.enemy.ActivateJumpDrive(0) self.arrived=2 else: print "enemy null" VS.terminateMission(0) return
def Execute (self): isSig=0 if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): if (not self.istarget): curun=VS.getUnit(self.curiter) if (self.enemy): if (curun==self.enemy): self.enemy.setTarget(self.you) self.curiter+=1 if (self.enemy.isNull()): self.Win(self.you,1) return elif (self.arrived==2): if (...
localdestination=self.significant.getName()
def Execute (self): isSig=0 if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): if (not self.istarget): curun=VS.getUnit(self.curiter) if (self.enemy): if (curun==self.enemy): self.enemy.setTarget(self.you) self.curiter+=1 if (self.enemy.isNull()): self.Win(self.you,1) return elif (self.arrived==2): if (...
VS.IOmessage (0,"bounty mission",self.mplay,"You must destroy the %s unit in this system." % (self.newship)) self.obj=VS.addObjective("Destroy the %s unit" % (self.newship))
localdestination=self.adjsys.SignificantUnit().getName() VS.IOmessage (3,"bounty mission",self.mplay,"You must destroy the %s unit in this system." % (self.newship))
def Execute (self): isSig=0 if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): if (not self.istarget): curun=VS.getUnit(self.curiter) if (self.enemy): if (curun==self.enemy): self.enemy.setTarget(self.you) self.curiter+=1 if (self.enemy.isNull()): self.Win(self.you,1) return elif (self.arrived==2): if (...
VS.IOmessage (3,"bounty mission",self.mplay,"He is running towards the jump point. Catch him!") VS.IOmessage (4,"bounty mission",self.mplay,"he is going to %s" % (localdestination))
VS.IOmessage (4,"bounty mission",self.mplay,"He is running towards the jump point. Catch him!") VS.IOmessage (5,"bounty mission",self.mplay,"he is going to %s" % (localdestination))
def Execute (self): isSig=0 if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): if (not self.istarget): curun=VS.getUnit(self.curiter) if (self.enemy): if (curun==self.enemy): self.enemy.setTarget(self.you) self.curiter+=1 if (self.enemy.isNull()): self.Win(self.you,1) return elif (self.arrived==2): if (...
VS.IOmessage (3,"bounty mission",self.mplay,"Scanners are picking up a metallic object!") VS.IOmessage (4,"bounty mission",self.mplay,"Coordinates appear near %s" % (localdestination))
VS.IOmessage (4,"bounty mission",self.mplay,"Scanners are picking up a metallic object!") VS.IOmessage (5,"bounty mission",self.mplay,"Coordinates appear near %s" % (localdestination))
def Execute (self): isSig=0 if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): if (not self.istarget): curun=VS.getUnit(self.curiter) if (self.enemy): if (curun==self.enemy): self.enemy.setTarget(self.you) self.curiter+=1 if (self.enemy.isNull()): self.Win(self.you,1) return elif (self.arrived==2): if (...
return 'FG:'+str(VS.getFactionIndex(faction))
return 'FG:'+str(VS.GetFactionIndex(faction))
def MakeFactionKey (faction): return 'FG:'+str(VS.getFactionIndex(faction))
return 'FG:'+str(fgname)+'|'+str(VS.getFactionIndex(faction))
return 'FG:'+str(fgname)+'|'+str(VS.GetFactionIndex(faction))
def MakeFGKey (fgname,faction): return 'FG:'+str(fgname)+'|'+str(VS.getFactionIndex(faction))
facs+= [VS.getFactionName(i)]
facs+= [VS.GetFactionName(i)]
def AllFactions (): facs =[] for i in range (VS.GetNumFactions()): facs+= [VS.getFactionName(i)] return facs
siz = getSaveStringLength (cp,key)
siz = Director.getSaveStringLength (cp,key)
def ReadStringList (cp,key): siz = getSaveStringLength (cp,key) tup =[] for i in range (siz): tup += [getSaveString(cp,key,i)] return tup
tup += [getSaveString(cp,key,i)]
tup += [Director.getSaveString(cp,key,i)]
def ReadStringList (cp,key): siz = getSaveStringLength (cp,key) tup =[] for i in range (siz): tup += [getSaveString(cp,key,i)] return tup
def _MakeFGString (starsystem,typenumlist): totalships = 0 ret = [] damage=0 for tt in numtypelist: totalships+=int(tt[1]) strlist+=[str(tt[0]),str(tt[1])] return [str(totalships),str(starsystem),str(damage)]+strlist def _AddShiptoKnownFG(key,tn): leg = Director.getSaveStringLength (dynamic_universe.cp,key)
def _MakeFGString (starsystem,typenumlist): totalships = 0 ret = [] damage=0 for tt in numtypelist: totalships+=int(tt[1]) strlist+=[str(tt[0]),str(tt[1])] return [str(totalships),str(starsystem),str(damage)]+strlist def _AddShiptoKnownFG(key,tn): leg = Director.getSaveStringLength (dynamic_universe.cp,key) try: numto...
def _MakeFGString (starsystem,typenumlist): totalships = 0 ret = [] damage=0 for tt in numtypelist: totalships+=int(tt[1]) strlist+=[str(tt[0]),str(tt[1])] return [str(totalships),str(starsystem),str(damage)]+strlist
numtotships =int(Director.getSaveString(dynamic_universe.cp,key,0)) numtotships+=int(tn[1]) Director.putSaveString(dynamic_universe.cp,key,0,str(numtotships))
del tup[tup.index(fgname)] Director.putSaveString(dynamic_universe.cp,key,index,ListToPipe(tup))
def _AddShiptoKnownFG(key,tn): leg = Director.getSaveStringLength (dynamic_universe.cp,key) try: numtotships =int(Director.getSaveString(dynamic_universe.cp,key,0)) numtotships+=int(tn[1]) Director.putSaveString(dynamic_universe.cp,key,0,str(numtotships)) except: print 'error adding ship to flightgroup' for i in range ...
print 'error adding ship to flightgroup'
print 'fg '+fgname+' not found in '+starsystem else: print 'no ships of faction '+faction+' in '+starsystem def _AddFGToFactionList(fgname,faction): key = MakeFactionKey(faction) Director.pushSaveString (dynamic_universe.cp,key,fgname) def _RemoveFGFromFactionList (fgname,faction): key = MakeFactionKey(faction) lun=...
def _AddShiptoKnownFG(key,tn): leg = Director.getSaveStringLength (dynamic_universe.cp,key) try: numtotships =int(Director.getSaveString(dynamic_universe.cp,key,0)) numtotships+=int(tn[1]) Director.putSaveString(dynamic_universe.cp,key,0,str(numtotships)) except: print 'error adding ship to flightgroup' for i in range ...
if (Director.getSaveString(dynamic_universe.cp,key,i-1)==str(tn[0])): numships=0 try: numships+= int(tn[1]) numships+= int (Director.getSaveString(dynamic_universe.cp,key,i)) except: pass Director.putSaveString(dynamic_universe.cp,key,i,str(numships)) return Director.pushSaveString(dynamic_universe.cp,key,str(tn[0])) D...
totalships+=int(VS.getSaveString(dynamic_universe.cp,key,i)) if (totalships!=int(VS.getSaveString(dynamic_universe.cp,key,0))): print 'mismatch on flightgroup '+fgname+' faction '+faction return 0 except: print 'nonint readingo n flightgroup '+fgname+'faction '+faction return 0 return 1 def PurgeZeroShips (faction): ke...
def _AddShiptoKnownFG(key,tn): leg = Director.getSaveStringLength (dynamic_universe.cp,key) try: numtotships =int(Director.getSaveString(dynamic_universe.cp,key,0)) numtotships+=int(tn[1]) Director.putSaveString(dynamic_universe.cp,key,0,str(numtotships)) except: print 'error adding ship to flightgroup' for i in range ...
def _RemoveFGFromSystem (fgname,faction,starsystem): key = MakeStarSystemFGKey( starsystem) leg = Director.getSaveStringLength(dynamic_universe.cp,key) index = VS.getFactionIndex(faction) if (leg>index): tup = Director.getSaveString (dynamic_universe.cp,key,index).split('|')
def NumShipsInFG (fgname,faction): key = MakeFGKey (fgname,faction) len = Director.getSaveStringLength (dynamic_universe.cp,key) if (len==0): return 0 else: try: return int(Director.getSaveString(dynamic_universe.cp,key,0)) except: print 'fatal: flightgroup without size' def DeleteFG(fgname,faction): key = MakeFGKey (f...
def _RemoveFGFromSystem (fgname,faction,starsystem): key = MakeStarSystemFGKey( starsystem) leg = Director.getSaveStringLength(dynamic_universe.cp,key) index = VS.getFactionIndex(faction) if (leg>index): tup = Director.getSaveString (dynamic_universe.cp,key,index).split('|') try: del tup[tup.index(fgname)] Director.put...
del tup[tup.index(fgname)] Director.putSaveString(dynamic_universe.cp,key,index,ListToPipe(tup))
numships = int (Director.getSaveString (dynamic_universe.cp,key,i))
def _RemoveFGFromSystem (fgname,faction,starsystem): key = MakeStarSystemFGKey( starsystem) leg = Director.getSaveStringLength(dynamic_universe.cp,key) index = VS.getFactionIndex(faction) if (leg>index): tup = Director.getSaveString (dynamic_universe.cp,key,index).split('|') try: del tup[tup.index(fgname)] Director.put...
print 'fg '+fgname+' not found in '+starsystem else: print 'no ships of faction '+faction+' in '+starsystem def _AddFGToFactionList(fgname,faction): key = MakeFactionKey(faction) Director.pushSaveString (dynamic_universe.cp,key,fgname) def _RemoveFGFromFactionList (fgname,faction): key = MakeFactionKey(faction) lun=...
pass if (numships>0): numships-=1 Director.putSaveString (dynamic_universe.cp,key,i,str(numships)) else:
def _RemoveFGFromSystem (fgname,faction,starsystem): key = MakeStarSystemFGKey( starsystem) leg = Director.getSaveStringLength(dynamic_universe.cp,key) index = VS.getFactionIndex(faction) if (leg>index): tup = Director.getSaveString (dynamic_universe.cp,key,index).split('|') try: del tup[tup.index(fgname)] Director.put...
return 1 return 0 def CheckFG (fgname,faction): key = MakeFGKey (fgname,faction) leg = VS.getSaveStringLength (dynamic_universe.cp,key) totalships=0 try: for i in range (ShipListOffset+1,leg,2): totalships+=int(VS.getSaveString(dynamic_universe.cp,key,i)) if (totalships!=int(VS.getSaveString(dynamic_universe.cp,key,0)...
Director.eraseSaveString(dynamic_universe.cp,key,i-1) print 'cannot find ship to delete in '+faction+' fg ' + fgname
def _RemoveFGFromFactionList (fgname,faction): key = MakeFactionKey(faction) lun=Director.getSaveStringLength(dynamic_universe.cp,key) for i in range (lun): if (Director.getSaveString(dynamic_universe.cp,key,i)==fgname): Director.eraseSaveString(dynamic_universe.cp,key,i) return 1 return 0
px = _unit.getPlayerX(player_num)
px = VS.getPlayerX(player_num)
def __init__(self, sigdis, detectiondis, gendis, minnships, gennships, unitprob, enemyprob, capprob, capdist): self.capship_gen_distance=capdist # player_num=player self.enprob = enemyprob self.fighterprob = unitprob
sig2=unit.getPlanet (0,false)
sig2=unit.getPlanet (0,0)
def getMinDistFrom(self,sig1): sig2=unit.getPlanet (0,false) mindist=100000000000000000000000000000000000000000000.0 i=0 while (sig2): tempdist = sig1.getSignificantDistance(sig2) if (tempdist<mindist and tempdist>0.0): mindist=tempdist i+=1 sig2 = unit.getPlanet (i,false) return mindist
sig2 = unit.getPlanet (i,false)
sig2 = unit.getPlanet (i,0)
def getMinDistFrom(self,sig1): sig2=unit.getPlanet (0,false) mindist=100000000000000000000000000000000000000000000.0 i=0 while (sig2): tempdist = sig1.getSignificantDistance(sig2) if (tempdist<mindist and tempdist>0.0): mindist=tempdist i+=1 sig2 = unit.getPlanet (i,false) return mindist
sig1=unit.getPlanet (0,false)
sig1=unit.getPlanet (0,0)
def minimumSigDistApart(self): sig1=unit.getPlanet (0,false) i=0 mindist=100000000000000000000000000000000000000000000.0 ave=0.0 while (sig1): tempdist = self.getMinDistFrom (sig1) if (ave<0.9): mindist = tempdist else: mindist += tempdist ave+=1.0 i+=1 sig1 = unit.getPlanet (i,false) if (ave!=0.0): mindist = mindist/a...
sig1 = unit.getPlanet (i,false)
sig1 = unit.getPlanet (i,0)
def minimumSigDistApart(self): sig1=unit.getPlanet (0,false) i=0 mindist=100000000000000000000000000000000000000000000.0 ave=0.0 while (sig1): tempdist = self.getMinDistFrom (sig1) if (ave<0.9): mindist = tempdist else: mindist += tempdist ave+=1.0 i+=1 sig1 = unit.getPlanet (i,false) if (ave!=0.0): mindist = mindist/a...
if (sig_distance>minsig*0.15):
if (self.sig_distance>minsig*0.15):
def CalculateSignificantDistance(self): minsig = self.minimumSigDistApart() if (sig_distance>minsig*0.15): self.cur.significant_distance=minsig*0.15 else: self.cur.significant_distance=sig_distance if (det_distance>minsig*0.2): self.cur.detection_distance=minsig*0.2 else: self.cur.detection_distance=det_distance prin...
self.cur.significant_distance=sig_distance if (det_distance>minsig*0.2):
self.cur.significant_distance=self.sig_distance if (self.det_distance>minsig*0.2):
def CalculateSignificantDistance(self): minsig = self.minimumSigDistApart() if (sig_distance>minsig*0.15): self.cur.significant_distance=minsig*0.15 else: self.cur.significant_distance=sig_distance if (det_distance>minsig*0.2): self.cur.detection_distance=minsig*0.2 else: self.cur.detection_distance=det_distance prin...
self.cur.detection_distance=det_distance
self.cur.detection_distance=self.det_distance
def CalculateSignificantDistance(self): minsig = self.minimumSigDistApart() if (sig_distance>minsig*0.15): self.cur.significant_distance=minsig*0.15 else: self.cur.significant_distance=sig_distance if (det_distance>minsig*0.2): self.cur.detection_distance=minsig*0.2 else: self.cur.detection_distance=det_distance prin...
sysfile = VS.getSystemFile()
sysfile = VS.getFileName()
def launch_near (self,un): numfactions=VS.GetNumFactions() if (numfactions==0): sys.stderr.write('warning: no factions\n') return sysfile = VS.getSystemFile() for i in range(0,numfactions): localfaction = _std.getGalaxyProperty(sysfile,"faction") if (random.random() < enprob): localfaction = faction_ships.get_enemy_of ...
localfaction = _std.getGalaxyProperty(sysfile,"faction") if (random.random() < enprob):
localfaction = VS.GetGalaxyProperty(sysfile,"faction") if (random.random() < self.enprob):
def launch_near (self,un): numfactions=VS.GetNumFactions() if (numfactions==0): sys.stderr.write('warning: no factions\n') return sysfile = VS.getSystemFile() for i in range(0,numfactions): localfaction = _std.getGalaxyProperty(sysfile,"faction") if (random.random() < enprob): localfaction = faction_ships.get_enemy_of ...
numship= random.randrange(1,gen_num_ships) det_distance = self.cur.detection_distance launch_recycle.launch_wave_around(localfaction,localfaction,"default",numship,false,generation_distance*_std.Rnd()*0.9,un, 2.0*det_distance)
numship= random.randrange(1,self.gen_num_ships) self.det_distance = self.cur.detection_distance launch_recycle.launch_wave_around(localfaction,localfaction,"default",numship,0,self.generation_distance*random.random()*0.9,un, 2.0*self.det_distance)
def launch_near (self,un): numfactions=VS.GetNumFactions() if (numfactions==0): sys.stderr.write('warning: no factions\n') return sysfile = VS.getSystemFile() for i in range(0,numfactions): localfaction = _std.getGalaxyProperty(sysfile,"faction") if (random.random() < enprob): localfaction = faction_ships.get_enemy_of ...
launch_recycle.launch_wave_around("Capitol",localfaction,"default",1,true,capship_gen_distance*(0.5+(_std.Rnd()*0.4)),un, 8.0*det_distance)
launch_recycle.launch_wave_around("Capitol",localfaction,"default",1,1,self.capship_gen_distance*(0.5+(random.random()*0.4)),un, 8.0*self.det_distance)
def launch_near (self,un): numfactions=VS.GetNumFactions() if (numfactions==0): sys.stderr.write('warning: no factions\n') return sysfile = VS.getSystemFile() for i in range(0,numfactions): localfaction = _std.getGalaxyProperty(sysfile,"faction") if (random.random() < enprob): localfaction = faction_ships.get_enemy_of ...
unleadah = un.getFgLeader ()
unleadah = un.getFlightgroupLeader ()
def atLeastNInsignificantUnitsNear (self,uni, n): num_ships=0 count=0 leadah = uni.getFgLeader () un = VS.getUnit (count) dd = self.cur.detection_distance while (un): if (uni.getSignificantDistance(un)<dd*1.6): if ((not un.isSignificant()) and (not un.isSun())): unleadah = un.getFgLeader () if (leadah!=unleadah): num_s...
self.cursys = VS.getSystemFile() oldsys = self.cur.lastsys==cursys self.cur.lastsys=cursys
self.cursys = VS.getFileName() oldsys = self.cur.lastsys==self.cursys self.cur.lastsys=self.cursys
def SetModeOne (self,significant): self.cur.last_ship=0 self.cur.curmode=1 self.cur.sig_container=significant self.cursys = VS.getSystemFile() oldsys = self.cur.lastsys==cursys self.cur.lastsys=cursys if (not oldsys): self.CalculateSignificantDistance()
"""Only tested to here
def UpgradeRadar (un): cat = getRandomRadar () temp=un.upgrade (cat,0,0,1,0)
def getRandomEngine (diff, cat):
def getRandomEngine (diff):
def getRandomEngine (diff, cat): #get random engine from master part list myint=GetDiffInt(diff) cat="engine_level_%d" % (myint) return (myint,cat)
(type,cat) = getRandomEngine (diff,cat)
(type,cat) = getRandomEngine (diff)
def UpgradeEngine (un, diff): (type,cat) = getRandomEngine (diff,cat) if (type!=0): temp=un.upgrade (cat,0,0,1,0) print "Upgrading Engine %s percent %f" % (cat,temp) if (temp>0.0): cat = GetRandomShield (2,type) temp=un.upgrade (cat,0,0,1,0) print "Upgrading Shield %s percent %f" % (cat,temp) cat = GetRandomShield (4,t...
percent
def basicUnit (un, diff): i=0 percent while (i<2):#two lasers percent=un.upgrade("laser",i,i,0,1) i=i+1 UpgradeEngine (un,diff) UpgradeRadar (un) if ((random.random()<0.9) and (random.random()<(diff*5.0))): UpgradeAfterburner(un,diff) if ((random.random()<0.9) and (random.random()<(diff*5.0))): percent=un.upgrade(un,"j...
_RemoveFGFromSystem(starsystem)
_RemoveFGFromSystem(fgname,faction,starsystem)
def DeleteFG(fgname,faction): key = MakeFGKey (fgname,faction) len = Director.getSaveStringLength (ccp,key) if (len>=ShipListOffset()): starsystem=Director.getSaveString(ccp,key,1) _RemoveFGFromSystem(starsystem) _RemoveFGFromFactionList(fgname,faction) WriteStringList (ccp,MakeFGKey(fgname,faction),[] )
AI.PythonAI.Execute(self);
VS.PythonAI.Execute(self);
def Execute(self): AI.PythonAI.Execute(self); sys.stdout.write('h') return ''
for i in faction_ships.enemies[faction_ships.factionToInt(faction)]: efg = AllFGsInSystem(i,sys)
for i in fg: enemyfac = faction_ships.get_enemy_of (faction) efg = AllFGsInSystem(enemy,sys)
def LookForTrouble(faction,sys): fg = FGsInSystem(faction,sys) for i in faction_ships.enemies[faction_ships.factionToInt(faction)]: efg = AllFGsInSystem(i,sys) if (len(efg)): if vsrandom.randrange(0,3)==0:#FIXME include some sort of measure "can I win" initiateAttack(fg,faction,efg,i)
if vsrandom.randrange(0,3)==0: initiateAttack(fg,faction,efg,i)
index=vsrandom.randrange(0,len(efg)) initiateAttack(fg,faction,efg[index],enemyfac)
def LookForTrouble(faction,sys): fg = FGsInSystem(faction,sys) for i in faction_ships.enemies[faction_ships.factionToInt(faction)]: efg = AllFGsInSystem(i,sys) if (len(efg)): if vsrandom.randrange(0,3)==0:#FIXME include some sort of measure "can I win" initiateAttack(fg,faction,efg,i)
if (self.type!=''):
if (tn!=[] and self.type!=''):
def Preprocess (self): self._preprocess=1 self._dyn_nr_ships=[] self._nr_ships=self.num import faction_ships if self.dynfg!='': import fg_util tn=fg_util.ShipsInFG(self.dynfg,self.faction) print 'dynamic launching from '+str(tn)+' from flightgroup '+self.dynfg + ' faction '+ self.faction knum=0 if (self.type!=''): for ...
VS.IOmessage (2,"bounty mission",self.mplay,"Once there, you must destroy a %s unit.", % (faction))
VS.IOmessage (2,"bounty mission",self.mplay,"Once there, you must destroy a %s unit." % (faction))
def __init__ (self,minnumsystemsaway, maxnumsystemsaway, creds, run_away, shipdifficulty, tempfaction): Director.Mission.__init__ () self.newship="" self.mplay="all" self.istarget=0 self.obj=0 self.curiter=0 self.arrived=0 self.faction = tempfaction self.difficulty = shipdifficulty self.runaway=run_away self.cred=creds...
enemy=VS.Unit()
def loop (self): isSig=0 enemy=VS.Unit() if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): enemy=self.enemy if (not self.istarget): curun=VS.getUnit(self.curiter) if (not enemy.isNull()): if (curun==enemy): enemy.setTarget(you) self.curiter+=1 if (you.isNull()): self.Lose(1) return if (enemy.isNull()):...
enemy=self.enemy
def loop (self): isSig=0 enemy=VS.Unit() if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): enemy=self.enemy if (not self.istarget): curun=VS.getUnit(self.curiter) if (not enemy.isNull()): if (curun==enemy): enemy.setTarget(you) self.curiter+=1 if (you.isNull()): self.Lose(1) return if (enemy.isNull()):...
if (not enemy.isNull()): if (curun==enemy): enemy.setTarget(you)
if (self.enemy): if (curun==self.enemy): self.enemy.setTarget(self.you)
def loop (self): isSig=0 enemy=VS.Unit() if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): enemy=self.enemy if (not self.istarget): curun=VS.getUnit(self.curiter) if (not enemy.isNull()): if (curun==enemy): enemy.setTarget(you) self.curiter+=1 if (you.isNull()): self.Lose(1) return if (enemy.isNull()):...
if (enemy.isNull()):
if (self.enemy.isNull()):
def loop (self): isSig=0 enemy=VS.Unit() if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): enemy=self.enemy if (not self.istarget): curun=VS.getUnit(self.curiter) if (not enemy.isNull()): if (curun==enemy): enemy.setTarget(you) self.curiter+=1 if (you.isNull()): self.Lose(1) return if (enemy.isNull()):...
enemy=self.enemy if (you.isNull()):
if (self.you.isNull()):
def loop (self): isSig=0 enemy=VS.Unit() if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): enemy=self.enemy if (not self.istarget): curun=VS.getUnit(self.curiter) if (not enemy.isNull()): if (curun==enemy): enemy.setTarget(you) self.curiter+=1 if (you.isNull()): self.Lose(1) return if (enemy.isNull()):...
if (enemy):
if (self.enemy):
def loop (self): isSig=0 enemy=VS.Unit() if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): enemy=self.enemy if (not self.istarget): curun=VS.getUnit(self.curiter) if (not enemy.isNull()): if (curun==enemy): enemy.setTarget(you) self.curiter+=1 if (you.isNull()): self.Lose(1) return if (enemy.isNull()):...
def __init__ (self,factionname, missiondifficulty, our_dist_from_jump, dist_from_jump, distance_from_base, creds, enemy_time, AllInThisSystem):
def __init__ (self,factionname, missiondifficulty, our_dist_from_jump, dist_from_jump, distance_from_base, creds, enemy_time, numsysaway):
def __init__ (self,factionname, missiondifficulty, our_dist_from_jump, dist_from_jump, distance_from_base, creds, enemy_time, AllInThisSystem): Director.Mission.__init__(self); self.you = VS.getPlayer(); if (AllInThisSystem==0): AllInThisSystem=1 elif (AllInThisSystem==1): AllInThisSystem=0 self.adjsys=go_to_adjacent_s...
if (AllInThisSystem==0): AllInThisSystem=1 elif (AllInThisSystem==1): AllInThisSystem=0 self.adjsys=go_to_adjacent_systems(self.you, AllInThisSystem)
self.adjsys=go_to_adjacent_systems(self.you, numsysaway)
def __init__ (self,factionname, missiondifficulty, our_dist_from_jump, dist_from_jump, distance_from_base, creds, enemy_time, AllInThisSystem): Director.Mission.__init__(self); self.you = VS.getPlayer(); if (AllInThisSystem==0): AllInThisSystem=1 elif (AllInThisSystem==1): AllInThisSystem=0 self.adjsys=go_to_adjacent_s...
return launch_types_around (fg,faction,[i],ai,radius,myunit,garbage_collection_distance,logo) return launch.launch_wave_around_unit(fg,faction,'truck',ai,1,radius,radius*1.5,myunit,logo)
return launch_types_around (fg,faction,[i],ai,radius,myunit,garbage_collection_distance,'') return launch.launch_wave_around_unit(fg,faction,'truck',ai,1,radius,radius*1.5,myunit,'')
def launch_dockable_around_unit (fg,faction,ai,radius,myunit,garbage_collection_distance): import fg_util for i in LandedShipsInFG(fg,faction): if (i[0]=='truck' or i[0]=='cargo_ship' or faction_ships.isCapital(i[0])): return launch_types_around (fg,faction,[i],ai,radius,myunit,garbage_collection_distance,logo) return ...
def __init__(self,playernum=None): if (playernum==None):
def __init__(self,pnum=None): if (pnum==None):
def __init__(self,playernum=None): if (playernum==None): return px = VS.getPlayerX(playernum) self.player_num=playernum this_unit=px
px = VS.getPlayerX(playernum) self.player_num=playernum this_unit=px
self.playernum=pnum
def __init__(self,playernum=None): if (playernum==None): return px = VS.getPlayerX(playernum) self.player_num=playernum this_unit=px
capship_gen_distance=capdist
self.capship_gen_distance=capdist
def __init__(self, sigdis, detectiondis, gendis, minnships, gennships, unitprob, enemyprob, capprob, capdist): capship_gen_distance=capdist # player_num=player enprob = enemyprob fighterprob = unitprob
enprob = enemyprob fighterprob = unitprob
self.enprob = enemyprob self.fighterprob = unitprob
def __init__(self, sigdis, detectiondis, gendis, minnships, gennships, unitprob, enemyprob, capprob, capdist): capship_gen_distance=capdist # player_num=player enprob = enemyprob fighterprob = unitprob
det_distance = detectiondis sig_distance = sigdis generation_distance=gendis min_num_ships=minnships gen_num_ships=gennships capship_prob=capprob
self.det_distance = detectiondis self.sig_distance = sigdis self.generation_distance=gendis self.min_num_ships=minnships self.gen_num_ships=gennships self.capship_prob=capprob player_num=0
def __init__(self, sigdis, detectiondis, gendis, minnships, gennships, unitprob, enemyprob, capprob, capdist): capship_gen_distance=capdist # player_num=player enprob = enemyprob fighterprob = unitprob
self.player=self.player+(playerdata(player_num)) player_num=player_num+1
self.players=self.players+(playerdata(player_num)) player_num+=1
def __init__(self, sigdis, detectiondis, gendis, minnships, gennships, unitprob, enemyprob, capprob, capdist): capship_gen_distance=capdist # player_num=player enprob = enemyprob fighterprob = unitprob
def getMinDistFrom(sig1):
def getMinDistFrom(self,sig1):
def getMinDistFrom(sig1): sig2=unit.getPlanet (0,false) mindist=100000000000000000000000000000000000000000000.0 i=0 while (sig2): tempdist = sig1.getSignificantDistance(sig2) if (tempdist<mindist and tempdist>0.0): mindist=tempdist i+=1 sig2 = unit.getPlanet (i,false) return mindist
def minimumSigDistApart():
def minimumSigDistApart(self):
def minimumSigDistApart(): sig1=unit.getPlanet (0,false) i=0 mindist=100000000000000000000000000000000000000000000.0 ave=0.0 while (sig1): tempdist = getMinDistFrom (sig1) if (ave<0.9): mindist = tempdist else: mindist += tempdist ave+=1.0 i+=1 sig1 = unit.getPlanet (i,false) if (ave!=0.0): mindist = mindist/ave return...
tempdist = getMinDistFrom (sig1)
tempdist = self.getMinDistFrom (sig1)
def minimumSigDistApart(): sig1=unit.getPlanet (0,false) i=0 mindist=100000000000000000000000000000000000000000000.0 ave=0.0 while (sig1): tempdist = getMinDistFrom (sig1) if (ave<0.9): mindist = tempdist else: mindist += tempdist ave+=1.0 i+=1 sig1 = unit.getPlanet (i,false) if (ave!=0.0): mindist = mindist/ave return...
def CalculateSignificantDistance(): minsig = minimumSigDistApart() significant_distance = 0
def CalculateSignificantDistance(self): minsig = self.minimumSigDistApart()
def CalculateSignificantDistance(): minsig = minimumSigDistApart() significant_distance = 0 if (sig_distance>minsig*0.15): significant_distance = minsig*0.15 cur.significant_distance=minsig*0.15 else: cur.significant_distance=sig_distance significant_distance = sig_distance if (det_distance>minsig*0.2): cur.detection_...
significant_distance = minsig*0.15 cur.significant_distance=minsig*0.15
self.cur.significant_distance=minsig*0.15
def CalculateSignificantDistance(): minsig = minimumSigDistApart() significant_distance = 0 if (sig_distance>minsig*0.15): significant_distance = minsig*0.15 cur.significant_distance=minsig*0.15 else: cur.significant_distance=sig_distance significant_distance = sig_distance if (det_distance>minsig*0.2): cur.detection_...
cur.significant_distance=sig_distance significant_distance = sig_distance
self.cur.significant_distance=sig_distance
def CalculateSignificantDistance(): minsig = minimumSigDistApart() significant_distance = 0 if (sig_distance>minsig*0.15): significant_distance = minsig*0.15 cur.significant_distance=minsig*0.15 else: cur.significant_distance=sig_distance significant_distance = sig_distance if (det_distance>minsig*0.2): cur.detection_...
cur.detection_distance=minsig*0.2 detection_distance = minsig*0.2
self.cur.detection_distance=minsig*0.2
def CalculateSignificantDistance(): minsig = minimumSigDistApart() significant_distance = 0 if (sig_distance>minsig*0.15): significant_distance = minsig*0.15 cur.significant_distance=minsig*0.15 else: cur.significant_distance=sig_distance significant_distance = sig_distance if (det_distance>minsig*0.2): cur.detection_...
cur.detection_distance=det_distance detection_distance = det_distance
self.cur.detection_distance=det_distance
def CalculateSignificantDistance(): minsig = minimumSigDistApart() significant_distance = 0 if (sig_distance>minsig*0.15): significant_distance = minsig*0.15 cur.significant_distance=minsig*0.15 else: cur.significant_distance=sig_distance significant_distance = sig_distance if (det_distance>minsig*0.2): cur.detection_...
print "resetting sigdist=%f detdist=%f" % (significant_distance,detection_distance) def SetEnemyProb (enp): enprob = enp def AsteroidNear (unit, how):
print "resetting sigdist=%f detdist=%f" % (self.cur.significant_distance,self.cur.detection_distance) def SetEnemyProb (self,enp): self.enprob = enp def AsteroidNear (self,unit, how):
def CalculateSignificantDistance(): minsig = minimumSigDistApart() significant_distance = 0 if (sig_distance>minsig*0.15): significant_distance = minsig*0.15 cur.significant_distance=minsig*0.15 else: cur.significant_distance=sig_distance significant_distance = sig_distance if (det_distance>minsig*0.2): cur.detection_...