author | nemo |
Fri, 02 Apr 2010 18:36:14 +0000 | |
changeset 3264 | 3cf9d915cdb9 |
parent 3263 | fd1588933051 |
child 3266 | aef4b9316060 |
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", |
3264 | 7 |
["pl"] = "Hedgewars-Knockball", |
8 |
["pt_PT"] = "Hedgewars-Knockball" |
|
3263 | 9 |
} |
10 |
||
11 |
local subcaption = { |
|
12 |
["en"] = "Not So Friendly Match", |
|
13 |
["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
|
14 |
["es"] = "Partido no-tan-amistoso", |
3264 | 15 |
["pl"] = "Mecz Nie-Taki-Towarzyski", |
16 |
["pt_PT"] = "Partida não muito amigável" |
|
3263 | 17 |
} |
18 |
||
19 |
local goal = { |
|
20 |
["en"] = "Bat balls at your enemies and|push them into the sea!", |
|
21 |
["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
|
22 |
["es"] = "¡Batea pelotas hacia tus enemigos|y hazlos caer al agua!", |
3264 | 23 |
["pl"] = "Uderzaj piłkami w swoich przeciwników|i strącaj ich do wody!", |
24 |
["pt_PT"] = "Bate bolas contra os teus|enimigos e empurra-os ao mar!" |
|
3263 | 25 |
} |
26 |
||
27 |
local scored = { |
|
28 |
["en"] = "%s is out and Team %d|scored a point!| |Score:", |
|
29 |
["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
|
30 |
["es"] = "¡%s cayó y Equipo %d|anotó un tanto!| |Puntuación:", |
3264 | 31 |
["pl"] = "%s utonął i drużyna %d|zdobyła punkt!| |Punktacja:", |
32 |
["pt_PT"] = "%s está fora e a equipa %d|soma um ponto!| |Pontuação:" |
|
3263 | 33 |
} |
34 |
||
35 |
local failed = { |
|
36 |
["en"] = "%s is out and Team %d|scored a penalty!| |Score:", |
|
37 |
["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
|
38 |
["es"] = "¡%s cayó y Equipo %d|anotó una falta!| |Puntuación:", |
3264 | 39 |
["pl"] = "%s utonął i drużyna %d|dostała punkt karny!| |Punktacja:", |
40 |
["pt_PT"] = "%s está fora e a equipa %d|perde um ponto!| |Pontuação:" |
|
3263 | 41 |
} |
42 |
||
43 |
local function loc(text) |
|
44 |
if text == nil then return "**missing**" |
|
45 |
elseif text[L] == nil then return text["en"] |
|
46 |
else return text[L] |
|
47 |
end |
|
48 |
end |
|
49 |
||
50 |
--------------------------------------------------------------- |
|
51 |
||
52 |
local score = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0} |
|
53 |
||
54 |
local ball = nil |
|
55 |
||
56 |
local started = false |
|
57 |
||
58 |
function onGameInit() |
|
59 |
GameFlags = gfSolidLand + gfInvulnerable + gfDivideTeams |
|
60 |
TurnTime = 20000 |
|
61 |
CaseFreq = 0 |
|
62 |
LandAdds = 0 |
|
63 |
Explosives = 0 |
|
64 |
Delay = 500 |
|
65 |
SuddenDeathTurns = 99999 -- "disable" sudden death |
|
66 |
end |
|
67 |
||
68 |
function onGameStart() |
|
69 |
ShowMission(loc(caption), loc(subcaption), loc(goal), -amBaseballBat, 0) |
|
70 |
started = true |
|
71 |
end |
|
72 |
||
73 |
function onGameTick() |
|
74 |
if ball ~= nil and GetFollowGear() ~= nil then FollowGear(ball) end |
|
75 |
end |
|
76 |
||
77 |
function onAmmoStoreInit() |
|
78 |
SetAmmo(amBaseballBat, 9, 0, 0) |
|
79 |
SetAmmo(amSkip, 9, 0, 0) |
|
80 |
end |
|
81 |
||
82 |
function onGearAdd(gear) |
|
83 |
if GetGearType(gear) == gtShover then |
|
84 |
ball = AddGear(GetX(gear), GetY(gear), gtBall, 0, 0, 0, 0) |
|
85 |
if ball ~= nil then |
|
86 |
CopyPV2(gear, ball) |
|
87 |
SetState(ball, 0x200) -- temporary - might change! |
|
88 |
SetTag(ball, 8) -- baseball skin |
|
89 |
FollowGear(ball) |
|
90 |
end |
|
91 |
end |
|
92 |
end |
|
93 |
||
94 |
function onGearDelete(gear) |
|
95 |
if not started then |
|
96 |
return |
|
97 |
end |
|
98 |
if gear == ball then |
|
99 |
ball = nil |
|
100 |
elseif (GetGearType(gear) == gtHedgehog) and CurrentHedgehog ~= nil then |
|
101 |
local clan = GetHogClan(CurrentHedgehog) |
|
102 |
local s |
|
103 |
if clan ~= nil then |
|
104 |
if GetHogClan(CurrentHedgehog) ~= GetHogClan(gear) then |
|
105 |
score[clan] = score[clan] + 1 |
|
106 |
s = string.format(loc(scored), GetHogName(gear), clan + 1) |
|
107 |
else |
|
108 |
score[clan] = score[clan] - 1 |
|
109 |
s = string.format(loc(failed), GetHogName(gear), clan + 1) |
|
110 |
end |
|
111 |
s = s .. " " .. score[0] |
|
112 |
for i = 1, ClansCount - 1 do s = s .. " - " .. score[i] end |
|
113 |
ShowMission(loc(caption), loc(subcaption), s, -amBaseballBat, 0) |
|
114 |
end |
|
115 |
end |
|
116 |
end |