share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua
changeset 14811 d65e25e211d4
parent 14578 50f511588635
child 14823 358d81e29a88
equal deleted inserted replaced
14810:583d8b96fb30 14811:d65e25e211d4
  1569 ------------------------------------------------------------
  1569 ------------------------------------------------------------
  1570 ------------------------------------------------------------
  1570 ------------------------------------------------------------
  1571 ------------------------------------------------------------
  1571 ------------------------------------------------------------
  1572 ------------------------------------------------------------
  1572 ------------------------------------------------------------
  1573 
  1573 
  1574 function DoHorribleThings(cUID)
  1574 function HandleRadarBlip(cUID)
  1575 
  1575 
  1576 	-- work out the distance to the target
  1576 	-- work out the distance to the target
  1577 	local g1X, g1Y = GetGearPosition(CurrentHedgehog)
  1577 	local g1X, g1Y = GetGearPosition(CurrentHedgehog)
  1578 	local g2X, g2Y = SI.vCircX[cUID], SI.vCircY[cUID]
  1578 	local g2X, g2Y = SI.vCircX[cUID], SI.vCircY[cUID]
  1579 	local q = g1X - g2X
  1579 	local q = g1X - g2X
  1580 	local w = g1Y - g2Y
  1580 	local w = g1Y - g2Y
       
  1581 	-- Floating point operations are safe, it's only for visuals
  1581 	local r = math.sqrt( (q*q) + (w*w) )	--alternate
  1582 	local r = math.sqrt( (q*q) + (w*w) )	--alternate
  1582 
  1583 
  1583 	local opp = w
  1584 	local opp = w
  1584 	if opp < 0 then
  1585 	if opp < 0 then
  1585 		opp = opp*-1
  1586 		opp = opp*-1
  2251 		for i = 0,(SI.vCCount-1) do
  2252 		for i = 0,(SI.vCCount-1) do
  2252 			SI.vCircX[i] = SI.vCircX[i] + SI.vCircDX[i]
  2253 			SI.vCircX[i] = SI.vCircX[i] + SI.vCircDX[i]
  2253 			SI.vCircY[i] = SI.vCircY[i] + SI.vCircDY[i]
  2254 			SI.vCircY[i] = SI.vCircY[i] + SI.vCircDY[i]
  2254 
  2255 
  2255 			if (CurrentHedgehog ~= nil) and (SI.rAlpha ~= 255) then
  2256 			if (CurrentHedgehog ~= nil) and (SI.rAlpha ~= 255) then
  2256 				DoHorribleThings(i)
  2257 				HandleRadarBlip(i)
  2257 			end
  2258 			end
  2258 
  2259 
  2259 		end
  2260 		end
  2260 
  2261 
  2261 		if (SI.TimeLeft == 0) and (SI.tumbleStarted == true) then
  2262 		if (SI.TimeLeft == 0) and (SI.tumbleStarted == true) then