share/hedgewars/Data/Scripts/Multiplayer/Tumbler.lua
author sheepluva
Wed, 02 Sep 2015 04:59:17 +0200
changeset 11063 c57f815cbb14
parent 8043 da083f8d95e6
child 12051 05a968518a56
permissions -rw-r--r--
make diagonal maze use map feature size
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
5825
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
     3
-- v.0.7.1
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
8043
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 5827
diff changeset
     6
HedgewarsScriptLoad("/Scripts/Locale.lua")
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 5827
diff changeset
     7
HedgewarsScriptLoad("/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
5825
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   113
------------------------
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   114
-- version 0.7.1
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   115
------------------------
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   116
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   117
-- redraw HUD on screen resolution change
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   118
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   119
---------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   120
-- some other ideas/things
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   121
---------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   122
--[[
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   123
-- add better gameflag handling
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   124
-- 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
   125
-- add more sounds
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   126
-- better barrel/minespawn effects
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   127
-- separate grab distance for mines/barrels
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   128
-- [probably not] make barrels always explode?
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   129
-- [probably not] persistent ammo?
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   130
-- [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
   131
]]
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   132
5720
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
----------------------------------------------------------------
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   135
----------------------------------------------------------------
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   136
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   137
local flames = {}
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   138
local fGearValues = {}
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 runOnflames(func)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   141
    for k, gear in ipairs(flames) do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   142
        func(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   143
    end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   144
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   145
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   146
function trackFGear(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   147
    table.insert(flames, gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   148
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   149
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   150
function trackFGearDeletion(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   151
    fGearValues[gear] = nil
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   152
    for k, g in ipairs(flames) do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   153
        if g == gear then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   154
            table.remove(flames, k)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   155
            break
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   156
        end
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
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   159
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   160
function getFGearValue(gear, key)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   161
    if fGearValues[gear] ~= nil then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   162
        return fGearValues[gear][key]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   163
    end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   164
    return nil
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   165
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   166
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   167
function setFGearValue(gear, key, value)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   168
    found = false
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   169
    for id, values in pairs(fGearValues) do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   170
        if id == gear then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   171
            values[key] = value
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   172
            found = true
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   173
        end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   174
    end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   175
    if not found then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   176
        fGearValues[gear] = { [key] = value }
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   177
    end
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
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   180
function decreaseFGearValue(gear, key)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   181
    for id, values in pairs(fGearValues) do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   182
        if id == gear then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   183
            values[key] = values[key] - 1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   184
        end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   185
    end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   186
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   187
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   188
function HandleLife(gear)
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
	decreaseFGearValue(gear, "L")
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   191
	if getFGearValue(gear, "L") == 0 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   192
		AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   193
		DeleteGear(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   194
	end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   195
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   196
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   197
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   198
----------------------------------------------------------------
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   199
----------------------------------------------------------------
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
function HideTags()
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   202
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   203
	for i = 0, 3 do
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   204
		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
   205
	end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   206
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   207
end
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
function DrawTag(i)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   210
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   211
	zoomL = 1.3
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   212
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   213
	xOffset = 40
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   214
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   215
	if i == 0 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   216
		yOffset = 40
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   217
		tCol = 0xffba00ff --0xffed09ff --0xffba00ff
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   218
		tValue = TimeLeft
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   219
	elseif i == 1 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   220
		zoomL = 1.1
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   221
		yOffset = 70
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   222
		tCol = wepCol[0]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   223
		tValue = wepAmmo[0]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   224
	elseif i == 2 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   225
		zoomL = 1.1
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   226
		xOffset = 40 + 35
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   227
		yOffset = 70
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   228
		tCol = wepCol[1]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   229
		tValue = wepAmmo[1]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   230
	elseif i == 3 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   231
		zoomL = 1.1
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   232
		xOffset = 40 + 70
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   233
		yOffset = 70
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   234
		tCol = wepCol[2]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   235
		tValue = wepAmmo[2]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   236
	end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   237
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   238
	DeleteVisualGear(vTag[i])
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   239
	vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   240
	g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vTag[i])
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   241
	SetVisualGearValues	(
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   242
				vTag[i], 		--id
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   243
				-(ScreenWidth/2) + xOffset,	--xoffset
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   244
				ScreenHeight - yOffset, --yoffset
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   245
				0, 			--dx
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   246
				0, 			--dy
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   247
				zoomL, 			--zoom
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   248
				1, 			--~= 0 means align to screen
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   249
				g7, 			--frameticks
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   250
				tValue, 		--value
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   251
				240000, 		--timer
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   252
				tCol		--GetClanColor( GetHogClan(CurrentHedgehog) )
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   253
				)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   254
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   255
end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   256
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   257
function GetGearDistance(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   258
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   259
	g1X, g1Y = GetGearPosition(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   260
	g2X, g2Y = GetGearPosition(CurrentHedgehog)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   261
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   262
	q = g1X - g2X
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   263
	w = g1Y - g2Y
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   264
	return( (q*q) + (w*w) )
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   265
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   266
end
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
-- 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
   269
-- 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
   270
function CheckProximityToExplosives(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   271
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   272
	if (GetGearDistance(gear) < 1400) then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   273
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   274
		if (GetGearType(gear) == gtExplosives) then
5720
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
			wepAmmo[0] = wepAmmo[0] + 1
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   277
			PlaySound(sndShotgunReload)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   278
			DeleteGear(gear)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   279
			AddCaption(wep[0] .. " " .. loc("ammo extended!"), wepCol[0], capgrpAmmoinfo )
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   280
			DrawTag(1)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   281
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   282
			barrelsEaten = barrelsEaten + 1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   283
			if barrelsEaten == 5 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   284
				AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Barrel Eater!"),0xffba00ff,capgrpMessage2)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   285
			end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   286
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   287
		elseif (GetGearType(gear) == gtMine) then
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   288
			wepAmmo[1] = wepAmmo[1] + 1
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   289
			PlaySound(sndShotgunReload)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   290
			DeleteGear(gear)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   291
			AddCaption(wep[1] .. " " .. loc("ammo extended!"), wepCol[1], capgrpAmmoinfo )
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   292
			DrawTag(2)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   293
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   294
			minesEaten = minesEaten + 1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   295
			if minesEaten == 5 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   296
				AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Mine Eater!"),0xffba00ff,capgrpMessage2)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   297
			end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   298
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   299
		end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   300
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   301
	else
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   302
		--AddCaption("There is nothing here...")
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   303
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   304
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   305
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   306
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   307
-- check proximity on crates
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   308
function CheckProximity(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   309
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   310
	dist = GetGearDistance(gear)
5720
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
	if (dist < 1600) and (GetGearType(gear) == gtCase) then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   313
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   314
		if GetHealth(gear) > 0 then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   315
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   316
			AddCaption(loc("Tumbling Time Extended!"), 0xffba00ff, capgrpMessage2 )
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   317
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   318
			TimeLeft = TimeLeft + HealthCaseAmount  --5 --5s
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   319
			DrawTag(0)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   320
			--PlaySound(sndShotgunReload)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   321
		else
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   322
			wepAmmo[2] = wepAmmo[2] + 800
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   323
			PlaySound(sndShotgunReload)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   324
			AddCaption(wep[2] .. " " .. loc("fuel extended!"), wepCol[2], capgrpAmmoinfo )
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   325
			DrawTag(3)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   326
		end
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   327
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   328
		DeleteGear(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   329
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   330
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   331
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   332
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   333
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   334
function ChangeWeapon()
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   335
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   336
	wepIndex = wepIndex + 1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   337
	if wepIndex == wepCount then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   338
		wepIndex = 0
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   339
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   340
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   341
	AddCaption(wep[wepIndex] .. " " .. loc("selected!"), wepCol[wepIndex],capgrpAmmoinfo )
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   342
	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
   343
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   344
end
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
---------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   347
-- action keys
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   348
---------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   349
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   350
function onPrecise()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   351
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   352
	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
   353
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   354
		wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   355
		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
   356
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   357
		if wep[wepIndex] == loc("Barrel Launcher") then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   358
			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
   359
			CopyPV(CurrentHedgehog, morte) -- new addition
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   360
			x,y = GetGearVelocity(morte)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   361
			x = x*2
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   362
			y = y*2
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   363
			SetGearVelocity(morte, x, y)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   364
			DrawTag(1)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   365
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   366
		elseif wep[wepIndex] == loc("Mine Deployer") then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   367
			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
   368
			SetTimer(morte, 1000)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   369
			DrawTag(2)
5598
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
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   373
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   374
	preciseOn = true
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   375
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   376
end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   377
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   378
function onPreciseUp()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   379
	preciseOn = false
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
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   382
function onHJump()
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   383
	-- 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
   384
	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
   385
		runOnGears(CheckProximityToExplosives)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   386
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   387
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   388
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   389
function onLJump()
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   390
	ChangeWeapon()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   391
end
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   392
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   393
-----------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   394
-- movement keys
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   395
-----------------
4872
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 onLeft()
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
		leftOn = 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 onRight()
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
		rightOn = 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 onUp()
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
		upOn = 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 onDown()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   416
	if (CurrentHedgehog ~= nil) and (stopMovement == false) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   417
		downOn = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   418
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   419
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   420
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   421
function onDownUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   422
	downOn = 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 onUpUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   425
	upOn = 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
function onLeftUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   428
	leftOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   429
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   430
function onRightUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   431
	rightOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   432
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   433
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   434
--------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   435
-- other event handlers
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   436
--------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   437
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   438
function onGameInit()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   439
	CaseFreq = 0
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   440
	HealthCaseProb = 0
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   441
	Delay = 1000
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   442
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   443
	mineSpawn = MinesNum
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   444
	if mineSpawn > 4 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   445
		mineSpawn = 4
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   446
	end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   447
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   448
	barrelSpawn = Explosives
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   449
	if barrelSpawn > 4 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   450
		barrelSpawn = 4
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   451
	end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   452
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   453
	--MinesNum = 0
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   454
	--Explosives = 0
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   455
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   456
	for i = 0, 3 do
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   457
		vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   458
	end
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
	HideTags()
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   461
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   462
	wep[0] = loc("Barrel Launcher")
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   463
	wep[1] = loc("Mine Deployer")
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   464
	wep[2] = loc("Flamer")
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   465
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   466
	wepCol[0] = 0x78818eff
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   467
	wepCol[1] = 0xa12a77ff
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   468
	wepCol[2] = 0xf49318ff
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   469
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   470
	wepCount = 3
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   471
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   472
end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   473
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   474
function onGameStart()
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   475
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   476
	ShowMission	(
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   477
			"TUMBLER",
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   478
			loc("a Hedgewars mini-game"),
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   479
			loc("Eliminate the enemy hogs to win.") .. "|" ..
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
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   482
			loc("New Mines Per Turn") .. ": " .. (mineSpawn) .. "|" ..
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   483
			loc("New Barrels Per Turn") .. ": " .. (barrelSpawn) .. "|" ..
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   484
			loc("Time Extension") .. ": " .. (HealthCaseAmount) .. loc("sec") .. "|" ..
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   485
			" " .. "|" ..
5598
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
			loc("Movement: [Up], [Down], [Left], [Right]") .. "|" ..
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   488
			loc("Fire") .. ": " .. loc("[Left Shift]") .. "|" ..
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   489
			loc("Change Weapon") .. ": " .. loc("[Enter]") .. "|" ..
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   490
			loc("Grab Mines/Explosives") .. ": " .. loc("[Backspace]") .. "|" ..
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   491
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   492
			" " .. "|" ..
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
			loc("Health crates extend your time.") .. "|" ..
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   495
			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
   496
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   497
			"", 4, 4000
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   498
			)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   499
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   500
end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   501
5825
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   502
function onScreenResize()
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   503
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   504
	-- redraw Tags so that their screen locations are updated
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   505
	if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   506
		for i = 0, 3 do
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   507
			DrawTag(i)
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   508
		end
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   509
	end
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   510
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   511
end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   512
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   513
function onNewTurn()
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   514
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   515
	stopMovement = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   516
	tumbleStarted = false
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   517
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   518
	-- 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
   519
	for i = 0, barrelSpawn-1 do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   520
		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
   521
		SetHealth(gear, 100)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   522
		if FindPlace(gear, false, 0, LAND_WIDTH, false) ~= nil then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   523
			tempE = AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   524
		end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   525
	end
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   526
	for i = 0, mineSpawn-1 do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   527
		gear = AddGear(100, 100, gtMine, 0, 0, 0, 0)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   528
		if FindPlace(gear, false, 0, LAND_WIDTH, false) ~= nil then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   529
			tempE = AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   530
		end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   531
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   532
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   533
	-- 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
   534
	r = GetRandom(100)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   535
	if r > 50 then
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   536
		gear = SpawnHealthCrate(0, 0)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   537
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   538
	r = GetRandom(100)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   539
	if r > 70 then
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   540
		gear = SpawnAmmoCrate(0, 0, amSkip)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   541
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   542
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   543
	HideTags()
5598
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
	--reset ammo counts
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   546
	wepAmmo[0] = 2
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   547
	wepAmmo[1] = 1
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   548
	wepAmmo[2] = 50 -- 50000 -- 50
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   549
	wepIndex = 2
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   550
	ChangeWeapon()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   551
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   552
	roundKills = 0
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   553
	barrelsEaten = 0
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   554
	minesEaten = 0
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   555
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   556
	FollowGear(CurrentHedgehog)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   557
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   558
end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   559
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   560
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   561
function DisableTumbler()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   562
	stopMovement = true
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   563
	upOn = false
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   564
	down = false
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   565
	leftOn = false
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   566
	rightOn = false
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   567
	HideTags()
4872
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
function onGameTick()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   571
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   572
	-- 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
   573
	if tumbleStarted == false then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   574
		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
   575
			--AddCaption(loc("Good to go!"))
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   576
			tumbleStarted = true
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   577
			TimeLeft = (TurnTime/1000)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   578
			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   579
			SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog) + 47) -- new
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   580
			for i = 0, 3 do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   581
				DrawTag(i)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   582
			end
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   583
		end
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 (CurrentHedgehog ~= nil) and (tumbleStarted == true) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   587
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   588
		runOnGears(CheckProximity) -- crates
4872
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
		-- Calculate and display turn time
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   591
		TimeLeftCounter = TimeLeftCounter + 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   592
		if TimeLeftCounter == 1000 then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   593
			TimeLeftCounter = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   594
			TimeLeft = TimeLeft - 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   595
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   596
			if TimeLeft >= 0 then
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   597
				DrawTag(0)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   598
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   599
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   600
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   601
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   602
		if TimeLeft == 0 then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   603
			DisableTumbler()
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   604
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   605
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   606
		-- handle movement based on IO
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   607
		moveTimer = moveTimer + 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   608
		if moveTimer == 100 then -- 100
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   609
			moveTimer = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   610
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   611
			runOnflames(HandleLife)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   612
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   613
			---------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   614
			-- new trail code
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   615
			---------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   616
			-- 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
   617
			if (TimeLeft <= 5) and (TimeLeft > 0) then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   618
				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
   619
				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
   620
				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
   621
			end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   622
			--------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   623
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   624
			dx, dy = GetGearVelocity(CurrentHedgehog)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   625
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   626
			dxlimit = 0.4*fMod
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   627
			dylimit = 0.4*fMod
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   628
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   629
			if dx > dxlimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   630
				dx = dxlimit
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   631
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   632
			if dy > dylimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   633
				dy = dylimit
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   634
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   635
			if dx < -dxlimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   636
				dx = -dxlimit
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   637
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   638
			if dy < -dylimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   639
				dy = -dylimit
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   640
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   641
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
			if leftOn == true then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   644
				dx = dx - 0.1*fMod
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   645
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   646
			if rightOn == true then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   647
				dx = dx + 0.1*fMod
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   648
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   649
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   650
			if upOn == true then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   651
				dy = dy - 0.1*fMod
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   652
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   653
			if downOn == true then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   654
				dy = dy + 0.1*fMod
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   655
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   656
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   657
			SetGearVelocity(CurrentHedgehog, dx, dy)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   658
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   659
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   660
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   661
		--
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   662
		--flamer
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   663
		--
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   664
		fireTimer = fireTimer + 1
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   665
		if fireTimer == 6 then	-- 5 --10
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   666
			fireTimer = 0
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   667
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   668
			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
   669
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   670
				wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   671
				AddCaption(
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   672
						loc("Flamer") .. ": " ..
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   673
						(wepAmmo[wepIndex]/800*100) - (wepAmmo[wepIndex]/800*100)%2 .. "%",
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   674
						wepCol[2],
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   675
						capgrpMessage2
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   676
						)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   677
				DrawTag(3)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   678
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   679
				dx, dy = GetGearVelocity(CurrentHedgehog)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   680
				shell = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtFlame, 0, 0, 0, 0)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   681
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   682
				xdev = 1 + GetRandom(25)	--15
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   683
				xdev = xdev / 100
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   684
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   685
				r = GetRandom(2)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   686
				if r == 1 then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   687
					xdev = xdev*-1
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   688
				end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   689
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   690
				ydev = 1 + GetRandom(25)	--15
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   691
				ydev = ydev / 100
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   692
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   693
				r = GetRandom(2)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   694
				if r == 1 then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   695
					ydev = ydev*-1
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   696
				end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   697
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   698
				--*13	--8	*-4
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   699
				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
   700
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   701
			end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   702
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   703
		end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   704
		--
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   705
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   706
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   707
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   708
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   709
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   710
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   711
function isATrackedGear(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   712
	if 	(GetGearType(gear) == gtExplosives) or
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   713
		(GetGearType(gear) == gtMine) or
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   714
		(GetGearType(gear) == gtCase)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   715
	then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   716
		return(true)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   717
	else
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   718
		return(false)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   719
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   720
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   721
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   722
--[[function onGearDamage(gear, damage)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   723
	if gear == CurrentHedgehog then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   724
		-- You are now tumbling
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   725
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   726
end]]
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   727
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   728
function onGearAdd(gear)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   729
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   730
	if GetGearType(gear) == gtFlame then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   731
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   732
		trackFGear(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   733
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   734
		fGears = fGears +1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   735
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   736
		if fGears < 80 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   737
			setFGearValue(gear,"L",30)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   738
		else
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   739
			setFGearValue(gear,"L",5) --3
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   740
		end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   741
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   742
	elseif isATrackedGear(gear) then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   743
		trackGear(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   744
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   745
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   746
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   747
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   748
function onGearDelete(gear)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   749
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   750
	if GetGearType(gear) == gtFlame then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   751
		trackFGearDeletion(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   752
		fGears = fGears -1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   753
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   754
	elseif isATrackedGear(gear) then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   755
		trackDeletion(gear)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   756
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   757
	-- achievements? prototype
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   758
	elseif GetGearType(gear) == gtHedgehog then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   759
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   760
		if GetHogTeamName(gear) ~= GetHogTeamName(CurrentHedgehog) then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   761
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   762
			roundKills = roundKills + 1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   763
			if roundKills == 2 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   764
				AddCaption(loc("Double Kill!"),0xffba00ff,capgrpMessage2)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   765
			elseif roundKills == 3 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   766
				AddCaption(loc("Killing spree!"),0xffba00ff,capgrpMessage2)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   767
			elseif roundKills >= 4 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   768
				AddCaption(loc("Unstoppable!"),0xffba00ff,capgrpMessage2)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   769
			end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   770
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   771
		elseif gear == CurrentHedgehog then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   772
			DisableTumbler()
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   773
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   774
		elseif gear ~= CurrentHedgehog then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   775
			AddCaption(loc("Friendly Fire!"),0xffba00ff,capgrpMessage2)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   776
		end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   777
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   778
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   779
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   780
	if CurrentHedgehog ~= nil then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   781
		FollowGear(CurrentHedgehog)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   782
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   783
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   784
end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   785
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   786