author | unC0Rr |
Fri, 25 Mar 2016 15:40:44 +0300 | |
changeset 11616 | 5b31f61e0723 |
parent 11301 | fa18940f290d |
child 12065 | 7df7c58ea965 |
permissions | -rw-r--r-- |
7095 | 1 |
|
2 |
---------------------- |
|
3 |
-- WALL TO WALL 0.4 |
|
4 |
---------------------- |
|
5 |
-- a shoppa minigame |
|
6 |
-- by mikade |
|
7 |
||
8 |
-- feel free to add map specific walls to LoadConfig, or post additional |
|
9 |
-- wall suggestions on our forum at: http://www.hedgewars.org/forum |
|
10 |
||
11 |
---------------- |
|
12 |
--0.1 |
|
13 |
---------------- |
|
14 |
-- concept test |
|
15 |
||
16 |
---------------- |
|
17 |
--0.2 |
|
18 |
---------------- |
|
19 |
-- unhardcoded turntimeleft, now uses shoppa default of 45s |
|
20 |
-- changed some things behind the scenes |
|
21 |
-- fixed oooooold radar bug |
|
22 |
-- added radar / script support for multiple crates |
|
23 |
-- tweaked weapons tables |
|
24 |
-- added surfing and changed crate spawn requirements a bit |
|
25 |
||
26 |
---------------- |
|
27 |
--0.3 |
|
28 |
---------------- |
|
29 |
-- stuffed dirty clothes into cupboard |
|
30 |
-- improved user feedback |
|
31 |
-- added/improved experimental config system, input masks included :D |
|
32 |
||
33 |
---------------- |
|
34 |
--0.4 |
|
35 |
---------------- |
|
36 |
-- for version 0.9.18, now detects border in correct location |
|
37 |
-- fix 0.3 config constraint |
|
38 |
-- remove unnecessary vars |
|
39 |
-- oops, remove hardcoding of minesnum,explosives |
|
40 |
-- ... and unhardcode turntime (again)... man, 30s is hard :( |
|
41 |
-- move some initialisations around |
|
42 |
-- numerous improvements to user feedback |
|
43 |
-- walls disappear after being touched |
|
44 |
-- added backwards compatibility with 0.9.17 |
|
45 |
||
46 |
---------------- |
|
47 |
--TO DO |
|
48 |
---------------- |
|
49 |
-- achievements / try detect shoppa moves? :| |
|
50 |
-- maybe add ability for the user to place zones like in Racer? |
|
51 |
-- add more hard-coded values for specific maps |
|
52 |
||
53 |
----------------------------- |
|
54 |
-- GO PONIES, GO PONIES, GO! |
|
55 |
----------------------------- |
|
56 |
||
8043 | 57 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
58 |
HedgewarsScriptLoad("/Scripts/Tracker.lua") |
|
59 |
HedgewarsScriptLoad("/Scripts/Utils.lua") |
|
7095 | 60 |
|
61 |
-- experimental menu stuff |
|
62 |
local menuIndex = 1 |
|
63 |
local menu = {} |
|
64 |
local preMenuCfg |
|
65 |
local postMenuCfg |
|
66 |
local roundN = 0 |
|
67 |
||
68 |
-- config and wall variables |
|
69 |
local AFR = false |
|
70 |
local allowCrazyWeps = false |
|
71 |
local requireSurfer = true |
|
72 |
local wX = {} |
|
73 |
local wY = {} |
|
74 |
local wWidth = {} |
|
75 |
local wHeight = {} |
|
76 |
local wTouched = {} |
|
77 |
--local margin |
|
78 |
local wallsLeft = 0 |
|
79 |
||
80 |
local hasSurfed = false |
|
81 |
local allWallsHit = false |
|
82 |
||
83 |
local gTimer = 1 |
|
84 |
local effectTimer = 1 |
|
85 |
||
86 |
local ropeG = nil |
|
87 |
local crateG = nil |
|
88 |
local allowCrate = true |
|
89 |
||
90 |
-- crate radar vars |
|
91 |
local rCirc = {} |
|
92 |
local rAlpha = 255 |
|
93 |
local rPingTimer = 0 |
|
94 |
local m2Count = 0 |
|
95 |
||
96 |
local weapons = {} |
|
97 |
||
98 |
--[[local unlisted = {amTardis, amLandGun,amExtraTime,amExtraDamage, |
|
99 |
amVampiric, amSwitch, amInvulnerable, amGirder, amJetpack, |
|
100 |
amPortalGun, amTeleport, amResurrector, amLaserSight, amLowGravity, |
|
101 |
amAirAttack, amNapalm, amMineStrike, amDrillStrike, |
|
102 |
amKamikaze, amSnowball, amSeduction}]] |
|
103 |
||
104 |
local crazyWeps = {amWatermelon, amHellishBomb, amBallgun, amRCPlane} |
|
105 |
||
106 |
local groundWeps = {amBee, amShotgun,amDEagle,amFirePunch, amWhip, |
|
107 |
amPickHammer, amBaseballBat, amCake,amBallgun, |
|
108 |
amRCPlane, amSniperRifle, amBirdy, amBlowTorch, amGasBomb, |
|
109 |
amFlamethrower, amSMine, amMortar, amHammer} |
|
110 |
||
111 |
local ropeWeps = {amGrenade, amClusterBomb, amBazooka, amMine, amDynamite, |
|
112 |
amWatermelon, amHellishBomb, amDrill, amMolotov} |
|
113 |
||
114 |
-- 0.9.18+ extra custom data for preset maps |
|
115 |
local MapList = |
|
116 |
{ |
|
117 |
--name, surfer, roof, LRwalls |
|
118 |
{"Atlantis Shoppa", true, false, true}, |
|
119 |
{"BambooPlinko", true, false, true}, |
|
120 |
{"BrickShoppa", false, false, true}, |
|
121 |
{"BubbleFlow", true, false, true}, |
|
122 |
{"Cave", false, false, true}, |
|
123 |
{"Glass Shoppa", true, false, true}, |
|
124 |
{"HardIce", false, false, true}, |
|
125 |
{"Industrial", false, false, true}, |
|
126 |
{"Islands", true, false, true}, |
|
127 |
{"Hedgelove", true, false, true}, |
|
128 |
{"NeonStyle", false, false, true}, |
|
129 |
{"Octorama", false, false, true}, |
|
130 |
{"red vs blue - Castle", true, false, true}, |
|
131 |
{"red vs blue - castle2", true, false, true}, |
|
132 |
{"red vs blue - True Shoppa Sky", true, false, true}, |
|
133 |
{"Ropes", false, false, true}, |
|
134 |
{"Ropes Rearranged", false, false, true}, |
|
135 |
{"RopesRevenge Flipped", true, false, true}, |
|
136 |
{"Ropes Three", false, false, true}, |
|
137 |
{"RopesTwo", false, false, true}, |
|
138 |
{"ShapeShoppa1.0", true, false, true}, |
|
139 |
{"ShappeShoppa Darkhow", true, false, true}, |
|
140 |
{"ShoppaCave2", true, false, true}, |
|
141 |
{"ShoppaFun", true, false, true}, |
|
142 |
{"ShoppaGolf", false, false, true}, |
|
143 |
{"ShoppaHell", false, true, false}, |
|
144 |
{"ShoppaKing", false, false, false}, |
|
145 |
{"ShoppaNeon", false, false, true}, |
|
146 |
{"ShoppaSky", false, false, true}, |
|
147 |
{"Shoppawall", false, false, true}, |
|
148 |
{"SkatePark", false, false, true}, |
|
149 |
{"SloppyShoppa", false, false, true}, |
|
150 |
{"Sticks", true, false, true}, |
|
151 |
{"Symmetrical Ropes ", false, false, true}, |
|
152 |
{"Tetris", false, false, true}, |
|
153 |
{"TransRopes2", false, false, true}, |
|
154 |
{"Wildmap", false, false, true}, |
|
155 |
{"Winter Shoppa", false, false, true}, |
|
156 |
{"2Cshoppa", true, false, true} |
|
157 |
} |
|
158 |
||
159 |
function BoolToCfgTxt(p) |
|
160 |
if p == false then |
|
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10670
diff
changeset
|
161 |
return loc("Disabled") |
7095 | 162 |
else |
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10670
diff
changeset
|
163 |
return loc("Enabled") |
7095 | 164 |
end |
165 |
end |
|
166 |
||
167 |
function LoadConfig(p) |
|
168 |
||
169 |
margin = 20 |
|
170 |
mapID = nil |
|
171 |
||
172 |
-- 0.9.17 |
|
173 |
if Map == "CHANGE_ME" then |
|
174 |
AddCaption(loc("For improved features/stability, play 0.9.18+")) |
|
175 |
--AddWall(10,10,4085,margin) |
|
176 |
AddWall(10,10,margin,2025) |
|
177 |
AddWall(4085-margin,10,margin,2025) |
|
178 |
end |
|
179 |
||
180 |
--0.9.18+ |
|
181 |
for i = 1, #MapList do |
|
182 |
if Map == MapList[i][1] then |
|
183 |
mapID = i |
|
184 |
--AddCaption(MapList[i][1] .. " found. reqSurf is " .. BoolToCfgTxt(MapList[i][2])) |
|
185 |
end |
|
186 |
end |
|
187 |
||
188 |
if (p == 1) and (mapID ~= nil) then |
|
189 |
requireSurfer = MapList[mapID][2] |
|
190 |
end |
|
191 |
||
192 |
if mapID ~= nil then |
|
193 |
||
194 |
-- add a wall to the roof |
|
195 |
if MapList[mapID][3] == true then |
|
196 |
AddWall(LeftX+10,TopY+10,RightX-LeftX-20,margin) |
|
197 |
end |
|
198 |
||
199 |
-- add walls on the left and right border |
|
200 |
if MapList[mapID][4] == true then |
|
201 |
AddWall(LeftX+10,TopY+10,margin,WaterLine) |
|
202 |
AddWall(RightX-10-margin,TopY+10,margin,WaterLine) |
|
203 |
end |
|
204 |
||
205 |
-- add map specific walls |
|
206 |
if Map == "Ropes" then |
|
207 |
AddWall(1092,934,54,262) |
|
208 |
AddWall(2822,323,33,137) |
|
209 |
elseif Map == "ShoppaKing" then |
|
210 |
AddWall(3777,1520,50,196) |
|
211 |
AddWall(1658,338,46,670) |
|
212 |
elseif Map == "ShoppaHell" then |
|
213 |
AddWall(2035,831,30,263) |
|
214 |
AddWall(3968,1668,31,383) |
|
215 |
elseif Map == "ShoppaNeon" then |
|
216 |
AddWall(980,400,20,300) |
|
217 |
AddWall(1940,400,20,300) |
|
218 |
AddWall(3088,565,26,284) |
|
219 |
AddWall(187,270,28,266) |
|
220 |
end |
|
221 |
||
222 |
-- if map is unrecognized, add two walls on the side borders |
|
223 |
-- also, if version of hw is not 0.9.17 or lower |
|
224 |
elseif Map ~= "CHANGE_ME" then |
|
225 |
AddWall(LeftX+10,TopY+10,margin,WaterLine) |
|
226 |
AddWall(RightX-10-margin,TopY+10,margin,WaterLine) |
|
227 |
end |
|
228 |
||
229 |
||
230 |
end |
|
231 |
||
232 |
function AddWall(zXMin,zYMin, zWidth, zHeight) |
|
233 |
||
234 |
table.insert(wX, zXMin) |
|
235 |
table.insert(wY, zYMin) |
|
236 |
table.insert(wWidth, zWidth) |
|
237 |
table.insert(wHeight, zHeight) |
|
238 |
table.insert(wTouched, false) |
|
239 |
||
240 |
end |
|
241 |
||
242 |
function DrawBlip(gear) |
|
243 |
SetVisualGearValues(getGearValue(gear,"CIRC"), getGearValue(gear,"RX"), getGearValue(gear,"RY"), 100, 255, 1, 10, 0, 40, 3, GetClanColor(GetHogClan(CurrentHedgehog))-rAlpha) |
|
244 |
end |
|
245 |
||
246 |
function TrackRadarBlip(gear) |
|
247 |
||
248 |
-- work out the distance to the target |
|
249 |
g1X, g1Y = GetGearPosition(CurrentHedgehog) |
|
250 |
g2X, g2Y = GetX(gear), GetY(gear) |
|
251 |
q = g1X - g2X |
|
252 |
w = g1Y - g2Y |
|
253 |
r = math.sqrt( (q*q) + (w*w) ) --alternate |
|
254 |
||
255 |
RCX = getGearValue(gear,"RX") |
|
256 |
RCY = getGearValue(gear,"RY") |
|
257 |
||
258 |
rCircDistance = r -- distance to circle |
|
259 |
||
260 |
opp = w |
|
261 |
if opp < 0 then |
|
262 |
opp = opp*-1 |
|
263 |
end |
|
264 |
||
265 |
-- work out the angle (theta) to the target |
|
266 |
t = math.deg ( math.asin(opp / r) ) |
|
267 |
||
268 |
-- based on the radius of the radar, calculate what x/y displacement should be |
|
269 |
NR = 150 -- radius at which to draw circs |
|
270 |
NX = math.cos( math.rad(t) ) * NR |
|
271 |
NY = math.sin( math.rad(t) ) * NR |
|
272 |
||
273 |
if rCircDistance < NR then |
|
274 |
RCX = g2X |
|
275 |
elseif q > 0 then |
|
276 |
RCX = g1X - NX |
|
277 |
else |
|
278 |
RCX = g1X + NX |
|
279 |
end |
|
280 |
||
281 |
if rCircDistance < NR then |
|
282 |
RCY = g2Y |
|
283 |
elseif w > 0 then |
|
284 |
RCY = g1Y - NY |
|
285 |
else |
|
286 |
RCY = g1Y + NY |
|
287 |
end |
|
288 |
||
289 |
setGearValue(gear, "RX", RCX) |
|
290 |
setGearValue(gear, "RY", RCY) |
|
291 |
||
292 |
end |
|
293 |
||
294 |
||
295 |
function HandleCircles() |
|
296 |
||
297 |
-- enable this if you want the radar to only show for a few seconds |
|
298 |
-- after you spawn the crate |
|
299 |
--[[if rAlpha ~= 255 then |
|
300 |
||
301 |
rPingTimer = rPingTimer + 1 |
|
302 |
if rPingTimer == 100 then |
|
303 |
rPingTimer = 0 |
|
304 |
||
305 |
rAlpha = rAlpha + 5 |
|
306 |
if rAlpha >= 255 then |
|
307 |
rAlpha = 255 |
|
308 |
end |
|
309 |
end |
|
310 |
||
311 |
end]] |
|
312 |
||
313 |
runOnGears(DrawBlip) |
|
314 |
||
315 |
m2Count = m2Count + 1 |
|
316 |
if m2Count == 25 then |
|
317 |
m2Count = 0 |
|
318 |
||
319 |
if (CurrentHedgehog ~= nil) and (rAlpha ~= 255) then |
|
320 |
runOnGears(TrackRadarBlip) |
|
321 |
end |
|
322 |
||
323 |
end |
|
324 |
||
325 |
end |
|
326 |
||
327 |
||
328 |
function CheckCrateConditions() |
|
329 |
||
330 |
crateSpawn = true |
|
331 |
||
332 |
if requireSurfer == true then |
|
333 |
if hasSurfed == false then |
|
334 |
crateSpawn = false |
|
335 |
end |
|
336 |
end |
|
337 |
||
338 |
if #wTouched > 0 then |
|
339 |
if allWallsHit == false then |
|
340 |
crateSpawn = false |
|
341 |
end |
|
342 |
end |
|
343 |
||
344 |
if crateSpawn == true then |
|
345 |
if allowCrate == true then |
|
346 |
--if (crateG == nil) and (allowCrate == true) then |
|
347 |
--AddCaption("") |
|
348 |
SpawnAmmoCrate(0, 0, weapons[1+GetRandom(#weapons)] ) |
|
349 |
rPingTimer = 0 |
|
350 |
rAlpha = 0 |
|
351 |
PlaySound(sndWarp) |
|
352 |
end |
|
353 |
end |
|
354 |
||
355 |
end |
|
356 |
||
10670
638af9cb922b
make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents:
10036
diff
changeset
|
357 |
function onGearWaterSkip(gear) |
638af9cb922b
make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents:
10036
diff
changeset
|
358 |
if gear == CurrentHedgehog then |
638af9cb922b
make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents:
10036
diff
changeset
|
359 |
hasSurfed = true |
638af9cb922b
make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents:
10036
diff
changeset
|
360 |
AddCaption(loc("Surfer!"),0xffba00ff,capgrpMessage2) |
7095 | 361 |
end |
362 |
end |
|
363 |
||
364 |
||
365 |
function WallHit(id, zXMin,zYMin, zWidth, zHeight) |
|
366 |
||
367 |
if wTouched[id] == false then |
|
368 |
tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtBigExplosion, 0, false) |
|
369 |
PlaySound(sndExplosion) |
|
370 |
wallsLeft = wallsLeft - 1 |
|
371 |
||
372 |
if wallsLeft == 0 then |
|
373 |
AddCaption(loc("All walls touched!")) |
|
374 |
allWallsHit = true |
|
375 |
if (requireSurfer == true) and (hasSurfed == false) then |
|
376 |
AddCaption(loc("Go surf!"),0xffba00ff,capgrpMessage2) |
|
377 |
end |
|
378 |
else |
|
379 |
AddCaption(loc("Walls Left") .. ": " .. wallsLeft) |
|
380 |
end |
|
381 |
||
382 |
end |
|
383 |
||
384 |
wTouched[id] = true |
|
385 |
tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmoke, 0, false) |
|
386 |
--PlaySound(sndVaporize) -- yeah, this is just annoying as shit |
|
387 |
||
388 |
end |
|
389 |
||
390 |
function CheckForWallCollision() |
|
391 |
||
392 |
for i = 1, #wTouched do |
|
393 |
if gearIsInBox(CurrentHedgehog, wX[i],wY[i],wWidth[i],wHeight[i]) then |
|
394 |
WallHit(i, wX[i],wY[i],wWidth[i],wHeight[i]) |
|
395 |
end |
|
396 |
end |
|
397 |
||
398 |
end |
|
399 |
||
400 |
function BorderSpark(zXMin,zYMin, zWidth, zHeight, bCol) |
|
401 |
||
402 |
eX = zXMin + GetRandom(zWidth+10) |
|
403 |
eY = zYMin + GetRandom(zHeight+10) |
|
404 |
||
405 |
tempE = AddVisualGear(eX, eY, vgtDust, 0, false) |
|
406 |
if tempE ~= 0 then |
|
407 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
|
408 |
SetVisualGearValues(tempE, eX, eY, g3, g4, g5, g6, g7, 1, g9, bCol ) |
|
409 |
end |
|
410 |
||
411 |
end |
|
412 |
||
413 |
||
414 |
function HandleBorderEffects() |
|
415 |
||
416 |
effectTimer = effectTimer + 1 |
|
417 |
if effectTimer > 15 then --25 |
|
418 |
||
419 |
effectTimer = 1 |
|
420 |
||
421 |
for i = 1, #wTouched do |
|
422 |
if wTouched[i] == true then |
|
423 |
--bCol = GetClanColor(GetHogClan(CurrentHedgehog)) |
|
424 |
else |
|
425 |
--bCol = 0xFFFFFFFF |
|
426 |
bCol = GetClanColor(GetHogClan(CurrentHedgehog)) |
|
427 |
BorderSpark(wX[i],wY[i],wWidth[i],wHeight[i], bCol) |
|
428 |
end |
|
429 |
--BorderSpark(wX[i],wY[i],wWidth[i],wHeight[i], bCol) |
|
430 |
end |
|
431 |
||
432 |
end |
|
433 |
||
434 |
end |
|
435 |
||
436 |
function onLJump() |
|
437 |
if roundN < 2 then |
|
438 |
roundN = 100 |
|
439 |
SetInputMask(0xFFFFFFFF) |
|
440 |
TurnTimeLeft = 1 |
|
441 |
AddCaption(loc("Configuration accepted."),0xffba00ff,capgrpMessage) |
|
442 |
HideMission() |
|
443 |
end |
|
444 |
end |
|
445 |
||
446 |
function onAttack() |
|
447 |
||
448 |
if roundN < 2 then |
|
449 |
||
450 |
if menuIndex == 1 then |
|
451 |
||
452 |
if #wTouched > 0 then |
|
453 |
for i = 1, #wTouched do |
|
454 |
wTouched[i] = nil |
|
455 |
wX[i] = nil |
|
456 |
wY[i] = nil |
|
457 |
wWidth[i] = nil |
|
458 |
wHeight[i] = nil |
|
459 |
end |
|
460 |
else |
|
461 |
LoadConfig(2) |
|
462 |
end |
|
463 |
||
464 |
elseif menuIndex == 2 then |
|
465 |
requireSurfer = not(requireSurfer) |
|
466 |
elseif menuIndex == 3 then |
|
467 |
AFR = not(AFR) |
|
468 |
elseif menuIndex == 4 then |
|
469 |
allowCrazyWeps = not(allowCrazyWeps) |
|
470 |
end |
|
471 |
||
472 |
UpdateMenu() |
|
473 |
configureWeapons() |
|
474 |
HandleStartingStage() |
|
475 |
||
476 |
elseif (AFR == true) then |
|
477 |
||
478 |
if (GetCurAmmoType() ~= amRope) and |
|
479 |
(GetCurAmmoType() ~= amSkip) and |
|
480 |
(GetCurAmmoType() ~= amNothing) |
|
481 |
then |
|
482 |
AddCaption(loc("You may only attack from a rope!"),0xffba00ff,capgrpMessage2) |
|
483 |
end |
|
484 |
||
485 |
end |
|
486 |
||
487 |
end |
|
488 |
||
489 |
function onDown() |
|
490 |
if roundN < 2 then |
|
491 |
menuIndex = menuIndex +1 |
|
492 |
if menuIndex > #menu then |
|
493 |
menuIndex = 1 |
|
494 |
end |
|
495 |
HandleStartingStage() |
|
496 |
end |
|
497 |
end |
|
498 |
||
499 |
function onUp() |
|
500 |
if roundN < 2 then |
|
501 |
menuIndex = menuIndex -1 |
|
502 |
if menuIndex == 0 then |
|
503 |
menuIndex = #menu |
|
504 |
end |
|
505 |
HandleStartingStage() |
|
506 |
end |
|
507 |
end |
|
508 |
||
509 |
function onGameInit() |
|
510 |
||
10036 | 511 |
ClearGameFlags() |
512 |
EnableGameFlags(gfRandomOrder, gfBorder, gfSolidLand) --, gfInfAttack |
|
7095 | 513 |
HealthCaseProb = 0 |
514 |
CaseFreq = 0 |
|
515 |
||
516 |
end |
|
517 |
||
518 |
function configureWeapons() |
|
519 |
||
520 |
-- reset wep array |
|
521 |
for i = 1, #weapons do |
|
522 |
weapons[i] = nil |
|
523 |
end |
|
524 |
||
525 |
-- add rope weps |
|
526 |
for i, w in pairs(ropeWeps) do |
|
527 |
table.insert(weapons, w) |
|
528 |
end |
|
529 |
||
530 |
-- add ground weps |
|
531 |
for i, w in pairs(groundWeps) do |
|
532 |
table.insert(weapons, w) |
|
533 |
end |
|
534 |
||
535 |
-- remove ground weps if attacking from rope is mandatory |
|
536 |
if AFR == true then |
|
537 |
for i = 1, #weapons do |
|
538 |
for w = 1, #groundWeps do |
|
539 |
if groundWeps[w] == weapons[i] then |
|
540 |
table.remove(weapons, i) |
|
541 |
end |
|
542 |
end |
|
543 |
end |
|
544 |
end |
|
545 |
||
546 |
-- remove crazy weps is crazy weps aren't allowed |
|
547 |
if allowCrazyWeps == false then |
|
548 |
for i = 1, #weapons do |
|
549 |
for w = 1, #crazyWeps do |
|
550 |
if crazyWeps[w] == weapons[i] then |
|
551 |
table.remove(weapons, i) |
|
552 |
end |
|
553 |
end |
|
554 |
end |
|
555 |
end |
|
556 |
||
557 |
end |
|
558 |
||
559 |
function onGameStart() |
|
560 |
||
561 |
LoadConfig(1) |
|
562 |
configureWeapons() |
|
563 |
UpdateMenu() |
|
564 |
HandleStartingStage() |
|
565 |
||
566 |
end |
|
567 |
||
568 |
function onNewTurn() |
|
569 |
||
570 |
wallsLeft = #wTouched |
|
571 |
||
572 |
for i = 1, #wTouched do |
|
573 |
wTouched[i] = false |
|
574 |
end |
|
575 |
||
576 |
allowCrate = true |
|
577 |
||
578 |
hasSurfed = false |
|
579 |
allWallsHit = false |
|
580 |
||
581 |
crateG = nil |
|
582 |
||
583 |
-- new config stuff |
|
584 |
roundN = roundN + 1 |
|
585 |
if roundN < 2 then |
|
586 |
TurnTimeLeft = -1 |
|
7183 | 587 |
SetInputMask(0) |
7095 | 588 |
allowCrate = false |
589 |
HandleStartingStage() -- new |
|
590 |
end |
|
591 |
||
592 |
end |
|
593 |
||
594 |
function UpdateMenu() |
|
595 |
||
596 |
preMenuCfg = loc("Spawn the crate, and attack!") .. "|" |
|
597 |
postMenuCfg = loc("Press [Enter] to accept this configuration.") |
|
598 |
||
599 |
menu = { |
|
600 |
loc("Walls Required") .. ": " .. #wTouched .. "|", |
|
601 |
loc("Surf Before Crate") .. ": " .. BoolToCfgTxt(requireSurfer) .. "|", |
|
602 |
loc("Attack From Rope") .. ": " .. BoolToCfgTxt(AFR) .. "|", |
|
603 |
loc("Super Weapons") .. ": " .. BoolToCfgTxt(allowCrazyWeps) .. "|" |
|
604 |
} |
|
605 |
end |
|
606 |
||
607 |
function HandleStartingStage() |
|
608 |
||
609 |
temp = menu[menuIndex] |
|
610 |
menu[menuIndex] = "--> " .. menu[menuIndex] |
|
611 |
||
612 |
missionComment = "" |
|
613 |
for i = 1, #menu do |
|
614 |
missionComment = missionComment .. menu[i] |
|
615 |
end |
|
616 |
||
617 |
ShowMission ( |
|
618 |
loc("WALL TO WALL") .. " 0.4", |
|
619 |
loc("a shoppa minigame"), |
|
620 |
preMenuCfg.. |
|
621 |
missionComment .. |
|
622 |
postMenuCfg .. |
|
623 |
--" " .. "|" .. |
|
624 |
"", 4, 300000 |
|
625 |
) |
|
626 |
||
627 |
menu[menuIndex] = temp |
|
628 |
||
629 |
end |
|
630 |
||
631 |
function onGameTick() |
|
632 |
||
633 |
if CurrentHedgehog ~= nil then |
|
634 |
||
635 |
--AddCaption(Map) |
|
636 |
--AddCaption(RightX ..";" .. GetX(CurrentHedgehog)) |
|
637 |
||
638 |
gTimer = gTimer + 1 |
|
639 |
if gTimer == 25 then |
|
640 |
gTimer = 1 |
|
641 |
||
642 |
CheckForWallCollision() |
|
643 |
CheckCrateConditions() |
|
644 |
||
645 |
if (crateG == GetFollowGear()) and (crateG ~= nil) then |
|
646 |
FollowGear(CurrentHedgehog) |
|
647 |
end |
|
648 |
||
649 |
-- if attackfromrope is set, forbid firing unless using rope |
|
650 |
if (AFR == true) and (roundN >= 2) then |
|
651 |
if (GetCurAmmoType() == amRope) or |
|
652 |
(GetCurAmmoType() == amSkip) or |
|
653 |
(GetCurAmmoType() == amNothing) |
|
654 |
then |
|
655 |
SetInputMask(0xFFFFFFFF) |
|
656 |
elseif ropeG == nil then |
|
7183 | 657 |
SetInputMask(bnot(gmAttack)) |
7095 | 658 |
end |
659 |
end |
|
660 |
||
661 |
end |
|
662 |
||
663 |
HandleBorderEffects() |
|
664 |
HandleCircles() |
|
665 |
||
666 |
end |
|
667 |
||
668 |
end |
|
669 |
||
670 |
function onGearAdd(gear) |
|
671 |
||
672 |
if GetGearType(gear) == gtRope then |
|
673 |
ropeG = gear |
|
674 |
elseif GetGearType(gear) == gtCase then |
|
675 |
||
676 |
crateG = gear |
|
677 |
trackGear(gear) |
|
678 |
||
679 |
table.insert(rCirc, AddVisualGear(0,0,vgtCircle,0,true) ) |
|
680 |
setGearValue(gear,"CIRC",rCirc[#rCirc]) |
|
681 |
setGearValue(gear,"RX",0) |
|
682 |
setGearValue(gear,"RY",0) |
|
683 |
SetVisualGearValues(rCirc[#rCirc], 0, 0, 100, 255, 1, 10, 0, 40, 3, 0xff00ffff) |
|
684 |
||
685 |
allowCrate = false |
|
686 |
||
687 |
rPingTimer = 0 |
|
688 |
rAlpha = 0 |
|
689 |
||
690 |
end |
|
691 |
||
692 |
end |
|
693 |
||
694 |
function onGearDelete(gear) |
|
695 |
||
696 |
if gear == ropeG then |
|
697 |
ropeG = nil |
|
698 |
elseif GetGearType(gear) == gtCase then |
|
699 |
||
700 |
if gear == crateG then |
|
701 |
crateG = nil |
|
702 |
-- rAlpha = 255 |
|
703 |
end |
|
704 |
||
705 |
for i = 1, #rCirc do |
|
706 |
if rCirc[i] == getGearValue(gear,"CIRC") then |
|
707 |
DeleteVisualGear(rCirc[i]) |
|
708 |
table.remove(rCirc, i) |
|
709 |
end |
|
710 |
end |
|
711 |
||
712 |
trackDeletion(gear) |
|
713 |
||
714 |
end |
|
715 |
||
716 |
end |
|
717 |
||
718 |
function onAmmoStoreInit() |
|
719 |
||
720 |
for i, w in pairs(ropeWeps) do |
|
721 |
SetAmmo(w, 0, 0, 0, 1) |
|
722 |
end |
|
723 |
||
724 |
for i, w in pairs(groundWeps) do |
|
725 |
SetAmmo(w, 0, 0, 0, 1) |
|
726 |
end |
|
727 |
||
728 |
for i, w in pairs(crazyWeps) do |
|
729 |
SetAmmo(w, 0, 0, 0, 1) |
|
730 |
end |
|
731 |
||
732 |
SetAmmo(amRope, 9, 0, 0, 0) |
|
733 |
SetAmmo(amSkip, 9, 0, 0, 0) |
|
734 |
||
735 |
end |