|
1 --------------------------------------- |
|
2 -- CAPTURE_THE_FLAG GAMEPLAY MODE 0.5 |
|
3 -- by mikade |
|
4 --------------------------------------- |
|
5 |
|
6 -- Version History |
|
7 --------- |
|
8 -- 0.1 |
|
9 --------- |
|
10 |
|
11 -- [conversion from map-dependant CTF_Blizzard to map independant Capture the Flag] |
|
12 -- added an intial starting stage where flagspawn is decided by the players (weapon set will require a jetpack unless I set) |
|
13 -- changed the flag from a crate to a visual gear, and all associated methods and checks relating to flags (five hours later, lol) |
|
14 -- changed starting/respawning positioning to accommodate different map sizes |
|
15 -- added another circle to mark flag spawn |
|
16 -- added gameFlag filter |
|
17 -- changed scoring feedback |
|
18 -- cleaned up some code |
|
19 |
|
20 -- removing own flag from spawning point no longer possible |
|
21 -- destroying flags no longer possible. |
|
22 -- added basic glowing circle effect to spawn area |
|
23 -- added expanding circle to fgear itself |
|
24 |
|
25 -- removed teleporters |
|
26 -- removed random crate drops (this should be decided by scheme) |
|
27 -- removed set map criteria like minesNum, turnTime, explosives etc. except for sudden death |
|
28 -- removed weapon defintions |
|
29 -- removed placement and respawning methods, hopefully divideTeams will have this covered |
|
30 |
|
31 --------- |
|
32 -- 0.2 |
|
33 --------- |
|
34 |
|
35 -- [now with user friendliness] |
|
36 -- 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 |
|
37 -- removed a bunch of backup code and no-longer needed variables / methods from CTF_Blizzard days |
|
38 -- removed an aura that was still mistakenly hanging about |
|
39 -- added an in-game note about placements |
|
40 -- added an in-game note about the rules of the game |
|
41 -- added translation support and loc()'ed everything |
|
42 -- changed things so the seed is no longer always the same... |
|
43 |
|
44 -- In this version: |
|
45 --------- |
|
46 -- 0.3 |
|
47 --------- |
|
48 -- [fufufufu kamikaze fix] |
|
49 -- added nill checks to make sure the player doesn't generate errors by producing a nil value in hhs[] when he uses kamikaze |
|
50 -- added a check to make sure the player doesn't kamikaze straight down and make the flag's starting point underwater |
|
51 -- added a check to make sure the player drops the flag if he has it and he uses kamikaze |
|
52 |
|
53 -------- |
|
54 -- 0.4 |
|
55 -------- |
|
56 |
|
57 -- remove user-branding and version numbers |
|
58 -- removed some stuff that wasn't needed |
|
59 -- fix piano strike exploit |
|
60 -- changed delay to allow for better portals |
|
61 -- changed starting feedback a little |
|
62 -- increased the radius around the circle indicating the flag thief so that it doesn't obscure his health |
|
63 |
|
64 -------- |
|
65 -- 0.5 |
|
66 -------- |
|
67 |
|
68 -- add support for more players |
|
69 -- allow limited sudden death |
|
70 -- stop TimeBox ruining my life |
|
71 -- profit??? |
|
72 |
|
73 ----------------- |
|
74 --SCRIPT BEGINS |
|
75 ----------------- |
|
76 |
|
77 -- enable awesome translaction support so we can use loc() wherever we want |
|
78 loadfile(GetDataPath() .. "Scripts/Locale.lua")() |
|
79 |
|
80 --------------------------------------------------------------- |
|
81 ----------lots of bad variables and things |
|
82 ----------because someone is too lazy |
|
83 ----------to read about tables properly |
|
84 ------------------ "Oh well, they probably have the memory" |
|
85 |
|
86 local gameStarted = false |
|
87 local gameTurns = 0 |
|
88 |
|
89 -------------------------- |
|
90 -- hog and team tracking variales |
|
91 -------------------------- |
|
92 |
|
93 local numhhs = 0 -- store number of hedgehogs |
|
94 local hhs = {} -- store hedgehog gears |
|
95 |
|
96 local numTeams -- store the number of teams in the game |
|
97 local teamNameArr = {} -- store the list of teams |
|
98 local teamSize = {} -- store how many hogs per team |
|
99 local teamIndex = {} -- at what point in the hhs{} does each team begin |
|
100 |
|
101 ------------------- |
|
102 -- flag variables |
|
103 ------------------- |
|
104 |
|
105 local fPlaced = {} -- has the flag been placed TRUE/FALSE |
|
106 |
|
107 local fGear = {} -- pointer to the visual gears that represent the flag |
|
108 local fGearX = {} |
|
109 local fGearY = {} |
|
110 |
|
111 local fThief = {} -- pointer to the hogs who stole the flags |
|
112 local fIsMissing = {} -- have the flags been destroyed or captured |
|
113 local fNeedsRespawn = {} -- do the flags need to be respawned |
|
114 local fCaptures = {} -- the team "scores" how many captures |
|
115 local fSpawnX = {} -- spawn X for flags |
|
116 local fSpawnY = {} -- spawn Y for flags |
|
117 |
|
118 local fThiefX = {} |
|
119 local fThiefY = {} |
|
120 local FTTC = 0 -- flag thief tracker counter |
|
121 |
|
122 local fSpawnC = {} -- spawn circle marker |
|
123 local fCirc = {} -- flag/carrier marker circles |
|
124 local fCol = {} -- colour of the clans |
|
125 |
|
126 local fGearRad = 0 |
|
127 local fGearRadMin = 5 |
|
128 local fGearRadMax = 33 |
|
129 local fGearTimer = 0 |
|
130 |
|
131 ------------------------ |
|
132 --flag methods |
|
133 ------------------------ |
|
134 |
|
135 function CheckScore(teamID) |
|
136 |
|
137 if teamID == 0 then |
|
138 alt = 1 |
|
139 elseif teamID == 1 then |
|
140 alt = 0 |
|
141 end |
|
142 |
|
143 if fCaptures[teamID] == 3 then |
|
144 for i = 0, (numhhs-1) do |
|
145 if hhs[i] ~= nil then |
|
146 if GetHogClan(hhs[i]) == alt then |
|
147 SetEffect(hhs[i], heResurrectable, false) |
|
148 SetHealth(hhs[i],0) |
|
149 end |
|
150 end |
|
151 end |
|
152 if CurrentHedgehog ~= nil then |
|
153 ShowMission(loc("GAME OVER!"), loc("Victory for the ") .. GetHogTeamName(CurrentHedgehog), loc("Hooray!"), 0, 0) |
|
154 end |
|
155 end |
|
156 |
|
157 end |
|
158 |
|
159 function DoFlagStuff(gear) |
|
160 |
|
161 if (gear == fGear[0]) then |
|
162 wtf = 0 |
|
163 bbq = 1 |
|
164 elseif (gear == fGear[1]) then |
|
165 wtf = 1 |
|
166 bbq = 0 |
|
167 end |
|
168 |
|
169 -- player has successfully captured the enemy flag |
|
170 if (GetHogClan(CurrentHedgehog) == wtf) and (CurrentHedgehog == fThief[bbq]) and (fIsMissing[wtf] == false) then |
|
171 |
|
172 DeleteVisualGear(fGear[wtf]) |
|
173 fGear[wtf] = nil -- the flag has now disappeared |
|
174 |
|
175 fIsMissing[wtf] = false |
|
176 fNeedsRespawn[wtf] = true |
|
177 fIsMissing[bbq] = false |
|
178 fNeedsRespawn[bbq] = true |
|
179 fCaptures[wtf] = fCaptures[wtf] +1 |
|
180 ShowMission(loc("You have SCORED!!"), GetHogTeamName(CurrentHedgehog) .. ": " .. fCaptures[wtf], loc("Opposing Team: ") .. fCaptures[bbq], 0, 0) |
|
181 PlaySound(sndVictory) |
|
182 fThief[bbq] = nil -- player no longer has the enemy flag |
|
183 CheckScore(wtf) |
|
184 |
|
185 --if the player is returning the flag |
|
186 elseif (GetHogClan(CurrentHedgehog) == wtf) and (fIsMissing[wtf] == true) then |
|
187 |
|
188 DeleteVisualGear(fGear[wtf]) |
|
189 fGear[wtf] = nil -- the flag has now disappeared |
|
190 |
|
191 fNeedsRespawn[wtf] = true |
|
192 HandleRespawns() -- this will set fIsMissing[wtf] to false :) |
|
193 AddCaption(loc("Flag returned!")) |
|
194 |
|
195 --if the player is taking the enemy flag |
|
196 elseif GetHogClan(CurrentHedgehog) == bbq then |
|
197 |
|
198 DeleteVisualGear(fGear[wtf]) |
|
199 fGear[wtf] = nil -- the flag has now disappeared |
|
200 |
|
201 fIsMissing[wtf] = true |
|
202 for i = 0,numhhs-1 do |
|
203 if CurrentHedgehog ~= nil then |
|
204 if CurrentHedgehog == hhs[i] then |
|
205 fThief[wtf] = hhs[i] |
|
206 end |
|
207 end |
|
208 end |
|
209 AddCaption(loc("Flag captured!")) |
|
210 |
|
211 end |
|
212 |
|
213 end |
|
214 |
|
215 function CheckFlagProximity() |
|
216 |
|
217 for i = 0, 1 do |
|
218 if fGear[i] ~= nil then |
|
219 |
|
220 g1X = fGearX[i] |
|
221 g1Y = fGearY[i] |
|
222 |
|
223 g2X, g2Y = GetGearPosition(CurrentHedgehog) |
|
224 |
|
225 q = g1X - g2X |
|
226 w = g1Y - g2Y |
|
227 dist = (q*q) + (w*w) |
|
228 |
|
229 if dist < 500 then --1600 |
|
230 DoFlagStuff(fGear[i]) |
|
231 end |
|
232 end |
|
233 end |
|
234 |
|
235 end |
|
236 |
|
237 |
|
238 function HandleRespawns() |
|
239 |
|
240 for i = 0, 1 do |
|
241 |
|
242 if fNeedsRespawn[i] == true then |
|
243 fGear[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
|
244 fGearX[i] = fSpawnX[i] |
|
245 fGearY[i] = fSpawnY[i] |
|
246 |
|
247 fNeedsRespawn[i] = false |
|
248 fIsMissing[i] = false -- new, this should solve problems of a respawned flag being "returned" when a player tries to score |
|
249 AddCaption(loc("Flag respawned!")) |
|
250 end |
|
251 |
|
252 end |
|
253 |
|
254 end |
|
255 |
|
256 |
|
257 function FlagThiefDead(gear) |
|
258 |
|
259 if (gear == fThief[0]) then |
|
260 wtf = 0 |
|
261 bbq = 1 |
|
262 elseif (gear == fThief[1]) then |
|
263 wtf = 1 |
|
264 bbq = 0 |
|
265 end |
|
266 |
|
267 if fThief[wtf] ~= nil then |
|
268 -- falls into water |
|
269 --ShowMission(LAND_HEIGHT, fThiefY[wtf], (LAND_HEIGHT - fThiefY[wtf]), 0, 0) |
|
270 if (LAND_HEIGHT - fThiefY[wtf]) < 15 then |
|
271 fIsMissing[wtf] = true |
|
272 fNeedsRespawn[wtf] = true |
|
273 HandleRespawns() |
|
274 else --normally |
|
275 fGearX[wtf] = fThiefX[wtf] |
|
276 fGearY[wtf] = fThiefY[wtf] |
|
277 fGear[wtf] = AddVisualGear(fGearX[wtf],fGearY[wtf],vgtCircle,0,true) |
|
278 end |
|
279 |
|
280 AddVisualGear(fThiefX[wtf], fThiefY[wtf], vgtBigExplosion, 0, false) |
|
281 fThief[wtf] = nil |
|
282 end |
|
283 |
|
284 end |
|
285 |
|
286 function HandleCircles() |
|
287 |
|
288 fGearTimer = fGearTimer + 1 |
|
289 if fGearTimer == 50 then |
|
290 fGearTimer = 0 |
|
291 fGearRad = fGearRad + 1 |
|
292 if fGearRad > fGearRadMax then |
|
293 fGearRad = fGearRadMin |
|
294 end |
|
295 end |
|
296 |
|
297 for i = 0, 1 do |
|
298 |
|
299 --SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 50, 3, fCol[i]) -- draw a circ for spawning area |
|
300 |
|
301 if fIsMissing[i] == false then -- draw a flag marker at the flag's spawning place |
|
302 SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 20, 0, 10, 0, 33, 3, fCol[i]) |
|
303 if fGear[i] ~= nil then -- draw the flag gear itself |
|
304 SetVisualGearValues(fGear[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, fGearRad, 2, fCol[i]) |
|
305 end |
|
306 elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then |
|
307 if fThief[i] ~= nil then -- draw circle round flag carrier -- 33 |
|
308 SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], 20, 200, 0, 0, 100, 50, 3, fCol[i]) |
|
309 --AddCaption("circle marking carrier") |
|
310 elseif fThief[i] == nil then -- draw cirle round dropped flag |
|
311 --g1X,g1Y,g4,g5,g6,g7,g8,g9,g10,g11 = GetVisualGearValues(fGear[i]) |
|
312 --SetVisualGearValues(fCirc[i], g1X, g1Y, 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
|
313 SetVisualGearValues(fCirc[i], fGearX[i], fGearY[i], 20, 200, 0, 0, 100, 33, 3, fCol[i]) |
|
314 --AddCaption('dropped circle marker') |
|
315 if fGear[i] ~= nil then -- flag gear itself |
|
316 --SetVisualGearValues(fGear[i], g1X, g1Y, 20, 200, 0, 0, 100, 10, 4, fCol[i]) |
|
317 SetVisualGearValues(fGear[i], fGearX[i], fGearY[i], 20, 200, 0, 0, 100, fGearRad, 2, fCol[i]) |
|
318 --AddCaption('dropped flag itself') |
|
319 end |
|
320 end |
|
321 end |
|
322 |
|
323 if fNeedsRespawn[i] == true then -- if the flag has been destroyed, no need for a circle |
|
324 SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 0, 0, fCol[i]) |
|
325 --AddCaption("needs respawn = true. flag 'destroyed'?") |
|
326 end |
|
327 end |
|
328 |
|
329 end |
|
330 |
|
331 ------------------------ |
|
332 -- general methods |
|
333 ------------------------ |
|
334 |
|
335 function CheckDistance(gear1, gear2) |
|
336 |
|
337 g1X, g1Y = GetGearPosition(gear1) |
|
338 g2X, g2Y = GetGearPosition(gear2) |
|
339 |
|
340 g1X = g1X - g2X |
|
341 g1Y = g1Y - g2Y |
|
342 z = (g1X*g1X) + (g1Y*g1Y) |
|
343 |
|
344 dist = z |
|
345 |
|
346 return dist |
|
347 |
|
348 end |
|
349 |
|
350 function RebuildTeamInfo() |
|
351 |
|
352 |
|
353 -- make a list of individual team names |
|
354 for i = 0, (TeamsCount-1) do |
|
355 teamNameArr[i] = i |
|
356 teamSize[i] = 0 |
|
357 teamIndex[i] = 0 |
|
358 end |
|
359 numTeams = 0 |
|
360 |
|
361 for i = 0, (numhhs-1) do |
|
362 |
|
363 z = 0 |
|
364 unfinished = true |
|
365 while(unfinished == true) do |
|
366 |
|
367 newTeam = true |
|
368 tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name |
|
369 |
|
370 if tempHogTeamName == teamNameArr[z] then |
|
371 newTeam = false |
|
372 unfinished = false |
|
373 end |
|
374 |
|
375 z = z + 1 |
|
376 |
|
377 if z == TeamsCount then |
|
378 unfinished = false |
|
379 if newTeam == true then |
|
380 teamNameArr[numTeams] = tempHogTeamName |
|
381 numTeams = numTeams + 1 |
|
382 end |
|
383 end |
|
384 |
|
385 end |
|
386 |
|
387 end |
|
388 |
|
389 -- find out how many hogs per team, and the index of the first hog in hhs |
|
390 for i = 0, numTeams-1 do |
|
391 |
|
392 for z = 0, numhhs-1 do |
|
393 if GetHogTeamName(hhs[z]) == teamNameArr[i] then |
|
394 if teamSize[i] == 0 then |
|
395 teamIndex[i] = z -- should give starting index |
|
396 end |
|
397 teamSize[i] = teamSize[i] + 1 |
|
398 --add a pointer so this hog appears at i in hhs |
|
399 end |
|
400 end |
|
401 |
|
402 end |
|
403 |
|
404 end |
|
405 |
|
406 function StartTheGame() |
|
407 |
|
408 gameStarted = true |
|
409 AddCaption(loc("Game Started!")) |
|
410 |
|
411 for i = 0, 1 do |
|
412 |
|
413 -- if someone uses kamikaze downwards, this can happen as the hog won't respawn |
|
414 if (LAND_HEIGHT - fSpawnY[i]) < 0 then |
|
415 tempG = AddGear(0, 0, gtTarget, 0, 0, 0, 0) |
|
416 FindPlace(tempG, true, 0, LAND_WIDTH, true) |
|
417 fSpawnX[i], fSpawnY[i] = GetGearPosition(tempG) |
|
418 DeleteGear(tempG) |
|
419 end |
|
420 |
|
421 fGear[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
|
422 fCirc[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
|
423 fSpawnC[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
|
424 |
|
425 fGearX[i] = fSpawnX[i] |
|
426 fGearY[i] = fSpawnY[i] |
|
427 |
|
428 fCol[i] = GetClanColor(i) |
|
429 fIsMissing[i] = false |
|
430 fNeedsRespawn[i] = false |
|
431 fCaptures[i] = 0 |
|
432 |
|
433 --SetVisualGearValues(zxc, 1000,1000, 20, 100, 0, 10, 1, 100, 5, GetClanColor(0)) |
|
434 |
|
435 SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 20, 100, 0, 10, 0, 75, 5, fCol[i]) |
|
436 |
|
437 end |
|
438 |
|
439 end |
|
440 |
|
441 ------------------------ |
|
442 -- game methods |
|
443 ------------------------ |
|
444 |
|
445 function onGameInit() |
|
446 |
|
447 GameFlags = band(bor(GameFlags, gfDivideTeams), bnot(gfKing + gfForts)) |
|
448 --SuddenDeathTurns = 999 -- suddendeath is off, effectively |
|
449 WaterRise = 0 |
|
450 Delay = 10 |
|
451 |
|
452 end |
|
453 |
|
454 |
|
455 function onGameStart() |
|
456 |
|
457 --ShowMission(loc(caption), loc(subcaption), loc(goal), 0, 0) |
|
458 ShowMission(loc("CAPTURE THE FLAG"), loc("Flags, and their home base will be placed where each team ends their first turn."), "", 0, 0) |
|
459 |
|
460 RebuildTeamInfo() |
|
461 |
|
462 -- should gfDivideTeams do this automatically? |
|
463 --[[for i = 0, (TeamsCount-1) do |
|
464 for g = teamIndex[i], (teamIndex[i]+teamSize[i]-1) do |
|
465 if GetHogClan(hhs[g]) == 0 then |
|
466 FindPlace(hhs[g], false, 0, LAND_WIDTH/2) |
|
467 elseif GetHogClan(hhs[g]) == 1 then |
|
468 FindPlace(hhs[g], false, LAND_WIDTH/2, LAND_WIDTH) |
|
469 end |
|
470 end |
|
471 end]] |
|
472 |
|
473 fPlaced[0] = false |
|
474 fPlaced[1] = false |
|
475 |
|
476 --zxc = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
|
477 |
|
478 |
|
479 --SetVisualGearValues(zxc, 1000,1000, 20, 255, 1, 10, 0, 200, 1, GetClanColor(0)) |
|
480 --minO,max0 -glowyornot --pulsate timer -- fuckall -- radius -- width -- colour |
|
481 end |
|
482 |
|
483 |
|
484 function onNewTurn() |
|
485 |
|
486 gameTurns = gameTurns + 1 |
|
487 |
|
488 if lastTeam ~= GetHogTeamName(CurrentHedgehog) then |
|
489 lastTeam = GetHogTeamName(CurrentHedgehog) |
|
490 end |
|
491 |
|
492 --AddCaption("Handling respawns") |
|
493 if gameStarted == true then |
|
494 HandleRespawns() |
|
495 --new method of placing starting flags |
|
496 elseif gameTurns == 1 then |
|
497 ShowMission(loc("CAPTURE THE FLAG"), loc("Flags, and their home base will be placed where each team ends their first turn."), "", 0, 0) |
|
498 elseif gameTurns == 2 then |
|
499 fPlaced[0] = true |
|
500 ShowMission(loc("CAPTURE THE FLAG"), loc("RULES OF THE GAME [Press ESC to view]"), loc(" - Return the enemy flag to your base to score | - First team to 3 captures wins | - You may only score when your flag is in your base | - Hogs will drop the flag if killed, or drowned | - Dropped flags may be returned or recaptured | - Hogs respawn when killed"), 0, 0) |
|
501 elseif gameTurns == 3 then |
|
502 fPlaced[1] = true |
|
503 StartTheGame() |
|
504 end |
|
505 |
|
506 end |
|
507 |
|
508 function onGameTick() |
|
509 |
|
510 -- onRessurect calls AFTER you have resurrected, |
|
511 -- so keeping track of x,y a few milliseconds before |
|
512 -- is useful |
|
513 --FTTC = FTTC + 1 |
|
514 --if FTTC == 100 then |
|
515 -- FTTC = 0 |
|
516 for i = 0,1 do |
|
517 if fThief[i] ~= nil then |
|
518 fThiefX[i] = GetX(fThief[i]) |
|
519 fThiefY[i] = GetY(fThief[i]) |
|
520 end |
|
521 end |
|
522 --end |
|
523 |
|
524 -- things we wanna check often |
|
525 if (CurrentHedgehog ~= nil) then |
|
526 --AddCaption(LAND_HEIGHT - GetY(CurrentHedgehog)) |
|
527 --AddCaption(GetX(CurrentHedgehog) .. "; " .. GetY(CurrentHedgehog)) |
|
528 --CheckTeleporters() |
|
529 |
|
530 end |
|
531 |
|
532 if gameStarted == true then |
|
533 HandleCircles() |
|
534 if CurrentHedgehog ~= nil then |
|
535 CheckFlagProximity() |
|
536 end |
|
537 elseif CurrentHedgehog ~= nil then -- if the game hasn't started yet, keep track of where we are gonna put the flags on turn end |
|
538 |
|
539 if GetHogClan(CurrentHedgehog) == 0 then |
|
540 i = 0 |
|
541 elseif GetHogClan(CurrentHedgehog) == 1 then |
|
542 i = 1 |
|
543 end |
|
544 |
|
545 fSpawnX[i] = GetX(CurrentHedgehog) |
|
546 fSpawnY[i] = GetY(CurrentHedgehog) |
|
547 |
|
548 end |
|
549 |
|
550 end |
|
551 |
|
552 function onGearResurrect(gear) |
|
553 |
|
554 --AddCaption("A gear has been resurrected!") |
|
555 |
|
556 -- mark the flag thief as dead if he needed a respawn |
|
557 for i = 0,1 do |
|
558 if gear == fThief[i] then |
|
559 FlagThiefDead(gear) |
|
560 end |
|
561 end |
|
562 |
|
563 -- should be covered by gfDivideTeams, actually |
|
564 -- place hogs belonging to each clan either left or right side of map |
|
565 --if GetHogClan(gear) == 0 then |
|
566 -- FindPlace(gear, false, 0, LAND_WIDTH/2) |
|
567 --elseif GetHogClan(gear) == 1 then |
|
568 -- FindPlace(gear, false, LAND_WIDTH/2, LAND_WIDTH) |
|
569 --end |
|
570 |
|
571 AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
|
572 |
|
573 end |
|
574 |
|
575 function InABetterPlaceNow(gear) |
|
576 for i = 0, (numhhs-1) do |
|
577 if gear == hhs[i] then |
|
578 |
|
579 for i = 0,1 do |
|
580 if gear == fThief[i] then |
|
581 FlagThiefDead(gear) |
|
582 end |
|
583 end |
|
584 hhs[i] = nil |
|
585 end |
|
586 end |
|
587 end |
|
588 |
|
589 function onHogHide(gear) |
|
590 InABetterPlaceNow(gear) |
|
591 end |
|
592 |
|
593 function onHogRestore(gear) |
|
594 match = false |
|
595 for i = 0, (numhhs-1) do |
|
596 if (hhs[i] == nil) and (match == false) then |
|
597 hhs[i] = gear |
|
598 --AddCaption(GetHogName(gear) .. " has reappeared it seems!") |
|
599 match = true |
|
600 end |
|
601 end |
|
602 end |
|
603 |
|
604 |
|
605 function onGearAdd(gear) |
|
606 |
|
607 if GetGearType(gear) == gtHedgehog then |
|
608 hhs[numhhs] = gear |
|
609 numhhs = numhhs + 1 |
|
610 SetEffect(gear, heResurrectable, true) |
|
611 |
|
612 elseif GetGearType(gear) == gtPiano then |
|
613 |
|
614 for i = 0, 1 do |
|
615 if CurrentHedgehog == fThief[i] then |
|
616 FlagThiefDead(gear) |
|
617 end |
|
618 end |
|
619 |
|
620 end |
|
621 |
|
622 end |
|
623 |
|
624 function onGearDelete(gear) |
|
625 |
|
626 if GetGearType(gear) == gtHedgehog then |
|
627 InABetterPlaceNow(gear) |
|
628 end |
|
629 |
|
630 end |