share/hedgewars/Data/Scripts/Multiplayer/Tumbler.lua
author mikade
Thu, 01 Sep 2011 00:28:38 +0200
changeset 5720 a962d0823f49
parent 5598 265429f7ba85
child 5825 a6eab1b7c00d
permissions -rw-r--r--
onHogAttack hook. Might reposition this later. Updates to Tumbler gameplay mode -- Better HUD -- Allow more user customization -- Bugfix for new gear spawns -- Performance tweaks -- Variety of small gameplay changes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
     1
------------------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
     2
-- TUMBLER
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
     3
-- v.0.7
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
     4
------------------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
     5
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
     6
loadfile(GetDataPath() .. "Scripts/Locale.lua")()
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
     7
loadfile(GetDataPath() .. "Scripts/Tracker.lua")()
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
     8
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
     9
local fMod = 1000000 -- use this for dev and .16+ games
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    10
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    11
local leftOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    12
local rightOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    13
local upOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    14
local downOn = false
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    15
local preciseOn = false
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    16
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    17
local wep = {}
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    18
local wepAmmo = {}
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    19
local wepCol = {}
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    20
local wepIndex = 0
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    21
local wepCount = 0
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    22
local fGears = 0
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    23
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    24
local mineSpawn
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    25
local barrelSpawn
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    26
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    27
local roundKills = 0
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    28
local barrelsEaten = 0
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    29
local minesEaten = 0
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    30
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    31
local moveTimer = 0
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    32
local fireTimer = 0
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    33
local TimeLeftCounter = 0
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    34
local TimeLeft = 0
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    35
local stopMovement = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    36
local tumbleStarted = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    37
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    38
local vTag = {}
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    39
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    40
------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    41
-- version 0.4
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    42
------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    43
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    44
-- removed some old code/comments
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    45
-- removed both shell and mortar as the primary and secondary weapons
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    46
-- the primary weapon is now an explosive(barrel)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    47
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    48
-- added support for picking up barrels scattered about the map (backspace)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    49
-- added support for dragging around mines (enter toggles on/off)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    50
-- added support for primary fire being onAttackUp
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    51
-- added a trail to indicate when the player has 5s or less left to tumble
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    52
-- updated showmission to reflect changed controls and options
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    53
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    54
------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    55
-- version 0.5
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    56
------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    57
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    58
-- changed some of the user feedback
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    59
-- i can't remember??
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    60
-- substituted onAttackUp for onPrecise()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    61
-- brought in line with new velocity changes
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    62
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    63
------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    64
-- version 0.6
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    65
------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    66
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    67
-- reduced starting "ammo"
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    68
-- randomly spawn new barrels/mines on new turn
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    69
-- updated user feedback
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    70
-- better locs and coloured addcaptions
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    71
-- added tag for turntime
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    72
-- removed tractor beam
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    73
-- added two new weapons and changed ammo handling
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    74
-- health crates now give tumbler time, and wep/utility give flamer ammo
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    75
-- explosives AND mines can be picked up to increase their relative ammo
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    76
-- replaced "no weapon" selected message that hw serves
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    77
-- modified crate frequencies a bit
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    78
-- added some simple kill-based achievements, i think
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    79
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    80
------------------------
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    81
-- version 0.7
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    82
------------------------
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    83
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    84
-- a few code optimisations/performance tweaks
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    85
-- removed some deprecated code
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    86
-- fix a potential spawn bug
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    87
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    88
-- improved HUD (now shows ammo counts)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    89
-- improved user feedback (less generic messages)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    90
-- colour-coded addcaptions to match hud :)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    91
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    92
-- base tumbling time now equals scheme turntime
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    93
-- tumbling time extension is now based on the amount of health contained in crate
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    94
-- new mines per turn based on minesnum
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    95
-- new barrels per turn based on explosives
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    96
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    97
-- added 2 more achievements: barrel eater and mine eater (like kills, don't do anything atm)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    98
-- slightly increased grab distance for explosives/mines
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    99
-- slightly increased flamer velocity
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   100
-- slightly decreased flamer volume
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   101
-- added a flame vaporiser (based on number of flame gears?)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   102
-- give tumblers an extra 47 health on the start of their tumble to counter the grenade (exp)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   103
-- refocus camera on tumbler on newturn (not on crates, barrels etc)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   104
-- increase delay: yes, yes, eat your hearts out
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   105
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   106
-- commit log
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   107
-- Better HUD
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   108
-- Allow more user customization
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   109
-- Bugfix for new gear spawns
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   110
-- Performance tweaks
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   111
-- Variety of small gameplay changes
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   112
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   113
---------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   114
-- some other ideas/things
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   115
---------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   116
--[[
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   117
-- add better gameflag handling
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   118
-- fix flamer "shots remaining" message on start or choose a standard versus %
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   119
-- add more sounds
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   120
-- better barrel/minespawn effects
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   121
-- separate grab distance for mines/barrels
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   122
-- [probably not] make barrels always explode?
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   123
-- [probably not] persistent ammo?
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   124
-- [probably not] dont hurt tumblers and restore their health at turn end?
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   125
]]
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   126
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   127
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   128
----------------------------------------------------------------
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   129
----------------------------------------------------------------
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   130
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   131
local flames = {}
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   132
local fGearValues = {}
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   133
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   134
function runOnflames(func)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   135
    for k, gear in ipairs(flames) do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   136
        func(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   137
    end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   138
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   139
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   140
function trackFGear(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   141
    table.insert(flames, gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   142
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   143
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   144
function trackFGearDeletion(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   145
    fGearValues[gear] = nil
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   146
    for k, g in ipairs(flames) do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   147
        if g == gear then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   148
            table.remove(flames, k)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   149
            break
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   150
        end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   151
    end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   152
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   153
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   154
function getFGearValue(gear, key)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   155
    if fGearValues[gear] ~= nil then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   156
        return fGearValues[gear][key]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   157
    end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   158
    return nil
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   159
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   160
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   161
function setFGearValue(gear, key, value)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   162
    found = false
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   163
    for id, values in pairs(fGearValues) do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   164
        if id == gear then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   165
            values[key] = value
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   166
            found = true
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   167
        end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   168
    end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   169
    if not found then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   170
        fGearValues[gear] = { [key] = value }
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   171
    end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   172
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   173
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   174
function decreaseFGearValue(gear, key)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   175
    for id, values in pairs(fGearValues) do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   176
        if id == gear then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   177
            values[key] = values[key] - 1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   178
        end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   179
    end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   180
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   181
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   182
function HandleLife(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   183
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   184
	decreaseFGearValue(gear, "L")
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   185
	if getFGearValue(gear, "L") == 0 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   186
		AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   187
		DeleteGear(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   188
	end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   189
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   190
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   191
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   192
----------------------------------------------------------------
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   193
----------------------------------------------------------------
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   194
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   195
function HideTags()
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   196
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   197
	for i = 0, 3 do 	
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   198
		SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xffffff00)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   199
	end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   200
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   201
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   202
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   203
function DrawTag(i)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   204
	
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   205
	zoomL = 1.3
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   206
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   207
	xOffset = 40
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   208
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   209
	if i == 0 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   210
		yOffset = 40	
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   211
		tCol = 0xffba00ff --0xffed09ff --0xffba00ff
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   212
		tValue = TimeLeft
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   213
	elseif i == 1 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   214
		zoomL = 1.1		
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   215
		yOffset = 70	
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   216
		tCol = wepCol[0]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   217
		tValue = wepAmmo[0]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   218
	elseif i == 2 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   219
		zoomL = 1.1		
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   220
		xOffset = 40 + 35
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   221
		yOffset = 70		
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   222
		tCol = wepCol[1]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   223
		tValue = wepAmmo[1]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   224
	elseif i == 3 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   225
		zoomL = 1.1		
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   226
		xOffset = 40 + 70
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   227
		yOffset = 70		
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   228
		tCol = wepCol[2]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   229
		tValue = wepAmmo[2]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   230
	end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   231
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   232
	DeleteVisualGear(vTag[i])
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   233
	vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   234
	g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vTag[i])
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   235
	SetVisualGearValues	(	
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   236
				vTag[i], 		--id
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   237
				-(ScreenWidth/2) + xOffset,	--xoffset
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   238
				ScreenHeight - yOffset, --yoffset
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   239
				0, 			--dx
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   240
				0, 			--dy
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   241
				zoomL, 			--zoom
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   242
				1, 			--~= 0 means align to screen
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   243
				g7, 			--frameticks
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   244
				tValue, 		--value
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   245
				240000, 		--timer
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   246
				tCol		--GetClanColor( GetHogClan(CurrentHedgehog) )
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   247
				)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   248
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   249
end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   250
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   251
function GetGearDistance(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   252
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   253
	g1X, g1Y = GetGearPosition(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   254
	g2X, g2Y = GetGearPosition(CurrentHedgehog)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   255
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   256
	q = g1X - g2X
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   257
	w = g1Y - g2Y
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   258
	return( (q*q) + (w*w) )
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   259
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   260
end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   261
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   262
-- add to your ammo ***WHEN YOU PUSH A KEY*** near them
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   263
-- yes that was my justification for a non generic method
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   264
function CheckProximityToExplosives(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   265
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   266
	if (GetGearDistance(gear) < 1400) then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   267
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   268
		if (GetGearType(gear) == gtExplosives) then
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   269
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   270
			wepAmmo[0] = wepAmmo[0] + 1
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   271
			PlaySound(sndShotgunReload)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   272
			DeleteGear(gear)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   273
			AddCaption(wep[0] .. " " .. loc("ammo extended!"), wepCol[0], capgrpAmmoinfo )
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   274
			DrawTag(1)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   275
			
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   276
			barrelsEaten = barrelsEaten + 1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   277
			if barrelsEaten == 5 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   278
				AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Barrel Eater!"),0xffba00ff,capgrpMessage2)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   279
			end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   280
		
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   281
		elseif (GetGearType(gear) == gtMine) then
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   282
			wepAmmo[1] = wepAmmo[1] + 1
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   283
			PlaySound(sndShotgunReload)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   284
			DeleteGear(gear)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   285
			AddCaption(wep[1] .. " " .. loc("ammo extended!"), wepCol[1], capgrpAmmoinfo )
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   286
			DrawTag(2)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   287
			
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   288
			minesEaten = minesEaten + 1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   289
			if minesEaten == 5 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   290
				AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Mine Eater!"),0xffba00ff,capgrpMessage2)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   291
			end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   292
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   293
		end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   294
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   295
	else
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   296
		--AddCaption("There is nothing here...")
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   297
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   298
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   299
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   300
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   301
-- check proximity on crates
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   302
function CheckProximity(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   303
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   304
	dist = GetGearDistance(gear)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   305
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   306
	if (dist < 1600) and (GetGearType(gear) == gtCase) then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   307
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   308
		if GetHealth(gear) > 0 then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   309
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   310
			AddCaption(loc("Tumbling Time Extended!"), 0xffba00ff, capgrpMessage2 )
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   311
			
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   312
			TimeLeft = TimeLeft + HealthCaseAmount  --5 --5s
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   313
			DrawTag(0)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   314
			--PlaySound(sndShotgunReload)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   315
		else
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   316
			wepAmmo[2] = wepAmmo[2] + 800
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   317
			PlaySound(sndShotgunReload)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   318
			AddCaption(wep[2] .. " " .. loc("fuel extended!"), wepCol[2], capgrpAmmoinfo )
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   319
			DrawTag(3)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   320
		end
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   321
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   322
		DeleteGear(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   323
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   324
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   325
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   326
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   327
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   328
function ChangeWeapon()
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   329
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   330
	wepIndex = wepIndex + 1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   331
	if wepIndex == wepCount then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   332
		wepIndex = 0
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   333
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   334
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   335
	AddCaption(wep[wepIndex] .. " " .. loc("selected!"), wepCol[wepIndex],capgrpAmmoinfo )
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   336
	AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   337
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   338
end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   339
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   340
---------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   341
-- action keys
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   342
---------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   343
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   344
function onPrecise()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   345
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   346
	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and (wepAmmo[wepIndex] > 0) then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   347
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   348
		wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   349
		AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   350
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   351
		if wep[wepIndex] == loc("Barrel Launcher") then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   352
			morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtExplosives, 0, 0, 0, 1)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   353
			CopyPV(CurrentHedgehog, morte) -- new addition
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   354
			x,y = GetGearVelocity(morte)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   355
			x = x*2
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   356
			y = y*2
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   357
			SetGearVelocity(morte, x, y)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   358
			DrawTag(1)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   359
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   360
		elseif wep[wepIndex] == loc("Mine Deployer") then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   361
			morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtMine, 0, 0, 0, 0)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   362
			SetTimer(morte, 1000)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   363
			DrawTag(2)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   364
		end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   365
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   366
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   367
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   368
	preciseOn = true
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   369
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   370
end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   371
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   372
function onPreciseUp()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   373
	preciseOn = false
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   374
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   375
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   376
function onHJump()
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   377
	-- pick up explosives/mines if nearby them
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   378
	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   379
		runOnGears(CheckProximityToExplosives)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   380
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   381
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   382
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   383
function onLJump()
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   384
	ChangeWeapon()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   385
end
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   386
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   387
-----------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   388
-- movement keys
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   389
-----------------
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   390
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   391
function onLeft()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   392
	if (CurrentHedgehog ~= nil) and (stopMovement == false) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   393
		leftOn = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   394
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   395
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   396
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   397
function onRight()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   398
	if (CurrentHedgehog ~= nil) and (stopMovement == false) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   399
		rightOn = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   400
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   401
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   402
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   403
function onUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   404
	if (CurrentHedgehog ~= nil) and (stopMovement == false) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   405
		upOn = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   406
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   407
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   408
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   409
function onDown()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   410
	if (CurrentHedgehog ~= nil) and (stopMovement == false) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   411
		downOn = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   412
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   413
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   414
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   415
function onDownUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   416
	downOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   417
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   418
function onUpUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   419
	upOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   420
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   421
function onLeftUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   422
	leftOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   423
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   424
function onRightUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   425
	rightOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   426
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   427
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   428
--------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   429
-- other event handlers
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   430
--------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   431
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   432
function onGameInit()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   433
	CaseFreq = 0
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   434
	HealthCaseProb = 0
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   435
	Delay = 1000
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   436
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   437
	mineSpawn = MinesNum
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   438
	if mineSpawn > 4 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   439
		mineSpawn = 4	
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   440
	end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   441
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   442
	barrelSpawn = Explosives
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   443
	if barrelSpawn > 4 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   444
		barrelSpawn = 4	
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   445
	end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   446
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   447
	--MinesNum = 0
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   448
	--Explosives = 0
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   449
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   450
	for i = 0, 3 do 	
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   451
		vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false)	
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   452
	end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   453
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   454
	HideTags()
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   455
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   456
	wep[0] = loc("Barrel Launcher")
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   457
	wep[1] = loc("Mine Deployer")	
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   458
	wep[2] = loc("Flamer")
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   459
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   460
	wepCol[0] = 0x78818eff
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   461
	wepCol[1] = 0xa12a77ff
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   462
	wepCol[2] = 0xf49318ff
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   463
	
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   464
	wepCount = 3
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   465
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   466
end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   467
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   468
function onGameStart()
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   469
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   470
	ShowMission	(
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   471
			"TUMBLER",
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   472
			loc("a Hedgewars mini-game"),
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   473
			loc("Eliminate the enemy hogs to win.") .. "|" ..
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   474
			" " .. "|" ..
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   475
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   476
			loc("New Mines Per Turn") .. ": " .. (mineSpawn) .. "|" ..
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   477
			loc("New Barrels Per Turn") .. ": " .. (barrelSpawn) .. "|" ..
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   478
			loc("Time Extension") .. ": " .. (HealthCaseAmount) .. loc("sec") .. "|" ..
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   479
			" " .. "|" ..
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   480
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   481
			loc("Movement: [Up], [Down], [Left], [Right]") .. "|" ..
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   482
			loc("Fire") .. ": " .. loc("[Left Shift]") .. "|" ..
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   483
			loc("Change Weapon") .. ": " .. loc("[Enter]") .. "|" ..
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   484
			loc("Grab Mines/Explosives") .. ": " .. loc("[Backspace]") .. "|" ..
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   485
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   486
			" " .. "|" ..
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   487
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   488
			loc("Health crates extend your time.") .. "|" ..
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   489
			loc("Ammo is reset at the end of your turn.") .. "|" ..
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   490
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   491
			"", 4, 4000
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   492
			)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   493
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   494
end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   495
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   496
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   497
function onNewTurn()
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   498
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   499
	stopMovement = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   500
	tumbleStarted = false
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   501
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   502
	-- randomly create new barrels mines on the map every turn (can be disabled by setting mine/barrels to 0 in scheme)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   503
	for i = 0, barrelSpawn-1 do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   504
		gear = AddGear(100, 100, gtExplosives, 0, 0, 0, 0)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   505
		SetHealth(gear, 100)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   506
		if FindPlace(gear, false, 0, LAND_WIDTH, false) ~= nil then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   507
			tempE = AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   508
		end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   509
	end
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   510
	for i = 0, mineSpawn-1 do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   511
		gear = AddGear(100, 100, gtMine, 0, 0, 0, 0)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   512
		if FindPlace(gear, false, 0, LAND_WIDTH, false) ~= nil then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   513
			tempE = AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   514
		end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   515
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   516
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   517
	-- randomly spawn time extension crates / flamer fuel on the map
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   518
	r = GetRandom(100)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   519
	if r > 50 then
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   520
		gear = SpawnHealthCrate(0, 0)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   521
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   522
	r = GetRandom(100)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   523
	if r > 70 then
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   524
		gear = SpawnAmmoCrate(0, 0, amSkip)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   525
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   526
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   527
	HideTags()
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   528
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   529
	--reset ammo counts
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   530
	wepAmmo[0] = 2
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   531
	wepAmmo[1] = 1 
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   532
	wepAmmo[2] = 50 -- 50000 -- 50
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   533
	wepIndex = 2
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   534
	ChangeWeapon()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   535
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   536
	roundKills = 0
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   537
	barrelsEaten = 0
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   538
	minesEaten = 0
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   539
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   540
	FollowGear(CurrentHedgehog)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   541
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   542
end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   543
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   544
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   545
function DisableTumbler()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   546
	stopMovement = true
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   547
	upOn = false
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   548
	down = false
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   549
	leftOn = false
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   550
	rightOn = false
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   551
	HideTags()
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   552
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   553
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   554
function onGameTick()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   555
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   556
	-- start the player tumbling with a boom once their turn has actually begun
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   557
	if tumbleStarted == false then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   558
		if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   559
			--AddCaption(loc("Good to go!"))
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   560
			tumbleStarted = true
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   561
			TimeLeft = (TurnTime/1000)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   562
			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   563
			SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog) + 47) -- new
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   564
			for i = 0, 3 do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   565
				DrawTag(i)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   566
			end			
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   567
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   568
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   569
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   570
	if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   571
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   572
		runOnGears(CheckProximity) -- crates
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   573
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   574
		-- Calculate and display turn time
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   575
		TimeLeftCounter = TimeLeftCounter + 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   576
		if TimeLeftCounter == 1000 then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   577
			TimeLeftCounter = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   578
			TimeLeft = TimeLeft - 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   579
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   580
			if TimeLeft >= 0 then
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   581
				DrawTag(0)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   582
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   583
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   584
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   585
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   586
		if TimeLeft == 0 then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   587
			DisableTumbler()
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   588
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   589
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   590
		-- handle movement based on IO
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   591
		moveTimer = moveTimer + 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   592
		if moveTimer == 100 then -- 100
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   593
			moveTimer = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   594
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   595
			runOnflames(HandleLife)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   596
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   597
			---------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   598
			-- new trail code
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   599
			---------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   600
			-- the trail lets you know you have 5s left to pilot, akin to birdy feathers
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   601
			if (TimeLeft <= 5) and (TimeLeft > 0) then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   602
				tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmoke, 0, false)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   603
				g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   604
				SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(GetHogClan(CurrentHedgehog)) )
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   605
			end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   606
			--------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   607
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   608
			dx, dy = GetGearVelocity(CurrentHedgehog)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   609
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   610
			dxlimit = 0.4*fMod
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   611
			dylimit = 0.4*fMod
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   612
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   613
			if dx > dxlimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   614
				dx = dxlimit
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   615
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   616
			if dy > dylimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   617
				dy = dylimit
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   618
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   619
			if dx < -dxlimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   620
				dx = -dxlimit
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   621
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   622
			if dy < -dylimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   623
				dy = -dylimit
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   624
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   625
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   626
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   627
			if leftOn == true then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   628
				dx = dx - 0.1*fMod
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   629
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   630
			if rightOn == true then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   631
				dx = dx + 0.1*fMod
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   632
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   633
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   634
			if upOn == true then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   635
				dy = dy - 0.1*fMod
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   636
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   637
			if downOn == true then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   638
				dy = dy + 0.1*fMod
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   639
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   640
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   641
			SetGearVelocity(CurrentHedgehog, dx, dy)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   642
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   643
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   644
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   645
		--
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   646
		--flamer
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   647
		--
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   648
		fireTimer = fireTimer + 1
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   649
		if fireTimer == 6 then	-- 5 --10
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   650
			fireTimer = 0
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   651
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   652
			if (wep[wepIndex] == loc("Flamer") ) and (preciseOn == true) and (wepAmmo[wepIndex] > 0) and (stopMovement == false) and (tumbleStarted == true) then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   653
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   654
				wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   655
				AddCaption(
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   656
						loc("Flamer") .. ": " ..
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   657
						(wepAmmo[wepIndex]/800*100) - (wepAmmo[wepIndex]/800*100)%2 .. "%",
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   658
						wepCol[2],
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   659
						capgrpMessage2
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   660
						)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   661
				DrawTag(3)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   662
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   663
				dx, dy = GetGearVelocity(CurrentHedgehog)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   664
				shell = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtFlame, 0, 0, 0, 0)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   665
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   666
				xdev = 1 + GetRandom(25)	--15
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   667
				xdev = xdev / 100
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   668
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   669
				r = GetRandom(2)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   670
				if r == 1 then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   671
					xdev = xdev*-1
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   672
				end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   673
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   674
				ydev = 1 + GetRandom(25)	--15
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   675
				ydev = ydev / 100
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   676
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   677
				r = GetRandom(2)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   678
				if r == 1 then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   679
					ydev = ydev*-1
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   680
				end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   681
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   682
				--*13	--8	*-4
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   683
				SetGearVelocity(shell, (dx*4.5)+(xdev*fMod), (dy*4.5)+(ydev*fMod))	--10
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   684
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   685
			end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   686
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   687
		end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   688
		--
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   689
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   690
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   691
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   692
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   693
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   694
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   695
function isATrackedGear(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   696
	if 	(GetGearType(gear) == gtExplosives) or
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   697
		(GetGearType(gear) == gtMine) or
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   698
		(GetGearType(gear) == gtCase)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   699
	then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   700
		return(true)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   701
	else
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   702
		return(false)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   703
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   704
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   705
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   706
--[[function onGearDamage(gear, damage)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   707
	if gear == CurrentHedgehog then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   708
		-- You are now tumbling
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   709
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   710
end]]
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   711
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   712
function onGearAdd(gear)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   713
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   714
	if GetGearType(gear) == gtFlame then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   715
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   716
		trackFGear(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   717
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   718
		fGears = fGears +1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   719
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   720
		if fGears < 80 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   721
			setFGearValue(gear,"L",30)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   722
		else
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   723
			setFGearValue(gear,"L",5) --3
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   724
		end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   725
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   726
	elseif isATrackedGear(gear) then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   727
		trackGear(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   728
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   729
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   730
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   731
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   732
function onGearDelete(gear)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   733
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   734
	if GetGearType(gear) == gtFlame then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   735
		trackFGearDeletion(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   736
		fGears = fGears -1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   737
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   738
	elseif isATrackedGear(gear) then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   739
		trackDeletion(gear)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   740
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   741
	-- achievements? prototype
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   742
	elseif GetGearType(gear) == gtHedgehog then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   743
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   744
		if GetHogTeamName(gear) ~= GetHogTeamName(CurrentHedgehog) then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   745
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   746
			roundKills = roundKills + 1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   747
			if roundKills == 2 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   748
				AddCaption(loc("Double Kill!"),0xffba00ff,capgrpMessage2)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   749
			elseif roundKills == 3 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   750
				AddCaption(loc("Killing spree!"),0xffba00ff,capgrpMessage2)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   751
			elseif roundKills >= 4 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   752
				AddCaption(loc("Unstoppable!"),0xffba00ff,capgrpMessage2)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   753
			end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   754
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   755
		elseif gear == CurrentHedgehog then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   756
			DisableTumbler()
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   757
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   758
		elseif gear ~= CurrentHedgehog then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   759
			AddCaption(loc("Friendly Fire!"),0xffba00ff,capgrpMessage2)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   760
		end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   761
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   762
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   763
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   764
	if CurrentHedgehog ~= nil then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   765
		FollowGear(CurrentHedgehog)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   766
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   767
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   768
end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   769
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   770