--- a/share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua Fri Sep 28 00:51:04 2012 +0400
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua Thu Sep 27 13:37:10 2012 -0400
@@ -235,6 +235,7 @@
-- some console stuff
local shellID = 0
local explosivesID = 0
+local luaGameTicks = 0
-- gaudyRacer
local boosterOn = false
@@ -296,6 +297,7 @@
-- tumbler goods
---------------------
+local moveTimer = 0
local leftOn = false
local rightOn = false
local upOn = false
@@ -316,6 +318,7 @@
local primShotsMax = 5
local primShotsLeft = 0
+local TimeLeftCounter = 0
local TimeLeft = 0
local stopMovement = false
local tumbleStarted = false
@@ -328,6 +331,8 @@
local shockwaveHealth = 0
local shockwaveRad = 300
+local Timer100 = 0
+
local vTag = {}
-----------------------------------------------
@@ -341,7 +346,8 @@
local FadeAlpha = 0 -- used to fade the circles out gracefully when player dies
local pTimer = 0 -- tracking projectiles following player
---local m2Count = 0 -- handle speed of circs
+local circAdjustTimer = 0 -- handle adjustment of circs direction
+local m2Count = 0 -- handle speed of circs
local vCirc = {}
local vCCount = 0
@@ -350,6 +356,7 @@
local rCircX = {}
local rCircY = {}
local rAlpha = 255
+local rPingTimer = 0
local radShotsLeft = 0
local vCircActive = {}
@@ -1153,10 +1160,11 @@
end
-function onGameTick20()
+function onGameTick()
--WriteLnToConsole("Start of GameTick")
+ luaGameTicks = luaGameTicks + 1 -- GameTime
HandleCircles()
@@ -1167,7 +1175,9 @@
--end
- if GameTime%100 == 0 then
+ Timer100 = Timer100 + 1
+ if Timer100 >= 100 then
+ Timer100 = 0
if beam == true then
shieldHealth = shieldHealth - 1
@@ -1191,7 +1201,7 @@
--runOnGears(HandleLifeSpan)
--runOnGears(DeleteFarFlungBarrel)
- if CirclesAreGo == true and CurrentHedgehog ~= nil then
+ if CirclesAreGo == true then
CheckDistances()
--runOnGears(CheckVarious) -- used to be in handletracking for some bizarre reason
--runOnGears(ProjectileTrack)
@@ -1215,7 +1225,7 @@
if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
--AddCaption(LOC_NOT("Good to go!"))
tumbleStarted = true
- TimeLeft = div(TurnTime, 1000) --45
+ TimeLeft = (TurnTime/1000) --45
FadeAlpha = 0
rAlpha = 255
AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
@@ -1233,7 +1243,9 @@
--AddCaption(GetX(CurrentHedgehog) .. ";" .. GetY(CurrentHedgehog) )
-- Calculate and display turn time
- if GameTime%1000 == 0 then
+ TimeLeftCounter = TimeLeftCounter + 1
+ if TimeLeftCounter == 1000 then
+ TimeLeftCounter = 0
TimeLeft = TimeLeft - 1
if TimeLeft >= 0 then
@@ -1298,8 +1310,10 @@
end
-- handle movement based on IO
- if GameTime%100 == 0 then -- 100
+ moveTimer = moveTimer + 1
+ if moveTimer == 100 then -- 100
--nw WriteLnToConsole("Start of Player MoveTimer")
+ moveTimer = 0
---------------
-- new trail code
@@ -1608,7 +1622,7 @@
vType[i] = "generic"
vCounter[i] = 0
- vCounterLim[i] = 150
+ vCounterLim[i] = 3000
vCircScore[i] = 0
vCircHealth[i] = 1
@@ -1801,7 +1815,7 @@
vType[i] = "drone"
vCircRadMin[i] = 50 *5
vCircRadMax[i] = 90 *5
- vCounterLim[i] = 150
+ vCounterLim[i] = 3000
vCircScore[i] = 10
vCircHealth[i] = 1
--else
@@ -1826,7 +1840,7 @@
vCircRadMin[i] = 100*5
vCircRadMax[i] = 180*5
vCircWidth[i] = 1
- vCounterLim[i] = 100
+ vCounterLim[i] = 2000
vCircScore[i] = 30
vCircHealth[i] = 3
else
@@ -1998,7 +2012,7 @@
end
-- if player is hit by circle bazooka
- elseif (GetGearType(gear) == gtShell) and (CurrentHedgehog ~= nil) then --or (GetGearType(gear) == gtBall) then
+ elseif (GetGearType(gear) == gtShell) then --or (GetGearType(gear) == gtBall) then
dist = GetDistFromGearToGear(gear, CurrentHedgehog)
@@ -2129,7 +2143,9 @@
if rAlpha ~= 255 then
- if GameTime%100 == 0 then
+ rPingTimer = rPingTimer + 1
+ if rPingTimer == 100 then
+ rPingTimer = 0
rAlpha = rAlpha + 5
if rAlpha >= 255 then
@@ -2245,7 +2261,10 @@
end
-- alter the circles velocities
- if GameTime%2000 == 0 then
+ circAdjustTimer = circAdjustTimer + 1
+ if circAdjustTimer == 2000 then
+
+ circAdjustTimer = 0
for i = 0,(vCCount-1) do
@@ -2253,9 +2272,9 @@
-- or make them move in random directions
if vCircX[i] > 5500 then
- vCircDX[i] = -4 --5 circmovchange
+ vCircDX[i] = -5 --5 circmovchange
elseif vCircX[i] < -1500 then
- vCircDX[i] = 4 --5 circmovchange
+ vCircDX[i] = 5 --5 circmovchange
else
z = GetRandom(2)
@@ -2268,9 +2287,9 @@
end
if vCircY[i] > 1500 then
- vCircDY[i] = -4 --5 circmovchange
+ vCircDY[i] = -5 --5 circmovchange
elseif vCircY[i] < -2900 then
- vCircDY[i] = 4 --5 circmovchange
+ vCircDY[i] = 5 --5 circmovchange
else
z = GetRandom(2)
if z == 1 then
@@ -2286,10 +2305,10 @@
end
-- move the circles according to their current velocities
- --m2Count = m2Count + 1
- --if m2Count == 25 then --25 circmovchange
-
- -- m2Count = 0
+ m2Count = m2Count + 1
+ if m2Count == 25 then --25 circmovchange
+
+ m2Count = 0
for i = 0,(vCCount-1) do
vCircX[i] = vCircX[i] + vCircDX[i]
vCircY[i] = vCircY[i] + vCircDY[i]
@@ -2330,7 +2349,7 @@
- --end
+ end
for i = 0,(vCCount-1) do
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i]) -- vCircCol[i] g10
@@ -2387,19 +2406,17 @@
--WriteLnToConsole("I just got the velocity of the shell. It is dx: " .. dx .. "; dy: " .. dy)
--WriteLnToConsole("CurrentHedgehog is at X: " .. GetX(CurrentHedgehog) .. "; Y: " .. GetY(CurrentHedgehog) )
- if CurrentHedgehog ~= nil then
- if GetX(gear) > GetX(CurrentHedgehog) then
- dx = dx - turningSpeed--0.1
- else
- dx = dx + turningSpeed--0.1
- end
-
- if GetY(gear) > GetY(CurrentHedgehog) then
- dy = dy - turningSpeed--0.1
- else
- dy = dy + turningSpeed--0.1
- end
- end
+ if GetX(gear) > GetX(CurrentHedgehog) then
+ dx = dx - turningSpeed--0.1
+ else
+ dx = dx + turningSpeed--0.1
+ end
+
+ if GetY(gear) > GetY(CurrentHedgehog) then
+ dy = dy - turningSpeed--0.1
+ else
+ dy = dy + turningSpeed--0.1
+ end
if (GetGearType(gear) == gtShell) then