|
1 -- Hedgewars - Knockball for 2+ Players |
|
2 |
|
3 local caption = { |
|
4 ["en"] = "Hedgewars-Knockball", |
|
5 ["de"] = "Hedgewars-Knockball" |
|
6 } |
|
7 |
|
8 local subcaption = { |
|
9 ["en"] = "Not So Friendly Match", |
|
10 ["de"] = "Kein-so-Freundschaftsspiel" |
|
11 } |
|
12 |
|
13 local goal = { |
|
14 ["en"] = "Bat balls at your enemies and|push them into the sea!", |
|
15 ["de"] = "Schlage Bälle auf deine Widersacher|und lass sie ins Meer fallen!" |
|
16 } |
|
17 |
|
18 local scored = { |
|
19 ["en"] = " scored a point!", |
|
20 ["de"] = " erhält einen Punkt!" |
|
21 } |
|
22 |
|
23 local failed = { |
|
24 ["en"] = " scored a penalty!", |
|
25 ["de"] = " erhält eine Strafe!" |
|
26 } |
|
27 |
|
28 local sscore = { |
|
29 ["en"] = "Score", |
|
30 ["de"] = "Punktestand" |
|
31 } |
|
32 |
|
33 local team = { |
|
34 ["en"] = "Team" |
|
35 } |
|
36 |
|
37 local drowning = { |
|
38 ["en"] = "is out and", |
|
39 ["de"] = "ist draußen und" |
|
40 } |
|
41 |
|
42 local function loc(text) |
|
43 if text == nil then return "**missing**" |
|
44 elseif text[L] == nil then return text["en"] |
|
45 else return text[L] |
|
46 end |
|
47 end |
|
48 |
|
49 --------------------------------------------------------------- |
|
50 |
|
51 local score = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0} |
|
52 |
|
53 local ball = nil |
|
54 |
|
55 function onGameInit() |
|
56 GameFlags = gfSolidLand + gfInvulnerable + gfDivideTeams |
|
57 TurnTime = 20000 |
|
58 CaseFreq = 0 |
|
59 LandAdds = 0 |
|
60 Explosives = 0 |
|
61 Delay = 500 |
|
62 end |
|
63 |
|
64 function onGameStart() |
|
65 ShowMission(loc(caption), loc(subcaption), loc(goal), -amBaseballBat, 0); |
|
66 end |
|
67 |
|
68 function onGameTick() |
|
69 if ball ~= nil then FollowGear(ball) end |
|
70 end |
|
71 |
|
72 function onAmmoStoreInit() |
|
73 SetAmmo(amBaseballBat, 9, 0, 0) |
|
74 SetAmmo(amSkip, 9, 0, 0) |
|
75 end |
|
76 |
|
77 function onGearAdd(gear) |
|
78 if GetGearType(gear) == gtShover then |
|
79 ball = AddGear(GetX(gear), GetY(gear), gtBall, 0, 0, 0, 0) |
|
80 if ball ~= nil then |
|
81 CopyPV2(gear, ball) |
|
82 SetState(ball, 0x200) -- temporary - might change! |
|
83 SetTag(ball, 8) -- baseball skin |
|
84 end |
|
85 end |
|
86 end |
|
87 |
|
88 function onGearDelete(gear) |
|
89 if gear == ball then |
|
90 ball = nil |
|
91 elseif (GetGearType(gear) == gtHedgehog) and CurrentHedgehog ~= nil then |
|
92 local clan = GetHogClan(CurrentHedgehog) |
|
93 local s = GetHogName(gear) .. " " .. loc(drowning) .. "|" .. loc(team) .. " " .. (clan + 1) .. " " |
|
94 if GetHogClan(CurrentHedgehog) ~= GetHogClan(gear) then |
|
95 score[clan] = score[clan] + 1 |
|
96 s = s .. loc(scored) |
|
97 else |
|
98 score[clan] = score[clan] - 1 |
|
99 s = s .. loc(failed) |
|
100 end |
|
101 s = s .. "| |" .. loc(sscore) .. ": " .. score[0] |
|
102 for i = 1, ClansCount - 1 do s = s .. " - " .. score[i] end |
|
103 ShowMission(loc(caption), loc(subcaption), s, -amBaseballBat, 0) |
|
104 end |
|
105 end |