share/hedgewars/Data/Scripts/Multiplayer/Capture_the_Flag.lua
changeset 5819 e23ced69e03d
parent 5277 09beef0752ab
child 5821 afb988c1a2fe
equal deleted inserted replaced
5817:70208e400a59 5819:e23ced69e03d
     1 ---------------------------------------
     1 ---------------------------------------
     2 -- CAPTURE_THE_FLAG GAMEPLAY MODE 0.4
     2 -- CAPTURE_THE_FLAG GAMEPLAY MODE 0.5
     3 -- by mikade
     3 -- by mikade
     4 ---------------------------------------
     4 ---------------------------------------
     5 
     5 
     6 -- Version History
     6 -- Version History
     7 ---------
     7 ---------
    58 -- removed some stuff that wasn't needed
    58 -- removed some stuff that wasn't needed
    59 -- fix piano strike exploit
    59 -- fix piano strike exploit
    60 -- changed delay to allow for better portals
    60 -- changed delay to allow for better portals
    61 -- changed starting feedback a little
    61 -- changed starting feedback a little
    62 -- increased the radius around the circle indicating the flag thief so that it doesn't obscure his health
    62 -- increased the radius around the circle indicating the flag thief so that it doesn't obscure his health
       
    63 
       
    64 --------
       
    65 -- 0.5
       
    66 --------
       
    67 
       
    68 -- add support for more players
       
    69 -- stop TimeBox ruining my life
       
    70 -- profit???
    63 
    71 
    64 -----------------
    72 -----------------
    65 --SCRIPT BEGINS
    73 --SCRIPT BEGINS
    66 -----------------
    74 -----------------
    67 
    75 
   340 
   348 
   341 function RebuildTeamInfo()
   349 function RebuildTeamInfo()
   342 
   350 
   343 
   351 
   344 	-- make a list of individual team names
   352 	-- make a list of individual team names
   345 	for i = 0, 5 do
   353 	for i = 0, (TeamsCount-1) do
   346 		teamNameArr[i] = i
   354 		teamNameArr[i] = i
   347 		teamSize[i] = 0
   355 		teamSize[i] = 0
   348 		teamIndex[i] = 0
   356 		teamIndex[i] = 0
   349 	end
   357 	end
   350 	numTeams = 0
   358 	numTeams = 0
   560 
   568 
   561 	AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
   569 	AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
   562 
   570 
   563 end
   571 end
   564 
   572 
       
   573 function InABetterPlaceNow(gear)
       
   574 	for i = 0, (numhhs-1) do
       
   575 		if gear == hhs[i] then
       
   576 				
       
   577 			for i = 0,1 do
       
   578 				if gear == fThief[i] then
       
   579 					FlagThiefDead(gear)
       
   580 				end
       
   581 			end				
       
   582 			hhs[i] = nil	
       
   583 		end		
       
   584 	end
       
   585 end
       
   586 
       
   587 function onHogHide(gear)
       
   588 	 InABetterPlaceNow(gear)
       
   589 end
       
   590 
       
   591 function onHogRestore(gear)
       
   592 	match = false	
       
   593 	for i = 0, (numhhs-1) do
       
   594 		if (hhs[i] == nil) and (match == false) then
       
   595 			hhs[i] = gear
       
   596 			--AddCaption(GetHogName(gear) .. " has reappeared it seems!")	
       
   597 			match = true
       
   598 		end
       
   599 	end
       
   600 end
       
   601 
       
   602 
   565 function onGearAdd(gear)
   603 function onGearAdd(gear)
   566 
   604 
   567 	if GetGearType(gear) == gtHedgehog then
   605 	if GetGearType(gear) == gtHedgehog then
   568 		hhs[numhhs] = gear
   606 		hhs[numhhs] = gear
   569 		numhhs = numhhs + 1
   607 		numhhs = numhhs + 1
   582 end
   620 end
   583 
   621 
   584 function onGearDelete(gear)
   622 function onGearDelete(gear)
   585 
   623 
   586 	if GetGearType(gear) == gtHedgehog then
   624 	if GetGearType(gear) == gtHedgehog then
   587 		for i = 0, (numhhs-1) do
   625 		InABetterPlaceNow(gear)		
   588 			if gear == hhs[i] then
   626 	end
   589 				
   627 
   590 				for i = 0,1 do
   628 end
   591 					if gear == fThief[i] then
       
   592 						FlagThiefDead(gear)
       
   593 					end
       
   594 				end				
       
   595 				hhs[i] = nil	
       
   596 			end		
       
   597 		end
       
   598 	end
       
   599 
       
   600 end