author | Wuzzy <Wuzzy2@mail.ru> |
Wed, 19 Dec 2018 05:50:02 +0100 | |
changeset 14480 | 2113296b7a29 |
parent 13648 | 690cc84e9fd6 |
child 14583 | 50f511588635 |
permissions | -rw-r--r-- |
5277 | 1 |
--------------------------------------- |
5819 | 2 |
-- CAPTURE_THE_FLAG GAMEPLAY MODE 0.5 |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
3 |
-- by mikade |
5277 | 4 |
--------------------------------------- |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
5 |
|
11911
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
6 |
---- Script parameter |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
7 |
-- With “captures=<number>” you can set your own capture limit, e.g. “captures=5” for 5 captures. |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
8 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
9 |
-- Version History |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
10 |
--------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
11 |
-- 0.1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
12 |
--------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
13 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
14 |
-- [conversion from map-dependant CTF_Blizzard to map independant Capture the Flag] |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
15 |
-- added an intial starting stage where flagspawn is decided by the players (weapon set will require a jetpack unless I set) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
16 |
-- changed the flag from a crate to a visual gear, and all associated methods and checks relating to flags (five hours later, lol) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
17 |
-- changed starting/respawning positioning to accommodate different map sizes |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
18 |
-- added another circle to mark flag spawn |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
19 |
-- added gameFlag filter |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
20 |
-- changed scoring feedback |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
21 |
-- cleaned up some code |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
22 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
23 |
-- removing own flag from spawning point no longer possible |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
24 |
-- destroying flags no longer possible. |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
25 |
-- added basic glowing circle effect to spawn area |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
26 |
-- added expanding circle to fgear itself |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
27 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
28 |
-- removed teleporters |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
29 |
-- removed random crate drops (this should be decided by scheme) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
30 |
-- removed set map criteria like minesNum, turnTime, explosives etc. except for sudden death |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
31 |
-- removed weapon defintions |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
32 |
-- removed placement and respawning methods, hopefully divideTeams will have this covered |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
33 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
34 |
--------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
35 |
-- 0.2 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
36 |
--------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
37 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
38 |
-- [now with user friendliness] |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
39 |
-- flag is now placed wherever you end up at the end of your first turn, this ensures that it is always placed by turn 3 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
40 |
-- removed a bunch of backup code and no-longer needed variables / methods from CTF_Blizzard days |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
41 |
-- removed an aura that was still mistakenly hanging about |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
42 |
-- added an in-game note about placements |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
43 |
-- added an in-game note about the rules of the game |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
44 |
-- added translation support and loc()'ed everything |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
45 |
-- changed things so the seed is no longer always the same... |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
46 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
47 |
-- In this version: |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
48 |
--------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
49 |
-- 0.3 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
50 |
--------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
51 |
-- [fufufufu kamikaze fix] |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
52 |
-- added nill checks to make sure the player doesn't generate errors by producing a nil value in hhs[] when he uses kamikaze |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
53 |
-- added a check to make sure the player doesn't kamikaze straight down and make the flag's starting point underwater |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
54 |
-- added a check to make sure the player drops the flag if he has it and he uses kamikaze |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
55 |
|
5277 | 56 |
-------- |
57 |
-- 0.4 |
|
58 |
-------- |
|
59 |
||
60 |
-- remove user-branding and version numbers |
|
61 |
-- removed some stuff that wasn't needed |
|
62 |
-- fix piano strike exploit |
|
63 |
-- changed delay to allow for better portals |
|
64 |
-- changed starting feedback a little |
|
65 |
-- increased the radius around the circle indicating the flag thief so that it doesn't obscure his health |
|
66 |
||
5819 | 67 |
-------- |
68 |
-- 0.5 |
|
69 |
-------- |
|
70 |
||
71 |
-- add support for more players |
|
5821
afb988c1a2fe
Allow limited form of SuddenDeath (WaterRise = 0) in both CTF modes
mikade
parents:
5819
diff
changeset
|
72 |
-- allow limited sudden death |
5819 | 73 |
-- stop TimeBox ruining my life |
74 |
-- profit??? |
|
75 |
||
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
76 |
----------------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
77 |
--SCRIPT BEGINS |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
78 |
----------------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
79 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
80 |
-- enable awesome translaction support so we can use loc() wherever we want |
8043 | 81 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
11911
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
82 |
HedgewarsScriptLoad("/Scripts/Params.lua") |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
83 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
84 |
--------------------------------------------------------------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
85 |
----------lots of bad variables and things |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
86 |
----------because someone is too lazy |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
87 |
----------to read about tables properly |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
88 |
------------------ "Oh well, they probably have the memory" |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
89 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
90 |
local gameStarted = false |
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
91 |
local gameOver = false |
11911
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
92 |
local captureLimit = 3 |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
93 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
94 |
-------------------------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
95 |
-- hog and team tracking variales |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
96 |
-------------------------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
97 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
98 |
local numhhs = 0 -- store number of hedgehogs |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
99 |
local hhs = {} -- store hedgehog gears |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
100 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
101 |
local teamSize = {} -- store how many hogs per team |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
102 |
local teamIndex = {} -- at what point in the hhs{} does each team begin |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
103 |
|
13120
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
104 |
local mostCapturesHogName = nil -- name of hog who holds the record of most flags captured |
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
105 |
local mostCapturesHogTeam = nil -- name of team who holds the record of most flags captured |
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
106 |
local mostCaptures = 0 -- number of most per-hog captures |
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
107 |
local capturesPerHog = {} |
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
108 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
109 |
------------------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
110 |
-- flag variables |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
111 |
------------------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
112 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
113 |
local fGear = {} -- pointer to the visual gears that represent the flag |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
114 |
local fGearX = {} |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
115 |
local fGearY = {} |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
116 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
117 |
local fThief = {} -- pointer to the hogs who stole the flags |
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
118 |
local fThiefFlag = {} -- contains the stolen flag type of fThief |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
119 |
local fIsMissing = {} -- have the flags been destroyed or captured |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
120 |
local fNeedsRespawn = {} -- do the flags need to be respawned |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
121 |
local fCaptures = {} -- the team "scores" how many captures |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
122 |
local fSpawnX = {} -- spawn X for flags |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
123 |
local fSpawnY = {} -- spawn Y for flags |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
124 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
125 |
local fThiefX = {} |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
126 |
local fThiefY = {} |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
127 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
128 |
local fSpawnC = {} -- spawn circle marker |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
129 |
local fCirc = {} -- flag/carrier marker circles |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
130 |
local fCol = {} -- colour of the clans |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
131 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
132 |
local fGearRad = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
133 |
local fGearRadMin = 5 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
134 |
local fGearRadMax = 33 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
135 |
local fGearTimer = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
136 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
137 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
138 |
--flag methods |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
139 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
140 |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
141 |
function CheckScore(clanID) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
142 |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
143 |
if fCaptures[clanID] == captureLimit then |
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
144 |
gameOver = true |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
145 |
-- Capture limit reached! We have a winner! |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
146 |
for i = 0, (numhhs-1) do |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
147 |
if hhs[i] ~= nil then |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
148 |
-- Kill all losers |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
149 |
if GetHogClan(hhs[i]) ~= clanID then |
7838 | 150 |
SetEffect(hhs[i], heResurrectable, 0) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
151 |
SetHealth(hhs[i],0) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
152 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
153 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
154 |
end |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
155 |
if CurrentHedgehog ~= nil then |
13648 | 156 |
AddCaption(string.format(loc("Victory for %s!"), GetHogTeamName(CurrentHedgehog)), capcolDefault, capgrpGameState) |
13024
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12084
diff
changeset
|
157 |
updateScores() |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
158 |
end |
13118
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
159 |
|
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
160 |
-- Calculate team rankings |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
161 |
|
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
162 |
local teamList = {} |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
163 |
for i=0, TeamsCount-1 do |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
164 |
local name = GetTeamName(i) |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
165 |
local clan = GetTeamClan(name) |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
166 |
table.insert(teamList, { score = fCaptures[clan], name = name, clan = clan }) |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
167 |
end |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
168 |
local teamRank = function(a, b) |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
169 |
return a.score > b.score |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
170 |
end |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
171 |
table.sort(teamList, teamRank) |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
172 |
|
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
173 |
for i=1, #teamList do |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
174 |
SendStat(siPointType, loc("point(s)")) |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
175 |
SendStat(siPlayerKills, tostring(teamList[i].score), teamList[i].name) |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
176 |
end |
13120
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
177 |
|
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
178 |
if mostCaptures >= 2 then |
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
179 |
SendStat(siCustomAchievement, string.format(loc("%s (%s) has captured the flag %d times."), mostCapturesHogName, mostCapturesHogTeam, mostCaptures)) |
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
180 |
end |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
181 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
182 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
183 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
184 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
185 |
function DoFlagStuff(flag, flagClan) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
186 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
187 |
if not CurrentHedgehog then |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
188 |
return |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
189 |
end |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
190 |
local wtf = flagClan |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
191 |
|
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
192 |
local thiefClan |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
193 |
for i=0, ClansCount - 1 do |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
194 |
if CurrentHedgehog == fThief[i] then |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
195 |
thiefClan = i |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
196 |
end |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
197 |
end |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
198 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
199 |
-- player has successfully captured the enemy flag |
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
200 |
if (GetHogClan(CurrentHedgehog) == flagClan) and (thiefClan ~= nil) and (fIsMissing[flagClan] == false) then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
201 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
202 |
fIsMissing[thiefClan] = false |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
203 |
fNeedsRespawn[thiefClan] = true |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
204 |
fCaptures[flagClan] = fCaptures[flagClan] +1 |
13648 | 205 |
AddCaption(string.format(loc("%s has scored!"), GetHogName(CurrentHedgehog)), capcolDefault, capgrpGameState) |
13024
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12084
diff
changeset
|
206 |
updateScores() |
11912
ce9e0f8e43f4
CTF: Play sound when capturing flag
Wuzzy <almikes@aol.com>
parents:
11911
diff
changeset
|
207 |
PlaySound(sndHomerun) |
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
208 |
fThief[thiefClan] = nil -- player no longer has the enemy flag |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
209 |
fThiefFlag[flagClan] = nil |
13120
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
210 |
|
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
211 |
capturesPerHog[CurrentHedgehog] = capturesPerHog[CurrentHedgehog] + 1 |
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
212 |
if capturesPerHog[CurrentHedgehog] > mostCaptures then |
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
213 |
mostCaptures = capturesPerHog[CurrentHedgehog] |
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
214 |
mostCapturesHogName = GetHogName(CurrentHedgehog) |
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
215 |
mostCapturesHogTeam = GetHogTeamName(CurrentHedgehog) |
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
216 |
end |
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
217 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
218 |
CheckScore(flagClan) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
219 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
220 |
--if the player is returning the flag |
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
221 |
elseif (GetHogClan(CurrentHedgehog) == flagClan) and (fIsMissing[flagClan] == true) then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
222 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
223 |
DeleteVisualGear(fGear[flagClan]) |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
224 |
fGear[flagClan] = nil -- the flag has now disappeared |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
225 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
226 |
fNeedsRespawn[flagClan] = true |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
227 |
HandleRespawns() -- this will set fIsMissing[flagClan] to false :) |
13648 | 228 |
AddCaption(loc("Flag returned!"), capcolDefault, capgrpMessage2) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
229 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
230 |
--if the player is taking the enemy flag (not possible if already holding a flag) |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
231 |
elseif GetHogClan(CurrentHedgehog) ~= flagClan and (thiefClan == nil) then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
232 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
233 |
DeleteVisualGear(fGear[flagClan]) |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
234 |
fGear[flagClan] = nil -- the flag has now disappeared |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
235 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
236 |
fIsMissing[flagClan] = true |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
237 |
for i = 0,numhhs-1 do |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
238 |
if CurrentHedgehog ~= nil then |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
239 |
if CurrentHedgehog == hhs[i] then |
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
240 |
fThief[flagClan] = hhs[i] |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
241 |
fThiefFlag[flagClan] = flagClan |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
242 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
243 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
244 |
end |
13648 | 245 |
AddCaption(loc("Flag captured!"), capcolDefault, capgrpMessage2) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
246 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
247 |
end |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
248 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
249 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
250 |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
251 |
function CheckFlagProximity() |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
252 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
253 |
for i = 0, ClansCount-1 do |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
254 |
if fGear[i] ~= nil then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
255 |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
256 |
local g1X = fGearX[i] |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
257 |
local g1Y = fGearY[i] |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
258 |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
259 |
local g2X, g2Y = GetGearPosition(CurrentHedgehog) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
260 |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
261 |
local q = g1X - g2X |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
262 |
local w = g1Y - g2Y |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
263 |
local dist = (q*q) + (w*w) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
264 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
265 |
if dist < 500 then |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
266 |
DoFlagStuff(fGear[i], i) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
267 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
268 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
269 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
270 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
271 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
272 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
273 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
274 |
function HandleRespawns() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
275 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
276 |
for i = 0, ClansCount-1 do |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
277 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
278 |
if fNeedsRespawn[i] == true then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
279 |
fGear[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
280 |
fGearX[i] = fSpawnX[i] |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
281 |
fGearY[i] = fSpawnY[i] |
5277 | 282 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
283 |
fNeedsRespawn[i] = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
284 |
fIsMissing[i] = false -- new, this should solve problems of a respawned flag being "returned" when a player tries to score |
13648 | 285 |
AddCaption(loc("Flag respawned!"), capcolDefault, capgrpMessage2) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
286 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
287 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
288 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
289 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
290 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
291 |
|
13118
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
292 |
-- Advance the clan score graph by one step |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
293 |
function DrawScores() |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
294 |
local clansUsed = {} |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
295 |
for i=0, TeamsCount-1 do |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
296 |
local team = GetTeamName(i) |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
297 |
local clan = GetTeamClan(team) |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
298 |
if not clansUsed[clan] then |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
299 |
local captures = fCaptures[clan] |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
300 |
SendStat(siClanHealth, captures, team) |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
301 |
clansUsed[clan] = true |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
302 |
end |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
303 |
end |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
304 |
end |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
305 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
306 |
function FlagThiefDead(gear) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
307 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
308 |
local thiefClan |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
309 |
local stolenFlagClan |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
310 |
for i=0, ClansCount-1 do |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
311 |
if (gear == fThief[i]) then |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
312 |
thiefClan = i |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
313 |
stolenFlagClan = fThiefFlag[i] |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
314 |
break |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
315 |
end |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
316 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
317 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
318 |
if stolenFlagClan ~= nil then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
319 |
-- falls into water |
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
320 |
if (LAND_HEIGHT - fThiefY[thiefClan]) < 15 then |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
321 |
fIsMissing[stolenFlagClan] = true |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
322 |
fNeedsRespawn[stolenFlagClan] = true |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
323 |
HandleRespawns() |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
324 |
else --normally |
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
325 |
fGearX[stolenFlagClan] = fThiefX[thiefClan] |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
326 |
fGearY[stolenFlagClan] = fThiefY[thiefClan] |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
327 |
fGear[stolenFlagClan] = AddVisualGear(fGearX[stolenFlagClan], fGearY[stolenFlagClan], vgtCircle, 0, true) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
328 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
329 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
330 |
AddVisualGear(fThiefX[thiefClan], fThiefY[thiefClan], vgtBigExplosion, 0, false) |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
331 |
fThief[thiefClan] = nil |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
332 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
333 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
334 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
335 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
336 |
function HandleCircles() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
337 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
338 |
fGearTimer = fGearTimer + 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
339 |
if fGearTimer == 50 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
340 |
fGearTimer = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
341 |
fGearRad = fGearRad + 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
342 |
if fGearRad > fGearRadMax then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
343 |
fGearRad = fGearRadMin |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
344 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
345 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
346 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
347 |
for i = 0, ClansCount-1 do |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
348 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
349 |
if fIsMissing[i] == false then -- draw a flag marker at the flag's spawning place |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
350 |
SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 20, 0, 10, 0, 33, 3, fCol[i]) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
351 |
if fGear[i] ~= nil then -- draw the flag gear itself |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
352 |
SetVisualGearValues(fGear[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, fGearRad, 2, fCol[i]) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
353 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
354 |
elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then |
5277 | 355 |
if fThief[i] ~= nil then -- draw circle round flag carrier -- 33 |
356 |
SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], 20, 200, 0, 0, 100, 50, 3, fCol[i]) |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
357 |
elseif fThief[i] == nil then -- draw cirle round dropped flag |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
358 |
SetVisualGearValues(fCirc[i], fGearX[i], fGearY[i], 20, 200, 0, 0, 100, 33, 3, fCol[i]) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
359 |
if fGear[i] ~= nil then -- flag gear itself |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
360 |
SetVisualGearValues(fGear[i], fGearX[i], fGearY[i], 20, 200, 0, 0, 100, fGearRad, 2, fCol[i]) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
361 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
362 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
363 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
364 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
365 |
if fNeedsRespawn[i] == true then -- if the flag has been destroyed, no need for a circle |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
366 |
SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 0, 0, fCol[i]) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
367 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
368 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
369 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
370 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
371 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
372 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
373 |
-- general methods |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
374 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
375 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
376 |
function CheckDistance(gear1, gear2) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
377 |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
378 |
local g1X, g1Y = GetGearPosition(gear1) |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
379 |
local g2X, g2Y = GetGearPosition(gear2) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
380 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
381 |
g1X = g1X - g2X |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
382 |
g1Y = g1Y - g2Y |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
383 |
local dist = (g1X*g1X) + (g1Y*g1Y) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
384 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
385 |
return dist |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
386 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
387 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
388 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
389 |
function RebuildTeamInfo() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
390 |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
391 |
-- make a list of teams |
5819 | 392 |
for i = 0, (TeamsCount-1) do |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
393 |
teamSize[i] = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
394 |
teamIndex[i] = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
395 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
396 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
397 |
-- find out how many hogs per team, and the index of the first hog in hhs |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
398 |
for i = 0, (TeamsCount-1) do |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
399 |
for z = 0, numhhs-1 do |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
400 |
if GetHogTeamName(hhs[z]) == GetTeamName(i) then |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
401 |
if teamSize[i] == 0 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
402 |
teamIndex[i] = z -- should give starting index |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
403 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
404 |
teamSize[i] = teamSize[i] + 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
405 |
--add a pointer so this hog appears at i in hhs |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
406 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
407 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
408 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
409 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
410 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
411 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
412 |
function StartTheGame() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
413 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
414 |
gameStarted = true |
13648 | 415 |
AddCaption(loc("Game Started!"), capcolDefault, capgrpGameState) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
416 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
417 |
for i = 0, ClansCount-1 do |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
418 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
419 |
fGear[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
420 |
fCirc[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
421 |
fSpawnC[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
422 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
423 |
fGearX[i] = fSpawnX[i] |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
424 |
fGearY[i] = fSpawnY[i] |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
425 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
426 |
fCol[i] = GetClanColor(i) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
427 |
fIsMissing[i] = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
428 |
fNeedsRespawn[i] = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
429 |
fCaptures[i] = 0 |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
430 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
431 |
SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 20, 100, 0, 10, 0, 75, 5, fCol[i]) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
432 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
433 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
434 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
435 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
436 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
437 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
438 |
-- game methods |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
439 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
440 |
|
11911
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
441 |
function onParameters() |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
442 |
parseParams() |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
443 |
if params["captures"] ~= nil then |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
444 |
local s = string.match(params["captures"], "(%d*)") |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
445 |
if s ~= nil then |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
446 |
captureLimit = math.max(1, tonumber(s)) |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
447 |
end |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
448 |
end |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
449 |
end |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
450 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
451 |
function onGameInit() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
452 |
|
13108
cf2a58dccc4a
CTF: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents:
13024
diff
changeset
|
453 |
DisableGameFlags(gfKing, gfAISurvival) |
10036 | 454 |
EnableGameFlags(gfDivideTeams) |
455 |
||
12084
8f222872d432
Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents:
11912
diff
changeset
|
456 |
-- Disable Sudden Death |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
457 |
WaterRise = 0 |
12084
8f222872d432
Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents:
11912
diff
changeset
|
458 |
HealthDecrease = 0 |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
459 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
460 |
|
13024
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12084
diff
changeset
|
461 |
function showCTFMission() |
11911
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
462 |
local captures |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
463 |
if captureLimit == 1 then |
13119
c3fc9157f740
CTF: Say "clan" instead of "team" in mission panel
Wuzzy <Wuzzy2@mail.ru>
parents:
13118
diff
changeset
|
464 |
captures = string.format(loc("- First clan to capture the flag wins"), captureLimit) |
11911
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
465 |
else |
13119
c3fc9157f740
CTF: Say "clan" instead of "team" in mission panel
Wuzzy <Wuzzy2@mail.ru>
parents:
13118
diff
changeset
|
466 |
captures = string.format(loc("- First clan to score %d captures wins"), captureLimit) |
11911
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
467 |
end |
11910 | 468 |
|
13119
c3fc9157f740
CTF: Say "clan" instead of "team" in mission panel
Wuzzy <Wuzzy2@mail.ru>
parents:
13118
diff
changeset
|
469 |
local rules = loc("Rules:") .. "|" .. |
c3fc9157f740
CTF: Say "clan" instead of "team" in mission panel
Wuzzy <Wuzzy2@mail.ru>
parents:
13118
diff
changeset
|
470 |
loc("- Place your clan flag at the end of your first turn") .. "|" .. |
11910 | 471 |
loc("- Return the enemy flag to your base to score") .."|".. |
11911
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
472 |
captures .. "|" .. |
11910 | 473 |
loc("- You may only score when your flag is in your base") .."|".. |
474 |
loc("- Hogs will drop the flag when killed") .."|".. |
|
475 |
loc("- Dropped flags may be returned or recaptured").."|".. |
|
11911
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
476 |
loc("- Hogs will be revived") |
11910 | 477 |
|
13024
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12084
diff
changeset
|
478 |
ShowMission(loc("Capture The Flag"), loc("A Hedgewars minigame"), rules, 0, 0) |
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12084
diff
changeset
|
479 |
end |
11910 | 480 |
|
13024
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12084
diff
changeset
|
481 |
function updateScores() |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
482 |
for i=0, TeamsCount-1 do |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
483 |
local team = GetTeamName(i) |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
484 |
local clan = GetTeamClan(team) |
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
485 |
SetTeamLabel(team, tostring(fCaptures[clan])) |
11910 | 486 |
end |
487 |
end |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
488 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
489 |
function onGameStart() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
490 |
|
13024
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12084
diff
changeset
|
491 |
showCTFMission() |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
492 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
493 |
RebuildTeamInfo() |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
494 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
495 |
for i=0, ClansCount-1 do |
13109
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
496 |
fCaptures[i] = 0 |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
497 |
end |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
498 |
|
13108
cf2a58dccc4a
CTF: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents:
13024
diff
changeset
|
499 |
for h=1, numhhs do |
cf2a58dccc4a
CTF: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents:
13024
diff
changeset
|
500 |
-- Hogs are resurrected for free, so this is pointless |
cf2a58dccc4a
CTF: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents:
13024
diff
changeset
|
501 |
AddAmmo(hhs[h], amResurrector, 0) |
cf2a58dccc4a
CTF: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents:
13024
diff
changeset
|
502 |
end |
cf2a58dccc4a
CTF: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents:
13024
diff
changeset
|
503 |
|
13109
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
504 |
updateScores() |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
505 |
|
13118
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
506 |
SendStat(siGraphTitle, loc("Score graph")) |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
507 |
SendHealthStatsOff() |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
508 |
SendRankingStatsOff() |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
509 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
510 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
511 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
512 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
513 |
function onNewTurn() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
514 |
|
13118
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
515 |
if gameStarted == true and not gameOver then |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
516 |
HandleRespawns() |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
517 |
end |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
518 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
519 |
local flagsPlaced = 0 |
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
520 |
for i=0, ClansCount-1 do |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
521 |
if fSpawnX[i] and fSpawnY[i] then |
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
522 |
flagsPlaced = flagsPlaced + 1 |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
523 |
end |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
524 |
end |
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
525 |
if not gameStarted and flagsPlaced == ClansCount then |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
526 |
StartTheGame() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
527 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
528 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
529 |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
530 |
function onEndTurn() |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
531 |
-- if the game hasn't started yet, keep track of where we are gonna put the flags on turn end |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
532 |
if not gameStarted and CurrentHedgehog ~= nil then |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
533 |
local clan = GetHogClan(CurrentHedgehog) |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
534 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
535 |
if GetX(CurrentHedgehog) and not fSpawnX[clan] then |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
536 |
fSpawnX[clan] = GetX(CurrentHedgehog) |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
537 |
fSpawnY[clan] = GetY(CurrentHedgehog) |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
538 |
end |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
539 |
end |
13118
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
540 |
|
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
541 |
if gameStarted == true then |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
542 |
DrawScores() |
75afd374b764
CTF: Show team scores and score graph in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
543 |
end |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
544 |
end |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
545 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
546 |
function onGameTick() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
547 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
548 |
for i = 0, ClansCount-1 do |
13111 | 549 |
if fThief[i] ~= nil then |
550 |
fThiefX[i] = GetX(fThief[i]) |
|
551 |
fThiefY[i] = GetY(fThief[i]) |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
552 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
553 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
554 |
|
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
555 |
if gameStarted == true and not gameOver then |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
556 |
HandleCircles() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
557 |
if CurrentHedgehog ~= nil then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
558 |
CheckFlagProximity() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
559 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
560 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
561 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
562 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
563 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
564 |
function onGearResurrect(gear) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
565 |
|
13115
efcdf31684ca
CTF: Drop flag when carrier uses piano strike
Wuzzy <Wuzzy2@mail.ru>
parents:
13114
diff
changeset
|
566 |
if GetGearType(gear) == gtHedgehog then |
efcdf31684ca
CTF: Drop flag when carrier uses piano strike
Wuzzy <Wuzzy2@mail.ru>
parents:
13114
diff
changeset
|
567 |
-- mark the flag thief as dead if he needed a respawn |
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
568 |
for i = 0, ClansCount-1 do |
13115
efcdf31684ca
CTF: Drop flag when carrier uses piano strike
Wuzzy <Wuzzy2@mail.ru>
parents:
13114
diff
changeset
|
569 |
if gear == fThief[i] then |
efcdf31684ca
CTF: Drop flag when carrier uses piano strike
Wuzzy <Wuzzy2@mail.ru>
parents:
13114
diff
changeset
|
570 |
FlagThiefDead(gear) |
efcdf31684ca
CTF: Drop flag when carrier uses piano strike
Wuzzy <Wuzzy2@mail.ru>
parents:
13114
diff
changeset
|
571 |
end |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
572 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
573 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
574 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
575 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
576 |
|
5819 | 577 |
function InABetterPlaceNow(gear) |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
578 |
for h = 0, (numhhs-1) do |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
579 |
if gear == hhs[h] then |
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
580 |
for i = 0, ClansCount-1 do |
5819 | 581 |
if gear == fThief[i] then |
582 |
FlagThiefDead(gear) |
|
583 |
end |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
584 |
end |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
585 |
hhs[h] = nil |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
586 |
end |
5819 | 587 |
end |
588 |
end |
|
589 |
||
590 |
function onHogHide(gear) |
|
591 |
InABetterPlaceNow(gear) |
|
592 |
end |
|
593 |
||
594 |
function onHogRestore(gear) |
|
595 |
for i = 0, (numhhs-1) do |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
596 |
if (hhs[i] == nil) then |
5819 | 597 |
hhs[i] = gear |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
598 |
break |
5819 | 599 |
end |
600 |
end |
|
601 |
end |
|
602 |
||
13109
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
603 |
function onHogAttack(ammoType) |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
604 |
if not gameStarted and ammoType == amTardis then |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
605 |
local i = GetHogClan(CurrentHedgehog) |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
606 |
fSpawnX[i] = GetX(CurrentHedgehog) |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
607 |
fSpawnY[i] = GetY(CurrentHedgehog) |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
608 |
end |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
609 |
end |
5819 | 610 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
611 |
function onGearAdd(gear) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
612 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
613 |
if GetGearType(gear) == gtHedgehog then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
614 |
hhs[numhhs] = gear |
13120
64d84011a48e
CTF: Write hog with most captures in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
13119
diff
changeset
|
615 |
capturesPerHog[gear] = 0 |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
616 |
numhhs = numhhs + 1 |
7838 | 617 |
SetEffect(gear, heResurrectable, 1) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
618 |
|
5277 | 619 |
elseif GetGearType(gear) == gtPiano then |
13116
10c914738f22
CTF: Allow to be played with more than 2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13115
diff
changeset
|
620 |
for i = 0, ClansCount-1 do |
5277 | 621 |
if CurrentHedgehog == fThief[i] then |
13115
efcdf31684ca
CTF: Drop flag when carrier uses piano strike
Wuzzy <Wuzzy2@mail.ru>
parents:
13114
diff
changeset
|
622 |
FlagThiefDead(CurrentHedgehog) |
5277 | 623 |
end |
624 |
end |
|
625 |
||
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
626 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
627 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
628 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
629 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
630 |
function onGearDelete(gear) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
631 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
632 |
if GetGearType(gear) == gtHedgehog then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
633 |
InABetterPlaceNow(gear) |
13109
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
634 |
elseif GetGearType(gear) == gtKamikaze and not gameStarted then |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
635 |
local i = GetHogClan(CurrentHedgehog) |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
636 |
if i <= 1 then |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
637 |
fSpawnX[i] = GetX(CurrentHedgehog) |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
638 |
fSpawnY[i] = GetY(CurrentHedgehog) |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
639 |
end |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
640 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
641 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
642 |
end |