author | sheepluva |
Sat, 07 Dec 2019 16:18:20 +0100 | |
branch | hedgeroid |
changeset 15517 | 45d6806548e9 |
parent 15138 | 73d8cc72239e |
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 |
||
12342 | 11 |
local frenzyAmmos = { |
12 |
amBazooka, |
|
13 |
amGrenade, |
|
14 |
amShotgun, |
|
15 |
amFirePunch, |
|
16 |
amMine, |
|
15138
73d8cc72239e
Frenzy: Change ammo slots to be closer to original slots
Wuzzy <Wuzzy2@mail.ru>
parents:
15137
diff
changeset
|
17 |
amMolotov, |
73d8cc72239e
Frenzy: Change ammo slots to be closer to original slots
Wuzzy <Wuzzy2@mail.ru>
parents:
15137
diff
changeset
|
18 |
amBlowTorch, |
12342 | 19 |
amJetpack, |
20 |
amTeleport, |
|
21 |
amLowGravity |
|
22 |
} |
|
11015 | 23 |
|
24 |
function showStartingInfo() |
|
25 |
||
26 |
ruleSet = "" .. |
|
12342 | 27 |
loc("RULES:") .. " |" .. |
11015 | 28 |
loc("Each turn is only ONE SECOND!") .. "|" .. |
14418
04231f066ada
Frenzy: Hide slot key info in Touch (there are no slot keys in Touch)
Wuzzy <Wuzzy2@mail.ru>
parents:
12342
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:
12342
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:
12342
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:
12342
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:
12342
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:
12342
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:
12342
diff
changeset
|
35 |
end |
12342 | 36 |
end |
11015 | 37 |
|
38 |
ShowMission(loc("FRENZY"), |
|
12342 | 39 |
loc("A frenetic Hedgewars mini-game"), |
15074
e16f906224fd
Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents:
14419
diff
changeset
|
40 |
ruleSet, -amMolotov, 4000) |
11015 | 41 |
|
42 |
end |
|
43 |
||
44 |
function onGameInit() |
|
45 |
||
14419
6843c4551cde
Frenzy: More consistent ready time setting
Wuzzy <Wuzzy2@mail.ru>
parents:
14418
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 |
||
15137
378efa87f558
Frenzy: Fix incorrect ammo slot numbers in ammo menu
Wuzzy <Wuzzy2@mail.ru>
parents:
15074
diff
changeset
|
69 |
for s=1, #frenzyAmmos do |
378efa87f558
Frenzy: Fix incorrect ammo slot numbers in ammo menu
Wuzzy <Wuzzy2@mail.ru>
parents:
15074
diff
changeset
|
70 |
SetAmmoSlot(frenzyAmmos[s], s) |
378efa87f558
Frenzy: Fix incorrect ammo slot numbers in ammo menu
Wuzzy <Wuzzy2@mail.ru>
parents:
15074
diff
changeset
|
71 |
end |
378efa87f558
Frenzy: Fix incorrect ammo slot numbers in ammo menu
Wuzzy <Wuzzy2@mail.ru>
parents:
15074
diff
changeset
|
72 |
SetAmmoSlot(amSkip, 10) |
11015 | 73 |
end |
74 |
||
75 |
function onGameStart() |
|
76 |
showStartingInfo() |
|
77 |
end |
|
78 |
||
79 |
function onSlot(sln) |
|
80 |
cTimer = 8 |
|
81 |
cn = sln |
|
82 |
end |
|
83 |
||
84 |
function onGameTick() |
|
85 |
if cTimer ~= 0 then |
|
86 |
cTimer = cTimer -1 |
|
87 |
if cTimer == 1 then |
|
88 |
ChangeWep(cn) |
|
89 |
cn = 0 |
|
90 |
cTimer = 0 |
|
91 |
end |
|
92 |
end |
|
93 |
end |
|
94 |
||
12342 | 95 |
-- Keyboard slot shortcuts |
11015 | 96 |
function ChangeWep(s) |
97 |
||
12342 | 98 |
if s >= 0 and s <= 9 then |
99 |
SetWeapon(frenzyAmmos[s+1]) |
|
11015 | 100 |
end |
101 |
||
102 |
end |
|
103 |
||
12342 | 104 |
function onAmmoStoreInit() |
105 |
-- Add frenzy ammos |
|
106 |
for i=1, #frenzyAmmos do |
|
107 |
SetAmmo(frenzyAmmos[i], 9, 0, 0, 0) |
|
11015 | 108 |
end |
12342 | 109 |
SetAmmo(amSkip, 9, 0, 0, 0) |
11015 | 110 |
end |