author | smxx |
Thu, 01 Apr 2010 16:46:44 +0000 | |
changeset 3240 | e3b52d10b4c2 |
parent 3238 | e99a43a2405b |
child 3257 | fff80d469185 |
permissions | -rw-r--r-- |
3240 | 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", |
3240 | 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", |
3240 | 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!", |
3240 | 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:", |
3240 | 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:", |
3240 | 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 |
if gear == ball then |
|
93 |
ball = nil |
|
94 |
elseif (GetGearType(gear) == gtHedgehog) and CurrentHedgehog ~= nil then |
|
95 |
local clan = GetHogClan(CurrentHedgehog) |
|
96 |
local s |
|
97 |
if clan ~= nil then |
|
98 |
if GetHogClan(CurrentHedgehog) ~= GetHogClan(gear) then |
|
99 |
score[clan] = score[clan] + 1 |
|
100 |
s = string.format(loc(scored), GetHogName(gear), clan + 1) |
|
101 |
else |
|
102 |
score[clan] = score[clan] - 1 |
|
103 |
s = string.format(loc(failed), GetHogName(gear), clan + 1) |
|
104 |
end |
|
105 |
s = s .. " " .. score[0] |
|
106 |
for i = 1, ClansCount - 1 do s = s .. " - " .. score[i] end |
|
107 |
ShowMission(loc(caption), loc(subcaption), s, -amBaseballBat, 0) |
|
108 |
end |
|
109 |
end |
|
110 |
end |