author | nemo |
Fri, 02 Apr 2010 18:35:53 +0000 | |
changeset 3263 | fd1588933051 |
parent 3257 | fff80d469185 |
child 3264 | 3cf9d915cdb9 |
permissions | -rw-r--r-- |
3263 | 1 |
-- Hedgewars - Knockball for 2+ Players |
2 |
||
3 |
local caption = { |
|
4 |
["en"] = "Hedgewars-Knockball", |
|
5 |
["de"] = "Hedgewars-Knockball", |
|
3223
f0e590790f3b
credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents:
3197
diff
changeset
|
6 |
["es"] = "Hedgewars-Knockball", |
3263 | 7 |
["pl"] = "Hedgewars-Knockball" |
8 |
} |
|
9 |
||
10 |
local subcaption = { |
|
11 |
["en"] = "Not So Friendly Match", |
|
12 |
["de"] = "Kein-so-Freundschaftsspiel", |
|
3223
f0e590790f3b
credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents:
3197
diff
changeset
|
13 |
["es"] = "Partido no-tan-amistoso", |
3263 | 14 |
["pl"] = "Mecz Nie-Taki-Towarzyski" |
15 |
} |
|
16 |
||
17 |
local goal = { |
|
18 |
["en"] = "Bat balls at your enemies and|push them into the sea!", |
|
19 |
["de"] = "Schlage Bälle auf deine Widersacher|und lass sie ins Meer fallen!", |
|
3223
f0e590790f3b
credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents:
3197
diff
changeset
|
20 |
["es"] = "¡Batea pelotas hacia tus enemigos|y hazlos caer al agua!", |
3263 | 21 |
["pl"] = "Uderzaj piłkami w swoich przeciwników|i strącaj ich do wody!" |
22 |
} |
|
23 |
||
24 |
local scored = { |
|
25 |
["en"] = "%s is out and Team %d|scored a point!| |Score:", |
|
26 |
["de"] = "%s ist draußen und Team %d|erhält einen Punkt!| |Punktestand:", |
|
3223
f0e590790f3b
credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents:
3197
diff
changeset
|
27 |
["es"] = "¡%s cayó y Equipo %d|anotó un tanto!| |Puntuación:", |
3263 | 28 |
["pl"] = "%s utonął i drużyna %d|zdobyła punkt!| |Punktacja:" |
29 |
} |
|
30 |
||
31 |
local failed = { |
|
32 |
["en"] = "%s is out and Team %d|scored a penalty!| |Score:", |
|
33 |
["de"] = "%s ist draußen und Team %d|erhält eine Strafe!| |Punktestand:", |
|
3223
f0e590790f3b
credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents:
3197
diff
changeset
|
34 |
["es"] = "¡%s cayó y Equipo %d|anotó una falta!| |Puntuación:", |
3263 | 35 |
["pl"] = "%s utonął i drużyna %d|dostała punkt karny!| |Punktacja:" |
36 |
} |
|
37 |
||
38 |
local function loc(text) |
|
39 |
if text == nil then return "**missing**" |
|
40 |
elseif text[L] == nil then return text["en"] |
|
41 |
else return text[L] |
|
42 |
end |
|
43 |
end |
|
44 |
||
45 |
--------------------------------------------------------------- |
|
46 |
||
47 |
local score = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0} |
|
48 |
||
49 |
local ball = nil |
|
50 |
||
51 |
local started = false |
|
52 |
||
53 |
function onGameInit() |
|
54 |
GameFlags = gfSolidLand + gfInvulnerable + gfDivideTeams |
|
55 |
TurnTime = 20000 |
|
56 |
CaseFreq = 0 |
|
57 |
LandAdds = 0 |
|
58 |
Explosives = 0 |
|
59 |
Delay = 500 |
|
60 |
SuddenDeathTurns = 99999 -- "disable" sudden death |
|
61 |
end |
|
62 |
||
63 |
function onGameStart() |
|
64 |
ShowMission(loc(caption), loc(subcaption), loc(goal), -amBaseballBat, 0) |
|
65 |
started = true |
|
66 |
end |
|
67 |
||
68 |
function onGameTick() |
|
69 |
if ball ~= nil and GetFollowGear() ~= 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 |
FollowGear(ball) |
|
85 |
end |
|
86 |
end |
|
87 |
end |
|
88 |
||
89 |
function onGearDelete(gear) |
|
90 |
if not started then |
|
91 |
return |
|
92 |
end |
|
93 |
if gear == ball then |
|
94 |
ball = nil |
|
95 |
elseif (GetGearType(gear) == gtHedgehog) and CurrentHedgehog ~= nil then |
|
96 |
local clan = GetHogClan(CurrentHedgehog) |
|
97 |
local s |
|
98 |
if clan ~= nil then |
|
99 |
if GetHogClan(CurrentHedgehog) ~= GetHogClan(gear) then |
|
100 |
score[clan] = score[clan] + 1 |
|
101 |
s = string.format(loc(scored), GetHogName(gear), clan + 1) |
|
102 |
else |
|
103 |
score[clan] = score[clan] - 1 |
|
104 |
s = string.format(loc(failed), GetHogName(gear), clan + 1) |
|
105 |
end |
|
106 |
s = s .. " " .. score[0] |
|
107 |
for i = 1, ClansCount - 1 do s = s .. " - " .. score[i] end |
|
108 |
ShowMission(loc(caption), loc(subcaption), s, -amBaseballBat, 0) |
|
109 |
end |
|
110 |
end |
|
111 |
end |