share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
author Wuzzy <almikes@aol.com>
Sat, 19 Nov 2016 20:22:55 +0100
changeset 11928 42e90b244e11
parent 11927 72593678e8d6
child 11929 167de692f2d7
permissions -rw-r--r--
Racer: Dump old commented-out code
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
     1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
     2
------------------------------------------
11647
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
     3
-- RACER 0.8
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
     4
-- map-independant racing script
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
     5
-- by mikade
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
     6
-----------------------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
     7
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
     8
-----------------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
     9
--0.1: took all the code from crazy racer and scrapped most of it
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    10
-----------------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    11
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    12
-- Removed tumbler system
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    13
-- Removed extra adds like boosters etc
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    14
-- Added experimental waypoint placement system
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    15
-- More user feedback
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    16
-- Reduced race complexity limit to 5 waypoints
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    17
-- stop placement at complexity limit reached and end turn
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    18
-- guys dont keep racing after dying
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    19
-- invulnerable feasibility
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    20
-- reverted time keeping method
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    21
-- reduced feedback display time
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    22
-- colour-coded addcaptions
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    23
-- cleaned up code
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    24
-- support for more players properly added
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    25
-- tardis fix
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    26
-- remove airstrikes
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    27
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    28
-- i think the remainder 0 .456 sec of the tracktime isnt getting reset on newturn
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    29
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    30
-- update feedback
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    31
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    32
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    33
-- 0.2
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    34
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    35
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    36
-- allow gameflags
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    37
-- extend time to 90s
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    38
-- remove other air-attack based weps
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    39
-- turn off water rise for sd
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    40
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    41
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    42
-- 0.3
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    43
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    44
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    45
-- prevent WP being placed in land
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    46
-- prevent waypoints being placed outside border
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    47
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    48
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    49
-- 0.4
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    50
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    51
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    52
-- update user feedback
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    53
-- add more sounds
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    54
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    55
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    56
-- 0.5
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    57
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    58
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    59
-- fix ghost disappearing if hog falls in water or somehow dies
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    60
-- lengthen ghost tracking interval to improve performance on slower machines
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    61
-- increase waypoint limit to 8
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    62
-- allow for persistent showmission information
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    63
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    64
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    65
-- 0.6
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    66
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    67
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    68
-- remove hogs from racing area as per request
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    69
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    70
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    71
-- 0.7
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    72
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    73
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    74
-- switch to first available weapon if starting race with no weapon selected
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    75
11647
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
    76
-------
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
    77
-- 0.8
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
    78
-------
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
    79
-- allow different boost directions
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
    80
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    81
-----------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    82
-- SCRIPT BEGINS
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    83
-----------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    84
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    85
HedgewarsScriptLoad("/Scripts/Locale.lua")
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    86
HedgewarsScriptLoad("/Scripts/OfficialChallenges.lua")
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    87
HedgewarsScriptLoad("/Scripts/Params.lua")
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    88
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    89
------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    90
-- Got Variables?
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    91
------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    92
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    93
local fMod = 1000000 -- 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    94
local roundLimit = 3
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    95
local roundNumber = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    96
local firstClan = 10
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    97
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    98
local fastX = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    99
local fastY = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   100
local fastCount = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   101
local fastIndex = 0
11581
fd02a080d962 - Fix room config being sent unmodified
unc0rr
parents: 11569
diff changeset
   102
