share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua
changeset 5827 a416f1070fdf
parent 5825 a6eab1b7c00d
child 5894 86c59c34cdd5
equal deleted inserted replaced
5825:a6eab1b7c00d 5827:a416f1070fdf
    71 -- switched most of the explosions/smoke effects back to non-critical vgears (with a few exceptions)
    71 -- switched most of the explosions/smoke effects back to non-critical vgears (with a few exceptions)
    72 -- tumbletime is now based off turntime and is variable
    72 -- tumbletime is now based off turntime and is variable
    73 -- delete explosives in DeleteFarFlungBarrel rather than explode them on map boundaries to save on performance
    73 -- delete explosives in DeleteFarFlungBarrel rather than explode them on map boundaries to save on performance
    74 -- utilized the improved AddCaption to tint / prevent overrides
    74 -- utilized the improved AddCaption to tint / prevent overrides
    75 -- temporarily disabled bugged sort that displays teams according to their score
    75 -- temporarily disabled bugged sort that displays teams according to their score
    76 -- reluctantly changed the colour of the bonus circ to purple 
    76 -- reluctantly changed the colour of the bonus circ to purple
    77 -- standarized point notation
    77 -- standarized point notation
    78 -- added some missing locs
    78 -- added some missing locs
    79 -- commented out remaining WriteLnToConsoles for the meanwhile with the prefix "nw"
    79 -- commented out remaining WriteLnToConsoles for the meanwhile with the prefix "nw"
    80 
    80 
    81 -- ACHIEIVEMENTS added
    81 -- ACHIEIVEMENTS added
   126 
   126 
   127 -----------------
   127 -----------------
   128 capgrpAmmostate
   128 capgrpAmmostate
   129 -----------------
   129 -----------------
   130 AddCaption( chainLength .. LOC_NOT("-chain! +") .. chainLength*2 .. LOC_NOT(" points!"),0xffba00ff,capgrpAmmostate)
   130 AddCaption( chainLength .. LOC_NOT("-chain! +") .. chainLength*2 .. LOC_NOT(" points!"),0xffba00ff,capgrpAmmostate)
   131 AddCaption(LOC_NOT("Multi-shot! +5 points!"),0xffba00ff,capgrpAmmostate) 
   131 AddCaption(LOC_NOT("Multi-shot! +5 points!"),0xffba00ff,capgrpAmmostate)
   132 
   132 
   133 -----------------
   133 -----------------
   134 capgrpAmmoinfo
   134 capgrpAmmoinfo
   135 -----------------
   135 -----------------
   136 AddCaption(LOC_NOT("Shield Miser! +20 points!"),0xffba00ff,capgrpAmmoinfo)
   136 AddCaption(LOC_NOT("Shield Miser! +20 points!"),0xffba00ff,capgrpAmmoinfo)
   143 AddCaption(LOC_NOT("BOOM! +50 points!"),0xffba00ff,capgrpVolume)
   143 AddCaption(LOC_NOT("BOOM! +50 points!"),0xffba00ff,capgrpVolume)
   144 AddCaption(LOC_NOT("BOOM! BOOM! BOOM! +100 points!"),0xffba00ff,capgrpVolume)
   144 AddCaption(LOC_NOT("BOOM! BOOM! BOOM! +100 points!"),0xffba00ff,capgrpVolume)
   145 AddCaption(LOC_NOT("Accuracy Bonus! +15 points!"),0xffba00ff,capgrpVolume)
   145 AddCaption(LOC_NOT("Accuracy Bonus! +15 points!"),0xffba00ff,capgrpVolume)
   146 
   146 
   147 -----------------
   147 -----------------
   148 capgrpMessage 
   148 capgrpMessage
   149 -----------------
   149 -----------------
   150 AddCaption(LOC_NOT("Ammo Depleted!"),0xff0000ff,capgrpMessage)
   150 AddCaption(LOC_NOT("Ammo Depleted!"),0xff0000ff,capgrpMessage)
   151 AddCaption(LOC_NOT("Ammo: ") .. primShotsLeft)
   151 AddCaption(LOC_NOT("Ammo: ") .. primShotsLeft)
   152 AddCaption("Shield Depleted",0xff0000ff,capgrpMessage)
   152 AddCaption("Shield Depleted",0xff0000ff,capgrpMessage)
   153 AddCaption( LOC_NOT("Shield ON:") .. " " .. shieldHealth - 80 .. " " .. LOC_NOT("Power Remaining") )
   153 AddCaption( LOC_NOT("Shield ON:") .. " " .. shieldHealth - 80 .. " " .. LOC_NOT("Power Remaining") )
   163 AddCaption(LOC_NOT("Kamikaze Expert! +15 points!"),0xffba00ff,capgrpMessage)
   163 AddCaption(LOC_NOT("Kamikaze Expert! +15 points!"),0xffba00ff,capgrpMessage)
   164 AddCaption(LOC_NOT("Depleted Kamikaze! +5 points!"),0xffba00ff,capgrpMessage)
   164 AddCaption(LOC_NOT("Depleted Kamikaze! +5 points!"),0xffba00ff,capgrpMessage)
   165 AddCaption(LOC_NOT("Timed Kamikaze! +10 points!"),0xffba00ff,capgrpMessage)
   165 AddCaption(LOC_NOT("Timed Kamikaze! +10 points!"),0xffba00ff,capgrpMessage)
   166 
   166 
   167 -----------------
   167 -----------------
   168 capgrpMessage2 
   168 capgrpMessage2
   169 -----------------
   169 -----------------
   170 AddCaption(LOC_NOT("Drone Hunter! +10 points!"),0xffba00ff,capgrpMessage2)
   170 AddCaption(LOC_NOT("Drone Hunter! +10 points!"),0xffba00ff,capgrpMessage2)
   171 AddCaption(LOC_NOT("Ammo Maniac! +5 points!"),0xffba00ff,capgrpMessage2)
   171 AddCaption(LOC_NOT("Ammo Maniac! +5 points!"),0xffba00ff,capgrpMessage2)
   172 AddCaption(LOC_NOT("Shield Seeker! +10 points!"),0xffba00ff,capgrpMessage2)
   172 AddCaption(LOC_NOT("Shield Seeker! +10 points!"),0xffba00ff,capgrpMessage2)
   173 AddCaption(LOC_NOT("Boss Slayer! +25 points!"),0xffba00ff,capgrpMessage2)
   173 AddCaption(LOC_NOT("Boss Slayer! +25 points!"),0xffba00ff,capgrpMessage2)
   225 local BK = 0
   225 local BK = 0
   226 local OK = 0
   226 local OK = 0
   227 local SK = 0
   227 local SK = 0
   228 local shieldMiser = true
   228 local shieldMiser = true
   229 local chainCounter = 0
   229 local chainCounter = 0
   230 local chainLength = 0 
   230 local chainLength = 0
   231 local shotsFired = 0
   231 local shotsFired = 0
   232 local shotsHit = 0
   232 local shotsHit = 0
   233 
   233 
   234 ---------------------
   234 ---------------------
   235 -- tumbler goods
   235 -- tumbler goods
   313 	end
   313 	end
   314 
   314 
   315 end
   315 end
   316 
   316 
   317 function DrawTag(i)
   317 function DrawTag(i)
   318 	
   318 
   319 	zoomL = 1.3
   319 	zoomL = 1.3
   320 
   320 
   321 	xOffset = 40
   321 	xOffset = 40
   322 
   322 
   323 	if i == 0 then
   323 	if i == 0 then
   324 		yOffset = 40	
   324 		yOffset = 40
   325 		tCol = 0xffba00ff
   325 		tCol = 0xffba00ff
   326 		tValue = TimeLeft
   326 		tValue = TimeLeft
   327 	elseif i == 1 then
   327 	elseif i == 1 then
   328 		zoomL = 1.1		
   328 		zoomL = 1.1
   329 		yOffset = 70	
   329 		yOffset = 70
   330 		tCol = 0x00ff00ff
   330 		tCol = 0x00ff00ff
   331 		tValue = primShotsLeft
   331 		tValue = primShotsLeft
   332 	elseif i == 2 then
   332 	elseif i == 2 then
   333 		zoomL = 1.1		
   333 		zoomL = 1.1
   334 		xOffset = 40 + 35
   334 		xOffset = 40 + 35
   335 		yOffset = 70		
   335 		yOffset = 70
   336 		tCol = 0xa800ffff
   336 		tCol = 0xa800ffff
   337 		tValue = shieldHealth - 80
   337 		tValue = shieldHealth - 80
   338 	end
   338 	end
   339 
   339 
   340 	DeleteVisualGear(vTag[i])
   340 	DeleteVisualGear(vTag[i])
   341 	vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
   341 	vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
   342 	g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vTag[i])
   342 	g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vTag[i])
   343 	SetVisualGearValues	(	
   343 	SetVisualGearValues	(
   344 				vTag[i], 		--id
   344 				vTag[i], 		--id
   345 				-(ScreenWidth/2) + xOffset,	--xoffset
   345 				-(ScreenWidth/2) + xOffset,	--xoffset
   346 				ScreenHeight - yOffset, --yoffset
   346 				ScreenHeight - yOffset, --yoffset
   347 				0, 			--dx
   347 				0, 			--dx
   348 				0, 			--dy
   348 				0, 			--dy
   626 	if GetGearType(gear) == gtExplosives then
   626 	if GetGearType(gear) == gtExplosives then
   627 		if 	(GetX(gear) < -1900) or
   627 		if 	(GetX(gear) < -1900) or
   628 			(GetX(gear) > 6200) or
   628 			(GetX(gear) > 6200) or
   629 			(GetY(gear) < -3400)
   629 			(GetY(gear) < -3400)
   630 		then
   630 		then
   631 			AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)			
   631 			AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
   632 			DeleteGear(gear)			
   632 			DeleteGear(gear)
   633 			--SetHealth(gear, 0)
   633 			--SetHealth(gear, 0)
   634 			--WriteLnToConsole("I'm setting barrel ID " .. getGearValue(gear,"ID") .. " to 0 health because it's been flung too close to the map edges. at Game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
   634 			--WriteLnToConsole("I'm setting barrel ID " .. getGearValue(gear,"ID") .. " to 0 health because it's been flung too close to the map edges. at Game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
   635 		end
   635 		end
   636 
   636 
   637 	end
   637 	end
   649 	--WriteLnToConsole("onPrecise event handler at Game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
   649 	--WriteLnToConsole("onPrecise event handler at Game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
   650 
   650 
   651 	-- Fire Barrel
   651 	-- Fire Barrel
   652 	if (primShotsLeft > 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
   652 	if (primShotsLeft > 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
   653 
   653 
   654 		shotsFired = shotsFired +1		
   654 		shotsFired = shotsFired +1
   655 		
   655 
   656 		morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtExplosives, 0, 0, 0, 1)
   656 		morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtExplosives, 0, 0, 0, 1)
   657 
   657 
   658 		primShotsLeft = primShotsLeft - 1
   658 		primShotsLeft = primShotsLeft - 1
   659 
   659 
   660 		if primShotsLeft == 0 then
   660 		if primShotsLeft == 0 then
   755 	CaseFreq = 0
   755 	CaseFreq = 0
   756 	HealthCaseProb = 0
   756 	HealthCaseProb = 0
   757 	MinesNum = 0
   757 	MinesNum = 0
   758 	Explosives = 0
   758 	Explosives = 0
   759 
   759 
   760 	for i = 0, 3 do 	
   760 	for i = 0, 3 do
   761 		vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false)	
   761 		vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
   762 	end
   762 	end
   763 
   763 
   764 	HideTags()
   764 	HideTags()
   765 
   765 
   766 end
   766 end
   850 		gameBegun = false
   850 		gameBegun = false
   851 		stopMovement = true
   851 		stopMovement = true
   852 		tumbleStarted = false
   852 		tumbleStarted = false
   853 		SetMyCircles(false)
   853 		SetMyCircles(false)
   854 	end
   854 	end
   855 	
   855 
   856 	HideTags()
   856 	HideTags()
   857 
   857 
   858 	---------------
   858 	---------------
   859 	---------------
   859 	---------------
   860 	--AddCaption("num g: " .. numGears() )
   860 	--AddCaption("num g: " .. numGears() )
   877 end
   877 end
   878 
   878 
   879 
   879 
   880 function onGameTick()
   880 function onGameTick()
   881 
   881 
   882 	
   882 
   883 	--WriteLnToConsole("Start of GameTick")	
   883 	--WriteLnToConsole("Start of GameTick")
   884 	luaGameTicks = luaGameTicks + 1 -- GameTime
   884 	luaGameTicks = luaGameTicks + 1 -- GameTime
   885 
   885 
   886 	HandleCircles()
   886 	HandleCircles()
   887 
   887 
   888 	Timer100 = Timer100 + 1
   888 	Timer100 = Timer100 + 1
   970 		-------------------------------
   970 		-------------------------------
   971 		-- checks in FloatyThings
   971 		-- checks in FloatyThings
   972 		if PlayerIsFine() == false then
   972 		if PlayerIsFine() == false then
   973 			TimeLeft = 0
   973 			TimeLeft = 0
   974 		end
   974 		end
   975 		
   975 
   976 		--WriteLnToConsole("successfully checked playerIsFine")
   976 		--WriteLnToConsole("successfully checked playerIsFine")
   977 		
   977 
   978 		if (TimeLeft == 0) then
   978 		if (TimeLeft == 0) then
   979 			if (stopMovement == false) then	--time to stop the player
   979 			if (stopMovement == false) then	--time to stop the player
   980 				stopMovement = true
   980 				stopMovement = true
   981 				beam = false
   981 				beam = false
   982 				upOn = false
   982 				upOn = false
  1000 			end
  1000 			end
  1001 		else -- remove this if you want tumbler to fall slowly on death
  1001 		else -- remove this if you want tumbler to fall slowly on death
  1002 		-------------------------------
  1002 		-------------------------------
  1003 		-- Player is still in luck
  1003 		-- Player is still in luck
  1004 		-------------------------------
  1004 		-------------------------------
  1005 			
  1005 
  1006 
  1006 
  1007 			--WriteLnToConsole("about to do chainCounter checks")
  1007 			--WriteLnToConsole("about to do chainCounter checks")
  1008 			if chainCounter > 0 then
  1008 			if chainCounter > 0 then
  1009 				chainCounter = chainCounter -1 
  1009 				chainCounter = chainCounter -1
  1010 				if chainCounter == 0 then
  1010 				if chainCounter == 0 then
  1011 					chainLength = 0
  1011 					chainLength = 0
  1012 				end
  1012 				end
  1013 			end
  1013 			end
  1014 				
  1014 
  1015 			-- handle movement based on IO
  1015 			-- handle movement based on IO
  1016 			moveTimer = moveTimer + 1
  1016 			moveTimer = moveTimer + 1
  1017 			if moveTimer == 100 then -- 100
  1017 			if moveTimer == 100 then -- 100
  1018 				--nw WriteLnToConsole("Start of Player MoveTimer")
  1018 				--nw WriteLnToConsole("Start of Player MoveTimer")
  1019 				moveTimer = 0
  1019 				moveTimer = 0
  1580 
  1580 
  1581 					CircleDamaged(i)
  1581 					CircleDamaged(i)
  1582 
  1582 
  1583 					circsHit = circsHit + 1
  1583 					circsHit = circsHit + 1
  1584 					if circsHit > 1 then
  1584 					if circsHit > 1 then
  1585 						AddCaption(loc("Multi-shot!") .. " +5 " .. loc("points") .. "!",0xffba00ff,capgrpAmmostate) 
  1585 						AddCaption(loc("Multi-shot!") .. " +5 " .. loc("points") .. "!",0xffba00ff,capgrpAmmostate)
  1586 					end
  1586 					end
  1587 
  1587 
  1588 					shotsHit = shotsHit + 1
  1588 					shotsHit = shotsHit + 1
  1589 
  1589 
  1590 				end
  1590 				end
  1877 			FadeAlpha = FadeAlpha + 1
  1877 			FadeAlpha = FadeAlpha + 1
  1878 			if FadeAlpha >= 255 then
  1878 			if FadeAlpha >= 255 then
  1879 				FadeAlpha = 255
  1879 				FadeAlpha = 255
  1880 			end
  1880 			end
  1881 
  1881 
  1882 			--new			
  1882 			--new
  1883 			--if FadeAlpha == 1 then
  1883 			--if FadeAlpha == 1 then
  1884 			--	AddCaption("GOT IT")				
  1884 			--	AddCaption("GOT IT")
  1885 			--	for i = 0,(vCCount-1) do
  1885 			--	for i = 0,(vCCount-1) do
  1886 			--		g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i])
  1886 			--		g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i])
  1887 			--		vCircCol[i] = g10	
  1887 			--		vCircCol[i] = g10
  1888 			--	end
  1888 			--	end
  1889 			--end
  1889 			--end
  1890 
  1890 
  1891 		end
  1891 		end
  1892 
  1892