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