author | Wuzzy <Wuzzy2@mail.ru> |
Thu, 08 Mar 2018 12:46:11 +0100 | |
changeset 13115 | efcdf31684ca |
parent 13114 | 59ebdb80d693 |
child 13116 | 10c914738f22 |
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 |
11911
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
91 |
local captureLimit = 3 |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
92 |
|
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 |
-- hog and team tracking variales |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
95 |
-------------------------- |
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 |
local numhhs = 0 -- store number of hedgehogs |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
98 |
local hhs = {} -- store hedgehog gears |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
99 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
100 |
local teamSize = {} -- store how many hogs per team |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
101 |
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
|
102 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
103 |
------------------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
104 |
-- flag variables |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
105 |
------------------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
106 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
107 |
local fPlaced = {} -- has the flag been placed TRUE/FALSE |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
108 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
109 |
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
|
110 |
local fGearX = {} |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
111 |
local fGearY = {} |
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 fThief = {} -- pointer to the hogs who stole the flags |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
114 |
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
|
115 |
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
|
116 |
local fCaptures = {} -- the team "scores" how many captures |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
117 |
local fSpawnX = {} -- spawn X for flags |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
118 |
local fSpawnY = {} -- spawn Y for flags |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
119 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
120 |
local fThiefX = {} |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
121 |
local fThiefY = {} |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
122 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
123 |
local fSpawnC = {} -- spawn circle marker |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
124 |
local fCirc = {} -- flag/carrier marker circles |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
125 |
local fCol = {} -- colour of the clans |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
126 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
127 |
local fGearRad = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
128 |
local fGearRadMin = 5 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
129 |
local fGearRadMax = 33 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
130 |
local fGearTimer = 0 |
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 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
133 |
--flag methods |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
134 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
135 |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
136 |
function CheckScore(clanID) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
137 |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
138 |
if fCaptures[clanID] == captureLimit then |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
139 |
-- Capture limit reached! We have a winner! |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
140 |
for i = 0, (numhhs-1) do |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
141 |
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
|
142 |
-- Kill all losers |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
143 |
if GetHogClan(hhs[i]) ~= clanID then |
7838 | 144 |
SetEffect(hhs[i], heResurrectable, 0) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
145 |
SetHealth(hhs[i],0) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
146 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
147 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
148 |
end |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
149 |
if CurrentHedgehog ~= nil then |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
150 |
AddCaption(string.format(loc("Victory for %s!"), GetHogTeamName(CurrentHedgehog)), 0xFFFFFFFF, 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
|
151 |
updateScores() |
4662
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 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
155 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
156 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
157 |
function DoFlagStuff(gear) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
158 |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
159 |
local wtf, bbq |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
160 |
if (gear == fGear[0]) then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
161 |
wtf = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
162 |
bbq = 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
163 |
elseif (gear == fGear[1]) then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
164 |
wtf = 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
165 |
bbq = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
166 |
end |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
167 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
168 |
-- player has successfully captured the enemy flag |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
169 |
if (GetHogClan(CurrentHedgehog) == wtf) and (CurrentHedgehog == fThief[bbq]) and (fIsMissing[wtf] == false) then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
170 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
171 |
DeleteVisualGear(fGear[wtf]) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
172 |
fGear[wtf] = nil -- the flag has now disappeared |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
173 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
174 |
fIsMissing[wtf] = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
175 |
fNeedsRespawn[wtf] = true |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
176 |
fIsMissing[bbq] = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
177 |
fNeedsRespawn[bbq] = true |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
178 |
fCaptures[wtf] = fCaptures[wtf] +1 |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
179 |
AddCaption(string.format(loc("%s has scored!"), GetHogName(CurrentHedgehog)), 0xFFFFFFFF, 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
|
180 |
updateScores() |
11912
ce9e0f8e43f4
CTF: Play sound when capturing flag
Wuzzy <almikes@aol.com>
parents:
11911
diff
changeset
|
181 |
PlaySound(sndHomerun) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
182 |
fThief[bbq] = nil -- player no longer has the enemy flag |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
183 |
CheckScore(wtf) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
184 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
185 |
--if the player is returning the flag |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
186 |
elseif (GetHogClan(CurrentHedgehog) == wtf) and (fIsMissing[wtf] == true) then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
187 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
188 |
DeleteVisualGear(fGear[wtf]) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
189 |
fGear[wtf] = nil -- the flag has now disappeared |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
190 |
|
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
191 |
fNeedsRespawn[wtf] = true |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
192 |
HandleRespawns() -- this will set fIsMissing[wtf] to false :) |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
193 |
AddCaption(loc("Flag returned!"), 0xFFFFFFFF, capgrpMessage2) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
194 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
195 |
--if the player is taking the enemy flag |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
196 |
elseif GetHogClan(CurrentHedgehog) == bbq then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
197 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
198 |
DeleteVisualGear(fGear[wtf]) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
199 |
fGear[wtf] = nil -- the flag has now disappeared |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
200 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
201 |
fIsMissing[wtf] = true |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
202 |
for i = 0,numhhs-1 do |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
203 |
if CurrentHedgehog ~= nil then |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
204 |
if CurrentHedgehog == hhs[i] then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
205 |
fThief[wtf] = hhs[i] |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
206 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
207 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
208 |
end |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
209 |
AddCaption(loc("Flag captured!"), 0xFFFFFFFF, capgrpMessage2) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
210 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
211 |
end |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
212 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
213 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
214 |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
215 |
function CheckFlagProximity() |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
216 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
217 |
for i = 0, 1 do |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
218 |
if fGear[i] ~= nil then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
219 |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
220 |
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
|
221 |
local g1Y = fGearY[i] |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
222 |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
223 |
local g2X, g2Y = GetGearPosition(CurrentHedgehog) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
224 |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
225 |
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
|
226 |
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
|
227 |
local dist = (q*q) + (w*w) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
228 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
229 |
if dist < 500 then --1600 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
230 |
DoFlagStuff(fGear[i]) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
231 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
232 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
233 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
234 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
235 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
236 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
237 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
238 |
function HandleRespawns() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
239 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
240 |
for i = 0, 1 do |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
241 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
242 |
if fNeedsRespawn[i] == true then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
243 |
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
|
244 |
fGearX[i] = fSpawnX[i] |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
245 |
fGearY[i] = fSpawnY[i] |
5277 | 246 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
247 |
fNeedsRespawn[i] = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
248 |
fIsMissing[i] = false -- new, this should solve problems of a respawned flag being "returned" when a player tries to score |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
249 |
AddCaption(loc("Flag respawned!"), 0xFFFFFFFF, capgrpMessage2) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
250 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
251 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
252 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
253 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
254 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
255 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
256 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
257 |
function FlagThiefDead(gear) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
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 wtf, bbq |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
260 |
if (gear == fThief[0]) then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
261 |
wtf = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
262 |
bbq = 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
263 |
elseif (gear == fThief[1]) then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
264 |
wtf = 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
265 |
bbq = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
266 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
267 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
268 |
if fThief[wtf] ~= nil then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
269 |
-- falls into water |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
270 |
if (LAND_HEIGHT - fThiefY[wtf]) < 15 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
271 |
fIsMissing[wtf] = true |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
272 |
fNeedsRespawn[wtf] = true |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
273 |
HandleRespawns() |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
274 |
else --normally |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
275 |
fGearX[wtf] = fThiefX[wtf] |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
276 |
fGearY[wtf] = fThiefY[wtf] |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
277 |
fGear[wtf] = AddVisualGear(fGearX[wtf],fGearY[wtf],vgtCircle,0,true) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
278 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
279 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
280 |
AddVisualGear(fThiefX[wtf], fThiefY[wtf], vgtBigExplosion, 0, false) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
281 |
fThief[wtf] = nil |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
282 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
283 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
284 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
285 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
286 |
function HandleCircles() |
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 |
fGearTimer = fGearTimer + 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
289 |
if fGearTimer == 50 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
290 |
fGearTimer = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
291 |
fGearRad = fGearRad + 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
292 |
if fGearRad > fGearRadMax then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
293 |
fGearRad = fGearRadMin |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
294 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
295 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
296 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
297 |
for i = 0, 1 do |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
298 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
299 |
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
|
300 |
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
|
301 |
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
|
302 |
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
|
303 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
304 |
elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then |
5277 | 305 |
if fThief[i] ~= nil then -- draw circle round flag carrier -- 33 |
306 |
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
|
307 |
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
|
308 |
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
|
309 |
if fGear[i] ~= nil then -- flag gear itself |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
310 |
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
|
311 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
312 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
313 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
314 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
315 |
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
|
316 |
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
|
317 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
318 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
319 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
320 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
321 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
322 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
323 |
-- general methods |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
324 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
325 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
326 |
function CheckDistance(gear1, gear2) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
327 |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
328 |
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
|
329 |
local g2X, g2Y = GetGearPosition(gear2) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
330 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
331 |
g1X = g1X - g2X |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
332 |
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
|
333 |
local dist = (g1X*g1X) + (g1Y*g1Y) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
334 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
335 |
return dist |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
336 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
337 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
338 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
339 |
function RebuildTeamInfo() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
340 |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
341 |
-- make a list of teams |
5819 | 342 |
for i = 0, (TeamsCount-1) do |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
343 |
teamSize[i] = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
344 |
teamIndex[i] = 0 |
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 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
347 |
-- 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
|
348 |
for i = 0, (TeamsCount-1) do |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
349 |
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
|
350 |
if GetHogTeamName(hhs[z]) == GetTeamName(i) then |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
351 |
if teamSize[i] == 0 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
352 |
teamIndex[i] = z -- should give starting index |
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 |
teamSize[i] = teamSize[i] + 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
355 |
--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
|
356 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
357 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
358 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
359 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
360 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
361 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
362 |
function StartTheGame() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
363 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
364 |
gameStarted = true |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
365 |
AddCaption(loc("Game Started!"), 0xFFFFFFFF, capgrpGameState) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
366 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
367 |
for i = 0, 1 do |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
368 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
369 |
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
|
370 |
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
|
371 |
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
|
372 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
373 |
fGearX[i] = fSpawnX[i] |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
374 |
fGearY[i] = fSpawnY[i] |
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 |
fCol[i] = GetClanColor(i) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
377 |
fIsMissing[i] = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
378 |
fNeedsRespawn[i] = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
379 |
fCaptures[i] = 0 |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
380 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
381 |
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
|
382 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
383 |
end |
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 |
end |
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 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
388 |
-- game methods |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
389 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
390 |
|
11911
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
391 |
function onParameters() |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
392 |
parseParams() |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
393 |
if params["captures"] ~= nil then |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
394 |
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
|
395 |
if s ~= nil then |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
396 |
captureLimit = math.max(1, tonumber(s)) |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
397 |
end |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
398 |
end |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
399 |
end |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
400 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
401 |
function onGameInit() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
402 |
|
13108
cf2a58dccc4a
CTF: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents:
13024
diff
changeset
|
403 |
DisableGameFlags(gfKing, gfAISurvival) |
10036 | 404 |
EnableGameFlags(gfDivideTeams) |
405 |
||
12084
8f222872d432
Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents:
11912
diff
changeset
|
406 |
-- Disable Sudden Death |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
407 |
WaterRise = 0 |
12084
8f222872d432
Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents:
11912
diff
changeset
|
408 |
HealthDecrease = 0 |
8f222872d432
Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents:
11912
diff
changeset
|
409 |
|
4662
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 |
|
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
|
412 |
function showCTFMission() |
11911
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
413 |
local captures |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
414 |
if captureLimit == 1 then |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
415 |
captures = string.format(loc("- First team to capture the flag wins"), captureLimit) |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
416 |
else |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
417 |
captures = string.format(loc("- First team to score %d captures wins"), captureLimit) |
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
418 |
end |
11910 | 419 |
|
420 |
local rules = loc("Rules:") .. " |" .. |
|
11911
0e943402b94f
CTF: Allow to set capture limit with script param
Wuzzy <almikes@aol.com>
parents:
11910
diff
changeset
|
421 |
loc("- Place your team flag at the end of your first turn") .. "|" .. |
11910 | 422 |
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
|
423 |
captures .. "|" .. |
11910 | 424 |
loc("- You may only score when your flag is in your base") .."|".. |
425 |
loc("- Hogs will drop the flag when killed") .."|".. |
|
426 |
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
|
427 |
loc("- Hogs will be revived") |
11910 | 428 |
|
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
|
429 |
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
|
430 |
end |
11910 | 431 |
|
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
|
432 |
function updateScores() |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
433 |
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
|
434 |
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
|
435 |
local clan = GetTeamClan(team) |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
436 |
if clan <= 1 then |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
437 |
SetTeamLabel(team, tostring(fCaptures[clan])) |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
438 |
end |
11910 | 439 |
end |
440 |
end |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
441 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
442 |
function onGameStart() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
443 |
|
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
|
444 |
showCTFMission() |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
445 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
446 |
RebuildTeamInfo() |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
447 |
|
13109
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
448 |
for i=0, 1 do |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
449 |
fPlaced[i] = false |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
450 |
fCaptures[i] = 0 |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
451 |
end |
4662
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 |
for h=1, numhhs do |
cf2a58dccc4a
CTF: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents:
13024
diff
changeset
|
454 |
-- Hogs are resurrected for free, so this is pointless |
cf2a58dccc4a
CTF: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents:
13024
diff
changeset
|
455 |
AddAmmo(hhs[h], amResurrector, 0) |
cf2a58dccc4a
CTF: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents:
13024
diff
changeset
|
456 |
end |
cf2a58dccc4a
CTF: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents:
13024
diff
changeset
|
457 |
|
13109
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
458 |
updateScores() |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
459 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
460 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
461 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
462 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
463 |
function onNewTurn() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
464 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
465 |
if gameStarted == true then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
466 |
HandleRespawns() |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
467 |
end |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
468 |
|
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
469 |
for i=0, 1 do |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
470 |
if fSpawnX[i] and fSpawnY[i] then |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
471 |
fPlaced[i] = true |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
472 |
end |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
473 |
end |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
474 |
if not gameStarted and fPlaced[0] and fPlaced[1] then |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
475 |
StartTheGame() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
476 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
477 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
478 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
479 |
|
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
480 |
function onEndTurn() |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
481 |
-- 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
|
482 |
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
|
483 |
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
|
484 |
|
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
485 |
if clan <= 1 and GetX(CurrentHedgehog) and not fSpawnX[clan] then |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
486 |
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
|
487 |
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
|
488 |
end |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
489 |
end |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
490 |
end |
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
491 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
492 |
function onGameTick() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
493 |
|
13111 | 494 |
for i = 0,1 do |
495 |
if fThief[i] ~= nil then |
|
496 |
fThiefX[i] = GetX(fThief[i]) |
|
497 |
fThiefY[i] = GetY(fThief[i]) |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
498 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
499 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
500 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
501 |
if gameStarted == true then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
502 |
HandleCircles() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
503 |
if CurrentHedgehog ~= nil then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
504 |
CheckFlagProximity() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
505 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
506 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
507 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
508 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
509 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
510 |
function onGearResurrect(gear) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
511 |
|
13115
efcdf31684ca
CTF: Drop flag when carrier uses piano strike
Wuzzy <Wuzzy2@mail.ru>
parents:
13114
diff
changeset
|
512 |
if GetGearType(gear) == gtHedgehog then |
efcdf31684ca
CTF: Drop flag when carrier uses piano strike
Wuzzy <Wuzzy2@mail.ru>
parents:
13114
diff
changeset
|
513 |
-- mark the flag thief as dead if he needed a respawn |
efcdf31684ca
CTF: Drop flag when carrier uses piano strike
Wuzzy <Wuzzy2@mail.ru>
parents:
13114
diff
changeset
|
514 |
for i = 0,1 do |
efcdf31684ca
CTF: Drop flag when carrier uses piano strike
Wuzzy <Wuzzy2@mail.ru>
parents:
13114
diff
changeset
|
515 |
if gear == fThief[i] then |
efcdf31684ca
CTF: Drop flag when carrier uses piano strike
Wuzzy <Wuzzy2@mail.ru>
parents:
13114
diff
changeset
|
516 |
FlagThiefDead(gear) |
efcdf31684ca
CTF: Drop flag when carrier uses piano strike
Wuzzy <Wuzzy2@mail.ru>
parents:
13114
diff
changeset
|
517 |
end |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
518 |
end |
13115
efcdf31684ca
CTF: Drop flag when carrier uses piano strike
Wuzzy <Wuzzy2@mail.ru>
parents:
13114
diff
changeset
|
519 |
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
520 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
521 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
522 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
523 |
|
5819 | 524 |
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
|
525 |
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
|
526 |
if gear == hhs[h] then |
5819 | 527 |
for i = 0,1 do |
528 |
if gear == fThief[i] then |
|
529 |
FlagThiefDead(gear) |
|
530 |
end |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
531 |
end |
13114
59ebdb80d693
Capture the Flag: Fix many Lua errors when playing with >2 clans
Wuzzy <Wuzzy2@mail.ru>
parents:
13111
diff
changeset
|
532 |
hhs[h] = nil |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
533 |
end |
5819 | 534 |
end |
535 |
end |
|
536 |
||
537 |
function onHogHide(gear) |
|
538 |
InABetterPlaceNow(gear) |
|
539 |
end |
|
540 |
||
541 |
function onHogRestore(gear) |
|
542 |
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
|
543 |
if (hhs[i] == nil) then |
5819 | 544 |
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
|
545 |
break |
5819 | 546 |
end |
547 |
end |
|
548 |
end |
|
549 |
||
13109
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
550 |
function onHogAttack(ammoType) |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
551 |
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
|
552 |
local i = GetHogClan(CurrentHedgehog) |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
553 |
fSpawnX[i] = GetX(CurrentHedgehog) |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
554 |
fSpawnY[i] = GetY(CurrentHedgehog) |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
555 |
end |
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
556 |
end |
5819 | 557 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
558 |
function onGearAdd(gear) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
559 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
560 |
if GetGearType(gear) == gtHedgehog then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
561 |
hhs[numhhs] = gear |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
562 |
numhhs = numhhs + 1 |
7838 | 563 |
SetEffect(gear, heResurrectable, 1) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
564 |
|
5277 | 565 |
elseif GetGearType(gear) == gtPiano then |
566 |
for i = 0, 1 do |
|
567 |
if CurrentHedgehog == fThief[i] then |
|
13115
efcdf31684ca
CTF: Drop flag when carrier uses piano strike
Wuzzy <Wuzzy2@mail.ru>
parents:
13114
diff
changeset
|
568 |
FlagThiefDead(CurrentHedgehog) |
5277 | 569 |
end |
570 |
end |
|
571 |
||
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 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
574 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
575 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
576 |
function onGearDelete(gear) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
577 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
578 |
if GetGearType(gear) == gtHedgehog then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
579 |
InABetterPlaceNow(gear) |
13109
e0ec37c8104d
CTF: Fix Lua errors when using kamikaze or tardis
Wuzzy <Wuzzy2@mail.ru>
parents:
13108
diff
changeset
|
580 |
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
|
581 |
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
|
582 |
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
|
583 |
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
|
584 |
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
|
585 |
end |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
586 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
587 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
588 |
end |