author | Wuzzy <Wuzzy2@mail.ru> |
Sat, 20 Apr 2019 16:46:07 +0200 | |
changeset 14844 | 358d81e29a88 |
parent 14435 | 6843c4551cde |
child 15090 | e16f906224fd |
permissions | -rw-r--r-- |
11015 | 1 |
------------------------------------------- |
2 |
-- FRENZY |
|
3 |
-- a hedgewars mode inspired by Hysteria |
|
4 |
------------------------------------------- |
|
5 |
||
6 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
|
7 |
||
8 |
local cTimer = 0 |
|
9 |
local cn = 0 |
|
10 |
||
12337 | 11 |
local frenzyAmmos = { |
12 |
amBazooka, |
|
13 |
amGrenade, |
|
14 |
amMolotov, |
|
15 |
amShotgun, |
|
16 |
amFirePunch, |
|
17 |
amMine, |
|
18 |
amJetpack, |
|
19 |
amBlowTorch, |
|
20 |
amTeleport, |
|
21 |
amLowGravity |
|
22 |
} |
|
11015 | 23 |
|
24 |
function showStartingInfo() |
|
25 |
||
26 |
ruleSet = "" .. |
|
12337 | 27 |
loc("RULES:") .. " |" .. |
11015 | 28 |
loc("Each turn is only ONE SECOND!") .. "|" .. |
14434
04231f066ada
Frenzy: Hide slot key info in Touch (there are no slot keys in Touch)
Wuzzy <Wuzzy2@mail.ru>
parents:
12337
diff
changeset
|
29 |
loc("Use your ready time to think.") |
04231f066ada
Frenzy: Hide slot key info in Touch (there are no slot keys in Touch)
Wuzzy <Wuzzy2@mail.ru>
parents:
12337
diff
changeset
|
30 |
if INTERFACE ~= "touch" then |
04231f066ada
Frenzy: Hide slot key info in Touch (there are no slot keys in Touch)
Wuzzy <Wuzzy2@mail.ru>
parents:
12337
diff
changeset
|
31 |
ruleSet = ruleSet .. "|" .. |
04231f066ada
Frenzy: Hide slot key info in Touch (there are no slot keys in Touch)
Wuzzy <Wuzzy2@mail.ru>
parents:
12337
diff
changeset
|
32 |
loc("Slot keys save time! (F1-F10 by default)") .. "| |" |
04231f066ada
Frenzy: Hide slot key info in Touch (there are no slot keys in Touch)
Wuzzy <Wuzzy2@mail.ru>
parents:
12337
diff
changeset
|
33 |
for i=1, #frenzyAmmos do |
04231f066ada
Frenzy: Hide slot key info in Touch (there are no slot keys in Touch)
Wuzzy <Wuzzy2@mail.ru>
parents:
12337
diff
changeset
|
34 |
ruleSet = ruleSet .. string.format(loc("Slot %d: %s"), i, GetAmmoName(frenzyAmmos[i])) .. "|" |
04231f066ada
Frenzy: Hide slot key info in Touch (there are no slot keys in Touch)
Wuzzy <Wuzzy2@mail.ru>
parents:
12337
diff
changeset
|
35 |
end |
12337 | 36 |
end |
11015 | 37 |
|
38 |
ShowMission(loc("FRENZY"), |
|
12337 | 39 |
loc("A frenetic Hedgewars mini-game"), |
11015 | 40 |
ruleSet, 0, 4000) |
41 |
||
42 |
end |
|
43 |
||
44 |
function onGameInit() |
|
45 |
||
14435
6843c4551cde
Frenzy: More consistent ready time setting
Wuzzy <Wuzzy2@mail.ru>
parents:
14434
diff
changeset
|
46 |
if TurnTime > 8000 then |
11015 | 47 |
Ready = 8000 |
48 |
else |
|
49 |
Ready = TurnTime |
|
50 |
end |
|
51 |
||
52 |
TurnTime = 1000 |
|
53 |
||
54 |
--These are the official settings, but I think I prefer allowing customization in this regard |
|
55 |
--MinesNum = 8 |
|
56 |
--MinesTime = 3000 |
|
57 |
--MinesDudPercent = 30 |
|
58 |
--Explosives = 0 |
|
59 |
||
60 |
--Supposedly official settings |
|
61 |
HealthCaseProb = 0 |
|
62 |
CrateFreq = 0 |
|
63 |
||
64 |
--Approximation of Official Settings |
|
65 |
--SuddenDeathTurns = 10 |
|
66 |
--WaterRise = 47 |
|
67 |
--HealthDecrease = 0 |
|
68 |
||
69 |
end |
|
70 |
||
71 |
function onGameStart() |
|
72 |
showStartingInfo() |
|
73 |
end |
|
74 |
||
75 |
function onSlot(sln) |
|
76 |
cTimer = 8 |
|
77 |
cn = sln |
|
78 |
end |
|
79 |
||
80 |
function onGameTick() |
|
81 |
if cTimer ~= 0 then |
|
82 |
cTimer = cTimer -1 |
|
83 |
if cTimer == 1 then |
|
84 |
ChangeWep(cn) |
|
85 |
cn = 0 |
|
86 |
cTimer = 0 |
|
87 |
end |
|
88 |
end |
|
89 |
end |
|
90 |
||
12337 | 91 |
-- Keyboard slot shortcuts |
11015 | 92 |
function ChangeWep(s) |
93 |
||
12337 | 94 |
if s >= 0 and s <= 9 then |
95 |
SetWeapon(frenzyAmmos[s+1]) |
|
11015 | 96 |
end |
97 |
||
98 |
end |
|
99 |
||
12337 | 100 |
function onAmmoStoreInit() |
101 |
-- Add frenzy ammos |
|
102 |
for i=1, #frenzyAmmos do |
|
103 |
SetAmmo(frenzyAmmos[i], 9, 0, 0, 0) |
|
11015 | 104 |
end |
12337 | 105 |
SetAmmo(amSkip, 9, 0, 0, 0) |
11015 | 106 |
end |