share/hedgewars/Data/Scripts/Multiplayer/Tumbler.lua
author Wuzzy <Wuzzy2@mail.ru>
Wed, 08 Aug 2018 15:22:34 +0200
changeset 13648 690cc84e9fd6
parent 13586 9c8749bb0d06
child 13690 09ea1faf97ca
permissions -rw-r--r--
Use capcolDefault in Lua scripts
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
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
     3
-- v.0.8.0
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
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
     6
--[[
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
     7
SCRIPT PARAMETER
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
     8
The script is configured with the script parameter.
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
     9
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    10
Additional configuration in the game scheme is permitted.
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    11
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    12
The script parameter is a comma-separated list of key=value pairs.
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    13
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    14
The values are always whole numbers, the keys are listed below.
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    15
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    16
Key			Default	Description
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    17
----------------------------------------------------------------------
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    18
spawnbarrels		2	Number of barrels that spawn per turn
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    19
spawnmines		4	Number of mines that spawn per turn
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    20
ammoflamer		50	Initial fuel/ammo of Flamer
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    21
ammobarrel		2	Initial ammo of Barrel Launcher
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    22
ammomine		1	Initial ammo of Mine Deployer
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    23
minetimerplaced		1000	Mine timer of mines dropped from Mine Deployer (!) in milliseconds
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    24
bonustime		25	Bonus time in utility crates, in seconds
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    25
bonusflames		800	Flamer fuel bonus in ammo crates
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    26
chanceammo		30	Chance (in %) that an ammo crate will drop before a turn
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    27
chancetime		50	Chance (in %) that an utility crate (extra time) will drop before a turn
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    28
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    29
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    30
EXAMPLES:
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    31
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    32
ammoflamer=800, ammomine=5
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    33
--> Starts the game with 800 Flamer fuel and 5 Mine Deployer mines.
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    34
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    35
chancetime=0
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    36
--> No clock crates.
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    37
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    38
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    39
GAME SCHEME CONFIGURATION
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    40
The script recognizes most game modifiers and settings, but changing the following game modifiers
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    41
will have no effect:
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    42
- Artillery
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    43
- Tag Team
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    44
- Shared ammo
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    45
- Per-hog ammo
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    46
- Place hogs
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    47
- Invulnerable
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    48
- Reset weapons
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    49
]]
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    50
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    51
8043
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 5827
diff changeset
    52
HedgewarsScriptLoad("/Scripts/Locale.lua")
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 5827
diff changeset
    53
HedgewarsScriptLoad("/Scripts/Tracker.lua")
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    54
HedgewarsScriptLoad("/Scripts/Params.lua")
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    55
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    56
local fMod = 1000000 -- use this for dev and .16+ games
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    57
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    58
local leftOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    59
local rightOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    60
local upOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    61
local downOn = false
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    62
local preciseOn = false
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    63
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    64
local wep = {}
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    65
local wepAmmo = {}
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    66
local wepCol = {}
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    67
local wepIndex = 0
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    68
local wepCount = 0
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    69
local fGears = 0
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    70
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    71
local mineSpawn
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    72
local barrelSpawn
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    73
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    74
local roundKills = 0
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    75
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    76
local moveTimer = 0
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    77
local fireTimer = 0
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    78
local TimeLeftCounter = 0
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    79
local TimeLeft = 0
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    80
local stopMovement = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    81
local tumbleStarted = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    82
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
    83
local vTag = {}
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    84
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    85
local barrelSpawn = 2
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    86
local mineSpawn = 4
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    87
local initAmmoFlamer = 50
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    88
local initAmmoBarrel = 2
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    89
local initAmmoMine = 1
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    90
local placedMineTime = 1000
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    91
local bonusTime = 25
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    92
local bonusFlames = 800
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    93
local chanceAmmo = 30
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    94
local chanceTime = 50
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    95
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
    96
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    97
------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    98
-- version 0.4
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
    99
------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   100
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   101
-- removed some old code/comments
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   102
-- 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
   103
-- 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
   104
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   105
-- 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
   106
-- 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
   107
-- added support for primary fire being onAttackUp
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   108
-- 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
   109