local fastColour = 0xffffffff
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   103
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   104
local currX = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   105
local currY = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   106
local currCount = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   107
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   108
local specialPointsX = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   109
local specialPointsY = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   110
local specialPointsCount = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   111
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   112
local TeamRope = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   113
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   114
--------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   115
-- hog and team tracking variales
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   116
--------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   117
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   118
local numhhs = 0 -- store number of hedgehogs
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   119
local hhs = {} -- store hedgehog gears
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   120
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   121
local numTeams --  store the number of teams in the game
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   122
local teamNameArr = {}  -- store the list of teams
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   123
local teamClan = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   124
local teamSize = {}     -- store how many hogs per team
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   125
local teamIndex = {} -- at what point in the hhs{} does each team begin
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   126
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   127
local teamComment = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   128
local teamScore = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   129
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   130
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   131
-- racer vars
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   132
--------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   133
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   134
local cGear = nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   135
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   136
local bestClan = nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   137
local bestTime = nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   138
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   139
local gameBegun = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   140
local gameOver = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   141
local racerActive = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   142
local trackTime = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   143
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   144
local wpCirc = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   145
local wpX = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   146
local wpY = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   147
local wpCol = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   148
local wpActive = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   149
local wpRad = 450 --75
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   150
local wpCount = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   151
local wpLimit = 8
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   152
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   153
local usedWeapons = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   154
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   155
local roundN
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   156
local lastRound
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   157
local RoundHasChanged
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   158
11647
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   159
local boostX = 0
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   160
local boostY = 0
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   161
local boostValue = 1
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   162
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   163
-------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   164
-- general methods
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   165
-------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   166
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   167
function onParameters()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   168
    parseParams()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   169
    if params["teamrope"] ~= nil then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   170
        TeamRope = true
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   171
    end
11926
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11925
diff changeset
   172
    if params["rounds"] ~= nil then
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11925
diff changeset
   173
        roundLimit = math.max(1, math.floor(tonumber(params["rounds"])))
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11925
diff changeset
   174
        if type(roundLimit) ~= "number" then
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11925
diff changeset
   175
             roundLimit = 3
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11925
diff changeset
   176
        end
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11925
diff changeset
   177
    end
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   178
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   179
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   180
function RebuildTeamInfo()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   181
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   182
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   183
        -- make a list of individual team names
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   184
        for i = 0, (TeamsCount-1) do
