author | sheepluva |
Sat, 23 Jan 2016 20:58:23 +0100 | |
changeset 11525 | c27565c942f5 |
parent 10620 | 0f7dedda093b |
permissions | -rw-r--r-- |
10028
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
1 |
|
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
2 |
local ta_pointsize = 63 |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
3 |
local ta_radius = (ta_pointsize * 10 + 6) / 2 |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
4 |
|
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
5 |
local sqrttwo = math.sqrt(2) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
6 |
|
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
7 |
-- creates round test area |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
8 |
function AddTestArea(testarea) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
9 |
step = 100 |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
10 |
xstep = step * testarea["xdir"] |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
11 |
ystep = step * testarea["ydir"] |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
12 |
x = testarea["x"] |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
13 |
y = testarea["y"] |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
14 |
if xstep * ystep ~= 0 then |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
15 |
xstep = math.floor(xstep / sqrttwo) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
16 |
ystep = math.floor(ystep / sqrttwo) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
17 |
end |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
18 |
AddPoint(x, y, ta_pointsize); |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
19 |
AddPoint(x + xstep, y + ystep, ta_pointsize, true); |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
20 |
end |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
21 |
|
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
22 |
-- vertical test areas |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
23 |
local taa_v1 = {x= 350, y= 400, xdir= 0, ydir= 1} |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
24 |
local taa_v2 = {x= 350, y=1500, xdir= 0, ydir=-1} |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
25 |
-- horizontal test areas |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
26 |
local taa_h1 = {x=1150, y= 400, xdir= 1, ydir= 0} |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
27 |
local taa_h2 = {x=1200, y=1100, xdir=-1, ydir= 0} |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
28 |
-- diagonal test areas |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
29 |
local taa_d1 = {x=2200, y= 400, xdir= 1, ydir= 1} |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
30 |
local taa_d2 = {x=2000, y=1500, xdir= 1, ydir=-1} |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
31 |
local taa_d3 = {x=3300, y= 400, xdir=-1, ydir= 1} |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
32 |
local taa_d4 = {x=3300, y=1500, xdir=-1, ydir=-1} |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
33 |
|
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
34 |
-- fail counter |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
35 |
local nfailed = 0 |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
36 |
local nspawned = 0 |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
37 |
local ndied = 0 |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
38 |
|
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
39 |
function onGameInit() |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
40 |
-- At first we have to overwrite/set some global variables |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
41 |
-- that define the map, the game has to load, as well as |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
42 |
-- other things such as the game rules to use, etc. |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
43 |
-- Things we don't modify here will use their default values. |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
44 |
|
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
45 |
-- The base number for the random number generator |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
46 |
Seed = 1 |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
47 |
-- The map to be played |
10421 | 48 |
MapGen = mgDrawn |
10028
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
49 |
-- The theme to be used |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
50 |
Theme = "Bamboo" |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
51 |
-- Game settings and rules |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
52 |
EnableGameFlags(gfOneClanMode, gfDisableWind, gfDisableLandObjects, gfDisableGirders, gfSolidLand) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
53 |
CaseFreq = 0 |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
54 |
MinesNum = 0 |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
55 |
Explosives = 0 |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
56 |
|
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
57 |
-- No damage please |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
58 |
DamagePercent = 1 |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
59 |
|
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
60 |
-- Draw Map |
10618 | 61 |
-- AddPoint(10,30,0) -- hog spawn platform |
10028
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
62 |
-- test areas |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
63 |
AddTestArea(taa_v1) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
64 |
AddTestArea(taa_v2) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
65 |
AddTestArea(taa_h1) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
66 |
AddTestArea(taa_h2) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
67 |
AddTestArea(taa_d1) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
68 |
AddTestArea(taa_d2) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
69 |
AddTestArea(taa_d3) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
70 |
AddTestArea(taa_d4) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
71 |
|
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
72 |
FlushPoints() |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
73 |
|
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
74 |
-- Create the player team |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
75 |
AddTeam("'Zooka Team", 14483456, "Simple", "Island", "Default") |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
76 |
-- And add a hog to it |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
77 |
player = AddHog("Hunter", 0, 1, "NoHat") |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
78 |
-- place it on how spawn platform |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
79 |
SetGearPosition(player, 10, 10) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
80 |
end |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
81 |
|
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
82 |
-- xdir/ydir is direction in which to fire the drills |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
83 |
function SpawnDrillRocketArray(testarea) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
84 |
xdir = testarea["xdir"] |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
85 |
ydir = testarea["ydir"] |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
86 |
centerx = testarea["x"] |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
87 |
centery = testarea["y"] |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
88 |
distance = 23 |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
89 |
d = distance |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
90 |
radius = ta_radius |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
91 |
speed = 900000; |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
92 |
local xmin, xmax, ymin, ymax |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
93 |
if (xdir ~= 0) and (ydir ~= 0) then |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
94 |
d = d / sqrttwo |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
95 |
radius = radius / sqrttwo |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
96 |
speed = math.floor(speed / sqrttwo) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
97 |
end |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
98 |
centerx = centerx - (xdir * (radius + 20)) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
99 |
centery = centery - (ydir * (radius + 20)) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
100 |
radius = radius - 6 |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
101 |
xn = ydir |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
102 |
yn = -xdir |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
103 |
startx = centerx - (radius * xn) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
104 |
starty = centery - (radius * yn) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
105 |
endx = centerx + (radius * xn) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
106 |
endy = centery + (radius * yn) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
107 |
|
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
108 |
-- spawn loop |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
109 |
x = startx |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
110 |
y = starty |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
111 |
xd = d * xn |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
112 |
yd = d * yn |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
113 |
if (xd < 0) and (startx < endx) then x = endx end |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
114 |
if (yd < 0) and (starty < endy) then y = endy end |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
115 |
nsteps = math.floor(math.max(math.abs(startx - endx),math.abs(starty - endy)) / d) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
116 |
for i = 1, nsteps, 1 do |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
117 |
AddGear(math.floor(x), math.floor(y), gtDrill, gsttmpFlag * (i % 2), speed * xdir, speed * ydir, 0) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
118 |
nspawned = nspawned + 1 |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
119 |
x = x + xd |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
120 |
y = y + yd |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
121 |
end |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
122 |
end |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
123 |
|
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
124 |
function onGearDelete(gear) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
125 |
if GetGearType(gear) == gtDrill then |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
126 |
-- the way to check state will change in API at some point |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
127 |
if band(GetState(gear), gsttmpFlag) == 0 then |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
128 |
-- regular drill rocket |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
129 |
if (GetTimer(gear) < 2000) or (GetTimer(gear) > 3000) then |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
130 |
nfailed = nfailed + 1 |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
131 |
end |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
132 |
else |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
133 |
-- airstrike drill rocket |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
134 |
if GetTimer(gear) > 0 then |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
135 |
nfailed = nfailed + 1 |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
136 |
end |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
137 |
end |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
138 |
ndied = ndied + 1 |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
139 |
if ndied == nspawned then |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
140 |
WriteLnToConsole('TESTRESULT: ' .. nfailed .. ' of ' .. nspawned .. ' drill rockets did not explode as expected') |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
141 |
if (nfailed > 0) then |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
142 |
EndLuaTest(TEST_FAILED) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
143 |
else |
10620 | 144 |
EndLuaTest(TEST_SUCCESSFUL) |
10028
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
145 |
end |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
146 |
end |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
147 |
end |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
148 |
end |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
149 |
|
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
150 |
function onGameStart() |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
151 |
SetGravity(1) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
152 |
|
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
153 |
SpawnDrillRocketArray(taa_h1) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
154 |
SpawnDrillRocketArray(taa_h2) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
155 |
SpawnDrillRocketArray(taa_v1) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
156 |
SpawnDrillRocketArray(taa_v2) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
157 |
SpawnDrillRocketArray(taa_d1) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
158 |
SpawnDrillRocketArray(taa_d2) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
159 |
SpawnDrillRocketArray(taa_d3) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
160 |
SpawnDrillRocketArray(taa_d4) |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
161 |
end |
9e742fc72696
add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff
changeset
|
162 |