[go: up one dir, main page]

Menu

[r11]: / modules / server.py  Maximize  Restore  History

Download this file

60 lines (56 with data), 2.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#from go_to_adjacent_systems import *
#import vsrandom
#import launch
#import faction_ships
import VS
import universe
import unit
import quest
import Director
import Vector
# this gets run once
class server (Director.Mission):
def __init__ (self):
print "cookies-TEST"
Director.Mission.__init__(self)
self.numbots=int(VS.vsConfig("network","numbots","1"))
import launch
self.count=0
self.facnames=["confed","kilrathi"]
self.shiptype=["hornet","salthi(old)"]
self.fac=[]
for i in range(len(self.facnames)):
self.fac.append([])
self.relaunchfac(i)
# this gets run whenever we call it!
def relaunchfac(self,i):
import launch
self.fac[i]=[]
if (self.numbots > 0):
for j in range(self.numbots):
print "Launching bots..."
self.fac[i].append(launch.launch_wave_around_unit(self.facnames[i]+"_Fleet",self.facnames[i],self.shiptype[i],"default",1,500,550,VS.getPlayerX(0),'',1))
# this gets run every frame
def Execute (self):
playa0=VS.getPlayerX(0)
playa1=VS.getPlayerX(1)
playa2=VS.getPlayerX(2)
#print num, "Players seen: ", (playa0.GetHull()), (playa1.GetHull()), (playa2.GetHull())
if (playa0 and (not playa1)):
for i in range (len(self.fac)):
found=False
for ship in self.fac[i]:
if ship:
found=True
if not found:
self.relaunchfac(i)
else: #if (num > 1):
#which=self.count%num
#playa=VS.getPlayerX(which)
#self.count+=1
#if playa:
for i in range (len(self.fac)):
for ship in self.fac[i]:
if ship:
print "Killing bots..."
ship.DealDamageToHull( (0.1,0.1,0.1) , (ship.GetHull()*1.1) )