~ubuntu-branches/ubuntu/wily/hedgewars/wily

« back to all changes in this revision

Viewing changes to share/hedgewars/Data/Maps/Control/map.lua

  • Committer: Package Import Robot
  • Author(s): Dmitry E. Oboukhov
  • Date: 2011-09-23 10:16:55 UTC
  • mfrom: (1.2.11 upstream)
  • Revision ID: package-import@ubuntu.com-20110923101655-3977th2gc5n0a3pv
Tags: 0.9.16-1
* New upstream version.
 + Downloadable content! Simply click to install any content.
   New voices, hats, maps, themes, translations, music, scripts...
   Hedgewars is now more customisable than ever before! As time goes
   by we will be soliciting community content to feature on this page,
   so remember to check it from time to time. If you decide you want
   to go back to standard Hedgewars, just remove the Data directory
   from your Hedgewars config directory.
 + 3-D rendering! Diorama-like rendering of the game in a variety
   of 3D modes. Let us know which ones work best for you, we didn't
   really have the equipment to test them all.
 + Resizable game window.
 + New utilities! The Time Box will remove one of your hedgehogs
   from the game for a while, protecting from attack until it returns,
   somewhere else on the map. Land spray will allow you to build bridges,
   seal up holes, or just make life unpleasant for your enemies.
 + New single player: Bamboo Thicket, That Sinking Feeling, Newton and
   the Tree and multi-player: The Specialists, Space Invaders,
   Racer - scripts! And a ton more script hooks for scripters
 + New twists on old weapons. Drill strike, seduction and fire have
   been adjusted. Defective mines have been added, rope can attach to
   hogs/crates/barrels again, grenades now have variable bounce (use
   precise key + 1-5). Portal gun is now more usable in flight and
   all game actions are a lot faster.
 + New theme - Golf, dozens of new community hats and a new
   localised Default voice, Ukranian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
--------------------------------
 
2
-- CONTROL 0.6
2
3
--------------------------------
3
4
 
4
 
 
5
5
---------
6
6
-- 0.2
7
7
---------
30
28
 
31
29
-- added scaling scoring based on clans: 300 points to win - 25 per team in game
32
30
 
 
31
--------
 
32
-- 0.5
 
33
--------
 
34
 
 
35
-- removed user branding
 
36
-- fixed infinite attack time exploit
 
37
 
 
38
--------
 
39
-- 0.6
 
40
--------
 
41
 
 
42
-- timebox fix
 
43
-- support for more players
 
44
-- remove version numbers
 
45
-- enable limited sudden death
 
46
-- using skip go generates as many points as you would have gotten had you sat and waited
 
47
 
33
48
-----------------
34
49
--script begins
35
50
-----------------
42
57
----------to read about tables properly
43
58
------------------ "Oh well, they probably have the memory"
44
59
 
 
60
local TimeCounter = 0
 
61
 
45
62
local gameWon = false
46
63
local pointLimit = 300
47
64
 
48
65
local vCirc = {}
49
66
local vCircCount = 0
50
67
 
51
 
local hGCount = 0
 
68
--local hGCount = 0
52
69
 
53
70
local vCircX = {}
54
71
local vCircY = {}
81
98
--zone and teleporter variables
82
99
--------------------------------
83
100
 
84
 
--local redTel
85
 
--local orangeTel
86
 
--local areaArr = {} -- no longer used
87
 
 
88
101
local cPoint = {}
89
102
local cOwnerClan = {}
90
103
 
152
165
                SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], 0xffffffff)
153
166
                cOwnerClan[i] = nil
154
167
                for k = 0, (numhhs-1) do
155
 
                        if (hhs[k] ~= nil) then
156
 
                        if (GearIsInZone(hhs[k],i)) == true then
157
 
 
158
 
                                if cOwnerClan[i] ~= nil then
159
 
                                        if cOwnerClan[i] ~= GetHogClan(hhs[k]) then 
160
 
                                                --if the hog now being compared is different to one that is also here and was previously compared
161
 
                                                
162
 
                                                SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], 0xffffffff)                                                
163
 
                                                --SetVisualGearValues(vCirc[i], 2739, 1378, 20, 255, 1, 10, 0, 300, 5, 0xffffffff)
164
 
        
165
 
                                                cOwnerClan[i] = 10 -- this means conflicted
166
 
                                        end
167
 
                                elseif cOwnerClan[i] == nil then
168
 
                                        cOwnerClan[i] = GetHogClan(hhs[k])
169
 
                                        --SetVisualGearValues(vCirc[i], 2739, 1378, 20, 255, 1, 10, 0, 300, 5, GetClanColor( GetHogClan(hhs[k])) )
170
 
                                        SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], GetClanColor( GetHogClan(hhs[k])))
171
 
        
172
 
                                end
173
 
 
174
 
                        end
 
168
                        if (hhs[k] ~= nil) then --and (GetGearType(hhs[k]) ~= nil) then
 
169
                if (GearIsInZone(hhs[k],i)) == true then
 
170
 
 
171
                    if cOwnerClan[i] ~= nil then
 
