tests/lua/drillrockets_boom.lua
author sheepluva
Tue, 02 Dec 2014 22:11:22 +0100
changeset 10609 15f2908113a1
parent 10421 87e47843018e
child 10611 58cad46782ff
permissions -rw-r--r--
make tests use Draw.lua for now too
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
10609
15f2908113a1 make tests use Draw.lua for now too
sheepluva
parents: 10421
diff changeset
     2
HedgewarsScriptLoad("/Scripts/Draw.lua")
10028
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
     3
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
     4
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
     5
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
     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
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
     8
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
     9
-- 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
    10
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
    11
	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
    12
	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
    13
	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
    14
	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
    15
	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
    16
	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
    17
		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
    18
		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
    19
	end
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
    20
	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
    21
	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
    22
end
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
    23
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
    24
-- 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
    25
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
    26
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
    27
-- 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
    28
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
    29
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
    30
-- 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
    31
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
    32
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
    33
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
    34
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
    35
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
    36
-- 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
    37
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
    38
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
    39
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
    40
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
    41
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
    42
	-- 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
    43
	-- 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
    44
	-- 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
    45
	-- 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
    46
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 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
    48
	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
    49
	-- The map to be played
10421
87e47843018e use constants for mapgen, expose those to lua
sheepluva
parents: 10028
diff changeset
    50
	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
    51
	-- 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
    52
	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
    53
	-- 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
    54
	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
    55
	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
    56
	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
    57
	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
    58
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
    59
	-- 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
    60
	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
    61
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
    62
	-- Draw Map
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
    63
	AddPoint(10,30,0) -- hog 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
    64
	-- 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
    65
	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
    66
	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
    67
	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
    68
	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
    69
	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
    70
	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
    71
	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
    72
	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
    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
	FlushPoints()
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
    75
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
    76
	-- 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
    77
	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
    78
	-- 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
    79
	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
    80
	-- 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
    81
	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
    82
end
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
    83
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/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
    85
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
    86
	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
    87
	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
    88
	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
    89
	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
    90
	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
    91
	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
    92
	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
    93
	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
    94
	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
    95
	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
    96
		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
    97
		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
    98
		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
    99
	end
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
   100
	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
   101
	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
   102
	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
   103
	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
   104
	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
   105
	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
   106
	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
   107
	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
   108
	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
   109
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
   110
	-- 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
   111
	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
   112
	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
   113
	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
   114
	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
   115
	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
   116
	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
   117
	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
   118
	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
   119
		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
   120
		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
   121
		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
   122
		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
   123
	end
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
   124
end
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
   125
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
   126
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
   127
	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
   128
		-- 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
   129
		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
   130
			-- 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
   131
			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
   132
				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
   133
			end
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
   134
		else
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
   135
			-- 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
   136
			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
   137
				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
   138
			end
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
   139
		end
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
   140
		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
   141
		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
   142
			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
   143
			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
   144
				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
   145
			else
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
   146
				EndLuaTest(TEST_SUCCESSFUL)
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
	end
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
   150
end
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
   151
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
   152
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
   153
	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
   154
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_h1)
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_h2)
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_v1)
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_v2)
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_d1)
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_d2)
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
   161
	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
   162
	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
   163
end
9e742fc72696 add a test based on unC0Rr's suggestion. still a lot of mess and redundancy involved, sry :P
sheepluva
parents:
diff changeset
   164