-- 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
   110
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   111
------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   112
-- version 0.5
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   113
------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   114
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   115
-- changed some of the user feedback
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   116
-- i can't remember??
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   117
-- substituted onAttackUp for onPrecise()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   118
-- brought in line with new velocity changes
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
------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   121
-- version 0.6
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   122
------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   123
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   124
-- reduced starting "ammo"
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   125
-- 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
   126
-- updated user feedback
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   127
-- better locs and coloured addcaptions
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   128
-- added tag for turntime
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   129
-- removed tractor beam
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   130
-- 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
   131
-- 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
   132
-- 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
   133
-- 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
   134
-- modified crate frequencies a bit
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   135
-- added some simple kill-based achievements, i think
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   136
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   137
------------------------
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   138
-- version 0.7
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
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   141
-- a few code optimisations/performance tweaks
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   142
-- removed some deprecated code
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   143
-- fix a potential spawn bug
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   144
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   145
-- improved HUD (now shows ammo counts)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   146
-- improved user feedback (less generic messages)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   147
-- colour-coded addcaptions to match hud :)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   148
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   149
-- base tumbling time now equals scheme turntime
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   150
-- 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
   151
-- new mines per turn based on minesnum
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   152
-- new barrels per turn based on explosives
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   153
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   154
-- 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
   155
-- slightly increased grab distance for explosives/mines
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   156
-- slightly increased flamer velocity
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   157
-- slightly decreased flamer volume
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   158
-- added a flame vaporiser (based on number of flame gears?)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   159
-- 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
   160