11928
42e90b244e11 Racer: Dump old commented-out code
Wuzzy <almikes@aol.com>
parents: 11927
diff changeset
   185
                teamNameArr[i] = " "
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   186
                teamSize[i] = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   187
                teamIndex[i] = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   188
                teamScore[i] = 100000
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   189
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   190
        numTeams = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   191
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   192
        for i = 0, (numhhs-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   193
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   194
                z = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   195
                unfinished = true
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   196
                while(unfinished == true) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   197
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   198
                        newTeam = true
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   199
                        tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   200
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   201
                        if tempHogTeamName == teamNameArr[z] then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   202
                                newTeam = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   203
                                unfinished = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   204
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   205
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   206
                        z = z + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   207
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   208
                        if z == TeamsCount then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   209
                                unfinished = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   210
                                if newTeam == true then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   211
                                        teamNameArr[numTeams] = tempHogTeamName
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   212
                                        numTeams = numTeams + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   213
                                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   214
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   215
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   216
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   217
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   218
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   219
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   220
        -- find out how many hogs per team, and the index of the first hog in hhs
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   221
        for i = 0, (numTeams-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   222
                for z = 0, (numhhs-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   223
                        if GetHogTeamName(hhs[z]) == teamNameArr[i] then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   224
                                teamClan[i] = GetHogClan(hhs[z])
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   225
                                if teamSize[i] == 0 then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   226
                                        teamIndex[i] = z -- should give starting index
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   227
                                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   228
                                teamSize[i] = teamSize[i] + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   229
                                --add a pointer so this hog appears at i in hhs
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   230
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   231
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   232
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   233
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   234
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   235
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   236
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   237
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   238
-----------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   239
-- RACER METHODS
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   240
-----------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   241
11647
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   242
function onLeft()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   243
	boostX = boostX +boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   244
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   245
function onLeftUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   246
	boostX = boostX -boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   247
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   248
function onRight()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   249
	boostX = boostX -boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   250
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   251
function onRightUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   252
	boostX = boostX +boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   253
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   254
function onUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   255
	boostY = boostY +boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   256
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   257
function onUpUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   258
	boostY = boostY -boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   259
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   260
function onDown()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   261
	boostY = boostY -boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   262
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   263
function onDownUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   264
	boostY = boostY +boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   265
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   266
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   267
function CheckWaypoints()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   268
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   269
        trackFinished = true
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   270
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   271
        for i = 0, (wpCount-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   272
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   273
                g1X, g1Y = GetGearPosition(CurrentHedgehog)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   274
                g2X, g2Y = wpX[i], wpY[i]
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   275
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   276
                g1X = g1X - g2X
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   277
                g1Y = g1Y - g2Y
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   278
                dist = (g1X*g1X) + (g1Y*g1Y)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   279
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   280
                NR = (48/100*wpRad)/2
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   281
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   282
                if dist < (NR*NR) then
11928
42e90b244e11 Racer: Dump old commented-out code
Wuzzy <almikes@aol.com>
parents: 11927
diff changeset
   283
                        wpCol[i] = GetClanColor(GetHogClan(CurrentHedgehog))
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   284
                        SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 20, 100, 1, 10, 0, wpRad, 5, wpCol[i])
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   285
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   286
                        wpRem = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   287
                        for k = 0, (wpCount-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   288
                                if wpActive[k] == false then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   289
                                        wpRem = wpRem + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   290
                                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   291
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   292
11925
7123bfc9643c Racer: Don't mess with ammo display when touching waypoint
Wuzzy <almikes@aol.com>
parents: 11924
diff changeset
   293
                        if wpActive[i] == false then
11927
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   294
                                local wpMessage = ""
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   295
                                if wpRem-1 == 0 then
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   296
                                         wpMessage = loc("Track completed!")
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   297
                                else
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   298
                                         wpMessage = string.format(loc("Waypoints remaining: %d"), wpRem-1)
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   299
                                end
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   300
                                AddCaption(wpMessage, 0xffba00ff, capgrpGameState)
11925
7123bfc9643c Racer: Don't mess with ammo display when touching waypoint
Wuzzy <almikes@aol.com>
parents: 11924
diff changeset
   301
                        end
7123bfc9643c Racer: Don't mess with ammo display when touching waypoint
Wuzzy <almikes@aol.com>
parents: 11924
diff changeset
   302
                        wpActive[i] = true
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   303
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   304
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   305
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   306
                if wpActive[i] == false then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   307
                        trackFinished = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   308
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   309
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   310
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   311
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   312
        return(trackFinished)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   313
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   314
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   315
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   316
function AdjustScores()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   317
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   318
        if bestTime == nil then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   319
                bestTime = 100000
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   320
                bestClan = 10
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   321
                bestTimeComment = "N/A"
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   322
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   323
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   324
        newScore = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   325
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   326
        -- update this clan's time if the new track is better
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   327
        for i = 0, (numTeams-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   328
                if teamClan[i] == GetHogClan(CurrentHedgehog) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   329
                        if trackTime < teamScore[i] then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   330
                                teamScore[i] = trackTime
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   331
                                newScore = true
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   332
                        else
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   333
                                newScore = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   334
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   335
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   336
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   337
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   338
        -- find the best time out of those so far
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   339
        for i = 0, (numTeams-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   340
                if teamScore[i] < bestTime then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   341
                        bestTime = teamScore[i]
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   342
                        bestClan = teamClan[i]
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   343
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   344
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   345
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   346
        if bestTime ~= 100000 then
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   347
                bestTimeComment = string.format(loc("%.1fs"), (bestTime/1000))
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   348
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   349
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   350
        if newScore == true then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   351
                if trackTime == bestTime then -- best time of the race
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   352
                        ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   353
                        loc("Track completed!"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   354
                        string.format(loc("New race record: %.1fs"), (trackTime/1000)) .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   355
                        string.format(loc("Winning time: %s"), bestTimeComment), 0, 4000)
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   356
                        PlaySound(sndHomerun)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   357
                else    -- best time for the clan
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   358
                        ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   359
                        loc("Track completed!"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   360
                        string.format(loc("New clan record: %.1fs"), (trackTime/1000)) .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   361
                        string.format(loc("Winning time: %s"), bestTimeComment), 4, 4000)
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   362
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   363
        else -- not any kind of new score
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   364
                ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   365
                loc("Track completed!"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   366
                string.format(loc("Time: %.1fs"), (trackTime/1000)) .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   367
                string.format(loc("Winning time: %s"), bestTimeComment), -amSkip, 4000)
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   368
                PlaySound(sndHellish)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   369
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   370
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   371
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   372
        if bestTime == trackTime then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   373
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   374
                fastColour = GetClanColor(GetHogClan(CurrentHedgehog))
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   375
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   376
                for i = 0, (currCount-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   377
                        fastX[i] = currX[i]
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   378
                        fastY[i] = currY[i]
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   379
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   380
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   381
                fastCount = currCount
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   382
                fastIndex = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   383
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   384
        else
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   385
                currCount = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   386
                fastIndex = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   387
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   388
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   389
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   390
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   391
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   392
function onNewRound()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   393
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   394
        roundNumber = roundNumber + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   395
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   396
        totalComment = ""
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   397
        for i = 0, (TeamsCount-1) do
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   398
                        if teamNameArr[i] ~= " " and teamScore[i] ~= -1 then
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   399
                                teamComment[i] = string.format(loc("%s: %.1fs"), teamNameArr[i], (teamScore[i]/1000)) .. "|"
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   400
                        else
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   401
                                teamComment[i] = string.format(loc("%s: N/A"), teamNameArr[i]) .. "|"
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   402
                        end
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   403
                        totalComment = totalComment .. teamComment[i]
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   404
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   405
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   406
        ShowMission(    loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   407
                                        loc("Status update"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   408
                                        string.format(loc("Rounds complete: %d/%d"), roundNumber, roundLimit) .. "|" .. " " .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   409
                                        loc("Best team times: ") .. "|" .. totalComment, 0, 4000)
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   410
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   411
        -- end game if its at round limit
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   412
        if roundNumber >= roundLimit then
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   413
                gameOver = true
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   414
                TurnTimeLeft = 10000000
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   415
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   416
                -- Sort the scores for the ranking list
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   417
                local unfinishedArray = {}
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   418
                local sortedTeams = {}
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   419
                local k = 1
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   420
                for i = 0, TeamsCount-1 do
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   421
                        if teamScore[i] ~= 100000 and teamNameArr[i] ~= " " then
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   422
                               sortedTeams[k] = {}
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   423
                               sortedTeams[k].name = teamNameArr[i]
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   424
                               sortedTeams[k].score = teamScore[i]
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   425
                               k = k + 1
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   426
                        else
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   427
                               table.insert(unfinishedArray, string.format(loc("%s did not finish the race."), teamNameArr[i]))
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   428
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   429
                end
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   430
                table.sort(sortedTeams, function(team1, team2) return team1.score < team2.score end)
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   431
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   432
                -- Write all the stats!
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   433
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   434
                for i = 1, #sortedTeams do
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   435
                        SendStat(siPointType, loc("milliseconds"))
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   436
                        SendStat(siPlayerKills, sortedTeams[i].score, sortedTeams[i].name)
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   437
                end
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   438
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   439
                if #sortedTeams >= 1 then
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   440
                        SendStat(siGameResult, string.format(loc("%s wins!"), sortedTeams[1].name))
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   441
                        SendStat(siGameResult, string.format(loc("%s wins!"), sortedTeams[1].name))
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   442
                        SendStat(siCustomAchievement, string.format(loc("%s wins with a best time of %.1fs."), sortedTeams[1].name, (sortedTeams[1].score/1000)))
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   443
                        for i=1,#unfinishedArray do
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   444
                                 SendStat(siCustomAchievement, unfinishedArray[i])
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   445
                        end
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   446
                else
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   447
                        SendStat(siGameResult, loc("Round draw"))
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   448
                        SendStat(siCustomAchievement, loc("Nobody managed to finish the race. What a shame!"))
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   449
                        SendStat(siCustomAchievement, loc("Maybe you should try easier waypoints next time."))
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   450
                end
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   451
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   452
                -- Game over
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   453
                EndGame()
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   454
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   455
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   456
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   457
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   458
function CheckForNewRound()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   459
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   460
        if GetHogClan(CurrentHedgehog) == firstClan then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   461
                onNewRound()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   462
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   463
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   464
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   465
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   466
function DisableTumbler()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   467
        currCount = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   468
        fastIndex = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   469
        TurnTimeLeft = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   470
        racerActive = false -- newadd
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   471
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   472
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   473
function HandleGhost()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   474
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   475
        -- get the current xy of the racer at this point
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   476
        currX[currCount] = GetX(CurrentHedgehog)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   477
        currY[currCount] = GetY(CurrentHedgehog)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   478
        currCount = currCount + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   479
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   480
        -- draw a ping of smoke where the fastest player was at this point
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   481
        if (fastCount ~= 0) and (fastIndex < fastCount) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   482
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   483
                fastIndex = fastIndex + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   484
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   485
                tempE = AddVisualGear(fastX[fastIndex], fastY[fastIndex], vgtSmoke, 0, false)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   486
                g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   487
                SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, fastColour )
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   488
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   489
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   490
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   491
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   492
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   493
function TryRepositionHogs()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   494
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   495
	if MapHasBorder() == true then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   496
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   497
		for i = 0, (numhhs-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   498
			if hhs[i] ~= nil then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   499
				SetGearPosition(hhs[i],GetX(hhs[i]), TopY-10)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   500
			end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   501
		end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   502
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   503
	end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   504
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   505
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   506
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   507
----------------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   508
-- GAME METHODS / EVENT HANDLERS
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   509
----------------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   510
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   511
function onGameInit()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   512
        EnableGameFlags(gfInfAttack, gfInvulnerable)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   513
        CaseFreq = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   514
        TurnTime = 90000
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   515
        WaterRise = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   516
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   517
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   518
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   519
function onGameStart()
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   520
        SendHealthStatsOff()
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   521
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   522
        roundN = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   523
        lastRound = TotalRounds
11928
42e90b244e11 Racer: Dump old commented-out code
Wuzzy <almikes@aol.com>
parents: 11927
diff changeset
   524
        RoundHasChanged = false
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   525
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   526
        for i = 0, (specialPointsCount-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   527
                PlaceWayPoint(specialPointsX[i], specialPointsY[i])
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   528
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   529
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   530
        RebuildTeamInfo()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   531
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   532
        ShowMission     (
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   533
                                loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   534
                                loc("A Hedgewars mini-game"),
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   535
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   536
                                loc("Build a track and race.") .. "|" ..
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   537
                                string.format(loc("Round limit: %d"), roundLimit) .. "|" ..
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   538
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   539
                                "", 4, 4000
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   540
                                )
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   541
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   542
        TryRepositionHogs()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   543
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   544
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   545
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   546
function PlaceWayPoint(x,y)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   547
    if not racerActive then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   548
        if wpCount == 0 or wpX[wpCount - 1] ~= x or wpY[wpCount - 1] ~= y then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   549
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   550
            wpX[wpCount] = x
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   551
            wpY[wpCount] = y
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   552
            wpCol[wpCount] = 0xffffffff
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   553
            wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true)
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   554
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   555
            SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 20, 100, 1, 10, 0, wpRad, 5, wpCol[wpCount])
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   556
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   557
            wpCount = wpCount + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   558
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   559
            AddCaption(string.format(loc("Waypoint placed. Available points remaining: %d"), wpLimit-wpCount))
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   560
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   561
    end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   562
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   563
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   564
function onSpecialPoint(x,y,flag)
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   565
    if flag == 99 then
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   566
        fastX[fastCount] = x
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   567
        fastY[fastCount] = y
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   568
        fastCount = fastCount + 1
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   569
    else
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   570
        addHashData(x)
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   571
        addHashData(y)
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   572
        addHashData(flag)
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   573
        specialPointsX[specialPointsCount] = x
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   574
        specialPointsY[specialPointsCount] = y
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   575
        specialPointsCount = specialPointsCount + 1
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   576
    end
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   577
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   578
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   579
function onNewTurn()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   580
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   581
        CheckForNewRound()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   582
        TryRepositionHogs()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   583
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   584
        racerActive = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   585
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   586
        trackTime = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   587
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   588
        currCount = 0 -- hopefully this solves problem
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   589
        AddAmmo(CurrentHedgehog, amAirAttack, 0)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   590
        gTimer = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   591
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   592
        -- Set the waypoints to unactive on new round
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   593
        for i = 0,(wpCount-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   594
                wpActive[i] = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   595
                wpCol[i] = 0xffffffff
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   596
                SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 20, 100, 1, 10, 0, wpRad, 5, wpCol[i])
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   597
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   598
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   599
        -- Handle Starting Stage of Game
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   600
        if (gameOver == false) and (gameBegun == false) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   601
                if wpCount >= 3 then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   602
                        gameBegun = true
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   603
                        roundNumber = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   604
                        firstClan = GetHogClan(CurrentHedgehog)
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   605
                        ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   606
                        loc("A Hedgewars mini-game"),
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   607
                        loc("Complete the track as fast as you can!"), 2, 4000)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   608
                else
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   609
                        ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   610
                        loc("Waypoint placement phase"),
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   611
                        loc("Place more waypoints using the 'Air Attack' weapon."), 2, 4000)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   612
                        AddAmmo(CurrentHedgehog, amAirAttack, 4000)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   613
                        SetWeapon(amAirAttack)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   614
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   615
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   616
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   617
        if gameOver == true then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   618
                gameBegun = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   619
                racerActive = false -- newadd
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   620
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   621
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   622
        AddAmmo(CurrentHedgehog, amTardis, 0)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   623
        AddAmmo(CurrentHedgehog, amDrillStrike, 0)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   624
        AddAmmo(CurrentHedgehog, amMineStrike, 0)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   625
        AddAmmo(CurrentHedgehog, amNapalm, 0)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   626
        AddAmmo(CurrentHedgehog, amPiano, 0)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   627
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   628
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   629
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   630
function onGameTick20()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   631
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   632
        -- airstrike detected, convert this into a potential waypoint spot
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   633
        if cGear ~= nil then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   634
                x,y = GetGearPosition(cGear)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   635
                if x > -9000 then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   636
                        x,y = GetGearTarget(cGear)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   637
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   638
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   639
                        if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   640
                                AddCaption(loc("Please place the waypoint in the air, within the map boundaries"))
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   641
                                PlaySound(sndDenied)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   642
                        elseif (y > WaterLine-50) then
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   643
                                AddCaption(loc("Please place the waypoint further away from the waterline"))
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   644
                                PlaySound(sndDenied)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   645
                        else
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   646
                                PlaceWayPoint(x, y)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   647
                                if wpCount == wpLimit then
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   648
                                        AddCaption(loc("Race complexity limit reached"))
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   649
                                        DisableTumbler()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   650
                                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   651
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   652
                else
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   653
                        DeleteGear(cGear)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   654
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   655
        SetGearPosition(cGear, -10000, 0)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   656
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   657
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   658
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   659
        -- start the player tumbling with a boom once their turn has actually begun
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   660
        if racerActive == false then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   661
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   662
                if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   663
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   664
                        -- if the gamehas started put the player in the middle of the first
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   665
                        --waypoint that was placed
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   666
                        if gameBegun == true then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   667
                                AddCaption(loc("Good to go!"))
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   668
                                racerActive = true
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   669
                                trackTime = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   670
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   671
                                SetGearPosition(CurrentHedgehog, wpX[0], wpY[0])
11648
mikade <redgrinner@gmail.com>
parents: 11647
diff changeset
   672
                                AddGear(GetX(CurrentHedgehog)+boostX, GetY(CurrentHedgehog)+boostY, gtGrenade, 0, 0, 0, 1)
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   673
                                FollowGear(CurrentHedgehog)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   674
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   675
                                HideMission()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   676
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   677
                                -- don't start empty-handed
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   678
                                if (GetCurAmmoType() == amNothing) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   679
                                        SetNextWeapon()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   680
                                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   681
                        else
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   682
                                -- still in placement mode
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   683
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   684
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   685
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   686
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   687
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   688
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   689
        -- has the player started his tumbling spree?
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   690
        if (CurrentHedgehog ~= nil) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   691
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   692
                --airstrike conversion used to be here
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   693
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   694
                -- if the RACE has started, show tracktimes and keep tabs on waypoints
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   695
                if (racerActive == true) and (gameBegun == true) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   696
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   697
                        --ghost
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   698
                        if GameTime%40 == 0 then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   699
                                HandleGhost()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   700
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   701
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   702
                        trackTime = trackTime + 20
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   703
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   704
                        if GameTime%100 == 0 then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   705
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   706
                                AddCaption(string.format(loc("Time: %.1fs"), (trackTime/1000)),GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   707
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   708
                                if (CheckWaypoints() == true) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   709
                                        AdjustScores()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   710
                                        DisableTumbler()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   711
                                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   712
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   713
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   714
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   715
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   716
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   717
                -- if the player has expended his tunbling time, stop him tumbling
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   718
                if TurnTimeLeft <= 20 then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   719
                        DisableTumbler()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   720
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   721
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   722
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   723
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   724
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   725
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   726
function onGearResurrect(gear)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   727
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   728
        AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   729
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   730
        if gear == CurrentHedgehog then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   731
                DisableTumbler()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   732
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   733
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   734
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   735
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   736
function onGearAdd(gear)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   737
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   738
        if GetGearType(gear) == gtHedgehog then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   739
                hhs[numhhs] = gear
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   740
                numhhs = numhhs + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   741
                SetEffect(gear, heResurrectable, 1)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   742
        elseif GetGearType(gear) == gtAirAttack then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   743
                cGear = gear
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   744
        elseif GetGearType(gear) == gtRope and TeamRope then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   745
            SetTag(gear,1)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   746
            SetGearValues(gear,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,GetClanColor(GetHogClan(CurrentHedgehog)))
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   747
        elseif GetGearType(gear) == gtAirMine then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   748
            DeleteGear(gear)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   749
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   750
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   751
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   752
function onGearDelete(gear)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   753
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   754
        if GetGearType(gear) == gtAirAttack then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   755
                cGear = nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   756
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   757
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   758
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   759
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   760
function onAttack()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   761
    at = GetCurAmmoType()
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   762
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   763
    usedWeapons[at] = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   764
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   765
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   766
function onAchievementsDeclaration()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   767
    usedWeapons[amSkip] = nil
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   768
    usedWeapons[amExtraTime] = nil
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   769
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   770
    usedRope = usedWeapons[amRope] ~= nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   771
    usedPortal = usedWeapons[amPortalGun] ~= nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   772
    usedSaucer = usedWeapons[amJetpack] ~= nil
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   773
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   774
    usedWeapons[amNothing] = nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   775
    usedWeapons[amRope] = nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   776
    usedWeapons[amPortalGun] = nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   777
    usedWeapons[amJetpack] = nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   778
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   779
    usedOther = next(usedWeapons) ~= nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   780
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   781
    if usedOther then -- smth besides nothing, skip, rope, portal or saucer used
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   782
        raceType = "unknown race"
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   783
    elseif usedRope and not usedPortal and not usedSaucer then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   784
        raceType = "rope race"
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   785
    elseif not usedRope and usedPortal and not usedSaucer then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   786
        raceType = "portal race"
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   787
    elseif not usedRope and not usedPortal and usedSaucer then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   788
        raceType = "saucer race"
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   789
    elseif (usedRope or usedPortal or usedSaucer or usedOther) == false then -- no weapons used at all?
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   790
        raceType = "no tools race"
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   791
    else -- at least two of rope, portal and saucer used
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   792
        raceType = "mixed race"
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   793
    end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   794
11545
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
   795
    map = detectMapWithDigest()
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   796
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   797
    for i = 0, (numTeams-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   798
        if teamScore[i] < 100000 then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   799
            DeclareAchievement(raceType, teamNameArr[i], map, teamScore[i])
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   800
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   801
    end
11569
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
   802
11585
026c329b1a13 Don't dump ghost points if map isn't detected
unc0rr
parents: 11581
diff changeset
   803
    if map ~= nil and fastCount > 0 then
11569
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
   804
        StartGhostPoints(fastCount)
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
   805
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
   806
        for i = 0, (fastCount - 1) do
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
   807
            DumpPoint(fastX[i], fastY[i])
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
   808
        end
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
   809
    end
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   810
end