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
|
3197
|
53 |
SuddenDeathTurns = 99999 -- "disable" sudden death
|
3004
|
54 |
end
|
|
55 |
|
|
56 |
function onGameStart()
|
|
57 |
ShowMission(loc(caption), loc(subcaption), loc(goal), -amBaseballBat, 0);
|
|
58 |
end
|
|
59 |
|
|
60 |
function onGameTick()
|
3058
|
61 |
if ball ~= nil and GetFollowGear() ~= nil then FollowGear(ball) end
|
3004
|
62 |
end
|
|
63 |
|
|
64 |
function onAmmoStoreInit()
|
|
65 |
SetAmmo(amBaseballBat, 9, 0, 0)
|
|
66 |
SetAmmo(amSkip, 9, 0, 0)
|
|
67 |
end
|
|
68 |
|
|
69 |
function onGearAdd(gear)
|
|
70 |
if GetGearType(gear) == gtShover then
|
|
71 |
ball = AddGear(GetX(gear), GetY(gear), gtBall, 0, 0, 0, 0)
|
|
72 |
if ball ~= nil then
|
|
73 |
CopyPV2(gear, ball)
|
|
74 |
SetState(ball, 0x200) -- temporary - might change!
|
|
75 |
SetTag(ball, 8) -- baseball skin
|
3058
|
76 |
FollowGear(ball)
|
3004
|
77 |
end
|
|
78 |
end
|
|
79 |
end
|
|
80 |
|
|
81 |
function onGearDelete(gear)
|
|
82 |
if gear == ball then
|
|
83 |
ball = nil
|
|
84 |
elseif (GetGearType(gear) == gtHedgehog) and CurrentHedgehog ~= nil then
|
|
85 |
local clan = GetHogClan(CurrentHedgehog)
|
3013
|
86 |
local s
|
3004
|
87 |
if GetHogClan(CurrentHedgehog) ~= GetHogClan(gear) then
|
|
88 |
score[clan] = score[clan] + 1
|
3013
|
89 |
s = string.format(loc(scored), GetHogName(gear), clan + 1)
|
3004
|
90 |
else
|
|
91 |
score[clan] = score[clan] - 1
|
3013
|
92 |
s = string.format(loc(failed), GetHogName(gear), clan + 1)
|
3004
|
93 |
end
|
3013
|
94 |
s = s .. " " .. score[0]
|
3004
|
95 |
for i = 1, ClansCount - 1 do s = s .. " - " .. score[i] end
|
|
96 |
ShowMission(loc(caption), loc(subcaption), s, -amBaseballBat, 0)
|
|
97 |
end
|
|
98 |
end
|