tests/lua/drillrockets_drill.lua
changeset 10028 9e742fc72696
parent 10026 14a3f7feeb39
child 10421 87e47843018e
equal deleted inserted replaced
10026:14a3f7feeb39 10028:9e742fc72696
   107 	centery = testarea["y"]
   107 	centery = testarea["y"]
   108 	distance = 23
   108 	distance = 23
   109 	d = distance
   109 	d = distance
   110 	radius = ta_radius
   110 	radius = ta_radius
   111 	local xmin, xmax, ymin, ymax
   111 	local xmin, xmax, ymin, ymax
       
   112 	speed = 900000;
       
   113 	local xmin, xmax, ymin, ymax
   112 	if (xdir ~= 0) and (ydir ~= 0) then
   114 	if (xdir ~= 0) and (ydir ~= 0) then
   113 		sqrttwo = math.sqrt(2)
   115 		sqrttwo = math.sqrt(2)
   114 		d = d / sqrttwo
   116 		d = d / sqrttwo
   115 		radius = radius / sqrttwo
   117 		radius = radius / sqrttwo
       
   118 		speed = math.floor(speed / sqrttwo)
   116 	end
   119 	end
   117 	centerx = centerx - (xdir * (radius + 20))
   120 	centerx = centerx - (xdir * (radius + 20))
   118 	centery = centery - (ydir * (radius + 20))
   121 	centery = centery - (ydir * (radius + 20))
   119 	radius = radius - 6
   122 	radius = radius - 6
   120 	xn = ydir
   123 	xn = ydir
   131 	yd = d * yn
   134 	yd = d * yn
   132 	if (xd < 0) and (startx < endx) then x = endx end
   135 	if (xd < 0) and (startx < endx) then x = endx end
   133 	if (yd < 0) and (starty < endy) then y = endy end
   136 	if (yd < 0) and (starty < endy) then y = endy end
   134 	nsteps = math.floor(math.max(math.abs(startx - endx),math.abs(starty - endy)) / d)
   137 	nsteps = math.floor(math.max(math.abs(startx - endx),math.abs(starty - endy)) / d)
   135 	for i = 1, nsteps, 1 do
   138 	for i = 1, nsteps, 1 do
   136 		AddGear(math.floor(x), math.floor(y), gtDrill, 0, 900000 * xdir, 900000 * ydir, 0)
   139 		AddGear(math.floor(x), math.floor(y), gtDrill, 0, speed * xdir, speed * ydir, 0)
   137 		nspawned = nspawned + 1
   140 		nspawned = nspawned + 1
   138 		x = x + xd
   141 		x = x + xd
   139 		y = y + yd
   142 		y = y + yd
   140 	end
   143 	end
   141 end
   144 end