author | Wuzzy <Wuzzy2@mail.ru> |
Sat, 15 Jun 2019 14:49:18 +0200 | |
changeset 15157 | 35f6213ba1fa |
parent 15074 | e16f906224fd |
child 15407 | 1028f5606b5f |
permissions | -rw-r--r-- |
13564 | 1 |
-------------- |
2 |
-- TECH RACER |
|
3 |
-------------- |
|
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
4 |
|
12393
0eb1457f7b94
Add big fat developer warning to all racing scripts about compability
Wuzzy <almikes@aol.com>
parents:
12338
diff
changeset
|
5 |
-- DEVELOPER WARNING - FOR OFFICIAL DEVELOPMENT -- |
0eb1457f7b94
Add big fat developer warning to all racing scripts about compability
Wuzzy <almikes@aol.com>
parents:
12338
diff
changeset
|
6 |
-- Be careful when editig this script, do not introduce changes lightly! |
0eb1457f7b94
Add big fat developer warning to all racing scripts about compability
Wuzzy <almikes@aol.com>
parents:
12338
diff
changeset
|
7 |
-- This script is used for time records on the official Hedgewars server. |
0eb1457f7b94
Add big fat developer warning to all racing scripts about compability
Wuzzy <almikes@aol.com>
parents:
12338
diff
changeset
|
8 |
-- Introducing breaking changes means we have to invalidate past time records! |
0eb1457f7b94
Add big fat developer warning to all racing scripts about compability
Wuzzy <almikes@aol.com>
parents:
12338
diff
changeset
|
9 |
|
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
10 |
-------------- |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
11 |
-- TO DO |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
12 |
-------------- |
10967
1434cec96ca3
- preview generation for rubbers, air-mines, crates, barrels
mikade <redgrinner@gmail.com>
parents:
10961
diff
changeset
|
13 |
-- allow scrolling of maps (was going to add this in the engine itself, but it can be done now by refreshing preview) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
14 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
15 |
----------------------------- |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
16 |
-- SCRIPT BEGINS |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
17 |
----------------------------- |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
18 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
19 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
20 |
HedgewarsScriptLoad("/Scripts/OfficialChallenges.lua") |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
21 |
HedgewarsScriptLoad("/Scripts/Tracker.lua") |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
22 |
HedgewarsScriptLoad("/Scripts/Params.lua") |
13220 | 23 |
HedgewarsScriptLoad("/Scripts/Utils.lua") |
10961 | 24 |
HedgewarsScriptLoad("/Scripts/TechMaps.lua") |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
25 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
26 |
------------------ |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
27 |
-- Got Variables? |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
28 |
------------------ |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
29 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
30 |
local atkArray = { |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
31 |
{amBazooka, "amBazooka", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
32 |
{amBee, "amBee", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
33 |
{amMortar, "amMortar", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
34 |
{amDrill, "amDrill", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
35 |
{amSnowball, "amSnowball", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
36 |
{amGrenade, "amGrenade", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
37 |
{amClusterBomb, "amClusterBomb", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
38 |
{amMolotov, "amMolotov", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
39 |
{amWatermelon, "amWatermelon", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
40 |
{amHellishBomb, "amHellishBomb", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
41 |
{amGasBomb, "amGasBomb", 0}, |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
42 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
43 |
{amShotgun, "amShotgun", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
44 |
{amDEagle, "amDEagle", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
45 |
{amFlamethrower,"amFlamethrower", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
46 |
{amSniperRifle, "amSniperRifle", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
47 |
{amSineGun, "amSineGun", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
48 |
{amIceGun, "amIceGun", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
49 |
{amLandGun, "amLandGun", 0}, |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
50 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
51 |
{amFirePunch, "amFirePunch", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
52 |
{amWhip, "amWhip", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
53 |
{amBaseballBat, "amBaseballBat", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
54 |
{amKamikaze, "amKamikaze", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
55 |
{amSeduction, "amSeduction", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
56 |
{amHammer, "amHammer", 0}, |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
57 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
58 |
{amMine, "amMine", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
59 |
{amDynamite, "amDynamite", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
60 |
{amCake, "amCake", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
61 |
{amBallgun, "amBallgun", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
62 |
{amRCPlane, "amRCPlane", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
63 |
{amSMine, "amSMine", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
64 |
{amAirMine, "amAirMine", 0}, |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
65 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
66 |
{amAirAttack, "amAirAttack", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
67 |
{amMineStrike, "amMineStrike", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
68 |
{amDrillStrike, "amDrillStrike", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
69 |
{amAirMine, "amAirMine", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
70 |
{amNapalm, "amNapalm", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
71 |
{amPiano, "amPiano", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
72 |
|
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
73 |
{amKnife, "amKnife", 0}, |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
74 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
75 |
{amBirdy, "amBirdy", 0} |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
76 |
} |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
77 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
78 |
local utilArray = { |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
79 |
{amBlowTorch, "amBlowTorch", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
80 |
{amPickHammer, "amPickHammer", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
81 |
{amGirder, "amGirder", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
82 |
{amRubber, "amRubber", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
83 |
{amPortalGun, "amPortalGun", 0}, |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
84 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
85 |
{amRope, "amRope", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
86 |
{amParachute, "amParachute", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
87 |
{amTeleport, "amTeleport", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
88 |
{amJetpack, "amJetpack", 0}, |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
89 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
90 |
{amInvulnerable,"amInvulnerable", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
91 |
{amLaserSight, "amLaserSight", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
92 |
{amVampiric, "amVampiric", 0}, |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
93 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
94 |
{amLowGravity, "amLowGravity", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
95 |
{amExtraDamage, "amExtraDamage", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
96 |
{amExtraTime, "amExtraTime", 0}, |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
97 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
98 |
{amResurrector, "amResurrector", 0}, |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
99 |
{amTardis, "amTardis", 0}, |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
100 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
101 |
{amSwitch, "amSwitch", 0} |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
102 |
} |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
103 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
104 |
local activationStage = 0 |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
105 |
local jet = nil |
13564 | 106 |
portalDistance = 5000 |
10979 | 107 |
ufoFuel = 0 |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
108 |
local roundLimit = 3 |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
109 |
local roundNumber = 0 |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
110 |
local firstClan = 10 |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
111 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
112 |
local fastX = {} |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
113 |
local fastY = {} |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
114 |
local fastCount = 0 |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
115 |
local fastIndex = 0 |
11586 | 116 |
local fastColour = 0xffffffff |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
117 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
118 |
local currX = {} |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
119 |
local currY = {} |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
120 |
local currCount = 0 |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
121 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
122 |
local specialPointsX = {} |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
123 |
local specialPointsY = {} |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
124 |
local specialPointsFlag = {} |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
125 |
local specialPointsCount = 0 |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
126 |
|
10967
1434cec96ca3
- preview generation for rubbers, air-mines, crates, barrels
mikade <redgrinner@gmail.com>
parents:
10961
diff
changeset
|
127 |
mapID = nil |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
128 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
129 |
-------------------------- |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
130 |
-- hog and team tracking variales |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
131 |
-------------------------- |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
132 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
133 |
local numhhs = 0 -- store number of hedgehogs |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
134 |
local hhs = {} -- store hedgehog gears |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
135 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
136 |
local numTeams -- store the number of teams in the game |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
137 |
local teamNameArr = {} -- store the list of teams |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
138 |
local teamClan = {} |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
139 |
local teamSize = {} -- store how many hogs per team |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
140 |
local teamIndex = {} -- at what point in the hhs{} does each team begin |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
141 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
142 |
local teamComment = {} |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
143 |
local teamScore = {} |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
144 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
145 |
------- |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
146 |
-- racer vars |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
147 |
-------- |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
148 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
149 |
local cGear = nil |
13029
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
150 |
local cameraGear = nil |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
151 |
|
11942
8fd4926e1e9e
TechRacer: Cleanup mess regarding teams which did not finish
Wuzzy <almikes@aol.com>
parents:
11941
diff
changeset
|
152 |
local bestClan = 10 |
13844
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
153 |
local bestTime = MAX_TURN_TIME |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
154 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
155 |
local gameBegun = false |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
156 |
local gameOver = false |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
157 |
local racerActive = false |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
158 |
local trackTime = 0 |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
159 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
160 |
local wpCirc = {} |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
161 |
local wpX = {} |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
162 |
local wpY = {} |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
163 |
local wpCol = {} |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
164 |
local wpActive = {} |
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
165 |
local wpRad = 450 |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
166 |
local wpCount = 0 |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
167 |
local wpLimit = 20 |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
168 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
169 |
local usedWeapons = {} |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
170 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
171 |
local roundN |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
172 |
local lastRound |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
173 |
local RoundHasChanged |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
174 |
|
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
175 |
local cnthhs = 0 |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
176 |
|
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
177 |
------------------- |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
178 |
-- general methods |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
179 |
------------------- |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
180 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
181 |
function RebuildTeamInfo() |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
182 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
183 |
-- make a list of individual team names |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
184 |
for i = 0, (TeamsCount-1) do |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
185 |
teamNameArr[i] = " " -- = i |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
186 |
teamSize[i] = 0 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
187 |
teamIndex[i] = 0 |
13844
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
188 |
teamScore[i] = MAX_TURN_TIME |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
189 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
190 |
numTeams = 0 |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
191 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
192 |
for i = 0, (numhhs-1) do |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
193 |
|
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
194 |
local z = 0 |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
195 |
local unfinished = true |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
196 |
while(unfinished == true) do |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
197 |
|
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
198 |
local newTeam = true |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
199 |
local tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
200 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
201 |
if tempHogTeamName == teamNameArr[z] then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
202 |
newTeam = false |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
203 |
unfinished = false |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
204 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
205 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
206 |
z = z + 1 |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
207 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
208 |
if z == TeamsCount then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
209 |
unfinished = false |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
210 |
if newTeam == true then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
211 |
teamNameArr[numTeams] = tempHogTeamName |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
212 |
numTeams = numTeams + 1 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
213 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
214 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
215 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
216 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
217 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
218 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
219 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
220 |
-- find out how many hogs per team, and the index of the first hog in hhs |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
221 |
for i = 0, (numTeams-1) do |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
222 |
for z = 0, (numhhs-1) do |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
223 |
if GetHogTeamName(hhs[z]) == teamNameArr[i] then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
224 |
teamClan[i] = GetHogClan(hhs[z]) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
225 |
if teamSize[i] == 0 then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
226 |
teamIndex[i] = z -- should give starting index |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
227 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
228 |
teamSize[i] = teamSize[i] + 1 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
229 |
--add a pointer so this hog appears at i in hhs |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
230 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
231 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
232 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
233 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
234 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
235 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
236 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
237 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
238 |
----------------- |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
239 |
-- RACER METHODS |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
240 |
----------------- |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
241 |
|
12971
b543d767fed3
Make first waypoint flash TechRacer, before hog starts racing
Wuzzy <Wuzzy2@mail.ru>
parents:
12969
diff
changeset
|
242 |
-- Returns min opacity, max opacity and flashing speed (`FrameTicks`) |
b543d767fed3
Make first waypoint flash TechRacer, before hog starts racing
Wuzzy <Wuzzy2@mail.ru>
parents:
12969
diff
changeset
|
243 |
-- for the waypoint visual gears |
b543d767fed3
Make first waypoint flash TechRacer, before hog starts racing
Wuzzy <Wuzzy2@mail.ru>
parents:
12969
diff
changeset
|
244 |
function FlashingHelper(wpIndex) |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
245 |
local minO, maxO, flashing |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
246 |
if wpIndex == 0 then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
247 |
-- Notable flashing of first waypoint |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
248 |
minO, maxO = 92, 255 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
249 |
flashing = 2 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
250 |
else |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
251 |
-- Slow pulsation |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
252 |
minO, maxO = 164, 224 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
253 |
flashing = 10 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
254 |
end |
12971
b543d767fed3
Make first waypoint flash TechRacer, before hog starts racing
Wuzzy <Wuzzy2@mail.ru>
parents:
12969
diff
changeset
|
255 |
return minO, maxO, flashing |
b543d767fed3
Make first waypoint flash TechRacer, before hog starts racing
Wuzzy <Wuzzy2@mail.ru>
parents:
12969
diff
changeset
|
256 |
end |
b543d767fed3
Make first waypoint flash TechRacer, before hog starts racing
Wuzzy <Wuzzy2@mail.ru>
parents:
12969
diff
changeset
|
257 |
|
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
258 |
function CheckWaypoints() |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
259 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
260 |
trackFinished = true |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
261 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
262 |
for i = 0, (wpCount-1) do |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
263 |
|
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
264 |
local g1X, g1Y = GetGearPosition(CurrentHedgehog) |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
265 |
local g2X, g2Y = wpX[i], wpY[i] |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
266 |
|
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
267 |
local g1X = g1X - g2X |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
268 |
local g1Y = g1Y - g2Y |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
269 |
local dist = (g1X*g1X) + (g1Y*g1Y) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
270 |
|
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
271 |
local NR = (48/100*wpRad)/2 |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
272 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
273 |
if dist < (NR*NR) and not gameOver then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
274 |
wpCol[i] = GetClanColor(GetHogClan(CurrentHedgehog)) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
275 |
SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 64, 64, 1, 10, 0, wpRad, 5, wpCol[i]) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
276 |
|
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
277 |
local wpRem = 0 |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
278 |
for k = 0, (wpCount-1) do |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
279 |
if wpActive[k] == false then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
280 |
wpRem = wpRem + 1 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
281 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
282 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
283 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
284 |
if not wpActive[i] then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
285 |
local wpMessage = "" |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
286 |
if wpRem-1 == 0 then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
287 |
wpMessage = loc("Track completed!") |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
288 |
else |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
289 |
wpMessage = string.format(loc("Waypoints remaining: %d"), wpRem-1) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
290 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
291 |
AddCaption(wpMessage, 0xffba00ff, capgrpGameState) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
292 |
end |
11938
20b755da986f
TechRacer: Don't mess with ammo caption while in waypoint.
Wuzzy <almikes@aol.com>
parents:
11937
diff
changeset
|
293 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
294 |
wpActive[i] = true |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
295 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
296 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
297 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
298 |
if wpActive[i] == false then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
299 |
trackFinished = false |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
300 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
301 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
302 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
303 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
304 |
return(trackFinished) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
305 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
306 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
307 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
308 |
function AdjustScores() |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
309 |
|
11942
8fd4926e1e9e
TechRacer: Cleanup mess regarding teams which did not finish
Wuzzy <almikes@aol.com>
parents:
11941
diff
changeset
|
310 |
local bestTimeComment = loc("Did not finish") |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
311 |
|
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
312 |
local newScore = false |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
313 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
314 |
-- update this clan's time if the new track is better |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
315 |
for i = 0, (numTeams-1) do |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
316 |
if teamClan[i] == GetHogClan(CurrentHedgehog) then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
317 |
if trackTime < teamScore[i] then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
318 |
teamScore[i] = trackTime |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
319 |
newScore = true |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
320 |
else |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
321 |
newScore = false |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
322 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
323 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
324 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
325 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
326 |
-- find the best time out of those so far |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
327 |
for i = 0, (numTeams-1) do |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
328 |
if teamScore[i] < bestTime then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
329 |
bestTime = teamScore[i] |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
330 |
bestClan = teamClan[i] |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
331 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
332 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
333 |
|
13844
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
334 |
if bestTime ~= MAX_TURN_TIME then |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
335 |
bestTimeComment = string.format(loc("%.1fs"), (bestTime/1000)) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
336 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
337 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
338 |
if newScore == true then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
339 |
if trackTime == bestTime then -- best time of the race |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
340 |
ShowMission(loc("TechRacer"), |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
341 |
loc("Track completed!"), |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
342 |
string.format(loc("New race record: %.1fs"), (trackTime/1000)) .. "|" .. |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
343 |
string.format(loc("Winning time: %s"), bestTimeComment), 0, 4000) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
344 |
PlaySound(sndHomerun) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
345 |
else -- best time for the clan |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
346 |
ShowMission(loc("TechRacer"), |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
347 |
loc("Track completed!"), |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
348 |
string.format(loc("New clan record: %.1fs"), (trackTime/1000)) .. "|" .. |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
349 |
string.format(loc("Winning time: %s"), bestTimeComment), 4, 4000) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
350 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
351 |
else -- not any kind of new score |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
352 |
ShowMission(loc("TechRacer"), |
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
353 |
loc("Track completed!"), |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
354 |
string.format(loc("Time: %.1fs"), (trackTime/1000)) .. "|" .. |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
355 |
string.format(loc("Winning time: %s"), bestTimeComment), -amSkip, 4000) |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
356 |
PlaySound(sndHellish) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
357 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
358 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
359 |
for i = 0, (TeamsCount-1) do |
13844
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
360 |
if teamNameArr[i] ~= " " and teamScore[i] ~= MAX_TURN_TIME then |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
361 |
SetTeamLabel(teamNameArr[i], string.format(loc("%.1fs"), teamScore[i]/1000)) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
362 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
363 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
364 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
365 |
if bestTime == trackTime then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
366 |
fastColour = GetClanColor(GetHogClan(CurrentHedgehog)) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
367 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
368 |
for i = 0, (currCount-1) do |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
369 |
fastX[i] = currX[i] |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
370 |
fastY[i] = currY[i] |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
371 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
372 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
373 |
fastCount = currCount |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
374 |
fastIndex = 0 |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
375 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
376 |
else |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
377 |
currCount = 0 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
378 |
fastIndex = 0 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
379 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
380 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
381 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
382 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
383 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
384 |
function onNewRound() |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
385 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
386 |
roundNumber = roundNumber + 1 |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
387 |
|
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
388 |
local totalComment = "" |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
389 |
for i = 0, (TeamsCount-1) do |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
390 |
if teamNameArr[i] ~= " " then |
13844
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
391 |
if teamScore[i] ~= MAX_TURN_TIME then |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
392 |
teamComment[i] = string.format(loc("%s: %.1fs"), teamNameArr[i], (teamScore[i]/1000)) .. "|" |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
393 |
else |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
394 |
teamComment[i] = string.format(loc("%s: Did not finish"), teamNameArr[i]) .. "|" |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
395 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
396 |
totalComment = totalComment .. teamComment[i] |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
397 |
elseif teamNameArr[i] == " " then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
398 |
teamComment[i] = "|" |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
399 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
400 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
401 |
|
15074
e16f906224fd
Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
402 |
local icon |
e16f906224fd
Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
403 |
if roundNumber >= roundLimit then |
e16f906224fd
Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
404 |
icon = 0 |
e16f906224fd
Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
405 |
else |
e16f906224fd
Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
406 |
icon = 2 |
e16f906224fd
Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
407 |
end |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
408 |
ShowMission(loc("TechRacer"), |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
409 |
loc("Status update"), |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
410 |
string.format(loc("Rounds complete: %d/%d"), roundNumber, roundLimit) .. "| |" .. |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
411 |
loc("Best team times: ") .. "|" .. |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
412 |
totalComment, |
15074
e16f906224fd
Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents:
14583
diff
changeset
|
413 |
icon, 4000) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
414 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
415 |
-- end game if its at round limit |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
416 |
if roundNumber >= roundLimit then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
417 |
-- Sort the scores for the ranking list |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
418 |
local unfinishedArray = {} |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
419 |
local sortedTeams = {} |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
420 |
local k = 1 |
13844
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
421 |
local c = 1 |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
422 |
local clanScores = {} |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
423 |
local previousClan |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
424 |
for i = 0, TeamsCount-1 do |
13844
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
425 |
local clan = GetTeamClan(teamNameArr[i]) |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
426 |
if not clanScores[clan+1] then |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
427 |
clanScores[clan+1] = {} |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
428 |
clanScores[clan+1].index = clan |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
429 |
clanScores[clan+1].score = teamScore[i] |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
430 |
end |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
431 |
if teamScore[i] ~= MAX_TURN_TIME and teamNameArr[i] ~= " " then |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
432 |
sortedTeams[k] = {} |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
433 |
sortedTeams[k].name = teamNameArr[i] |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
434 |
sortedTeams[k].score = teamScore[i] |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
435 |
sortedTeams[k].clan = clan |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
436 |
k = k + 1 |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
437 |
else |
13844
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
438 |
table.insert(unfinishedArray, string.format(loc("%s did not finish the race."), teamNameArr[i])) |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
439 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
440 |
end |
13844
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
441 |
table.sort(sortedTeams, function(team1, team2) |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
442 |
if team1.score == team2.score then |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
443 |
return team1.clan < team2.clan |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
444 |
else |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
445 |
return team1.score < team2.score |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
446 |
end |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
447 |
end) |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
448 |
table.sort(clanScores, function(clan1, clan2) return clan1.score < clan2.score end) |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
449 |
local rank = 0 |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
450 |
local rankPlus = 0 |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
451 |
local prevScore |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
452 |
local clanRanks = {} |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
453 |
for c = 1, #clanScores do |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
454 |
rankPlus = rankPlus + 1 |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
455 |
if clanScores[c].score ~= prevScore then |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
456 |
rank = rank + rankPlus |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
457 |
rankPlus = 0 |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
458 |
end |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
459 |
prevScore = clanScores[c].score |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
460 |
clanRanks[clanScores[c].index] = rank |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
461 |
end |
11940
e1bae42efacd
TechRacer: Show racing times and ranking in stats screen
Wuzzy <almikes@aol.com>
parents:
11939
diff
changeset
|
462 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
463 |
-- Write all the stats! |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
464 |
for i = 1, #sortedTeams do |
14583
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
14554
diff
changeset
|
465 |
SendStat(siPointType, "!TIME") |
13844
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
466 |
SendStat(siTeamRank, tostring(clanRanks[GetTeamClan(sortedTeams[i].name)])) |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
467 |
SendStat(siPlayerKills, sortedTeams[i].score, sortedTeams[i].name) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
468 |
end |
11940
e1bae42efacd
TechRacer: Show racing times and ranking in stats screen
Wuzzy <almikes@aol.com>
parents:
11939
diff
changeset
|
469 |
|
13844
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
470 |
local roundDraw = false |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
471 |
if #clanScores >= 2 and clanScores[1].score == clanScores[2].score and clanScores[1].score ~= MAX_TURN_TIME then |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
472 |
roundDraw = true |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
473 |
SendStat(siGameResult, loc("Round draw")) |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
474 |
SendStat(siCustomAchievement, loc("The teams are tied for the fastest time.")) |
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
475 |
elseif #sortedTeams >= 1 then |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
476 |
SendStat(siGameResult, string.format(loc("%s wins!"), sortedTeams[1].name)) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
477 |
SendStat(siCustomAchievement, string.format(loc("%s wins with a best time of %.1fs."), sortedTeams[1].name, (sortedTeams[1].score/1000))) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
478 |
for i=1,#unfinishedArray do |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
479 |
SendStat(siCustomAchievement, unfinishedArray[i]) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
480 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
481 |
else |
13844
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
482 |
roundDraw = true |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
483 |
SendStat(siGameResult, loc("Round draw")) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
484 |
SendStat(siCustomAchievement, loc("Nobody managed to finish the race. What a shame!")) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
485 |
SendStat(siCustomAchievement, loc("Maybe you should try an easier TechRacer map.")) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
486 |
end |
11940
e1bae42efacd
TechRacer: Show racing times and ranking in stats screen
Wuzzy <almikes@aol.com>
parents:
11939
diff
changeset
|
487 |
|
12338
6bdabf67a012
Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents:
12292
diff
changeset
|
488 |
-- Kill all the losers |
6bdabf67a012
Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents:
12292
diff
changeset
|
489 |
for i = 0, (numhhs-1) do |
13845
219c2e588874
Add missing roundDraw check in TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13844
diff
changeset
|
490 |
if GetHogClan(hhs[i]) ~= bestClan or roundDraw then |
12338
6bdabf67a012
Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents:
12292
diff
changeset
|
491 |
SetEffect(hhs[i], heResurrectable, 0) |
6bdabf67a012
Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents:
12292
diff
changeset
|
492 |
SetHealth(hhs[i],0) |
6bdabf67a012
Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents:
12292
diff
changeset
|
493 |
end |
6bdabf67a012
Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents:
12292
diff
changeset
|
494 |
end |
6bdabf67a012
Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents:
12292
diff
changeset
|
495 |
|
6bdabf67a012
Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents:
12292
diff
changeset
|
496 |
gameOver = true |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
497 |
for i=0, wpCount-1 do |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
498 |
-- Fade out waypoints |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
499 |
SetVisualGearValues(wpCirc[i], nil, nil, 0, 0, nil, 6) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
500 |
end |
12338
6bdabf67a012
Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents:
12292
diff
changeset
|
501 |
EndTurn(true) |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
502 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
503 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
504 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
505 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
506 |
function CheckForNewRound() |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
507 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
508 |
if GetHogClan(CurrentHedgehog) == firstClan then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
509 |
onNewRound() |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
510 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
511 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
512 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
513 |
|
12292
faf1b93422ba
Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
514 |
function DisableTumbler(endTurn) |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
515 |
if endTurn == nil then endTurn = true end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
516 |
if racerActive then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
517 |
currCount = 0 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
518 |
fastIndex = 0 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
519 |
racerActive = false -- newadd |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
520 |
if endTurn then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
521 |
EndTurn(true) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
522 |
end |
12969
a5c5fe878a4e
Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents:
12968
diff
changeset
|
523 |
if trackFinished and not gameOver then |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
524 |
for i=0, wpCount-1 do |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
525 |
SetVisualGearValues(wpCirc[i], nil, nil, 255, 255, nil, 2) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
526 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
527 |
elseif not gameOver then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
528 |
for i=0, wpCount-1 do |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
529 |
SetVisualGearValues(wpCirc[i], nil, nil, 32, 32, nil, 1) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
530 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
531 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
532 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
533 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
534 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
535 |
function HandleGhost() |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
536 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
537 |
-- get the current xy of the racer at this point |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
538 |
currX[currCount] = GetX(CurrentHedgehog) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
539 |
currY[currCount] = GetY(CurrentHedgehog) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
540 |
currCount = currCount + 1 |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
541 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
542 |
-- draw a ping of smoke where the fastest player was at this point |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
543 |
if (fastCount ~= 0) and (fastIndex < fastCount) then |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
544 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
545 |
fastIndex = fastIndex + 1 |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
546 |
|
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
547 |
local tempE = AddVisualGear(fastX[fastIndex], fastY[fastIndex], vgtSmoke, 0, false) |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
548 |
SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, fastColour ) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
549 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
550 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
551 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
552 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
553 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
554 |
function BoomGirder(x,y,rot) |
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
555 |
local girTime = 1 |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
556 |
if rot < 4 then |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
557 |
AddGear(x, y, gtGrenade, 0, 0, 0, girTime) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
558 |
elseif rot == 4 then |
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
559 |
AddGear(x-45, y, gtGrenade, 0, 0, 0, girTime) -- needed? |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
560 |
AddGear(x-30, y, gtGrenade, 0, 0, 0, girTime) |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
561 |
AddGear(x, y, gtGrenade, 0, 0, 0, girTime) -- needed? |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
562 |
AddGear(x+30, y, gtGrenade, 0, 0, 0, girTime) |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
563 |
AddGear(x+45, y, gtGrenade, 0, 0, 0, girTime) -- needed? |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
564 |
elseif rot == 5 then ------- diag |
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
565 |
AddGear(x+45, y+45, gtGrenade, 0, 0, 0, girTime) --n |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
566 |
AddGear(x+30, y+30, gtGrenade, 0, 0, 0, girTime) |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
567 |
AddGear(x, y, gtGrenade, 0, 0, 0, girTime) -- needed? |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
568 |
AddGear(x-30, y-30, gtGrenade, 0, 0, 0, girTime) |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
569 |
AddGear(x-45, y-45, gtGrenade, 0, 0, 0, girTime) --n |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
570 |
elseif rot == 6 then |
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
571 |
AddGear(x, y-45, gtGrenade, 0, 0, 0, girTime) -- needed? |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
572 |
AddGear(x, y+30, gtGrenade, 0, 0, 0, girTime) |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
573 |
AddGear(x, y, gtGrenade, 0, 0, 0, girTime) -- needed? |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
574 |
AddGear(x, y-30, gtGrenade, 0, 0, 0, girTime) |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
575 |
AddGear(x, y+45, gtGrenade, 0, 0, 0, girTime) -- needed? |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
576 |
elseif rot == 7 then ------- |
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
577 |
AddGear(x+45, y-45, gtGrenade, 0, 0, 0, girTime) --n |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
578 |
AddGear(x+30, y-30, gtGrenade, 0, 0, 0, girTime) |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
579 |
AddGear(x, y, gtGrenade, 0, 0, 0, girTime) -- needed? |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
580 |
AddGear(x-30, y+30, gtGrenade, 0, 0, 0, girTime) |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
581 |
AddGear(x-45, y+45, gtGrenade, 0, 0, 0, girTime) --n |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
582 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
583 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
584 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
585 |
function RemoveGear(gear) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
586 |
if (isATrackedGear(gear) == true) and (GetGearType(gear) ~= gtHedgehog) then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
587 |
DeleteGear(gear) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
588 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
589 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
590 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
591 |
function ClearMap() |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
592 |
runOnGears(RemoveGear) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
593 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
594 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
595 |
function CallBob(x,y) |
12969
a5c5fe878a4e
Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents:
12968
diff
changeset
|
596 |
if not racerActive and not gameOver then |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
597 |
if wpCount == 0 or wpX[wpCount - 1] ~= x or wpY[wpCount - 1] ~= y then |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
598 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
599 |
wpX[wpCount] = x |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
600 |
wpY[wpCount] = y |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
601 |
wpCol[wpCount] = 0xffffffff |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
602 |
wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
603 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
604 |
local minO, maxO, flashing = FlashingHelper(wpCount) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
605 |
-- Make first waypoint flash very noticably before the hog starts racing |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
606 |
SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], minO, maxO, 1, flashing, 0, wpRad, 5, wpCol[wpCount]) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
607 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
608 |
wpCount = wpCount + 1 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
609 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
610 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
611 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
612 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
613 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
614 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
615 |
function HandleFreshMapCreation() |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
616 |
|
13563
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
617 |
if activationStage ~= 1 then |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
618 |
return |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
619 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
620 |
|
13563
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
621 |
-- the boom stage, boom girders, reset ammo, and delete other map objects |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
622 |
ClearMap() |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
623 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
624 |
-- the creation stage, place girders and needed gears, grant ammo |
13563
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
625 |
InterpretPoints() |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
626 |
|
13563
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
627 |
-- these are from onParameters() |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
628 |
if (mapID == nil) or (mapID == 0) then |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
629 |
LoadMap(2000) |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
630 |
else |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
631 |
LoadMap(mapID) |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
632 |
end |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
633 |
|
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
634 |
if gameOver then |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
635 |
for i = 0,(wpCount-1) do |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
636 |
SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 164, 224, 1, 10, 0, wpRad, 5, wpCol[wpCount]) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
637 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
638 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
639 |
else |
13563
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
640 |
for i = 0,(wpCount-1) do |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
641 |
DeleteVisualGear(wpCirc[i]) |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
642 |
end |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
643 |
wpCount = 0 |
12969
a5c5fe878a4e
Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents:
12968
diff
changeset
|
644 |
|
13563
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
645 |
for i = 1, techCount-1 do |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
646 |
CallBob(techX[i],techY[i]) |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
647 |
end |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
648 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
649 |
|
13563
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
650 |
if ufoFuel == 2000 then |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
651 |
SetAmmoDescriptionAppendix(amJetpack, loc("On this map you get infinite fuel.")) |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
652 |
elseif ufoFuel ~= nil and ufoFuel ~= 0 then |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
653 |
SetAmmoDescriptionAppendix(amJetpack, string.format(loc("On this map you get %d%% fuel."), div(ufoFuel, 20))) |
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
654 |
end |
12394
605a7c85a798
Mention overwritten fuel in ammo description of UFO in TechRacer
Wuzzy <almikes@aol.com>
parents:
12393
diff
changeset
|
655 |
|
13563
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
656 |
activationStage = 200 |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
657 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
658 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
659 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
660 |
function TryRepositionHogs() |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
661 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
662 |
if MapHasBorder() == true then |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
663 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
664 |
for i = 0, (numhhs-1) do |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
665 |
if hhs[i] ~= nil then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
666 |
SetGearPosition(hhs[i],GetX(hhs[i]), TopY-10) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
667 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
668 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
669 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
670 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
671 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
672 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
673 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
674 |
---------------------------------- |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
675 |
-- GAME METHODS / EVENT HANDLERS |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
676 |
---------------------------------- |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
677 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
678 |
function onParameters() |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
679 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
680 |
parseParams() |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
681 |
mapID = tonumber(params["m"]) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
682 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
683 |
roundLimit = tonumber(params["rounds"]) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
684 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
685 |
if (roundLimit == 0) or (roundLimit == nil) then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
686 |
roundLimit = 3 |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
687 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
688 |
|
10967
1434cec96ca3
- preview generation for rubbers, air-mines, crates, barrels
mikade <redgrinner@gmail.com>
parents:
10961
diff
changeset
|
689 |
if mapID == nil then |
1434cec96ca3
- preview generation for rubbers, air-mines, crates, barrels
mikade <redgrinner@gmail.com>
parents:
10961
diff
changeset
|
690 |
mapID = 2 + GetRandom(7) |
1434cec96ca3
- preview generation for rubbers, air-mines, crates, barrels
mikade <redgrinner@gmail.com>
parents:
10961
diff
changeset
|
691 |
end |
1434cec96ca3
- preview generation for rubbers, air-mines, crates, barrels
mikade <redgrinner@gmail.com>
parents:
10961
diff
changeset
|
692 |
|
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
693 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
694 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
695 |
function onGameInit() |
13220 | 696 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
697 |
TemplateFilter = 0 |
13220 | 698 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
699 |
if MapGen == mgDrawn then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
700 |
eraseMap(false) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
701 |
else |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
702 |
MapGen = mgDrawn |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
703 |
end |
14554
ca27e4cd15fd
Force MapFeatureSize=12 in TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
14075
diff
changeset
|
704 |
MapFeatureSize = 12 |
13220 | 705 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
706 |
if mapID == nil then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
707 |
mapID = 2 + GetRandom(7) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
708 |
end |
11012
91cc6aef818c
tentative/lazy fixes for unC0Rr's evil
mikade <redgrinner@gmail.com>
parents:
10979
diff
changeset
|
709 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
710 |
addHashData(mapID) |
11551 | 711 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
712 |
Theme = "Cave" |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
713 |
Map = "" |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
714 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
715 |
EnableGameFlags(gfInfAttack, gfDisableWind, gfBorder) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
716 |
DisableGameFlags(gfSolidLand) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
717 |
CaseFreq = 0 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
718 |
TurnTime = 90000 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
719 |
WaterRise = 0 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
720 |
HealthDecrease = 0 |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
721 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
722 |
for x = 1, 16 do |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
723 |
AddPoint(x*100,100,5) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
724 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
725 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
726 |
FlushPoints() |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
727 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
728 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
729 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
730 |
function limitHogs(gear) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
731 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
732 |
cnthhs = cnthhs + 1 |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
733 |
if cnthhs > 1 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
734 |
DeleteGear(gear) |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
735 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
736 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
737 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
738 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
739 |
function onSpecialPoint(x,y,flag) |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
740 |
if flag == 99 then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
741 |
fastX[fastCount] = x |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
742 |
fastY[fastCount] = y |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
743 |
fastCount = fastCount + 1 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
744 |
elseif flag == 0 then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
745 |
techX[techCount], techY[techCount] = x, y |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
746 |
techCount = techCount + 1 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
747 |
else |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
748 |
addHashData(x) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
749 |
addHashData(y) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
750 |
addHashData(flag) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
751 |
specialPointsX[specialPointsCount] = x |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
752 |
specialPointsY[specialPointsCount] = y |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
753 |
specialPointsFlag[specialPointsCount] = flag |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
754 |
specialPointsCount = specialPointsCount + 1 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
755 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
756 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
757 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
758 |
function InterpretPoints() |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
759 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
760 |
-- flags run from 0 to 127 |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
761 |
for i = 0, (specialPointsCount-1) do |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
762 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
763 |
-- Mines |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
764 |
if specialPointsFlag[i] == 1 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
765 |
SetTimer(AddGear(specialPointsX[i], specialPointsY[i], gtMine, 0, 0, 0, 0), 1) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
766 |
elseif specialPointsFlag[i] == 2 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
767 |
SetTimer(AddGear(specialPointsX[i], specialPointsY[i], gtMine, 0, 0, 0, 0), 1000) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
768 |
elseif specialPointsFlag[i] == 3 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
769 |
SetTimer(AddGear(specialPointsX[i], specialPointsY[i], gtMine, 0, 0, 0, 0), 2000) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
770 |
elseif specialPointsFlag[i] == 4 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
771 |
SetTimer(AddGear(specialPointsX[i], specialPointsY[i], gtMine, 0, 0, 0, 0), 3000) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
772 |
elseif specialPointsFlag[i] == 5 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
773 |
SetTimer(AddGear(specialPointsX[i], specialPointsY[i], gtMine, 0, 0, 0, 0), 4000) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
774 |
elseif specialPointsFlag[i] == 6 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
775 |
SetTimer(AddGear(specialPointsX[i], specialPointsY[i], gtMine, 0, 0, 0, 0), 5000) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
776 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
777 |
-- Sticky Mines |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
778 |
elseif specialPointsFlag[i] == 7 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
779 |
AddGear(specialPointsX[i], specialPointsY[i], gtSMine, 0, 0, 0, 0) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
780 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
781 |
-- Air Mines |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
782 |
elseif specialPointsFlag[i] == 8 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
783 |
AddGear(specialPointsX[i], specialPointsY[i], gtAirMine, 0, 0, 0, 0) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
784 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
785 |
-- Health Crates |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
786 |
elseif specialPointsFlag[i] == 9 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
787 |
SetHealth(SpawnHealthCrate(specialPointsX[i],specialPointsY[i]),25) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
788 |
elseif specialPointsFlag[i] == 10 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
789 |
SetHealth(SpawnHealthCrate(specialPointsX[i],specialPointsY[i]),50) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
790 |
elseif specialPointsFlag[i] == 11 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
791 |
SetHealth(SpawnHealthCrate(specialPointsX[i],specialPointsY[i]),75) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
792 |
elseif specialPointsFlag[i] == 12 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
793 |
SetHealth(SpawnHealthCrate(specialPointsX[i],specialPointsY[i]),100) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
794 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
795 |
-- Cleaver |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
796 |
elseif specialPointsFlag[i] == 13 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
797 |
AddGear(specialPointsX[i], specialPointsY[i], gtKnife, 0, 0, 0, 0) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
798 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
799 |
-- Target |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
800 |
elseif specialPointsFlag[i] == 14 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
801 |
AddGear(specialPointsX[i], specialPointsY[i], gtTarget, 0, 0, 0, 0) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
802 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
803 |
--Barrels |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
804 |
elseif specialPointsFlag[i] == 15 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
805 |
SetHealth(AddGear(specialPointsX[i], specialPointsY[i], gtExplosives, 0, 0, 0, 0),1) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
806 |
elseif specialPointsFlag[i] == 16 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
807 |
SetHealth(AddGear(specialPointsX[i], specialPointsY[i], gtExplosives, 0, 0, 0, 0),25) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
808 |
elseif specialPointsFlag[i] == 17 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
809 |
SetHealth(AddGear(specialPointsX[i], specialPointsY[i], gtExplosives, 0, 0, 0, 0),50) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
810 |
elseif specialPointsFlag[i] == 18 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
811 |
SetHealth(AddGear(specialPointsX[i], specialPointsY[i], gtExplosives, 0, 0, 0, 0),75) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
812 |
elseif specialPointsFlag[i] == 19 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
813 |
SetHealth(AddGear(specialPointsX[i], specialPointsY[i], gtExplosives, 0, 0, 0, 0),100) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
814 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
815 |
-- There are about 58+- weps / utils |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
816 |
-- Weapon Crates |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
817 |
elseif (specialPointsFlag[i] >= 20) and (specialPointsFlag[i] < (#atkArray+20)) then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
818 |
SpawnAmmoCrate(specialPointsX[i],specialPointsY[i],atkArray[specialPointsFlag[i]-19][1]) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
819 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
820 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
821 |
-- Utility Crates |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
822 |
elseif (specialPointsFlag[i] >= (#atkArray+20)) and (specialPointsFlag[i] < (#atkArray+20+#utilArray)) then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
823 |
SpawnUtilityCrate(specialPointsX[i],specialPointsY[i],utilArray[specialPointsFlag[i]-19-#atkArray][1]) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
824 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
825 |
--79-82 (reserved for future wep crates) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
826 |
--89,88,87,86 and 85,84,83,82 (reserved for the 2 custom sprites and their landflags) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
827 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
828 |
--90-99 reserved for scripted structures |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
829 |
|
10979 | 830 |
elseif specialPointsFlag[i] == 98 then |
831 |
portalDistance = specialPointsX[i] |
|
832 |
ufoFuel = specialPointsY[i] |
|
833 |
||
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
834 |
-- Normal Girders |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
835 |
elseif specialPointsFlag[i] == 100 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
836 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 0, 4294967295, nil, nil, nil, lfNormal) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
837 |
elseif specialPointsFlag[i] == 101 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
838 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 1, 4294967295, nil, nil, nil, lfNormal) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
839 |
elseif specialPointsFlag[i] == 102 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
840 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 2, 4294967295, nil, nil, nil, lfNormal) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
841 |
elseif specialPointsFlag[i] == 103 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
842 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 3, 4294967295, nil, nil, nil, lfNormal) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
843 |
elseif specialPointsFlag[i] == 104 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
844 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 4, 4294967295, nil, nil, nil, lfNormal) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
845 |
elseif specialPointsFlag[i] == 105 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
846 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 5, 4294967295, nil, nil, nil, lfNormal) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
847 |
elseif specialPointsFlag[i] == 106 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
848 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 6, 4294967295, nil, nil, nil, lfNormal) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
849 |
elseif specialPointsFlag[i] == 107 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
850 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 7, 4294967295, nil, nil, nil, lfNormal) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
851 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
852 |
-- Invulnerable Girders |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
853 |
elseif specialPointsFlag[i] == 108 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
854 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 0, 2516582650, nil, nil, nil, lfIndestructible) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
855 |
elseif specialPointsFlag[i] == 109 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
856 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 1, 2516582650, nil, nil, nil, lfIndestructible) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
857 |
elseif specialPointsFlag[i] == 110 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
858 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 2, 2516582650, nil, nil, nil, lfIndestructible) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
859 |
elseif specialPointsFlag[i] == 111 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
860 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 3, 2516582650, nil, nil, nil, lfIndestructible) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
861 |
elseif specialPointsFlag[i] == 112 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
862 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 4, 2516582650, nil, nil, nil, lfIndestructible) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
863 |
elseif specialPointsFlag[i] == 113 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
864 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 5, 2516582650, nil, nil, nil, lfIndestructible) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
865 |
elseif specialPointsFlag[i] == 114 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
866 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 6, 2516582650, nil, nil, nil, lfIndestructible) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
867 |
elseif specialPointsFlag[i] == 115 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
868 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 7, 2516582650, nil, nil, nil, lfIndestructible) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
869 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
870 |
-- Icy Girders |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
871 |
elseif specialPointsFlag[i] == 116 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
872 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 0, 16448250, nil, nil, nil, lfIce) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
873 |
elseif specialPointsFlag[i] == 117 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
874 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 1, 16448250, nil, nil, nil, lfIce) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
875 |
elseif specialPointsFlag[i] == 118 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
876 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 2, 16448250, nil, nil, nil, lfIce) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
877 |
elseif specialPointsFlag[i] == 119 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
878 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 3, 16448250, nil, nil, nil, lfIce) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
879 |
elseif specialPointsFlag[i] == 120 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
880 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 4, 16448250, nil, nil, nil, lfIce) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
881 |
elseif specialPointsFlag[i] == 121 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
882 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 5, 16448250, nil, nil, nil, lfIce) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
883 |
elseif specialPointsFlag[i] == 121 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
884 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 6, 16448250, nil, nil, nil, lfIce) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
885 |
elseif specialPointsFlag[i] == 123 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
886 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmGirder, 7, 16448250, nil, nil, nil, lfIce) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
887 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
888 |
-- Rubber Bands |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
889 |
elseif specialPointsFlag[i] == 124 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
890 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmRubber, 0, 4294967295, nil, nil, nil, lfBouncy) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
891 |
elseif specialPointsFlag[i] == 125 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
892 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmRubber, 1, 4294967295, nil, nil, nil, lfBouncy) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
893 |
elseif specialPointsFlag[i] == 126 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
894 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmRubber, 2, 4294967295, nil, nil, nil, lfBouncy) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
895 |
elseif specialPointsFlag[i] == 127 then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
896 |
PlaceSprite(specialPointsX[i], specialPointsY[i], sprAmRubber, 3, 4294967295, nil, nil, nil, lfBouncy) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
897 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
898 |
-- Waypoints |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
899 |
else -- 0 / no value |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
900 |
CallBob(specialPointsX[i], specialPointsY[i]) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
901 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
902 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
903 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
904 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
905 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
906 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
907 |
function onGameStart() |
13774
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
908 |
if ClansCount >= 2 then |
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
909 |
SendGameResultOff() |
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
910 |
SendRankingStatsOff() |
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
911 |
SendAchievementsStatsOff() |
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
912 |
SendHealthStatsOff() |
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
913 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
914 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
915 |
trackTeams() |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
916 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
917 |
roundN = 0 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
918 |
lastRound = TotalRounds |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
919 |
RoundHasChanged = false |
14075
a5be3ef4bbbe
Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
Wuzzy <Wuzzy2@mail.ru>
parents:
13846
diff
changeset
|
920 |
WriteLnToConsole("TechRacer: Using map #"..tostring(mapID-1).." (mapID="..tostring(mapID)..")") |
a5be3ef4bbbe
Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
Wuzzy <Wuzzy2@mail.ru>
parents:
13846
diff
changeset
|
921 |
officialChallenge = detectMapWithDigest() |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
922 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
923 |
RebuildTeamInfo() |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
924 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
925 |
for i=0 , TeamsCount - 1 do |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
926 |
cnthhs = 0 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
927 |
runOnHogsInTeam(limitHogs, teamNameArr[i]) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
928 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
929 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
930 |
ShowMission( |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
931 |
loc("TechRacer"), |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
932 |
loc("A Hedgewars mini-game"), |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
933 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
934 |
loc("Complete the track as fast as you can!") .. "|" .. |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
935 |
loc("Round limit:") .. " " .. roundLimit .. "|" .. |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
936 |
loc("You can further customize the race by changing the scheme script parameter.") .. "|", |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
937 |
4, 4000 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
938 |
) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
939 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
940 |
TryRepositionHogs() |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
941 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
942 |
activationStage = 1 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
943 |
HandleFreshMapCreation() |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
944 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
945 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
946 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
947 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
948 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
949 |
function onNewTurn() |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
950 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
951 |
CheckForNewRound() |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
952 |
TryRepositionHogs() |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
953 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
954 |
racerActive = false |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
955 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
956 |
activationStage = 1 |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
957 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
958 |
trackTime = 0 |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
959 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
960 |
currCount = 0 -- hopefully this solves problem |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
961 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
962 |
-- Set the waypoints to unactive on new round |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
963 |
if not gameOver then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
964 |
for i = 0,(wpCount-1) do |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
965 |
wpActive[i] = false |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
966 |
wpCol[i] = 0xffffffff |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
967 |
local minO, maxO, flashing = FlashingHelper(i) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
968 |
SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], minO, maxO, 1, flashing, 0, wpRad, 5, wpCol[i]) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
969 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
970 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
971 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
972 |
-- Handle Starting Stage of Game |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
973 |
if (gameOver == false) and (gameBegun == false) then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
974 |
gameBegun = true |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
975 |
roundNumber = 0 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
976 |
firstClan = GetHogClan(CurrentHedgehog) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
977 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
978 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
979 |
if gameOver == true then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
980 |
gameBegun = false |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
981 |
racerActive = false |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
982 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
983 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
984 |
AddAmmo(CurrentHedgehog, amTardis, 0) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
985 |
AddAmmo(CurrentHedgehog, amDrillStrike, 0) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
986 |
AddAmmo(CurrentHedgehog, amMineStrike, 0) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
987 |
AddAmmo(CurrentHedgehog, amNapalm, 0) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
988 |
AddAmmo(CurrentHedgehog, amPiano, 0) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
989 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
990 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
991 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
992 |
function onGameTick20() |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
993 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
994 |
if (jet ~= nil) and (ufoFuel ~= 0) then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
995 |
if ufoFuel == 2000 then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
996 |
SetHealth(jet, 2000) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
997 |
end |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
998 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
999 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1000 |
runOnGears(PortalEffects) |
10979 | 1001 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1002 |
-- airstrike detected, convert this into a potential waypoint spot |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1003 |
if cGear ~= nil then |
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
1004 |
local x,y = GetGearPosition(cGear) |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1005 |
if x > -9000 then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1006 |
x,y = GetGearTarget(cGear) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1007 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1008 |
if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1009 |
AddCaption(loc("Please place the waypoint in the air and within the map boundaries")) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1010 |
PlaySound(sndDenied) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1011 |
elseif (y > WaterLine-50) then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1012 |
AddCaption(loc("Please place the waypoint further away from the waterline")) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1013 |
PlaySound(sndDenied) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1014 |
else |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1015 |
CallBob(x, y) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1016 |
if wpCount == wpLimit then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1017 |
AddCaption(loc("Race complexity limit reached")) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1018 |
DisableTumbler() |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1019 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1020 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1021 |
else |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1022 |
DeleteGear(cGear) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1023 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1024 |
SetGearPosition(cGear, -10000, 0) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1025 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1026 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1027 |
|
13563
af92481415ef
TechRacer: Fix gears not spawning on turn start when player pressed control right at start
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
1028 |
if activationStage < 200 then |
13029
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
1029 |
HandleFreshMapCreation() |
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
1030 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1031 |
if not gameOver and gameBegun and not racerActive then |
13029
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
1032 |
if cameraGear then |
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
1033 |
DeleteGear(cameraGear) |
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
1034 |
end |
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
1035 |
-- Move camera to first waypoint. |
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
1036 |
-- We use a dummy gear to feed FollowGear. It does not affect the race. |
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
1037 |
cameraGear = AddGear(wpX[0], wpY[0], gtGenericFaller, 0, 0, 0, 5000) |
13032
625d5a45f267
Racer/TechRacer: Show best times next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents:
13029
diff
changeset
|
1038 |
SetState(cameraGear, bor(GetState(cameraGear), gstNoGravity+gstInvisible)) |
13029
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
1039 |
FollowGear(cameraGear) |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1040 |
end |
13029
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
1041 |
|
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
1042 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1043 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1044 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1045 |
-- start the player tumbling with a boom once their turn has actually begun |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1046 |
if racerActive == false then |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1047 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1048 |
if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1049 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1050 |
-- if the gamehas started put the player in the middle of the first |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1051 |
-- waypoint that was placed |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1052 |
if gameBegun == true then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1053 |
AddCaption(loc("Good to go!")) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1054 |
racerActive = true |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1055 |
trackTime = 0 |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1056 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1057 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1058 |
SetGearPosition(CurrentHedgehog, wpX[0], wpY[0]) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1059 |
SetGearMessage(CurrentHedgehog,gmLeft) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1060 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1061 |
FollowGear(CurrentHedgehog) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1062 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1063 |
HideMission() |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1064 |
activationStage = 201 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1065 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1066 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1067 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1068 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1069 |
elseif (activationStage == 201) and (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1070 |
SetGearMessage(CurrentHedgehog,0) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1071 |
activationStage = 202 |
13564 | 1072 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1073 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1074 |
-- has the player started his tumbling spree? |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1075 |
if (CurrentHedgehog ~= nil) then |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1076 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1077 |
-- if the RACE has started, show tracktimes and keep tabs on waypoints |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1078 |
if (racerActive == true) and (activationStage == 202) then |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1079 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1080 |
--ghost |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1081 |
if GameTime%40 == 0 then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1082 |
HandleGhost() |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1083 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1084 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1085 |
trackTime = trackTime + 20 |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1086 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1087 |
if GameTime%100 == 0 then |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1088 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1089 |
AddCaption(string.format(loc("Time: %.1fs"), (trackTime/1000)), GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1090 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1091 |
if (CheckWaypoints() == true) then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1092 |
AdjustScores() |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1093 |
DisableTumbler() |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1094 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1095 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1096 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1097 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1098 |
-- If hedgehog is not controlled anymore, stop racing mode |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1099 |
if band(GetState(CurrentHedgehog), gstHHDriven) == 0 then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1100 |
DisableTumbler(false) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1101 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1102 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1103 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1104 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1105 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1106 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1107 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1108 |
|
10979 | 1109 |
-- handle short range portal gun |
1110 |
function PortalEffects(gear) |
|
1111 |
||
1112 |
if GetGearType(gear) == gtPortal then |
|
1113 |
||
13287
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13220
diff
changeset
|
1114 |
local tag = GetTag(gear) |
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13220
diff
changeset
|
1115 |
local col |
10979 | 1116 |
if tag == 0 then |
1117 |
col = 0xfab02aFF -- orange ball |
|
1118 |
elseif tag == 1 then |
|
1119 |
col = 0x00FF00FF -- orange portal |
|
1120 |
elseif tag == 2 then |
|
1121 |
col = 0x364df7FF -- blue ball |
|
1122 |
elseif tag == 3 then |
|
1123 |
col = 0xFFFF00FF -- blue portal |
|
1124 |
end |
|
1125 |
||
1126 |
if (tag == 0) or (tag == 2) then -- i.e ball form |
|
13287
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13220
diff
changeset
|
1127 |
local remLife = getGearValue(gear,"life") |
10979 | 1128 |
remLife = remLife - 1 |
1129 |
setGearValue(gear, "life", remLife) |
|
1130 |
||
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
1131 |
-- Limited range portal ball dies |
10979 | 1132 |
if remLife == 0 then |
1133 |
||
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
1134 |
-- Make portal ball disappear in a puff of smoke |
13692
a8b2a5e7e9db
Clean up more visual gears stuff in scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
13635
diff
changeset
|
1135 |
local tempE = AddVisualGear(GetX(gear)+15, GetY(gear), vgtSmoke, 0, false) |
13287
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13220
diff
changeset
|
1136 |
SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, col) |
10979 | 1137 |
|
13692
a8b2a5e7e9db
Clean up more visual gears stuff in scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
13635
diff
changeset
|
1138 |
tempE = AddVisualGear(GetX(gear)-15, GetY(gear), vgtSmoke, 0, false) |
13287
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13220
diff
changeset
|
1139 |
SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, col) |
10979 | 1140 |
|
13692
a8b2a5e7e9db
Clean up more visual gears stuff in scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
13635
diff
changeset
|
1141 |
tempE = AddVisualGear(GetX(gear), GetY(gear)+15, vgtSmoke, 0, false) |
13287
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13220
diff
changeset
|
1142 |
SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, col) |
10979 | 1143 |
|
13692
a8b2a5e7e9db
Clean up more visual gears stuff in scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
13635
diff
changeset
|
1144 |
tempE = AddVisualGear(GetX(gear), GetY(gear)-15, vgtSmoke, 0, false) |
13287
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13220
diff
changeset
|
1145 |
SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, col) |
10979 | 1146 |
|
1147 |
PlaySound(sndVaporize) |
|
1148 |
DeleteGear(gear) |
|
1149 |
||
1150 |
end |
|
1151 |
||
1152 |
end |
|
1153 |
||
1154 |
end |
|
1155 |
||
1156 |
end |
|
1157 |
||
13635
fe7d2bbf5f3f
Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents:
13567
diff
changeset
|
1158 |
function onGearResurrect(gear, vGear) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1159 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1160 |
if gear == CurrentHedgehog then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1161 |
DisableTumbler(false) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1162 |
end |
13635
fe7d2bbf5f3f
Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents:
13567
diff
changeset
|
1163 |
if vGear then |
fe7d2bbf5f3f
Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents:
13567
diff
changeset
|
1164 |
DeleteVisualGear(vGear) |
fe7d2bbf5f3f
Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents:
13567
diff
changeset
|
1165 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1166 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1167 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1168 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1169 |
function isATrackedGear(gear) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1170 |
if (GetGearType(gear) == gtHedgehog) or |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1171 |
(GetGearType(gear) == gtGrenade) or |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1172 |
(GetGearType(gear) == gtTarget) or |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1173 |
(GetGearType(gear) == gtFlame) or |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1174 |
(GetGearType(gear) == gtExplosives) or |
10979 | 1175 |
(GetGearType(gear) == gtPortal) or |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1176 |
(GetGearType(gear) == gtMine) or |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1177 |
(GetGearType(gear) == gtSMine) or |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1178 |
(GetGearType(gear) == gtAirMine) or |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1179 |
(GetGearType(gear) == gtCase) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1180 |
then |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1181 |
return(true) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1182 |
else |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1183 |
return(false) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1184 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1185 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1186 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1187 |
function onGearAdd(gear) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1188 |
|
10979 | 1189 |
if isATrackedGear(gear) then |
1190 |
trackGear(gear) |
|
1191 |
||
1192 |
if GetGearType(gear) == gtPortal then |
|
1193 |
setGearValue(gear,"life",portalDistance) |
|
1194 |
elseif GetGearType(gear) == gtHedgehog then |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1195 |
hhs[numhhs] = gear |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1196 |
numhhs = numhhs + 1 |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1197 |
SetEffect(gear, heResurrectable, 1) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1198 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1199 |
|
10979 | 1200 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1201 |
|
10979 | 1202 |
if GetGearType(gear) == gtAirAttack then |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1203 |
cGear = gear |
10979 | 1204 |
elseif GetGearType(gear) == gtJetpack then |
1205 |
jet = gear |
|
1206 |
if (ufoFuel ~= 0) then |
|
1207 |
SetHealth(jet, ufoFuel) |
|
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1208 |
end |
10979 | 1209 |
end |
1210 |
||
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1211 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1212 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1213 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1214 |
function onGearDelete(gear) |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1215 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1216 |
if isATrackedGear(gear) then |
13029
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
1217 |
trackDeletion(gear) |
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
1218 |
elseif GetGearType(gear) == gtAirAttack then |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1219 |
cGear = nil |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1220 |
elseif GetGearType(gear) == gtJetpack then |
13029
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
1221 |
jet = nil |
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
1222 |
elseif gear == cameraGear then |
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
1223 |
cameraGear = nil |
a568bc16a99a
Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents:
12971
diff
changeset
|
1224 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1225 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1226 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1227 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1228 |
function onAttack() |
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
1229 |
local at = GetCurAmmoType() |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1230 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1231 |
usedWeapons[at] = 0 |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1232 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1233 |
|
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1234 |
function onAchievementsDeclaration() |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1235 |
usedWeapons[amSkip] = nil |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1236 |
usedWeapons[amExtraTime] = nil |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1237 |
|
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
1238 |
local usedRope = usedWeapons[amRope] ~= nil |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
1239 |
local usedPortal = usedWeapons[amPortalGun] ~= nil |
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
1240 |
local usedSaucer = usedWeapons[amJetpack] ~= nil |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1241 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1242 |
usedWeapons[amRope] = nil |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1243 |
usedWeapons[amPortalGun] = nil |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1244 |
usedWeapons[amJetpack] = nil |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1245 |
|
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
1246 |
local usedOther = next(usedWeapons) ~= nil |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1247 |
|
13566
cba63f72e52f
TechRacer: Make most variables local
Wuzzy <Wuzzy2@mail.ru>
parents:
13565
diff
changeset
|
1248 |
local raceType |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1249 |
if usedOther then -- smth besides skip, rope, portal or saucer used |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1250 |
raceType = "unknown race" |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1251 |
elseif usedRope and not usedPortal and not usedSaucer then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1252 |
raceType = "rope race" |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1253 |
elseif not usedRope and usedPortal and not usedSaucer then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1254 |
raceType = "portal race" |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1255 |
elseif not usedRope and not usedPortal and usedSaucer then |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1256 |
raceType = "saucer race" |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1257 |
elseif (usedRope or usedPortal or usedSaucer or usedOther) == false then -- no weapons used at all? |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1258 |
raceType = "no tools race" |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1259 |
else -- at least two of rope, portal and saucer used |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1260 |
raceType = "mixed race" |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1261 |
end |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1262 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1263 |
for i = 0, (numTeams-1) do |
13844
2fceeea62b10
Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents:
13692
diff
changeset
|
1264 |
if teamScore[i] < MAX_TURN_TIME then |
14075
a5be3ef4bbbe
Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
Wuzzy <Wuzzy2@mail.ru>
parents:
13846
diff
changeset
|
1265 |
DeclareAchievement(raceType, teamNameArr[i], officialChallenge, teamScore[i]) |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1266 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1267 |
end |
11574 | 1268 |
|
14075
a5be3ef4bbbe
Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
Wuzzy <Wuzzy2@mail.ru>
parents:
13846
diff
changeset
|
1269 |
if officialChallenge ~= nil and fastCount > 0 then |
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1270 |
StartGhostPoints(fastCount) |
11574 | 1271 |
|
13565
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1272 |
for i = 0, (fastCount - 1) do |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1273 |
DumpPoint(fastX[i], fastY[i]) |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1274 |
end |
dc7b1a4ddded
Clean up messy indentations in TechRacer script
Wuzzy <Wuzzy2@mail.ru>
parents:
13564
diff
changeset
|
1275 |
end |
11574 | 1276 |
|
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1277 |
end |
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1278 |
|
10967
1434cec96ca3
- preview generation for rubbers, air-mines, crates, barrels
mikade <redgrinner@gmail.com>
parents:
10961
diff
changeset
|
1279 |
function onAmmoStoreInit() |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1280 |
|
10967
1434cec96ca3
- preview generation for rubbers, air-mines, crates, barrels
mikade <redgrinner@gmail.com>
parents:
10961
diff
changeset
|
1281 |
SetAmmo(amSkip, 9, 0, 0, 0) |
10959
1225f42f61e2
Pass ScriptParams to preview to support techracer. Proof of concept for techracer, generate a preview for m=4
nemo
parents:
10950
diff
changeset
|
1282 |
|
10967
1434cec96ca3
- preview generation for rubbers, air-mines, crates, barrels
mikade <redgrinner@gmail.com>
parents:
10961
diff
changeset
|
1283 |
for i = 1, #atkArray do |
1434cec96ca3
- preview generation for rubbers, air-mines, crates, barrels
mikade <redgrinner@gmail.com>
parents:
10961
diff
changeset
|
1284 |
SetAmmo(atkArray[i][1], 0, 0, 0, 1) |
1434cec96ca3
- preview generation for rubbers, air-mines, crates, barrels
mikade <redgrinner@gmail.com>
parents:
10961
diff
changeset
|
1285 |
end |
1434cec96ca3
- preview generation for rubbers, air-mines, crates, barrels
mikade <redgrinner@gmail.com>
parents:
10961
diff
changeset
|
1286 |
|
1434cec96ca3
- preview generation for rubbers, air-mines, crates, barrels
mikade <redgrinner@gmail.com>
parents:
10961
diff
changeset
|
1287 |
for i = 1, #utilArray do |
1434cec96ca3
- preview generation for rubbers, air-mines, crates, barrels
mikade <redgrinner@gmail.com>
parents:
10961
diff
changeset
|
1288 |
SetAmmo(utilArray[i][1], 0, 0, 0, 1) |
1434cec96ca3
- preview generation for rubbers, air-mines, crates, barrels
mikade <redgrinner@gmail.com>
parents:
10961
diff
changeset
|
1289 |
end |
1434cec96ca3
- preview generation for rubbers, air-mines, crates, barrels
mikade <redgrinner@gmail.com>
parents:
10961
diff
changeset
|
1290 |
|
1434cec96ca3
- preview generation for rubbers, air-mines, crates, barrels
mikade <redgrinner@gmail.com>
parents:
10961
diff
changeset
|
1291 |
end |