172
                        if cOwnerClan[i] ~= GetHogClan(hhs[k]) then 
 
173
                            --if the hog now being compared is different to one that is also here and was previously compared
 
174
                            
 
175
                            SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], 0xffffffff)                                            
 
176
                            --SetVisualGearValues(vCirc[i], 2739, 1378, 20, 255, 1, 10, 0, 300, 5, 0xffffffff)
 
177
        
 
178
                            cOwnerClan[i] = 10 -- this means conflicted
 
179
                        end
 
180
                    elseif cOwnerClan[i] == nil then
 
181
                        cOwnerClan[i] = GetHogClan(hhs[k])
 
182
                        --SetVisualGearValues(vCirc[i], 2739, 1378, 20, 255, 1, 10, 0, 300, 5, GetClanColor( GetHogClan(hhs[k])) )
 
183
                        SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], GetClanColor( GetHogClan(hhs[k])))
 
184
        
 
185
                    end
 
186
 
 
187
                end
 
188
           -- else hhs[k] = nil
175
189
                        end
176
190
                end
177
191
 
199
213
        for i = 0,(zCount-1) do                 
200
214
                if CurrentHedgehog ~= nil then          
201
215
                        if cOwnerClan[i] == GetHogClan(CurrentHedgehog) then
202
 
                                g = AddVisualGear(vCircX[i], vCircY[i], vgtHealthTag, 100, False)
203
 
                                SetVisualGearValues(g, vCircX[i], vCircY[i], 0, 0, 0, 0, 0, teamScore[cOwnerClan[i]], 1500, GetClanColor(cOwnerClan[i]))
 
216
                                g = AddVisualGear(vCircX[i], vCircY[i]-100, vgtHealthTag, 100, False)
 
217
                if g ~= 0 then
 
218
                                    SetVisualGearValues(g, vCircX[i], vCircY[i]-100, 0, 0, 0, 0, 0, teamScore[cOwnerClan[i]], 1500, GetClanColor(cOwnerClan[i]))
 
219
                end
204
220
                        end
205
221
                end
206
222
        end
215
231
 
216
232
 
217
233
        -- make a list of individual team names
218
 
        for i = 0, 5 do
 
234
        for i = 0, (TeamsCount-1) do
219
235
                teamNameArr[i] = " " -- = i
220
236
                teamSize[i] = 0
221
237
                teamIndex[i] = 0
272
288
-- game methods
273
289
------------------------
274
290
 
 
291
function onAttack()
 
292
 
 
293
        if CurrentHedgehog ~= nil then
 
294
                if GetCurAmmoType() == amSkip then
 
295
                        z = (TurnTimeLeft / 2000) - (TurnTimeLeft / 2000)%2 
 
