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()
|
3058
|
60 |
if ball ~= nil and GetFollowGear() ~= nil then FollowGear(ball) end
|
3004
|
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
|
3058
|
75 |
FollowGear(ball)
|
3004
|
76 |
end
|
|
77 |
end
|
|
78 |
end
|
|
79 |
|
|
80 |
function onGearDelete(gear)
|
|
81 |
if gear == ball then
|
|
82 |
ball = nil
|
|
83 |
elseif (GetGearType(gear) == gtHedgehog) and CurrentHedgehog ~= nil then
|
|
84 |
local clan = GetHogClan(CurrentHedgehog)
|
3013
|
85 |
local s
|
3004
|
86 |
if GetHogClan(CurrentHedgehog) ~= GetHogClan(gear) then
|
|
87 |
score[clan] = score[clan] + 1
|
3013
|
88 |
s = string.format(loc(scored), GetHogName(gear), clan + 1)
|
3004
|
89 |
else
|
|
90 |
score[clan] = score[clan] - 1
|
3013
|
91 |
s = string.format(loc(failed), GetHogName(gear), clan + 1)
|
3004
|
92 |
end
|
3013
|
93 |
s = s .. " " .. score[0]
|
3004
|
94 |
for i = 1, ClansCount - 1 do s = s .. " - " .. score[i] end
|
|
95 |
ShowMission(loc(caption), loc(subcaption), s, -amBaseballBat, 0)
|
|
96 |
end
|
|
97 |
end
|