share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua
changeset 13282 b13071610c07
parent 13277 c15af5a5f458
child 13354 f9a15dcd857c
equal deleted inserted replaced
13281:36243bd726df 13282:b13071610c07
  2462 -- handle short range portal gun
  2462 -- handle short range portal gun
  2463 function PortalEffects(gear)
  2463 function PortalEffects(gear)
  2464 
  2464 
  2465 	if GetGearType(gear) == gtPortal then
  2465 	if GetGearType(gear) == gtPortal then
  2466 
  2466 
  2467 		tag = GetTag(gear)
  2467 		local tag = GetTag(gear)
       
  2468 		local col
  2468 		if tag == 0 then
  2469 		if tag == 0 then
  2469 			col = 0xfab02aFF -- orange ball
  2470 			col = 0xfab02aFF -- orange ball
  2470 		elseif tag == 1 then
  2471 		elseif tag == 1 then
  2471 			col = 0x00FF00FF -- orange portal
  2472 			col = 0x00FF00FF -- orange portal
  2472 		elseif tag == 2 then
  2473 		elseif tag == 2 then
  2474 		elseif tag == 3 then
  2475 		elseif tag == 3 then
  2475 			col = 0xFFFF00FF  -- blue portal
  2476 			col = 0xFFFF00FF  -- blue portal
  2476 		end
  2477 		end
  2477 
  2478 
  2478 		if (tag == 0) or (tag == 2) then -- i.e ball form
  2479 		if (tag == 0) or (tag == 2) then -- i.e ball form
  2479 			tempE = AddVisualGear(GetX(gear), GetY(gear), vgtDust, 0, true)
  2480 			local remLife = getGearValue(gear,"life")
  2480 			SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, 1, nil, col )
       
  2481 
       
  2482 			remLife = getGearValue(gear,"life")
       
  2483 			remLife = remLife - 1
  2481 			remLife = remLife - 1
  2484 			setGearValue(gear, "life", remLife)
  2482 			setGearValue(gear, "life", remLife)
  2485 
  2483 
       
  2484 			-- Destroy portal ball when max. distance reached
  2486 			if remLife == 0 then
  2485 			if remLife == 0 then
  2487 
  2486 
  2488 				tempE = AddVisualGear(GetX(gear)+15, GetY(gear), vgtSmoke, 0, true)
  2487 				local tempE = AddVisualGear(GetX(gear)+15, GetY(gear), vgtSmoke, 0, true)
  2489 				SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, col)
  2488 				SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, col)
  2490 
  2489 
  2491 				tempE = AddVisualGear(GetX(gear)-15, GetY(gear), vgtSmoke, 0, true)
  2490 				tempE = AddVisualGear(GetX(gear)-15, GetY(gear), vgtSmoke, 0, true)
  2492 				SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, col)
  2491 				SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, col)
  2493 
  2492 
  2494 				tempE = AddVisualGear(GetX(gear), GetY(gear)+15, vgtSmoke, 0, true)
  2493 				tempE = AddVisualGear(GetX(gear), GetY(gear)+15, vgtSmoke, 0, true)
  2495 				SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, col)
  2494 				SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, col)
  2496 
  2495 
  2497 				tempE = AddVisualGear(GetX(gear), GetY(gear)-15, vgtSmoke, 0, true)
  2496 				tempE = AddVisualGear(GetX(gear), GetY(gear)-15, vgtSmoke, 0, true)
  2498 				SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, col)
  2497 				SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, col)
  2499 
       
  2500 
  2498 
  2501 				PlaySound(sndVaporize)
  2499 				PlaySound(sndVaporize)
  2502 				DeleteGear(gear)
  2500 				DeleteGear(gear)
  2503 
  2501 
  2504 			end
  2502 			end