296
                        --AddCaption("scored: " .. z,GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
 
297
                        for i = 0, z do
 
298
                                AwardPoints()
 
299
                        end
 
300
                end
 
301
        end
 
302
 
 
303
end
 
304
 
275
305
function onGameInit()
276
306
 
277
307
        -- Things we don't modify here will use their default values.
278
308
        --GameFlags = gfInfAttack + gfSolidLand -- Game settings and rules
279
309
        
280
310
        GameFlags = band(bor(GameFlags, gfInfAttack + gfSolidLand), bnot(gfKing + gfForts))
281
 
                
282
 
        SuddenDeathTurns = 99 -- suddendeath is off, effectively
 
311
        WaterRise = 0
283
312
 
284
313
end
285
314
 
286
315
 
287
316
function onGameStart()
288
317
 
289
 
        
290
 
 
291
318
        -- build zones
292
319
        cPoint[0] = CreateZone(571,47,120,80)
293
320
        cPoint[1] = CreateZone(1029,643,120,80)
327
354
        for i = 0, (numTeams-1) do
328
355
                pointLimit = pointLimit - 25
329
356
        end
330
 
        --SetGearPosition(hhs[0], 631, 82)
331
 
        --SetGearPosition(hhs[1], 1088, 684)
332
 
        --SetGearPosition(hhs[2], 381, 1569)
333
 
 
 
357
        
334
358
        -- reposition hogs if they are on control points until they are not or sanity limit kicks in
335
359
        reN = 0
336
360
        --zz = 0
345
369
                --AddCaption(zz) -- number of times it took to work
346
370
        end
347
371
 
348
 
        ShowMission(loc("CONTROL v0.3"), loc("by mikade"), loc("Control pillars to score points.") .. "|" .. loc("Goal:") .. " " .. pointLimit .. " " .. loc("points"), 0, 0)
 
372
        ShowMission("CONTROL", 
 
373
        "", 
 
374
        loc("Control pillars to score points.") .. "|" .. 
 
375
        loc("Goal") .. ": " .. pointLimit .. " " .. loc("points"), 0, 0)
349
376
 
350
377
 
351
378
end
353
380
 
354
381
function onNewTurn()
355
382
 
 
383
        -- reset the time counter so that it will get set to TurnTimeLeft in onGameTick 
 
384
        TimeCounter = 0
356
385
                
357
386
        if lastTeam ~= GetHogTeamName(CurrentHedgehog) then
358
387
                lastTeam = GetHogTeamName(CurrentHedgehog)
379
408
                        TurnTimeLeft = 1
380
409
                end
381
410
 
382
 
                for i = 0,5 do
 
411
                totalComment = ""               
 
412
                for i = 0,(TeamsCount-1) do
383
413
                                if teamNameArr[i] ~= " " then                           -- i
384
 
                                        teamComment[i] = teamNameArr[i] .. ": " .. teamScore[teamClan[i]] .. loc (" points|")
 
414
                                        teamComment[i] = teamNameArr[i] .. ": " .. teamScore[teamClan[i]] .. " " .. loc("points") .. "|"
 
415
                                        totalComment = totalComment .. teamComment[i]                   
385
416
                                elseif teamNameArr[i] == " " then
386
417
                                        teamComment[i] = "|"
387
418
                                end
388
419
                        end
389
 
                        ShowMission(loc("CONTROL"), loc("Team Scores:"), teamComment[0] .. teamComment[1] .. teamComment[2] .. teamComment[3] .. teamComment[4] .. teamComment[5], 0, 1600)
 
420
                        
 
421
                        ShowMission("CONTROL", 
 
422
                        loc("Team Scores") .. ":", 
 
423
                        totalComment, 0, 1600)
390
424
        
391
425
        end
392
426
 
398
432
        if (vCircCount >= 500) and (gameWon == false) then
399
433
                vCircCount = 0
400
434
                CheckZones()
401
 
                --AwardPoints()
402
 
 
403
 
 
404
 
                --[[for i = 0,5 do
405
 
 
406
 
                        if teamNameArr[i] ~= " " then                           -- i
407
 
                                teamComment[i] = teamNameArr[i] .. ": " .. teamScore[teamClan[i] ] .. " points|"
408
 
                        elseif teamNameArr[i] == " " then
409
 
                                teamComment[i] = "|"
410
 
                        end
411
 
                end
412
 
                
413
 
                ShowMission("CONTROL", "Team Scores:", teamComment[0] .. teamComment[1] .. teamComment[2] .. teamComment[3] .. teamComment[4] .. teamComment[5], 0, 1600)]]
414
 
 
415
435
        end     
416
436
 
417
437
        -- things we wanna check often
424
444
 
425
445
        end
426
446
 
427
 
        hGCount = hGCount + 1
428
 
        if (hGCount >= 2000) and (gameWon == false) then
429
 
                hGCount = 0
430
 
                AwardPoints()
431
 
        end
 
447
        -- set TimeCounter to starting time if it is uninitialised (from onNewTurn)     
 
448
        if (TimeCounter == 0) and (TurnTimeLeft > 0) then
 
449
                TimeCounter = TurnTimeLeft      
 
450
        end     
 
451
        
 
452
        -- has it ACTUALLY been 2 seconds since we last did this?       
 
453
        if (TimeCounter - TurnTimeLeft) >= 2000 then
 
454
                TimeCounter = TurnTimeLeft
 
455
                
 
456
                if (gameWon == false) then
 
457
                        AwardPoints()           
 
458
                end     
 
459
        end     
 
460
        
 
461
        --AddCaption(TimeCounter)       
 
462
        --hGCount = hGCount + 1
 
463
        --if (hGCount >= 2000) and (gameWon == false) then
 
464
        --      hGCount = 0
 
465
        --      AwardPoints()
 
466
        --end
432
467
 
433
468
end
434
469
 
436
471
        AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
437
472
end
438
473
 
 
474
function InABetterPlaceNow(gear)
 
475
        for i = 0, (numhhs-1) do
 
476
                if gear == hhs[i] then
 
477
                        hhs[i] = nil
 
478
                end
 
479
        end
 
480
end
 
481
 
 
482
function onHogHide(gear)
 
483
         InABetterPlaceNow(gear)
 
484
end
 
485
 
 
486
function onHogRestore(gear)
 
487
        match = false
 
488
        for i = 0, (numhhs-1) do
 
489
                if (hhs[i] == nil) and (match == false) then
 
490
                        hhs[i] = gear
 
491
                        --AddCaption(GetHogName(gear) .. " has reappeared it seems!")
 
492
                        --FollowGear(gear)
 
493
                        match = true
 
494
                end
 
495
        end
 
496
end
 
497
 
439
498
 
440
499
function onGearAdd(gear)
441
500
 
442
501
        if GetGearType(gear) == gtHedgehog then
443
 
 
444
502
                hhs[numhhs] = gear
445
503
                numhhs = numhhs + 1
446
504
                SetEffect(gear, heResurrectable, true)
447
 
 
448
505
        end
449
506
 
450
507
end
452
509
function onGearDelete(gear)
453
510
 
454
511
        if GetGearType(gear) == gtHedgehog then
455
 
        --AddCaption("gear deleted!")
456
 
                for i = 0, (numhhs-1) do
457
 
                        if gear == hhs[i] then
458
 
                                hhs[i] = nil
459
 
                                --AddCaption("for real")        
460
 
                        end             
461
 
                end
 
512
                InABetterPlaceNow(gear)
462
513
        end
463
514
 
464
515
end