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