-- refocus camera on tumbler on newturn (not on crates, barrels etc)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   161
-- increase delay: yes, yes, eat your hearts out
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   162
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   163
-- commit log
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   164
-- Better HUD
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   165
-- Allow more user customization
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   166
-- Bugfix for new gear spawns
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   167
-- Performance tweaks
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   168
-- Variety of small gameplay changes
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   169
5825
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   170
------------------------
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   171
-- version 0.7.1
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   172
------------------------
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   173
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   174
-- redraw HUD on screen resolution change
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   175
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   176
------------------------
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   177
-- version 0.8.0
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   178
------------------------
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   179
-- Allow detailed configuration with script parameter (see above)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   180
-- Alternative weapon selection with slot keys
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   181
--- Slot 1: Barrel Launcher
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   182
--- Slot 2: Mine Deployer
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   183
--- Slot 3: Flamer
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   184
-- Add mine/barrel launch sounds
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   185
-- Improved ammo display
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   186
-- Denied sound + message when trying to fire empty ammo weapon
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   187
-- Slightly better mission description
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   188
--- The old hacks by (ab)using MinesNum, Explosives and HealthCaseAmount have been removed
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   189
-- Permanently disable some gameflags which currently won't work together with this script (see above)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   190
-- Show flamer ammo as fuel everywhere (no more percentage confusion)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   191
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   192
---------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   193
-- some other ideas/things
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   194
---------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   195
--[[
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   196
-- allow invulnerability mode (currently broken, thus disabled)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   197
-- better barrel/minespawn effects
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   198
-- separate grab distance for mines/barrels
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   199
-- bug: message color for remaining ammo does not change if two times the same message
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   200
   (but in different desired color) is shown in quick succession (i.e. "Out of ammo!" for all weapons)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   201
-- [probably not] make barrels always explode?
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   202
-- [probably not] persistent ammo?
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   203
-- [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
   204
]]
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   205
5720
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
----------------------------------------------------------------
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
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   210
local flames = {}
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   211
local fGearValues = {}
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   212
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   213
function runOnflames(func)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   214
    for k, gear in ipairs(flames) do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   215
        func(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   216
    end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   217
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   218
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   219
function trackFGear(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   220
    table.insert(flames, gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   221
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   222
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   223
function trackFGearDeletion(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   224
    fGearValues[gear] = nil
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   225
    for k, g in ipairs(flames) do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   226
        if g == gear then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   227
            table.remove(flames, k)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   228
            break
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   229
        end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   230
    end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   231
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   232
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   233
function getFGearValue(gear, key)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   234
    if fGearValues[gear] ~= nil then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   235
        return fGearValues[gear][key]
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
    return nil
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   238
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   239
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   240
function setFGearValue(gear, key, value)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   241
    found = false
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   242
    for id, values in pairs(fGearValues) do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   243
        if id == gear then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   244
            values[key] = value
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   245
            found = true
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   246
        end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   247
    end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   248
    if not found then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   249
        fGearValues[gear] = { [key] = value }
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   250
    end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   251
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   252
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   253
function decreaseFGearValue(gear, key)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   254
    for id, values in pairs(fGearValues) do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   255
        if id == gear then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   256
            values[key] = values[key] - 1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   257
        end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   258
    end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   259
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   260
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   261
function HandleLife(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   262
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   263
	decreaseFGearValue(gear, "L")
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   264
	if getFGearValue(gear, "L") == 0 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   265
		AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   266
		DeleteGear(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   267
	end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   268
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   269
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   270
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   271
----------------------------------------------------------------
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   272
----------------------------------------------------------------
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   273
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   274
function HideTags()
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   275
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   276
	for i = 0, 3 do
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   277
		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
   278
	end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   279
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   280
end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   281
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   282
function DrawTag(i)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   283
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   284
	zoomL = 1.3
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   285
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   286
	xOffset = 40
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   287
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   288
	if i == 0 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   289
		yOffset = 40
12067
3d03e9294633 Use yellow clock color in Space Invasion and Tumbler
Wuzzy <almikes@aol.com>
parents: 12058
diff changeset
   290
		tCol = 0xffee00ff
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   291
		tValue = TimeLeft
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   292
	elseif i == 1 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   293
		zoomL = 1.1
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   294
		yOffset = 70
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   295
		tCol = wepCol[0]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   296
		tValue = wepAmmo[0]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   297
	elseif i == 2 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   298
		zoomL = 1.1
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   299
		xOffset = 40 + 35
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   300
		yOffset = 70
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   301
		tCol = wepCol[1]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   302
		tValue = wepAmmo[1]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   303
	elseif i == 3 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   304
		zoomL = 1.1
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   305
		xOffset = 40 + 70
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   306
		yOffset = 70
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   307
		tCol = wepCol[2]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   308
		tValue = wepAmmo[2]
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   309
	end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   310
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   311
	DeleteVisualGear(vTag[i])
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   312
	vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   313
	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
   314
	SetVisualGearValues	(
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   315
				vTag[i], 		--id
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   316
				-(ScreenWidth/2) + xOffset,	--xoffset
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   317
				ScreenHeight - yOffset, --yoffset
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   318
				0, 			--dx
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   319
				0, 			--dy
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   320
				zoomL, 			--zoom
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   321
				1, 			--~= 0 means align to screen
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   322
				g7, 			--frameticks
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   323
				tValue, 		--value
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   324
				240000, 		--timer
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   325
				tCol		--GetClanColor( GetHogClan(CurrentHedgehog) )
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   326
				)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   327
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   328
end
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
function GetGearDistance(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   331
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   332
	g1X, g1Y = GetGearPosition(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   333
	g2X, g2Y = GetGearPosition(CurrentHedgehog)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   334
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   335
	q = g1X - g2X
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   336
	w = g1Y - g2Y
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   337
	return( (q*q) + (w*w) )
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   338
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
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   341
-- 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
   342
-- 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
   343
function CheckProximityToExplosives(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   344
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   345
	if (GetGearDistance(gear) < 1400) then
5598
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
		if (GetGearType(gear) == gtExplosives) then
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   348
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   349
			wepAmmo[0] = wepAmmo[0] + 1
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   350
			PlaySound(sndShotgunReload)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   351
			DeleteGear(gear)
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   352
			AddCaption(loc("+1 barrel!"), wepCol[0], capgrpAmmoinfo )
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   353
			DrawTag(1)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   354
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   355
		elseif (GetGearType(gear) == gtMine) then
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   356
			wepAmmo[1] = wepAmmo[1] + 1
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   357
			PlaySound(sndShotgunReload)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   358
			DeleteGear(gear)
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   359
			AddCaption(loc("+1 mine!"), wepCol[1], capgrpAmmoinfo )
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   360
			DrawTag(2)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   361
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   362
		end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   363
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   364
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   365
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   366
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   367
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   368
-- check proximity on crates
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   369
function CheckProximity(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   370
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   371
	dist = GetGearDistance(gear)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   372
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   373
	if (dist < 1600) and (GetGearType(gear) == gtCase) then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   374
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   375
		if band(GetGearPos(gear), 0x4) ~= 0 then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   376
12067
3d03e9294633 Use yellow clock color in Space Invasion and Tumbler
Wuzzy <almikes@aol.com>
parents: 12058
diff changeset
   377
			AddCaption(string.format(loc("+%d seconds!"), bonusTime), 0xffee00ff, capgrpMessage2 )
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   378
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   379
			TimeLeft = TimeLeft + bonusTime
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   380
			DrawTag(0)
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   381
			PlaySound(sndExtraTime)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   382
		elseif band(GetGearPos(gear), 0x1) ~= 0 then
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   383
			wepAmmo[2] = wepAmmo[2] + bonusFlames
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   384
			PlaySound(sndShotgunReload)
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   385
			AddCaption(string.format(loc("+%d flamer fuel!"), bonusFlames), wepCol[2], capgrpAmmoinfo )
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   386
			DrawTag(3)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   387
		end
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   388
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   389
		DeleteGear(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   390
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   391
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   392
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   393
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   394
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   395
function shotsRemainingMessage()
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   396
	local shotsMsg
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   397
	if wepAmmo[wepIndex] <= 0 then
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   398
		shotsMsg = loc("Out of ammo!")
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   399
	else
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   400
		if wepIndex == 2 then
12057
144264948277 Change ammo display texts in Tumbler to avoid pluralization failures
Wuzzy <almikes@aol.com>
parents: 12056
diff changeset
   401
			shotsMsg = loc("Fuel: %d")
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   402
		else
12057
144264948277 Change ammo display texts in Tumbler to avoid pluralization failures
Wuzzy <almikes@aol.com>
parents: 12056
diff changeset
   403
			shotsMsg = loc("Ammo: %d")
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   404
		end
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   405
	end
13586
9c8749bb0d06 Clean up Tumbler captions a bit
Wuzzy <Wuzzy2@mail.ru>
parents: 12349
diff changeset
   406
	AddCaption(string.format(shotsMsg, wepAmmo[wepIndex]), wepCol[wepIndex],capgrpAmmostate)
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   407
end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   408
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   409
function ChangeWeapon(newIndex)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   410
	if newIndex == nil then
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   411
		wepIndex = wepIndex + 1
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   412
		if wepIndex == wepCount then
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   413
			wepIndex = 0
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   414
		end
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   415
	else
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   416
		wepIndex = newIndex
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   417
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   418
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   419
	local selText
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   420
	if wepIndex == 0 then
13586
9c8749bb0d06 Clean up Tumbler captions a bit
Wuzzy <Wuzzy2@mail.ru>
parents: 12349
diff changeset
   421
		selText = loc("Barrel Launcher")
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   422
	elseif wepIndex == 1 then
13586
9c8749bb0d06 Clean up Tumbler captions a bit
Wuzzy <Wuzzy2@mail.ru>
parents: 12349
diff changeset
   423
		selText = loc("Mine Deployer")
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   424
	else
13586
9c8749bb0d06 Clean up Tumbler captions a bit
Wuzzy <Wuzzy2@mail.ru>
parents: 12349
diff changeset
   425
		selText = loc("Flamer")
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   426
	end
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   427
	AddCaption(selText, wepCol[wepIndex],capgrpAmmoinfo )
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   428
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   429
	shotsRemainingMessage()
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   430
end
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   431
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   432
---------------
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   433
-- Parse parameters
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   434
---------------
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   435
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   436
function parseNum(key, default, min, max)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   437
	local num = tonumber(params[key])
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   438
	if type(num) ~= "number" then 
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   439
		if default ~= nil then
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   440
			return default
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   441
		else
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   442
			return nil
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   443
		end
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   444
	end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   445
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   446
	if min ~= nil then
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   447
		num = math.max(min, num)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   448
	end
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   449
	if max ~= nil then
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   450
		num = math.min(max, num)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   451
	end
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   452
	return num
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   453
end
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   454
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   455
function onParameters()
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   456
	parseParams()
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   457
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   458
	barrelSpawn = parseNum("spawnbarrels", barrelSpawn, 0)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   459
	mineSpawn = parseNum("spawnmines", mineSpawn, 0)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   460
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   461
	initAmmoFlamer = parseNum("ammoflamer", initAmmoFlamer, 0)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   462
	initAmmoBarrel = parseNum("ammobarrel", initAmmoBarrel, 0)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   463
	initAmmoMine = parseNum("ammomine", initAmmoMine, 0)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   464
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   465
	placedMineTime = parseNum("minetimeplaced", placedMineTime, 0, 5000)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   466
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   467
	bonusTime = parseNum("bonustime", bonusTime, 0)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   468
	bonusFlames = parseNum("bonusflames", bonusFlames, 0)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   469
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   470
	chanceAmmo = parseNum("chanceammo", chanceAmmo, 0, 100)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   471
	chanceTime = parseNum("chancetime", chanceTime, 0, 100)
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
---------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   475
-- action keys
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   476
---------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   477
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   478
function onPrecise()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   479
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   480
	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   481
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   482
		if wepAmmo[wepIndex] <= 0 then
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   483
			PlaySound(sndDenied)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   484
			shotsRemainingMessage()
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   485
		else
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   486
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   487
			wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   488
			shotsRemainingMessage()
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   489
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   490
			if wep[wepIndex] == loc("Barrel Launcher") then
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   491
				morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtExplosives, 0, 0, 0, 1)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   492
				CopyPV(CurrentHedgehog, morte) -- new addition
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   493
				x,y = GetGearVelocity(morte)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   494
				x = x*2
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   495
				y = y*2
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   496
				SetGearVelocity(morte, x, y)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   497
				DrawTag(1)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   498
				PlaySound(sndThrowRelease)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   499
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   500
			elseif wep[wepIndex] == loc("Mine Deployer") then
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   501
				morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtMine, 0, 0, 0, 0)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   502
				SetTimer(morte, placedMineTime)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   503
				DrawTag(2)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   504
				PlaySound(sndThrowRelease)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   505
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   506
			end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   507
		end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   508
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   509
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   510
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   511
	preciseOn = true
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   512
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   513
end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   514
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   515
function onPreciseUp()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   516
	preciseOn = false
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   517
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   518
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   519
onAttack = onPrecise
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   520
onAttackUp = onPreciseUp
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   521
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   522
function onHJump()
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   523
	-- 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
   524
	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
   525
		runOnGears(CheckProximityToExplosives)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   526
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   527
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   528
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   529
-------------------
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   530
-- Weapon selection
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   531
-------------------
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   532
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   533
function onLJump()
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   534
	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   535
		ChangeWeapon()
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   536
	end
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   537
end
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   538
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   539
function onSlot(slot)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   540
	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   541
		if slot >= 0 and slot <= 2 then
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   542
			ChangeWeapon(slot)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   543
		end
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   544
	end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   545
end
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   546
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   547
-----------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   548
-- movement keys
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   549
-----------------
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   550
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   551
function onLeft()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   552
	if (CurrentHedgehog ~= nil) and (stopMovement == false) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   553
		leftOn = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   554
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   555
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   556
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   557
function onRight()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   558
	if (CurrentHedgehog ~= nil) and (stopMovement == false) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   559
		rightOn = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   560
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   561
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   562
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   563
function onUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   564
	if (CurrentHedgehog ~= nil) and (stopMovement == false) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   565
		upOn = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   566
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   567
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   568
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   569
function onDown()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   570
	if (CurrentHedgehog ~= nil) and (stopMovement == false) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   571
		downOn = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   572
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   573
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   574
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   575
function onDownUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   576
	downOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   577
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   578
function onUpUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   579
	upOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   580
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   581
function onLeftUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   582
	leftOn = false
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
function onRightUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   585
	rightOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   586
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   587
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   588
--------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   589
-- other event handlers
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   590
--------------------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   591
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   592
function onGameInit()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   593
	CaseFreq = 0
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   594
	HealthCaseProb = 0
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   595
	Delay = 1000
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   596
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   597
	for i = 0, 3 do
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   598
		vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   599
	end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   600
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   601
	HideTags()
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   602
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   603
	wep[0] = loc("Barrel Launcher")
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   604
	wep[1] = loc("Mine Deployer")
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   605
	wep[2] = loc("Flamer")
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   606
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   607
	wepCol[0] = 0x78818eff
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   608
	wepCol[1] = 0xa12a77ff
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   609
	wepCol[2] = 0xf49318ff
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   610
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   611
	wepCount = 3
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   612
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   613
	DisableGameFlags(gfArtillery + gfSharedAmmo + gfPerHogAmmo + gfTagTeam + gfPlaceHog + gfInvulnerable)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   614
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   615
end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   616
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   617
function onGameStart()
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   618
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   619
	local clockStr
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   620
	local timeStr
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   621
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   622
	if chanceTime > 0 then
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   623
		clockStr = loc("Utility crates extend your time.") .. "|"
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   624
		timeStr = string.format(loc("Time extension: %ds"), bonusTime) .. "|"
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   625
	else
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   626
		clockStr = ""
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   627
		timeStr = ""
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   628
	end
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   629
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   630
	ShowMission	(
12069
54f53cf14ae4 Make name “Tumbler” translatable
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   631
			loc("Tumbler"),
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   632
			loc("A Hedgewars mini-game"),
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   633
			loc("Fly around and hurl explosives to your enemies.") .."|"..
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   634
			loc("Eliminate the enemy hogs to win.") .. "|" ..
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   635
			" " .. "|" ..
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   636
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   637
			string.format(loc("New mines per turn: %d"), mineSpawn) .. "|" ..
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   638
			string.format(loc("New barrels per turn: %d"), barrelSpawn) .. "|" ..
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   639
			timeStr ..
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   640
			" " .. "|" ..
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   641
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   642
			loc("Movement: [Up], [Down], [Left], [Right]") .. "|" ..
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   643
			loc("Fire: [Precise]") .. "|" ..
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   644
			loc("Change weapon: [Long jump] or [Slot 1]-[Slot 3]") .. "|" ..
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   645
			loc("Grab mines/barrels: [High jump]") .. "|" ..
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   646
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   647
			" " .. "|" ..
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   648
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   649
			clockStr ..
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   650
			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
   651
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   652
			"", 4, 4000
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   653
			)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   654
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   655
end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   656
5825
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   657
function onScreenResize()
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   658
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   659
	-- 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
   660
	if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   661
		for i = 0, 3 do
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   662
			DrawTag(i)
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   663
		end
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   664
	end
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   665
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5720
diff changeset
   666
end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   667
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   668
function onAmmoStoreInit()
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   669
	-- Remove all conventional weapons
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   670
	for a=0, 56 do
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   671
		SetAmmo(a, 0, 0, 0, 0)
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   672
	end
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   673
end
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   674
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   675
function onNewTurn()
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   676
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   677
	stopMovement = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   678
	tumbleStarted = false
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   679
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   680
	-- 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
   681
	for i = 0, barrelSpawn-1 do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   682
		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
   683
		SetHealth(gear, 100)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   684
		if FindPlace(gear, false, 0, LAND_WIDTH, false) ~= nil then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   685
			tempE = AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   686
		end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   687
	end
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   688
	for i = 0, mineSpawn-1 do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   689
		gear = AddGear(100, 100, gtMine, 0, 0, 0, 0)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   690
		if FindPlace(gear, false, 0, LAND_WIDTH, false) ~= nil then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   691
			tempE = AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   692
		end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   693
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   694
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   695
	-- 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
   696
	r = GetRandom(100)
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   697
	if r > 100-chanceTime then
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   698
		gear = SpawnFakeUtilityCrate(0, 0, false, false)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   699
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   700
	r = GetRandom(100)
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   701
	if r > 100-chanceAmmo then
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   702
		gear = SpawnFakeAmmoCrate(0, 0, false, false)
5598
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
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   705
	HideTags()
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   706
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   707
	--reset ammo counts
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   708
	wepAmmo[0] = 2
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   709
	wepAmmo[1] = 1
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   710
	wepAmmo[2] = 50 -- 50000 -- 50
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   711
	wepIndex = 2
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   712
	ChangeWeapon()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   713
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   714
	roundKills = 0
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   715
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   716
	FollowGear(CurrentHedgehog)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   717
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   718
end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   719
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   720
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   721
function DisableTumbler()
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   722
	stopMovement = true
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   723
	upOn = false
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   724
	down = false
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   725
	leftOn = false
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   726
	rightOn = false
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   727
	HideTags()
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   728
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   729
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   730
function onGameTick()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   731
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   732
	-- 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
   733
	if tumbleStarted == false then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   734
		if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   735
			tumbleStarted = true
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   736
			TimeLeft = (TurnTime/1000)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   737
			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   738
			SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog) + 47) -- new
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   739
			for i = 0, 3 do
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   740
				DrawTag(i)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   741
			end
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   742
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   743
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   744
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   745
	if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   746
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   747
		runOnGears(CheckProximity) -- crates
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   748
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   749
		-- Calculate and display turn time
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   750
		TimeLeftCounter = TimeLeftCounter + 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   751
		if TimeLeftCounter == 1000 then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   752
			TimeLeftCounter = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   753
			TimeLeft = TimeLeft - 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   754
12058
281a4f33b08f Add countdown sounds to Tumbler
Wuzzy <almikes@aol.com>
parents: 12057
diff changeset
   755
			-- Countdown sounds
281a4f33b08f Add countdown sounds to Tumbler
Wuzzy <almikes@aol.com>
parents: 12057
diff changeset
   756
			if TimeLeft == 5 then
281a4f33b08f Add countdown sounds to Tumbler
Wuzzy <almikes@aol.com>
parents: 12057
diff changeset
   757
				PlaySound(sndHurry, CurrentHedgehog)
281a4f33b08f Add countdown sounds to Tumbler
Wuzzy <almikes@aol.com>
parents: 12057
diff changeset
   758
			elseif TimeLeft <= 4 and TimeLeft >= 1 then
281a4f33b08f Add countdown sounds to Tumbler
Wuzzy <almikes@aol.com>
parents: 12057
diff changeset
   759
				PlaySound(_G["sndCountdown"..TimeLeft])
281a4f33b08f Add countdown sounds to Tumbler
Wuzzy <almikes@aol.com>
parents: 12057
diff changeset
   760
			end
281a4f33b08f Add countdown sounds to Tumbler
Wuzzy <almikes@aol.com>
parents: 12057
diff changeset
   761
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   762
			if TimeLeft >= 0 then
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   763
				DrawTag(0)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   764
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   765
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   766
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   767
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   768
		if TimeLeft == 0 then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   769
			DisableTumbler()
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   770
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   771
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   772
		-- handle movement based on IO
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   773
		moveTimer = moveTimer + 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   774
		if moveTimer == 100 then -- 100
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   775
			moveTimer = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   776
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   777
			runOnflames(HandleLife)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   778
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   779
			---------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   780
			-- new trail code
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   781
			---------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   782
			-- 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
   783
			if (TimeLeft <= 5) and (TimeLeft > 0) then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   784
				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
   785
				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
   786
				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
   787
			end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   788
			--------------
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   789
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   790
			dx, dy = GetGearVelocity(CurrentHedgehog)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   791
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   792
			dxlimit = 0.4*fMod
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   793
			dylimit = 0.4*fMod
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   794
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   795
			if dx > dxlimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   796
				dx = dxlimit
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   797
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   798
			if dy > dylimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   799
				dy = dylimit
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   800
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   801
			if dx < -dxlimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   802
				dx = -dxlimit
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   803
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   804
			if dy < -dylimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   805
				dy = -dylimit
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   806
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   807
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   808
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   809
			if leftOn == true then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   810
				dx = dx - 0.1*fMod
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   811
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   812
			if rightOn == true then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   813
				dx = dx + 0.1*fMod
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   814
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   815
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   816
			if upOn == true then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   817
				dy = dy - 0.1*fMod
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   818
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   819
			if downOn == true then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   820
				dy = dy + 0.1*fMod
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   821
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   822
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   823
			SetGearVelocity(CurrentHedgehog, dx, dy)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   824
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   825
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   826
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   827
		--
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   828
		--flamer
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   829
		--
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   830
		fireTimer = fireTimer + 1
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   831
		if fireTimer == 6 then	-- 5 --10
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   832
			fireTimer = 0
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   833
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   834
			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
   835
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   836
				wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1
12056
05a968518a56 Tumbler updates: Script params, select weaps via slots, more sounds, rewrite texts, ignore broken gameflags
Wuzzy <almikes@aol.com>
parents: 8043
diff changeset
   837
				shotsRemainingMessage()
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   838
				DrawTag(3)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   839
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   840
				dx, dy = GetGearVelocity(CurrentHedgehog)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   841
				shell = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtFlame, 0, 0, 0, 0)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   842
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   843
				xdev = 1 + GetRandom(25)	--15
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   844
				xdev = xdev / 100
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   845
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   846
				r = GetRandom(2)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   847
				if r == 1 then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   848
					xdev = xdev*-1
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   849
				end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   850
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   851
				ydev = 1 + GetRandom(25)	--15
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   852
				ydev = ydev / 100
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   853
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   854
				r = GetRandom(2)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   855
				if r == 1 then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   856
					ydev = ydev*-1
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   857
				end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   858
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   859
				--*13	--8	*-4
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   860
				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
   861
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   862
			end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   863
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   864
		end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   865
		--
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   866
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   867
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   868
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   869
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   870
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   871
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   872
function isATrackedGear(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   873
	if 	(GetGearType(gear) == gtExplosives) or
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   874
		(GetGearType(gear) == gtMine) or
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   875
		(GetGearType(gear) == gtCase)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   876
	then
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   877
		return(true)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   878
	else
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   879
		return(false)
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   880
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   881
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   882
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   883
function onGearAdd(gear)
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   884
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   885
	if GetGearType(gear) == gtFlame then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   886
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   887
		trackFGear(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   888
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   889
		fGears = fGears +1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   890
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   891
		if fGears < 80 then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   892
			setFGearValue(gear,"L",30)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   893
		else
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   894
			setFGearValue(gear,"L",5) --3
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   895
		end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   896
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   897
	elseif isATrackedGear(gear) then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   898
		trackGear(gear)
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   899
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   900
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   901
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   902
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   903
function onGearDelete(gear)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   904
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   905
	if GetGearType(gear) == gtFlame then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   906
		trackFGearDeletion(gear)
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   907
		fGears = fGears -1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   908
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   909
	elseif isATrackedGear(gear) then
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   910
		trackDeletion(gear)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   911
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   912
	-- achievements? prototype
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   913
	elseif GetGearType(gear) == gtHedgehog then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   914
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   915
		if GetHogTeamName(gear) ~= GetHogTeamName(CurrentHedgehog) then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   916
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   917
			roundKills = roundKills + 1
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   918
			if roundKills == 2 then
13648
690cc84e9fd6 Use capcolDefault in Lua scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13586
diff changeset
   919
				AddCaption(loc("Double Kill!"),capcolDefault,capgrpMessage2)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   920
			elseif roundKills == 3 then
13648
690cc84e9fd6 Use capcolDefault in Lua scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13586
diff changeset
   921
				AddCaption(loc("Killing spree!"),capcolDefault,capgrpMessage2)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   922
			elseif roundKills >= 4 then
13648
690cc84e9fd6 Use capcolDefault in Lua scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13586
diff changeset
   923
				AddCaption(loc("Unstoppable!"),capcolDefault,capgrpMessage2)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   924
			end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   925
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   926
		elseif gear == CurrentHedgehog then
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   927
			DisableTumbler()
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   928
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   929
		elseif gear ~= CurrentHedgehog then
13648
690cc84e9fd6 Use capcolDefault in Lua scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13586
diff changeset
   930
			AddCaption(loc("Friendly Fire!"),capcolDefault,capgrpMessage2)
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   931
		end
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   932
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   933
	end
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   934
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   935
	if CurrentHedgehog ~= nil then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   936
		FollowGear(CurrentHedgehog)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   937
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   938
5720
a962d0823f49 onHogAttack hook. Might reposition this later.
mikade
parents: 5598
diff changeset
   939
end
5598
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   940
265429f7ba85 - Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents: 5325
diff changeset
   941