share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua
author mikade <redgrinner@gmail.com>
Mon, 27 Oct 2014 21:24:55 +0900
changeset 10447 139cb2c9e9f6
child 10673 2f19ff0ded73
permissions -rw-r--r--
Add Construction Mode (probably needs testing / fixing)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10447
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
     1
---------------------------------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
     2
--- LE CONSTRUCTION MODE 0.7 (badly adapted from Hedge Editor 0.5)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
     3
---------------------------------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
     4
-- a hedgewars gameplay mode by mikade
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
     5
-- special thanks to all who helped test and offered suggestions
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
     6
-- additional thanks to sheepluva/nemo for adding some extra hooks
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
     7
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
     8
-- (to do)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
     9
-- investigate loc not working on addcaptions
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    10
-- check for parsecommands before porting to dev
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    11
-- test onUpDown more extensively as it may need revision (check for amRubber etc)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    12
-- test localization of weapons and utils and stuff
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    13
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    14
-- try posistion grenades in Harmer so it blows hogs away from the struc
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    15
-- and don't explode too close to the struc
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    16
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    17
-- additional/previous balance ideas
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    18
-- based on your money?
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    19
-- based on the number of strucs/gens you own?
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    20
-- based on your existing arsenal?
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    21
-- limit number of crates spawned per round perhaps (done)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    22
-- limit number of generators?
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    23
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    24
------------------------------------------------------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    25
--version history
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    26
------------------------------------------------------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    27
--v0.1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    28
-- concept test
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    29
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    30
--v0.2
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    31
-- improved documentation (in script and in game)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    32
-- improved localisation (or is it? at any rate, crate placement should now say e.g. Bazooka and not amBazooka)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    33
-- added variable weapon costs (based on the values from Vatten's Consumerism script)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    34
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    35
-- added reflector shield (still needs work and balancing)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    36
-- added weapon-filter (probably ok)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    37
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    38
-- enabled super weapons like ballgun, rcplane, watermelon, hellish to test balance
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    39
-- reduce max money to 1000
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    40
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    41
--v0.3
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    42
-- some /s removed
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    43
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    44
--v0.4
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    45
-- added support for per hog ammo (hopefully)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    46
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    47
--v0.5 (dev)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    48
-- added somewhat horribly implemented support for different structure sprites
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    49
-- added override pictures for ammo menu
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    50
-- added override message on wep select to aid understanding
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    51
-- split menu into/between weps/parts: struc, crates, gears
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    52
-- add a limit on crates per turn
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    53
-- add a limit on extra time per turn
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    54
-- add a test level
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    55
-- restored rubber placement
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    56
-- cleaned up some of the code a bit and removed about 280 lines of code I didn't need, lol
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    57
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    58
--v0.6 (dev)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    59
-- added magic dance
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    60
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    61
--v.07 (pushed to repo)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    62
-- added a cfg file
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    63
-- removed another 903 lines of code we weren't using (lol)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    64
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    65
--------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    66
-- STRUCTURES LIST / IDEAS
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    67
--------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    68
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    69
--Healing Station: heals hogs to 150 life
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    70
--Teleportation Node: allows teleporting to any other teleporter nodes
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    71
--Bio-filter: explodes enemy hogs
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    72
--Respawner: if you have one of these, any slain hogs are resurrected here :D
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    73
--Generator: generates energy (used to buy stuff, and possibly later other strucs might have upkeep costs)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    74
--Support Station: allows purchasing of weapons, utilities, and med-crates
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    75
--Construction Station: allows purchasing of girders, rubber, mines, sticky mines, barrels
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    76
--Reflector Shield: reflect projectiles
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    77
--Weapon Filter: kill all equipement of enemy hogs passing through this area.
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    78
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    79
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    80
--to make the grill more attractive make it vaporize flying saucers
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    81
--and also rope, and maybe incoming gears
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    82
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    83
-- make healing thing also cure poison
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    84
-- maybe make poison more virulent and dangerous
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    85
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    86
--(not implemented / abandoned ideas)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    87
-- Core: allows construction of other structures.
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    88
-- Automated Turret (think red drones from space invasion)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    89
-- Canon (gives access to 3 fireballs per turn while near)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    90
-- something that allows control of wind/water
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    91
-- Gravity Field generator : triggers world gravity change
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    92
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    93
-- structures consume power over time and
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    94
-- maybe you can turn structures OFF/ON, manually to save power.
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    95
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    96
-- hacking
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    97
-- allow hacking of structures, either being able to use enemy structures,
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    98
-- or turning a team's structures against them.
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
    99
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   100
-- pylons
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   101
-- allow hogs to put down a pylon-like gear which then allows the core
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   102
-- to place other structures/objects within the pylon's sphere of influence
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   103
-- this would allow aggressive structure advancement
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   104
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   105
-- resouce mining?
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   106
-- you could designate something like mines, that you could get close to,
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   107
-- "pick up", and then "drop" back at a central location to simulate
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   108
-- resource mining. bit complicated/meh, normal power generators probably easier
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   109
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   110
-- it would be cool to have a red mask we could apply over girders
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   111
-- that would indicate they were Indestructible
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   112
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   113
HedgewarsScriptLoad("/Scripts/Locale.lua")
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   114
HedgewarsScriptLoad("/Scripts/Tracker.lua")
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   115
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   116
----------------------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   117
-- STRUC CRAP
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   118
----------------------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   119
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   120
strucID = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   121
strucGear = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   122
strucClan = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   123
strucType = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   124
strucCost = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   125
strucHealth = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   126
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   127
strucCirc = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   128
strucCircCol = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   129
strucCircRadius = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   130
strucCircType = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   131
strucAltDisplay = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   132
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   133
placedExpense = 0
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   134
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   135
tempID = nil
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   136
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   137
sUID = 0
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   138
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   139
colorRed = 0xff0000ff
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   140
colorGreen = 0x00ff00ff
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   141
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   142
clanBoundsSX = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   143
clanBoundsSY = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   144
clanBoundsEX = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   145
clanBoundsEY = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   146
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   147
clanPower = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   148
clanBoon = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   149
clanID = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   150
clanLStrucIndex = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   151
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   152
clanLWepIndex = {} -- for ease of use let's track this stuff
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   153
clanLUtilIndex = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   154
clanLGearIndex = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   155
clanUsedExtraTime = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   156
clanCratesSpawned = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   157
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   158
effectTimer = 0
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   159
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   160
wallsVisible = false
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   161
wX = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   162
wY = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   163
wWidth = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   164
wHeight = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   165
wCol = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   166
margin = 20
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   167
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   168
tauntString = ""
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   169
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   170
vTag = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   171
lastWep = nil
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   172
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   173
function HideTags()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   174
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   175
	for i = 0, 2 do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   176
		SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xffffff00)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   177
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   178
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   179
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   180
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   181
function DrawTag(i)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   182
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   183
	zoomL = 1.3
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   184
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   185
	xOffset = 40
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   186
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   187
	if i == 0 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   188
		yOffset = 40
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   189
		tCol = 0xffba00ff
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   190
		tValue = 30--TimeLeft
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   191
	elseif i == 1 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   192
		zoomL = 1.1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   193
		xOffset = 45
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   194
		yOffset = 70
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   195
		tCol = 0x00ff00ff
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   196
		tValue = clanPower[GetHogClan(CurrentHedgehog)]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   197
	elseif i == 2 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   198
		zoomL = 1.1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   199
		xOffset = 60 + 35
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   200
		yOffset = 70
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   201
		tCol = 0xa800ffff
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   202
		tValue = 10--shieldHealth - 80
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   203
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   204
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   205
	DeleteVisualGear(vTag[i])
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   206
	vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   207
	g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vTag[i])
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   208
	SetVisualGearValues	(
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   209
				vTag[i], 		--id
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   210
				-div(ScreenWidth,2) + xOffset,	--xoffset
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   211
				ScreenHeight - yOffset, --yoffset
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   212
				0, 			--dx
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   213
				0, 			--dy
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   214
				zoomL, 			--zoom
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   215
				1, 			--~= 0 means align to screen
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   216
				g7, 			--frameticks
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   217
				tValue, 		--value
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   218
				240000, 		--timer
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   219
				tCol		--GetClanColor( GetHogClan(CurrentHedgehog) )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   220
				)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   221
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   222
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   223
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   224
function onScreenResize()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   225
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   226
	-- redraw Tags so that their screen locations are updated
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   227
	if (CurrentHedgehog ~= nil) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   228
			DrawTag(0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   229
			DrawTag(1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   230
			DrawTag(2)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   231
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   232
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   233
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   234
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   235
function XYisInRect(px, py, psx, psy, pex, pey)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   236
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   237
	if (px > psx) and (px < pex) and (py > psy) and (py < pey) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   238
		return(true)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   239
	else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   240
		return(false)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   241
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   242
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   243
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   244
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   245
function AddWall(zXMin,zYMin, zWidth, zHeight, zCol)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   246
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   247
	table.insert(wX, zXMin)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   248
	table.insert(wY, zYMin)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   249
	table.insert(wWidth, zWidth)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   250
	table.insert(wHeight, zHeight)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   251
	table.insert(wCol, zCol)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   252
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   253
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   254
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   255
function BorderSpark(zXMin,zYMin, zWidth, zHeight, bCol)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   256
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   257
	eX = zXMin + GetRandom(zWidth+10)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   258
	eY = zYMin + GetRandom(zHeight+10)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   259
	tempE = AddVisualGear(eX, eY, vgtDust, 0, false)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   260
	if tempE ~= 0 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   261
		g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   262
		SetVisualGearValues(tempE, eX, eY, g3, g4, g5, g6, g7, 1, g9, bCol )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   263
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   264
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   265
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   266
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   267
function HandleBorderEffects()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   268
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   269
	effectTimer = effectTimer + 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   270
	if effectTimer > 15 then --25
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   271
		effectTimer = 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   272
		for i = 1, #wX do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   273
			BorderSpark(wX[i],wY[i],wWidth[i],wHeight[i], wCol[i])
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   274
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   275
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   276
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   277
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   278
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   279
----
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   280
-- old reflecting stuff from like 3 years ago lol
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   281
---
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   282
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   283
function gearCanBeDeflected(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   284
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   285
	if 	(GetGearType(gear) == gtShell) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   286
		--(GetGearType(gear) == gtBee) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   287
		(GetGearType(gear) == gtGrenade) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   288
		(GetGearType(gear) == gtAirBomb) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   289
		--(GetGearType(gear) == gtRCPlane) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   290
		--(GetGearType(gear) == gtRope) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   291
		(GetGearType(gear) == gtClusterBomb) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   292
		(GetGearType(gear) == gtCluster) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   293
		(GetGearType(gear) == gtGasBomb) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   294
		--(GetGearType(gear) == gtSeduction) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   295
		(GetGearType(gear) == gtMine) or	-------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   296
		(GetGearType(gear) == gtMortar) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   297
		(GetGearType(gear) == gtHellishBomb) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   298
		(GetGearType(gear) == gtWatermelon) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   299
		(GetGearType(gear) == gtMelonPiece)	or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   300
		(GetGearType(gear) == gtEgg) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   301
		(GetGearType(gear) == gtDrill) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   302
		(GetGearType(gear) == gtBall) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   303
		(GetGearType(gear) == gtExplosives) or	------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   304
			(GetGearType(gear) == gtFlame) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   305
			(GetGearType(gear) == gtPortal) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   306
			(GetGearType(gear) == gtDynamite) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   307
			(GetGearType(gear) == gtSMine) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   308
			--(GetGearType(gear) == gtKamikaze) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   309
			--(GetGearType(gear) == gtRCPlane) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   310
			--(GetGearType(gear) == gtCake) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   311
			--(GetGearType(gear) == gtHedgehog) or ------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   312
		(GetGearType(gear) == gtKnife) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   313
		(GetGearType(gear) == gtJetpack) or -- test this and birdy plz
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   314
		(GetGearType(gear) == gtBirdy) or -- test this and birdy plz
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   315
		(GetGearType(gear) == gtSnowball) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   316
		(GetGearType(gear) == gtMolotov)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   317
	then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   318
		return(true)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   319
	else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   320
		return(false)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   321
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   322
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   323
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   324
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   325
function getThreatDamage(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   326
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   327
	--- damage amounts for weapons
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   328
	if 	(GetGearType(gear) == gtGrenade) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   329
		(GetGearType(gear) == gtClusterBomb) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   330
		(GetGearType(gear) == gtGasBomb) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   331
		(GetGearType(gear) == gtKnife) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   332
		(GetGearType(gear) == gtEgg) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   333
		(GetGearType(gear) == gtMolotov) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   334
		(GetGearType(gear) == gtHellishBomb) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   335
		(GetGearType(gear) == gtWatermelon) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   336
		(GetGearType(gear) == gtSMine)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   337
	then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   338
		dmg = 30
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   339
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   340
	elseif (GetGearType(gear) == gtMelonPiece) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   341
		dmg = 40
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   342
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   343
	elseif (GetGearType(gear) == gtAirBomb) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   344
			(GetGearType(gear) == gtDrill) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   345
			(GetGearType(gear) == gtMine) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   346
			(GetGearType(gear) == gtCluster) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   347
		dmg = 20
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   348
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   349
	elseif (GetGearType(gear) == gtFlame) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   350
			(GetGearType(gear) == gtPortal) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   351
			(GetGearType(gear) == gtDynamite)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   352
			--(GetGearType(gear) == gtKamikaze) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   353
			--(GetGearType(gear) == gtRCPlane) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   354
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   355
			--(GetGearType(gear) == gtCake)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   356
	then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   357
		dmg = 0
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   358
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   359
	elseif (GetGearType(gear) == gtBall) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   360
		dmg = 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   361
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   362
	else	--normal shell, snowball etc
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   363
		dmg = 65
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   364
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   365
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   366
	return(dmg)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   367
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   368
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   369
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   370
function setGearReflectionValues(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   371
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   372
	dmg = getThreatDamage(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   373
	setGearValue(gear,"damage",dmg)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   374
	setGearValue(gear,"deflects",0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   375
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   376
	if (CurrentHedgehog ~= nil) then --and (gameStarted == true) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   377
		setGearValue(gear,"owner",GetHogClan(CurrentHedgehog)) -- NEW NEEDS CHANGE?
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   378
	else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   379
		setGearValue(gear,"owner",10) -- nil
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   380
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   381
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   382
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   383
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   384
function AddStruc(pX,pY, pType, pClan)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   385
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   386
	sUID = sUID + 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   387
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   388
	tempG = AddGear(0, 0, gtTarget, 0, 0, 0, 0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   389
	SetGearPosition(tempG, pX, pY)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   390
	setGearValue(tempG, "sUID", sUID)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   391
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   392
	tempCirc = AddVisualGear(0,0,vgtCircle,0,true)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   393
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   394
	SetVisualGearValues(tempCirc, 0, 0, 100, 255, 1, 100, 0, 500, 1, 0xFFFFFF00)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   395
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   396
	table.insert(strucID, sUID)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   397
	table.insert(strucType, pType)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   398
	table.insert(strucGear,tempG)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   399
	table.insert(strucClan,pClan)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   400
	table.insert(strucCost,2)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   401
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   402
	frameID = 0
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   403
	visualSprite = sprTarget
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   404
	madness = AddVisualGear(GetX(tempG), GetY(tempG), vgtStraightShot, 1, true,1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   405
	g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(madness)	--g9
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   406
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   407
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   408
	if pType == loc("Reflector Shield") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   409
		table.insert(strucHealth,255)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   410
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   411
		--SetVisualGearValues(madness, g1, g2, 0, 0, g5, frameID, g7, visualSprite, g9, g10 )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   412
		--SetState(tempG, bor(GetState(tempG),gstInvisible) )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   413
		--table.insert(strucAltDisplay, madness)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   414
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   415
	else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   416
		table.insert(strucHealth,1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   417
		--table.insert(strucAltDisplay, 1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   418
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   419
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   420
	table.insert(strucCirc,tempCirc)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   421
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   422
	table.insert(strucCircType, 1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   423
	if pType == loc("Bio-Filter") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   424
		table.insert(strucCircCol,colorRed)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   425
		table.insert(strucCircRadius,1000)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   426
		frameID = 7
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   427
	elseif pType == loc("Healing Station") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   428
		table.insert(strucCircCol,0xFF00FF00)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   429
		--table.insert(strucCircCol,colorGreen)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   430
		table.insert(strucCircRadius,500)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   431
		frameID = 3
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   432
	elseif pType == loc("Respawner") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   433
		table.insert(strucCircCol,0xFF00FF00)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   434
		--table.insert(strucCircCol,0xFF00FFFF)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   435
		table.insert(strucCircRadius,75)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   436
		runOnHogs(EnableHogResurrectionForThisClan)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   437
		frameID = 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   438
	elseif pType == loc("Teleportation Node") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   439
		table.insert(strucCircCol,0x0000FFFF)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   440
		table.insert(strucCircRadius,350)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   441
		frameID = 6
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   442
	elseif pType == loc("Core") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   443
		table.insert(strucCircCol,0xFFFFFFFF)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   444
		table.insert(strucCircRadius,350)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   445
	elseif pType == loc("Generator") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   446
		table.insert(strucCircCol,0xFFFF00FF)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   447
		table.insert(strucCircRadius,75)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   448
		setGearValue(tempG, "power", 0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   449
		frameID = 2
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   450
	elseif pType == loc("Support Station") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   451
		table.insert(strucCircCol,0xFFFF00FF)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   452
		table.insert(strucCircRadius,500)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   453
		frameID = 4
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   454
	elseif pType == loc("Construction Station") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   455
		table.insert(strucCircCol,0xFFFFFFFF)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   456
		table.insert(strucCircRadius,500)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   457
		frameID = 8
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   458
	elseif pType == loc("Reflector Shield") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   459
		table.insert(strucCircCol,0xffae00ff)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   460
		table.insert(strucCircRadius,750)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   461
		frameID = 9
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   462
	elseif pType == loc("Weapon Filter") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   463
		table.insert(strucCircCol,0xa800ffff)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   464
		table.insert(strucCircRadius,750)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   465
		frameID = 5
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   466
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   467
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   468
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   469
	SetVisualGearValues(madness, g1, g2, 0, 0, g5, frameID, g7, visualSprite, g9, g10 )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   470
	SetState(tempG, bor(GetState(tempG),gstInvisible) )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   471
	table.insert(strucAltDisplay, madness)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   472
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   473
	-- may be needed for non gear-based structures
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   474
	--table.insert(strucX, GetX(tempG))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   475
	--table.insert(strucY, GetY(tempG))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   476
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   477
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   478
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   479
-- this is basically onStructureDelete
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   480
-- we may need to expand it for non-gear structures later
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   481
function CheckGearForStructureLink(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   482
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   483
	respawnerDestroyed = false
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   484
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   485
	for i = 1, #strucID do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   486
		if strucID[i] == getGearValue(gear,"sUID") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   487
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   488
			if strucType[i] == loc("Respawner") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   489
				respawnerDestroyed = true
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   490
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   491
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   492
			table.remove(strucID,i)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   493
			table.remove(strucGear,i)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   494
			table.remove(strucClan,i)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   495
			table.remove(strucType,i)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   496
			table.remove(strucCost,i)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   497
			table.remove(strucHealth,i)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   498
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   499
			DeleteVisualGear(strucCirc[i])
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   500
			table.remove(strucCirc,i)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   501
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   502
			table.remove(strucCircCol,i)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   503
			table.remove(strucCircRadius,i)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   504
			table.remove(strucCircType,i)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   505
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   506
			if strucAltDisplay[i] ~= 1 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   507
				DeleteVisualGear(strucAltDisplay[i])
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   508
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   509
			table.remove(strucAltDisplay,i)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   510
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   511
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   512
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   513
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   514
	if respawnerDestroyed == true then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   515
		runOnHogs(RecalibrateRespawn)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   516
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   517
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   518
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   519
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   520
-- called when we add a new respawner
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   521
function EnableHogResurrectionForThisClan(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   522
	if GetHogClan(gear) == GetHogClan(CurrentHedgehog) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   523
		SetEffect(gear, heResurrectable, 1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   524
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   525
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   526
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   527
-- this is called when a respawner blows up
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   528
function RecalibrateRespawn(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   529
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   530
	respawnerList = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   531
	for i = 1, #strucID do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   532
		if (strucType[i] == loc("Respawner")) and (strucClan[i] == GetHogClan(gear)) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   533
			table.insert(respawnerList, i)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   534
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   535
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   536
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   537
	if #respawnerList >= 1 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   538
		SetEffect(gear, heResurrectable, 1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   539
	else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   540
		SetEffect(gear, heResurrectable, 0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   541
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   542
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   543
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   544
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   545
--resposition dead hogs at a respawner if they own one
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   546
function FindRespawner(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   547
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   548
	respawnerList = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   549
	for i = 1, #strucID do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   550
		if (strucType[i] == loc("Respawner")) and (strucClan[i] == GetHogClan(gear)) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   551
			table.insert(respawnerList, i)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   552
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   553
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   554
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   555
	if #respawnerList >= 1 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   556
		i = GetRandom(#respawnerList)+1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   557
		SetGearPosition(gear,GetX(strucGear[respawnerList[i]]),GetY(strucGear[respawnerList[i]])-25)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   558
		AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   559
	else	-- (this should never happen, but just in case)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   560
		SetEffect(gear, heResurrectable, 0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   561
		DeleteGear(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   562
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   563
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   564
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   565
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   566
function onGearResurrect(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   567
	AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   568
	FindRespawner(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   569
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   570
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   571
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   572
function CheckTeleport(gear, tX, tY)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   573
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   574
	teleportOriginSuccessful = false
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   575
	teleportDestinationSuccessful = false
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   576
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   577
	for i = 1, #strucID do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   578
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   579
		if (strucType[i] == loc("Teleportation Node")) and (strucClan[i] == GetHogClan(CurrentHedgehog)) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   580
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   581
			dist = GetDistFromGearToXY(CurrentHedgehog,GetX(strucGear[i]), GetY(strucGear[i]))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   582
			if strucCircType[i] == 0 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   583
				NR = strucCircRadius[i]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   584
			else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   585
				NR = (48/100*strucCircRadius[i])/2
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   586
				--NR = div((div(48,100) * strucCircRadius[tempID]),2)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   587
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   588
			if dist <= NR*NR then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   589
				teleportOriginSuccessful = true
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   590
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   591
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   592
			dist = GetDistFromXYtoXY(tX,tY,GetX(strucGear[i]), GetY(strucGear[i]))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   593
			if strucCircType[i] == 0 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   594
				NR = strucCircRadius[i]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   595
			else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   596
				NR = (48/100*strucCircRadius[i])/2
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   597
				--NR = div((div(48,100) * strucCircRadius[tempID]),2)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   598
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   599
			if dist <= NR*NR then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   600
				teleportDestinationSuccessful = true
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   601
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   602
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   603
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   604
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   605
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   606
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   607
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   608
	if ((teleportDestinationSuccessful == false) or (teleportOriginSuccessful == false)) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   609
		AddCaption(loc("Teleport Unsuccessful. Please teleport within a clan teleporter's sphere of influence."))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   610
		SetGearTarget(gear, GetX(CurrentHedgehog), GetY(CurrentHedgehog))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   611
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   612
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   613
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   614
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   615
--Check for proximity of gears to structures, and make structures behave accordingly
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   616
function CheckProximity(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   617
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   618
	--if isAStructureEffectingGear(gear) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   619
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   620
		dist = GetDistFromGearToXY(gear, GetX(strucGear[tempID]), GetY(strucGear[tempID]))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   621
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   622
		-- calculate my real radius if I am an aura
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   623
		if strucCircType[tempID] == 0 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   624
			NR = strucCircRadius[tempID]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   625
		else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   626
			NR = (48/100*strucCircRadius[tempID])/2
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   627
			--NR = div((div(48,100) * strucCircRadius[tempID]),2) -- doesn't work ffff
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   628
				--NR = div((48/100*strucCircRadius[tempID]),2) -- still works
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   629
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   630
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   631
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   632
		-- we're in business
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   633
		if dist <= NR*NR then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   634
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   635
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   636
			-- heal clan hogs
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   637
			if strucType[tempID] == loc("Healing Station") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   638
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   639
				if GetGearType(gear) == gtHedgehog then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   640
					if GetHogClan(gear) == strucClan[tempID] then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   641
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   642
						hogLife = GetHealth(gear) + 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   643
						if hogLife > 150 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   644
							hogLife = 150
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   645
						end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   646
						SetHealth(gear, hogLife)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   647
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   648
						-- change this to the med kit sprite health ++++s later
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   649
						tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   650
						g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   651
						SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, colorGreen )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   652
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   653
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   654
					end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   655
				end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   656
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   657
			-- explode enemy clan hogs
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   658
			elseif strucType[tempID] == loc("Bio-Filter") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   659
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   660
				--tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   661
				--g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   662
				--SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, colorRed )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   663
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   664
				if GetGearType(gear) == gtHedgehog then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   665
					if (GetHogClan(gear) ~= strucClan[tempID]) and (GetHealth(gear) > 0) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   666
						AddGear(GetX(gear), GetY(gear), gtGrenade, 0, 0, 0, 1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   667
					end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   668
				end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   669
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   670
			-- were those weapons in your pocket, or were you just happy to see me?
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   671
			elseif strucType[tempID] == loc("Weapon Filter") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   672
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   673
				if GetGearType(gear) == gtHedgehog then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   674
					if (GetHogClan(gear) ~= strucClan[tempID]) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   675
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   676
						for wpnIndex = 1, #atkArray do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   677
							AddAmmo(gear, atkArray[wpnIndex][1], 0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   678
						end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   679
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   680
						for wpnIndex = 1, #utilArray do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   681
							AddAmmo(gear, utilArray[wpnIndex][1], 0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   682
						end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   683
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   684
						AddAmmo(gear, amAirAttack, 100)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   685
						AddAmmo(gear, amSwitch, 100)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   686
						AddAmmo(gear, amSkip, 100)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   687
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   688
					end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   689
				end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   690
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   691
			-- BOUNCE! POGO! POGO! POGO! POGO!
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   692
			elseif strucType[tempID] == loc("Reflector Shield") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   693
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   694
				-- add check for whose projectile it is
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   695
				if gearCanBeDeflected(gear) == true then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   696
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   697
					gOwner = getGearValue(gear,"owner")
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   698
					gDeflects = getGearValue(gear,"deflects")
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   699
					gDmg = getGearValue(gear,"damage")
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   700
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   701
					if gDeflects >= 3 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   702
						DeleteGear(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   703
						AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   704
						PlaySound(sndVaporize)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   705
					elseif gOwner ~= strucClan[tempID] then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   706
						--whether to vaporize gears or bounce them
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   707
						if gDmg ~= 0 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   708
							dx, dy = GetGearVelocity(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   709
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   710
							if (dx == 0) and (dy == 0) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   711
								-- static mine, explosive, etc encountered
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   712
								-- do nothing
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   713
							else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   714
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   715
								--let's bounce something!
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   716
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   717
								--if dx == 0 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   718
									-- bounce away eggs
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   719
								--	dx = 0.5
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   720
								--end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   721
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   722
								dx = dx*(-1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   723
								dy = dy*(-1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   724
								SetGearVelocity(gear,dx,dy)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   725
								setGearValue(gear,"deflects",(gDeflects+1))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   726
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   727
								AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   728
								PlaySound(sndExplosion)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   729
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   730
								strucHealth[tempID] = strucHealth[tempID] - gDmg
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   731
								strucCircCol[tempID] = strucCircCol[tempID] - gDmg
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   732
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   733
								if strucHealth[tempID] <= 0 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   734
									AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtExplosion, 0, false)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   735
									DeleteGear(strucGear[tempID])
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   736
									PlaySound(sndExplosion)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   737
								end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   738
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   739
							end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   740
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   741
						else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   742
							DeleteGear(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   743
							AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   744
							PlaySound(sndVaporize)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   745
						end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   746
					end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   747
				end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   748
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   749
			--mark as within range of a teleporter node
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   750
			elseif strucType[tempID] == loc("Teleportation Node") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   751
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   752
				if GetGearType(gear) == gtHedgehog then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   753
					if GetHogClan(gear) == strucClan[tempID] then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   754
						--tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   755
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   756
						for i = 1, #sProx do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   757
							if sProx[i][1] == loc("Teleportation Mode") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   758
								sProx[i][2] = true
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   759
							end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   760
						end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   761
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   762
					end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   763
				end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   764
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   765
			-- mark as within range of construction station
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   766
			-- and thus allow menu access to placement modes
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   767
			-- for girders, mines, sticky mines and barrels
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   768
			elseif strucType[tempID] == loc("Construction Station") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   769
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   770
				if GetGearType(gear) == gtHedgehog then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   771
					if GetHogClan(gear) == strucClan[tempID] then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   772
						tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   773
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   774
						for i = 1, #sProx do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   775
							if ((sProx[i][1] == loc("Girder Placement Mode"))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   776
							or (sProx[i][1] == loc("Rubber Placement Mode"))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   777
							or (sProx[i][1] == loc("Mine Placement Mode"))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   778
							or (sProx[i][1] == loc("Sticky Mine Placement Mode"))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   779
							or (sProx[i][1] == loc("Barrel Placement Mode")))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   780
							then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   781
								sProx[i][2] = true
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   782
							end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   783
						end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   784
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   785
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   786
					end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   787
				end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   788
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   789
			-- mark as within stupport station range
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   790
			-- and thus allow menu access to placement modes
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   791
			-- for weapon, utility, and med crates
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   792
			elseif strucType[tempID] == loc("Support Station") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   793
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   794
				if GetGearType(gear) == gtHedgehog then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   795
					if GetHogClan(gear) == strucClan[tempID] then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   796
						tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   797
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   798
						for i = 1, #sProx do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   799
							if ((sProx[i][1] == loc("Health Crate Placement Mode"))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   800
							or (sProx[i][1] == loc("Weapon Crate Placement Mode"))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   801
							or (sProx[i][1] == loc("Utility Crate Placement Mode")))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   802
							then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   803
								sProx[i][2] = true
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   804
								--AddCaption("wahey in a support station")
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   805
							end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   806
						end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   807
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   808
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   809
					end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   810
				end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   811
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   812
			-- doesn't do shit
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   813
			elseif strucType[tempID] == loc("Core") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   814
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   815
				if GetGearType(gear) == gtHedgehog then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   816
					if GetHogClan(gear) == strucClan[tempID] then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   817
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   818
						tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   819
						g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   820
						SetVisualGearValues(tempE, g1+20, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(strucClan[tempID]) )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   821
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   822
						tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   823
						g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   824
						SetVisualGearValues(tempE, g1-20, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(strucClan[tempID]) )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   825
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   826
					end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   827
				end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   828
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   829
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   830
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   831
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   832
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   833
	--end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   834
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   835
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   836
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   837
-- used to check if we need to run through all hogs or just currenthedgehog
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   838
function isAStructureThatAppliesToMultipleGears(pID)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   839
	if 	strucType[pID] == loc("Healing Station") or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   840
		strucType[pID] == loc("Reflector Shield") or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   841
		strucType[pID] == loc("Weapon Filter") or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   842
		strucType[pID] == loc("Bio-Filter")
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   843
	then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   844
		return(true)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   845
	else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   846
		return(false)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   847
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   848
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   849
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   850
function HandleStructures()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   851
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   852
	for i = 1, #sProx do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   853
		sProx[i][2] = false
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   854
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   855
		if sProx[i][1] == loc("Structure Placement Mode") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   856
			sProx[i][2] = true
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   857
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   858
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   859
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   860
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   861
	for i = 1, #strucID do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   862
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   863
		g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(strucCirc[i])
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   864
		SetVisualGearValues(strucCirc[i], GetX(strucGear[i]), GetY(strucGear[i]), g3, g4, g5, g6, g7, strucCircRadius[i], g9, strucCircCol[i])
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   865
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   866
		tempID = i
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   867
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   868
		g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(strucAltDisplay[i])				--8000
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   869
		SetVisualGearValues(strucAltDisplay[i], GetX(strucGear[i]), GetY(strucGear[i]), 0, 0, g5, g6, 800000, sprTarget, g9, g10 )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   870
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   871
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   872
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   873
		-- Check For proximity of stuff to our structures
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   874
		if isAStructureThatAppliesToMultipleGears(i) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   875
			runOnGears(CheckProximity)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   876
		else -- only check prox on CurrentHedgehog
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   877
			CheckProximity(CurrentHedgehog)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   878
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   879
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   880
		if strucType[i] == loc("Core") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   881
			tempE = AddVisualGear(GetX(strucGear[i]), GetY(strucGear[i]), vgtSmoke, 0, true)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   882
			g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   883
			SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(strucClan[i]) )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   884
		elseif strucType[i] == loc("Reflector Shield") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   885
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   886
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   887
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   888
			--frameID = 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   889
			--visualSprite = sprTarget
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   890
			--g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(strucAltDisplay[i])			--frameID / g6
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   891
			--SetVisualGearValues(strucAltDisplay[i], GetX(strucGear[i]), GetY(strucGear[i]), 0, 0, g5, g6, 8000, visualSprite, g9, g10 )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   892
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   893
		elseif strucType[i] == loc("Generator") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   894
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   895
			--frameID = 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   896
			--visualSprite = sprTarget
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   897
																									--layer
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   898
			--tempE = AddVisualGear(GetX(strucGear[i]), GetY(strucGear[i]), vgtStraightShot, 1, true,1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   899
			--g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)	--g9
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   900
			--SetVisualGearValues(tempE, g1, g2, 0, 0, g5, frameID, g7, visualSprite, g9, g10 )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   901
			--SetState(strucGear[i], bor(GetState(strucGear[i]),gstInvisible) )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   902
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   903
			--currently generate power for all clans.
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   904
			-- or should power only be generated for current clan?
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   905
			for z = 0, ClansCount-1 do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   906
				if z == strucClan[i] then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   907
					increaseGearValue(strucGear[i],"power")
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   908
					if getGearValue(strucGear[i],"power") == 10 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   909
						setGearValue(strucGear[i],"power",0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   910
						clanPower[z] = clanPower[z] + 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   911
						if clanPower[z] > 1000 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   912
							clanPower[z] = 1000
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   913
						end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   914
					end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   915
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   916
				end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   917
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   918
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   919
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   920
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   921
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   922
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   923
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   924
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   925
	-- this is kinda messy and gross (even more than usual), fix it up at some point
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   926
	-- it just assumes that if you have access to girders, it works for rubbers
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   927
	-- as that is what the struc implemenation means due to construction station
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   928
	anyUIProx = false
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   929
	for i = 1, #sProx do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   930
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   931
		if sProx[i][1] == loc("Girder Placement Mode") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   932
			if sProx[i][2] == true then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   933
				AddAmmo(CurrentHedgehog, amGirder, 100)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   934
				AddAmmo(CurrentHedgehog, amRubber, 100)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   935
				AddAmmo(CurrentHedgehog, amDrillStrike, 100)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   936
			else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   937
				AddAmmo(CurrentHedgehog, amGirder, 0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   938
				AddAmmo(CurrentHedgehog, amRubber, 0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   939
				AddAmmo(CurrentHedgehog, amDrillStrike, 0) -- new
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   940
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   941
		elseif sProx[i][1] == loc("Teleportation Mode") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   942
			if sProx[i][2] == true then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   943
				AddAmmo(CurrentHedgehog, amTeleport, 100)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   944
			else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   945
				AddAmmo(CurrentHedgehog, amTeleport, 0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   946
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   947
		elseif sProx[i][1] == loc("Weapon Crate Placement Mode") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   948
			-- this is new stuff
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   949
			if sProx[i][2] == true then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   950
				AddAmmo(CurrentHedgehog, amNapalm, 100)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   951
			else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   952
				AddAmmo(CurrentHedgehog, amNapalm, 0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   953
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   954
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   955
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   956
		if (sProx[i][2] == true) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   957
			anyUIProx = true
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   958
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   959
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   960
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   961
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   962
	-- doesn't do shit atm, maybe later when we add cores we can use this
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   963
	--if anyUIProx == true then --(and core is placed)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   964
	--	AddAmmo(CurrentHedgehog, amAirAttack, 100)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   965
	--else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   966
	--	AddAmmo(CurrentHedgehog, amAirAttack, 0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   967
	--end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   968
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   969
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   970
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   971
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   972
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   973
function checkForSpecialWeapons()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   974
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   975
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   976
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   977
	if (GetCurAmmoType() == amAirAttack) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   978
		AddCaption(loc("Structure Placement Tool"),GetClanColor(GetHogClan(CurrentHedgehog)),capgrpAmmoinfo)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   979
	elseif (GetCurAmmoType() == amDrillStrike) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   980
		AddCaption(loc("Object Placement Tool"),GetClanColor(GetHogClan(CurrentHedgehog)),capgrpAmmoinfo)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   981
	elseif (GetCurAmmoType() == amNapalm) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   982
		AddCaption(loc("Crate Placement Tool"),GetClanColor(GetHogClan(CurrentHedgehog)),capgrpAmmoinfo)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   983
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   984
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   985
	lastWep = GetCurAmmoType()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   986
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   987
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   988
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   989
----------------------------------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   990
-- EXCERPTS OF ADAPTED HEDGE_EDITOR CODE FOLLOWS
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   991
----------------------------------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   992
-- experimental crap
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   993
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   994
local landType = 0
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   995
-----------------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   996
-- tracking vars for save slash load purposes
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   997
-----------------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   998
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
   999
local hhs = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1000
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1001
---------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1002
-- crates are made of this stuff
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1003
---------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1004
placeholder = 20
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1005
 atkArray =
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1006
				{
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1007
				{amBazooka, 	"amBazooka",		0, loc("Bazooka"), 			2*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1008
				--{amBee, 		"amBee",			0, loc("Homing Bee"), 		4*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1009
				{amMortar, 		"amMortar",			0, loc("Mortar"), 			1*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1010
				{amDrill, 		"amDrill",			0, loc("Drill Rocket"), 	3*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1011
				{amSnowball, 	"amSnowball",		0, loc("Mudball"), 			3*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1012
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1013
				{amGrenade,		"amGrenade",		0, loc("Grenade"), 			2*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1014
				{amClusterBomb,	"amClusterBomb",	0, loc("Cluster Bomb"), 	3*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1015
				{amMolotov, 	"amMolotov",		0, loc("Molotov Cocktail"), 3*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1016
				{amWatermelon, 	"amWatermelon",		0, loc("Watermelon Bomb"), 25*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1017
				{amHellishBomb,	"amHellishBomb",	0, loc("Hellish Handgrenade"), 25*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1018
				{amGasBomb, 	"amGasBomb",		0, loc("Limburger"), 		3*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1019
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1020
				{amShotgun,		"amShotgun",		0, loc("Shotgun"), 			2*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1021
				{amDEagle,		"amDEagle",			0, loc("Desert Eagle"), 	2*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1022
				{amFlamethrower,"amFlamethrower",	0, loc("Flamethrower"), 	4*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1023
				{amSniperRifle,	"amSniperRifle",	0, loc("Sniper Rifle"), 	3*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1024
				--{amSineGun, 	"amSineGun",		0, loc("SineGun"), 			6*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1025
				{amIceGun, 		"amIceGun",			0, loc("Freezer"), 			15*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1026
				{amLandGun,		"amLandGun",		0, loc("Land Sprayer"), 	5*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1027
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1028
				{amFirePunch, 	"amFirePunch",		0, loc("Shoryuken"), 		3*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1029
				{amWhip,		"amWhip",			0, loc("Whip"), 			1*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1030
				{amBaseballBat, "amBaseballBat",	0, loc("Baseball Bat"), 	7*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1031
				--{amKamikaze, 	"amKamikaze",		0, loc("Kamikaze"),			1*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1032
				{amSeduction, 	"amSeduction",		0, loc("Seduction"),		1*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1033
				{amHammer,		"amHammer",			0, loc("Hammer"), 			1*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1034
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1035
				{amMine, 		"amMine",			0, loc("Mine"), 			1*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1036
				{amDynamite, 	"amDynamite",		0, loc("Dynamite"),			9*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1037
				{amCake, 		"amCake",			0, loc("Cake"), 			25*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1038
				{amBallgun, 	"amBallgun",		0, loc("Ballgun"), 			40*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1039
				--{amRCPlane,		"amRCPlane",		0, loc("RC Plane"), 	25*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1040
				{amSMine,		"amSMine",			0, loc("Sticky Mine"), 		5*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1041
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1042
				--{amAirAttack,	"amAirAttack",		0, loc("Air Attack"), 		10*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1043
				--{amMineStrike,	"amMineStrike",		0, loc("Mine Strike"), 		15*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1044
				--{amDrillStrike,	"amDrillStrike",	0, loc("Drill Strike"), 15*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1045
				--{amNapalm, 		"amNapalm",			0, loc("Napalm"), 		15*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1046
				--{amPiano,		"amPiano",			0, loc("Piano Strike"), 	40*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1047
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1048
				{amKnife,		"amKnife",			0, loc("Cleaver"), 			2*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1049
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1050
				{amBirdy,		"amBirdy",			0, loc("Birdy"), 			7*placeholder}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1051
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1052
				}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1053
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1054
 utilArray =
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1055
				{
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1056
				{amBlowTorch, 		"amBlowTorch",		0, loc("Blowtorch"), 		4*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1057
				{amPickHammer,		"amPickHammer",		0, loc("Pickhammer"), 		2*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1058
				--{amGirder, 			"amGirder",			0, loc("Girder"), 		4*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1059
				--{amRubber, 			"amRubber",			0, loc("Rubber Band"), 	5*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1060
				{amPortalGun,		"amPortalGun",		0, loc("Personal Portal Device"), 15*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1061
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1062
				{amRope, 			"amRope",			0, loc("Rope"), 			7*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1063
				{amParachute, 		"amParachute",		0, loc("Parachute"), 		2*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1064
				--{amTeleport,		"amTeleport",		0, loc("Teleport"), 		6*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1065
				{amJetpack,			"amJetpack",		0, loc("Flying Saucer"), 	8*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1066
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1067
				{amInvulnerable,	"amInvulnerable",	0, loc("Invulnerable"), 	5*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1068
				{amLaserSight,		"amLaserSight",		0, loc("Laser Sight"), 		2*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1069
				{amVampiric,		"amVampiric",		0, loc("Vampirism"), 		6*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1070
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1071
				{amLowGravity, 		"amLowGravity",		0, loc("Low Gravity"), 		4*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1072
				{amExtraDamage, 	"amExtraDamage",	0, loc("Extra Damage"), 	6*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1073
				{amExtraTime,		"amExtraTime",		0, loc("Extra Time"), 		8*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1074
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1075
				{amResurrector, 	"amResurrector",	0, loc("Resurrector"), 		8*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1076
				{amTardis, 			"amTardis",			0, loc("Tardis"), 			2*placeholder},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1077
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1078
				{amSwitch,			"amSwitch",			0, loc("Switch Hog"), 		4*placeholder}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1079
				}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1080
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1081
----------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1082
-- hog and map editting junk
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1083
----------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1084
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1085
 local reducedSpriteIDArray = {
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1086
  sprBigDigit, sprKowtow, sprBee, sprExplosion50, sprGirder
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1087
  }
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1088
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1089
  local reducedSpriteTextArray = {
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1090
  "sprBigDigit", "sprKowtow", "sprBee", "sprExplosion50", "sprGirder"
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1091
  }
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1092
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1093
----------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1094
-- placement shite
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1095
----------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1096
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1097
local cGear = nil -- detects placement of girders and objects (using airattack)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1098
local curWep = amNothing
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1099
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1100
-- primary placement categories
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1101
local cIndex = 1 -- category index
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1102
local cat = 	{
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1103
				"Girder Placement Mode",
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1104
				"Rubber Placement Mode",
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1105
				"Mine Placement Mode",
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1106
				"Sticky Mine Placement Mode",
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1107
				"Barrel Placement Mode",
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1108
				"Health Crate Placement Mode",
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1109
				"Weapon Crate Placement Mode",
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1110
				"Utility Crate Placement Mode",
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1111
				--"Target Placement Mode",
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1112
				--"Cleaver Placement Mode",
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1113
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1114
				--"Advanced Repositioning Mode",
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1115
				--"Tagging Mode",
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1116
				--"Sprite Testing Mode",
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1117
				--"Sprite Placement Mode",
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1118
				"Structure Placement Mode"
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1119
				}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1120
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1121
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1122
 sProx = 	{
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1123
				{loc("Girder Placement Mode"),false},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1124
				{loc("Rubber Placement Mode"),false},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1125
				{loc("Mine Placement Mode"),false},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1126
				{loc("Sticky Mine Placement Mode"),false},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1127
				{loc("Barrel Placement Mode"),false},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1128
				{loc("Health Crate Placement Mode"),false},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1129
				{loc("Weapon Crate Placement Mode"),false},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1130
				{loc("Utility Crate Placement Mode"),false},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1131
				--{loc("Target Placement Mode"),false},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1132
				--{loc("Cleaver Placement Mode"),false},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1133
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1134
				--{loc("Advanced Repositioning Mode"),false},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1135
				--{loc("Tagging Mode"),false},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1136
				--{loc("Sprite Testing Mode"),false},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1137
				--{loc("Sprite Placement Mode"),false},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1138
				{loc("Structure Placement Mode"),false},
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1139
				{loc("Teleportation Mode"),false}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1140
				}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1141
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1142
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1143
local pMode = {}	-- pMode contains custom subsets of the main categories
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1144
local pIndex = 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1145
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1146
local genTimer = 0
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1147
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1148
local CGR = 1 -- current girder rotation, we actually need this as HW remembers what rotation you last used
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1149
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1150
local placedX = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1151
local placedY = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1152
local placedSpec = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1153
local placedSuperSpec = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1154
local placedType = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1155
local placedCount = 0
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1156
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1157
local sCirc -- circle that appears around selected gears
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1158
local sGear = nil
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1159
local closestDist
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1160
local closestGear = nil
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1161
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1162
local tCirc = {} -- array of circles that appear around tagged gears
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1163
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1164
------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1165
-- SOME GENERAL METHODS
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1166
------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1167
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1168
function GetDistFromGearToXY(gear, g2X, g2Y)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1169
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1170
	g1X, g1Y = GetGearPosition(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1171
	q = g1X - g2X
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1172
	w = g1Y - g2Y
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1173
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1174
	return ( (q*q) + (w*w) )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1175
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1176
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1177
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1178
function GetDistFromXYtoXY(a, b, c, d)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1179
	q = a - c
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1180
	w = b - d
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1181
	return ( (q*q) + (w*w) )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1182
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1183
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1184
function SelectGear(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1185
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1186
	d = GetDistFromGearToXY(gear, placedX[placedCount], placedY[placedCount])
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1187
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1188
	if d < closestDist then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1189
		closestDist = d
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1190
		closestGear = gear
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1191
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1192
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1193
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1194
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1195
-- essentially called when user clicks the mouse
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1196
-- with girders or an airattack
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1197
function PlaceObject(x,y)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1198
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1199
	placedX[placedCount] = x
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1200
	placedY[placedCount] = y
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1201
	placedType[placedCount] = cat[cIndex]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1202
	placedSpec[placedCount] = pMode[pIndex]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1203
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1204
	if (clanUsedExtraTime[GetHogClan(CurrentHedgehog)] == true) and (cat[cIndex] == "Utility Crate Placement Mode") and (utilArray[pIndex][1] == amExtraTime) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1205
		AddCaption(loc("You may only use 1 Extra Time per turn."),0xffba00ff,capgrpVolume)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1206
		PlaySound(sndDenied)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1207
	elseif (clanCratesSpawned[GetHogClan(CurrentHedgehog)] > 4) and ( (cat[cIndex] == "Health Crate Placement Mode") or (cat[cIndex] == "Utility Crate Placement Mode") or (cat[cIndex] == "Weapon Crate Placement Mode")  )  then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1208
		AddCaption(loc("You may only spawn 5 crates per turn."),0xffba00ff,capgrpVolume)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1209
		PlaySound(sndDenied)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1210
	elseif (XYisInRect(x,y, clanBoundsSX[GetHogClan(CurrentHedgehog)],clanBoundsSY[GetHogClan(CurrentHedgehog)],clanBoundsEX[GetHogClan(CurrentHedgehog)],clanBoundsEY[GetHogClan(CurrentHedgehog)]) == true)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1211
	and (clanPower[GetHogClan(CurrentHedgehog)] >= placedExpense)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1212
	then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1213
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1214
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1215
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1216
		if cat[cIndex] == "Girder Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1217
			PlaceGirder(x, y, CGR)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1218
			placedSpec[placedCount] = CGR
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1219
		elseif cat[cIndex] == "Rubber Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1220
			PlaceSprite(x,y, sprAmRubber, CGR, lfBouncy)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1221
			--PlaceGirder(x, y, CGR)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1222
			placedSpec[placedCount] = CGR
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1223
		elseif cat[cIndex] == "Target Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1224
			gear = AddGear(x, y, gtTarget, 0, 0, 0, 0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1225
		elseif cat[cIndex] == "Cleaver Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1226
			gear = AddGear(x, y, gtKnife, 0, 0, 0, 0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1227
		elseif cat[cIndex] == "Health Crate Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1228
			gear = SpawnHealthCrate(x,y)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1229
			SetHealth(gear, pMode[pIndex])
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1230
			setGearValue(gear,"caseType","med")
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1231
			clanCratesSpawned[GetHogClan(CurrentHedgehog)] = clanCratesSpawned[GetHogClan(CurrentHedgehog)] +1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1232
		elseif cat[cIndex] == "Weapon Crate Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1233
			gear = SpawnAmmoCrate(x, y, atkArray[pIndex][1])
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1234
			placedSpec[placedCount] = atkArray[pIndex][2]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1235
			setGearValue(gear,"caseType","ammo")
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1236
			setGearValue(gear,"contents",atkArray[pIndex][2])
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1237
			clanCratesSpawned[GetHogClan(CurrentHedgehog)] = clanCratesSpawned[GetHogClan(CurrentHedgehog)] +1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1238
		elseif cat[cIndex] == "Utility Crate Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1239
			gear = SpawnUtilityCrate(x, y, utilArray[pIndex][1])
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1240
			placedSpec[placedCount] = utilArray[pIndex][2]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1241
			setGearValue(gear,"caseType","util")
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1242
			setGearValue(gear,"contents",utilArray[pIndex][2])
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1243
			if utilArray[pIndex][1] == amExtraTime then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1244
				clanUsedExtraTime[GetHogClan(CurrentHedgehog)] = true
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1245
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1246
			clanCratesSpawned[GetHogClan(CurrentHedgehog)] = clanCratesSpawned[GetHogClan(CurrentHedgehog)] +1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1247
		elseif cat[cIndex] == "Barrel Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1248
			gear = AddGear(x, y, gtExplosives, 0, 0, 0, 0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1249
			SetHealth(gear, pMode[pIndex])
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1250
		elseif cat[cIndex] == "Mine Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1251
			gear = AddGear(x, y, gtMine, 0, 0, 0, 0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1252
			SetTimer(gear, pMode[pIndex])
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1253
		elseif cat[cIndex] == "Sticky Mine Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1254
			gear = AddGear(x, y, gtSMine, 0, 0, 0, 0)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1255
		elseif cat[cIndex] == "Advanced Repositioning Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1256
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1257
			if pMode[pIndex] == "Selection Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1258
				closestDist = 999999999
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1259
				closestGear = nil -- just in case
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1260
				sGear = nil
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1261
				runOnGears(SelectGear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1262
				sGear = closestGear
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1263
				closestGear = nil
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1264
			elseif pMode[pIndex] == "Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1265
				if sGear ~= nil then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1266
					SetGearPosition(sGear, x, y)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1267
				end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1268
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1269
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1270
		elseif cat[cIndex] == "Tagging Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1271
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1272
			closestDist = 999999999
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1273
			closestGear = nil
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1274
			sGear = nil
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1275
			runOnGears(SelectGear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1276
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1277
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1278
			if closestGear ~= nil then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1279
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1280
				if getGearValue(closestGear,"tag") == nil then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1281
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1282
					--if there is no tag, add a victory/failure tag and circle
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1283
					setGearValue(closestGear, "tCirc",AddVisualGear(0,0,vgtCircle,0,true))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1284
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1285
					--AddCaption("circ added",0xffba00ff,capgrpVolume)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1286
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1287
					if pMode[pIndex] == "Tag Victory Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1288
						setGearValue(closestGear, "tag","victory")
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1289
						SetVisualGearValues(getGearValue(closestGear,"tCirc"), 0, 0, 100, 255, 1, 10, 0, 40, 3, 0xff0000ff)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1290
					elseif pMode[pIndex] == "Tag Failure Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1291
						setGearValue(closestGear, "tag","failure")
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1292
						SetVisualGearValues(getGearValue(closestGear,"tCirc"), 0, 0, 100, 255, 1, 10, 0, 40, 3, 0x0000ffff)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1293
					end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1294
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1295
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1296
				else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1297
					-- remove tag and delete circ
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1298
					--AddCaption("circ removed",0xffba00ff,capgrpVolume)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1299
					setGearValue(closestGear, "tag", nil)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1300
					DeleteVisualGear(getGearValue(closestGear,"tCirc"))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1301
					setGearValue(closestGear, "tCirc", nil)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1302
				end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1303
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1304
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1305
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1306
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1307
		elseif cat[cIndex] == "Sprite Testing Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1308
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1309
			frameID = 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1310
			visualSprite = reducedSpriteIDArray[pIndex]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1311
			--visualSprite = spriteIDArray[pIndex]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1312
			tempE = AddVisualGear(x, y, vgtStraightShot, 0, true)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1313
			g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1314
			SetVisualGearValues(tempE, g1, g2, 0, 0, g5, frameID, g7, visualSprite, g9, g10 )
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1315
	--sprHorizonLong crashes game, so does skyL, as does flake
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1316
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1317
		-- reduced list of cool sprites
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1318
		-- sprBigDigit, sprKnife, sprFrozenHog, sprKowtow, sprBee, sprExplosion50, sprPiano, sprChunk, sprHHTelepMask, sprSeduction, sprSwitch, sprGirder,
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1319
		--sprAMAmmos, sprAMSlotKeys, sprTurnsLeft, sprExplosivesRoll + maybe some others like the health case, arrows, etc
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1320
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1321
		elseif cat[cIndex] == "Sprite Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1322
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1323
			PlaceSprite(x,y, reducedSpriteIDArray[pIndex], 1, landType)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1324
			--PlaceGirder(x, y, CGR)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1325
			placedSpec[placedCount] = reducedSpriteTextArray[pIndex]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1326
			placedSuperSpec[placedCount] = landType
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1327
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1328
			if landType == lfIce then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1329
				placedSuperSpec[placedCount] = "lfIce"
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1330
			elseif landType == lfIndestructible then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1331
				placedSuperSpec[placedCount] = "lfIndestructible"
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1332
			elseif landType == lfBouncy then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1333
				placedSuperSpec[placedCount] = "lfBouncy"
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1334
			else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1335
				placedSuperSpec[placedCount] = "lfNormal"
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1336
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1337
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1338
		elseif cat[cIndex] == "Structure Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1339
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1340
			AddStruc(x,y, pMode[pIndex],GetHogClan(CurrentHedgehog))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1341
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1342
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1343
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1344
		clanPower[GetHogClan(CurrentHedgehog)] = clanPower[GetHogClan(CurrentHedgehog)] - placedExpense
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1345
		placedCount = placedCount + 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1346
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1347
	else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1348
		AddCaption("Invalid Placement",0xffba00ff,capgrpVolume)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1349
		PlaySound(sndDenied)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1350
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1351
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1352
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1353
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1354
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1355
-- called when user changes primary selection
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1356
-- either via up/down keys
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1357
-- or selecting girder/airattack
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1358
function RedefineSubset()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1359
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1360
	pIndex = 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1361
	pMode = {}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1362
	placedExpense = 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1363
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1364
	if cat[cIndex] == "Girder Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1365
		pIndex = CGR
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1366
		pMode = {"Girder"}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1367
		--	pCount = 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1368
	elseif cat[cIndex] == "Rubber Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1369
		pIndex = CGR
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1370
		pMode = {"Rubber"}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1371
		placedExpense = 3
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1372
	--	pCount = 1???
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1373
	elseif cat[cIndex] == "Target Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1374
		pMode = {"Standard Target"}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1375
	elseif cat[cIndex] == "Cleaver Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1376
		pMode = {"Standard Cleaver"}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1377
	elseif cat[cIndex] == "Barrel Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1378
		--pMode = {1,50,75,100}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1379
		pMode = {50}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1380
		placedExpense = 10
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1381
	elseif cat[cIndex] == "Health Crate Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1382
		--pMode = {25,50,75,100}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1383
		pMode = {25}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1384
		placedExpense = 5
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1385
	elseif cat[cIndex] == "Weapon Crate Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1386
		for i = 1, #atkArray do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1387
			pMode[i] = atkArray[i][4] -- was [2]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1388
			--placedExpense = atkArray[5]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1389
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1390
		placedExpense = 30
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1391
	elseif cat[cIndex] == "Utility Crate Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1392
		for i = 1, #utilArray do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1393
			pMode[i] = utilArray[i][4] -- was [2]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1394
			--placedExpense = utilArray[5]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1395
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1396
		placedExpense = 20
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1397
	elseif cat[cIndex] == "Mine Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1398
		--pMode = {1,1000,2000,3000,4000,5000,0}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1399
		pMode = {1,1000,2000,3000,4000,5000}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1400
		-- 0 is dud right, or is that nil?
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1401
		placedExpense = 15
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1402
	elseif cat[cIndex] == "Sticky Mine Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1403
		pMode = {"Normal Sticky Mine"}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1404
	--elseif cat[cIndex] == "Gear Repositioning Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1405
	--	for i = 1, #hhs do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1406
	--		pMode[i] = GetHogName(hhs[i])
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1407
	--	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1408
		placedExpense = 20
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1409
	elseif cat[cIndex] == "Advanced Repositioning Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1410
		pMode = {"Selection Mode","Placement Mode"}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1411
	elseif cat[cIndex] == "Tagging Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1412
		pMode = {"Tag Victory Mode","Tag Failure Mode"}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1413
	elseif cat[cIndex] == "Sprite Testing Mode" or cat[cIndex] == "Sprite Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1414
		--for i = 1, #spriteTextArray do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1415
		--	pMode[i] = spriteTextArray[i]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1416
		--end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1417
		for i = 1, #reducedSpriteTextArray do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1418
			pMode[i] = reducedSpriteTextArray[i]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1419
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1420
		placedExpense = 100
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1421
	elseif cat[cIndex] == "Structure Placement Mode" then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1422
		pMode = {loc("Healing Station"), loc("Bio-Filter"), loc("Weapon Filter"), loc("Reflector Shield"), loc("Respawner"),loc("Teleportation Node"),--[[loc("Core"),]]loc("Generator"),loc("Construction Station"),loc("Support Station")}
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1423
		--placedExpense = 100
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1424
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1425
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1426
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1427
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1428
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1429
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1430
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1431
-- called in onGameTick()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1432
function HandleHedgeEditor()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1433
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1434
	if CurrentHedgehog ~= nil then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1435
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1436
		if wallsVisible == true then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1437
			HandleBorderEffects()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1438
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1439
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1440
		if (CurrentHedgehog ~= nil) and (TurnTimeLeft ~= TurnTime) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1441
			if (lastWep ~= GetCurAmmoType()) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1442
				checkForSpecialWeapons()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1443
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1444
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1445
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1446
		genTimer = genTimer + 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1447
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1448
		if genTimer >= 100 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1449
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1450
			genTimer = 0
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1451
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1452
			DrawTag(1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1453
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1454
			HandleStructures()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1455
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1456
			curWep = GetCurAmmoType()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1457
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1458
			-- change to girder mode on weapon swap
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1459
			if (cIndex ~= 1) and (curWep == amGirder) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1460
				cIndex = 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1461
				RedefineSubset()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1462
			elseif (cIndex ~=2) and (curWep == amRubber) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1463
				cIndex = 2
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1464
				RedefineSubset()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1465
			-- change to generic mode if girder no longer selected
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1466
			elseif (cIndex == 1) and (curWep ~= amGirder) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1467
				cIndex = 3 -- was 2
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1468
				RedefineSubset()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1469
			elseif (cIndex == 2) and (curWep ~= amRubber) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1470
				cIndex = 3 --new
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1471
				RedefineSubset()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1472
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1473
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1474
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1475
			-- update display selection criteria
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1476
			if (curWep == amGirder) or (curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) or (curWep == amRubber) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1477
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1478
				---------------hooolllllyyyy fucking shit this
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1479
				-- code is a broken mess now
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1480
				-- it was redesigned and compromised three times
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1481
				-- so now it is a mess trying to do what it was
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1482
				-- never designed to do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1483
				-- needs to be rewritten badly sadface
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1484
				-- this bit here catches the new 3 types of weapons
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1485
				if ((sProx[cIndex][1] == loc("Structure Placement Mode") and (curWep ~= amAirAttack))) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1486
					updatePlacementDisplay(1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1487
				elseif (sProx[cIndex][1] == loc("Health Crate Placement Mode")) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1488
							(sProx[cIndex][1] == loc("Weapon Crate Placement Mode")) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1489
							(sProx[cIndex][1] == loc("Utility Crate Placement Mode")) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1490
								if curWep ~= amNapalm then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1491
									updatePlacementDisplay(1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1492
								end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1493
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1494
				elseif (sProx[cIndex][1] == loc("Mine Placement Mode")) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1495
							(sProx[cIndex][1] == loc("Sticky Mine Placement Mode")) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1496
							(sProx[cIndex][1] == loc("Barrel Placement Mode")) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1497
								if curWep ~= amDrillStrike then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1498
									updatePlacementDisplay(1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1499
								end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1500
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1501
				end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1502
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1503
				--this is called when it happens that we have placement
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1504
				--mode selected and we are looking at something
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1505
				--we shouldn't be allowed to look at, as would be the case
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1506
				--when you WERE allowed to look at it, but then maybe
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1507
				--a bomb blows up the structure that was granting you
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1508
				--that ability
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1509
				if (sProx[cIndex][2] ~= true) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1510
					updatePlacementDisplay(1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1511
				else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1512
					updateCost()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1513
				end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1514
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1515
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1516
				AddCaption(cat[cIndex],0xffba00ff,capgrpMessage)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1517
				AddCaption(pMode[pIndex],0xffba00ff,capgrpMessage2)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1518
				wallsVisible = true
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1519
			else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1520
				wallsVisible = false
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1521
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1522
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1523
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1524
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1525
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1526
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1527
	--update selected gear display
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1528
	if (cat[cIndex] == "Advanced Repositioning Mode") and (sGear ~= nil) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1529
		SetVisualGearValues(sCirc, GetX(sGear), GetY(sGear), 100, 255, 1, 10, 0, 300, 3, 0xff00ffff)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1530
	elseif (cat[cIndex] == "Tagging Mode") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1531
		if (sGear ~= nil) or (closestGear ~= nil) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1532
			SetVisualGearValues(sCirc, GetX(sGear), GetY(sGear), 0, 1, 1, 10, 0, 1, 1, 0x00000000)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1533
			closestGear = nil
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1534
			sGear = nil
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1535
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1536
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1537
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1538
	-- some kind of target detected, tell me your story
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1539
	if cGear ~= nil then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1540
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1541
		x,y = GetGearTarget(cGear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1542
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1543
		if GetGearType(cGear) == gtAirAttack then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1544
			DeleteGear(cGear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1545
			PlaceObject(x, y)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1546
		elseif GetGearType(cGear) == gtTeleport then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1547
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1548
				CheckTeleport(cGear, x, y)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1549
				cGear = nil
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1550
		elseif GetGearType(cGear) == gtGirder then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1551
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1552
			CGR = GetState(cGear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1553
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1554
			-- improve rectangle test based on CGR when you can be bothered
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1555
			--if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1556
			--	AddCaption("Invalid Girder Placement",0xffba00ff,capgrpVolume)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1557
			--else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1558
				PlaceObject(x, y)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1559
			--end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1560
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1561
			-- this allows the girder tool to be used like a mining laser
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1562
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1563
		--[[
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1564
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1565
			if CGR < 4 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1566
				AddGear(x, y, gtGrenade, 0, 0, 0, 1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1567
			elseif CGR == 4 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1568
				g = AddGear(x-30, y, gtGrenade, 0, 0, 0, 1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1569
				g = AddGear(x+30, y, gtGrenade, 0, 0, 0, 1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1570
			elseif CGR == 5 then -------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1571
				g = AddGear(x+30, y+30, gtGrenade, 0, 0, 0, 1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1572
				g = AddGear(x-30, y-30, gtGrenade, 0, 0, 0, 1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1573
			elseif CGR == 6 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1574
				g = AddGear(x, y+30, gtGrenade, 0, 0, 0, 1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1575
				g = AddGear(x, y-30, gtGrenade, 0, 0, 0, 1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1576
			elseif CGR == 7 then -------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1577
				g = AddGear(x+30, y-30, gtGrenade, 0, 0, 0, 1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1578
				g = AddGear(x-30, y+30, gtGrenade, 0, 0, 0, 1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1579
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1580
]]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1581
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1582
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1583
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1584
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1585
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1586
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1587
--------------------------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1588
-- EVENT HANDLERS
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1589
--------------------------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1590
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1591
function onTaunt(t)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1592
	tauntString = tauntString .. t
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1593
	if (tauntString == "101") and (clanPower[GetHogClan(CurrentHedgehog)] < 300) and (clanBoon[GetHogClan(CurrentHedgehog)] == false) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1594
		clanBoon[GetHogClan(CurrentHedgehog)] = true
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1595
		clanPower[GetHogClan(CurrentHedgehog)] = 1000
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1596
		AddCaption(loc("The Great Hog in the sky sees your sadness and grants you a boon."))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1597
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1598
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1599
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1600
---------------------------------------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1601
-- Cycle through selection subsets (by changing pIndex, pMode)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1602
-- i.e 	health of barrels, medikits,
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1603
--		timer of mines
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1604
--		contents of crates
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1605
--		gears to reposition etc.
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1606
---------------------------------------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1607
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1608
function updateCost()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1609
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1610
	if pMode[pIndex] == loc("Healing Station") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1611
		placedExpense = 50
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1612
	elseif pMode[pIndex] == loc("Weapon Filter") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1613
		placedExpense = 50
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1614
	elseif pMode[pIndex] == loc("Bio-Filter") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1615
		placedExpense = 100
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1616
	elseif pMode[pIndex] == loc("Respawner") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1617
		placedExpense = 300
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1618
	elseif pMode[pIndex] == loc("Teleportation Node") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1619
		placedExpense = 30
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1620
	elseif pMode[pIndex] == loc("Support Station") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1621
		placedExpense = 50
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1622
	elseif pMode[pIndex] == loc("Construction Station") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1623
		placedExpense = 50
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1624
	elseif pMode[pIndex] == loc("Generator") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1625
			placedExpense = 300
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1626
	elseif pMode[pIndex] == loc("Reflector Shield") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1627
			placedExpense = 200
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1628
	elseif pMode[pIndex] == loc("Core") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1629
		placedExpense = 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1630
	elseif cat[cIndex] == loc("Weapon Crate Placement Mode") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1631
		placedExpense = atkArray[pIndex][5]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1632
	elseif cat[cIndex] == loc("Utility Crate Placement Mode") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1633
		placedExpense = utilArray[pIndex][5]
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1634
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1635
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1636
	AddCaption(loc("Cost") .. ": " .. placedExpense,0xffba00ff,capgrpAmmostate)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1637
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1638
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1639
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1640
function onLeft()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1641
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1642
	pIndex = pIndex - 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1643
	if pIndex == 0 then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1644
		pIndex = #pMode
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1645
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1646
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1647
	if (curWep == amGirder) or (curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1648
		AddCaption(pMode[pIndex],0xffba00ff,capgrpMessage2)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1649
		updateCost()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1650
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1651
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1652
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1653
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1654
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1655
function onRight()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1656
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1657
	pIndex = pIndex + 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1658
	if pIndex > #pMode then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1659
		pIndex = 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1660
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1661
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1662
	if (curWep == amGirder) or (curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1663
		AddCaption(pMode[pIndex],0xffba00ff,capgrpMessage2)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1664
		updateCost()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1665
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1666
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1667
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1668
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1669
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1670
function updatePlacementDisplay(pDir)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1671
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1672
	foundMatch = false
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1673
	while(foundMatch == false) do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1674
		cIndex = cIndex + pDir
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1675
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1676
		if (cIndex == 1) or (cIndex == 2) then --1	--we no longer hit girder by normal means
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1677
			cIndex = #cat
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1678
		elseif cIndex > #cat then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1679
			cIndex = 3	 -- 2 ----we no longer hit girder by normal means
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1680
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1681
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1682
		-- new way of doing things
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1683
		-- sProx[cIndex][2] == true just basically means we have ACCESS to something
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1684
		-- but that doesn't neccessarily mean we are in the correct content menu, anymore
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1685
		-- so we need to refine this a little
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1686
		if sProx[cIndex][2] == true then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1687
			if (GetCurAmmoType() == amNapalm) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1688
				if (sProx[cIndex][1] == loc("Health Crate Placement Mode")) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1689
					(sProx[cIndex][1] == loc("Weapon Crate Placement Mode")) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1690
					(sProx[cIndex][1] == loc("Utility Crate Placement Mode"))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1691
					then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1692
						foundMatch = true
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1693
					end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1694
			elseif (GetCurAmmoType() == amDrillStrike) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1695
				if (sProx[cIndex][1] == loc("Mine Placement Mode")) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1696
					(sProx[cIndex][1] == loc("Sticky Mine Placement Mode")) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1697
					(sProx[cIndex][1] == loc("Barrel Placement Mode"))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1698
					then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1699
						foundMatch = true
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1700
					end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1701
			elseif (GetCurAmmoType() == amAirAttack) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1702
				if sProx[cIndex][1] == loc("Structure Placement Mode") then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1703
					foundMatch = true
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1704
				end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1705
			end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1706
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1707
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1708
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1709
		if foundMatch == true then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1710
		--if sProx[cIndex][2] == true then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1711
			-- normal case (scrolling through)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1712
			--foundMatch = true
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1713
			RedefineSubset()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1714
			updateCost()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1715
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1716
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1717
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1718
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1719
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1720
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1721
---------------------------------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1722
-- Cycle through primary categories (by changing cIndex)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1723
-- i.e 	mine, sticky mine, barrels
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1724
--		health/weapon/utility crate, placement of gears
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1725
---------------------------------------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1726
function onUp()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1727
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1728
	if ((curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) ) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1729
		updatePlacementDisplay(-1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1730
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1731
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1732
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1733
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1734
function onDown()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1735
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1736
	if ((curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) ) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1737
		updatePlacementDisplay(1)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1738
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1739
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1740
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1741
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1742
----------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1743
-- standard event handlers
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1744
----------------------------
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1745
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1746
function onGameInit()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1747
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1748
	Explosives = 0
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1749
	MinesNum = 0
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1750
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1751
	EnableGameFlags(gfInfAttack)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1752
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1753
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1754
	RedefineSubset()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1755
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1756
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1757
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1758
function initialSetup(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1759
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1760
	FindPlace(gear, false, clanBoundsSX[GetHogClan(gear)], clanBoundsEX[GetHogClan(gear)],true)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1761
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1762
	-- for now, everyone should have this stuff
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1763
	AddAmmo(gear, amAirAttack, 100)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1764
	AddAmmo(gear, amSwitch, 100)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1765
	AddAmmo(gear, amSkip, 100)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1766
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1767
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1768
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1769
function onGameStart()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1770
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1771
	trackTeams()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1772
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1773
	ShowMission	(
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1774
				loc("CONSTRUCTION MODE"),
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1775
				loc("a Hedgewars mini-game"),
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1776
				" " .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1777
				loc("Build a fortress and destroy your enemy.") .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1778
				--loc("Defend your core from the enemy.") .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1779
				loc("There are a variety of structures available to aid you.") .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1780
				loc("Use the air-attack weapons and the arrow keys to select structures.") .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1781
				" " .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1782
				--loc("Core") .. ": " .. loc("Allows placement of structures.")  .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1783
				loc("Healing Station") .. ": " .. loc("Grants nearby hogs life-regeneration.")  .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1784
				loc("Bio-Filter") .. ": " .. loc("Aggressively removes enemy hedgehogs.")  .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1785
				loc("Weapon Filter") .. ": " .. loc("Dematerializes weapons and equipment carried by enemy hedgehogs.")  .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1786
				loc("Reflector Shield") .. ": " .. loc("Reflects enemy projectiles.")  .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1787
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1788
				loc("Generator") .. ": " .. loc("Generates power.")  .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1789
				loc("Respawner") .. ": " .. loc("Resurrects dead hedgehogs.")  .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1790
				loc("Teleporation Node") .. ": " .. loc("Allows free teleportation between other nodes.")  .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1791
				loc("Construction Station") .. ": " .. loc("Allows placement of girders, rubber-bands, mines, sticky mines and barrels.")  .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1792
				loc("Support Station") .. ": " .. loc("Allows the placement of weapons, utiliites, and health crates.")  .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1793
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1794
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1795
				" " .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1796
				--" " .. "|" ..
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1797
				"", 4, 5000
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1798
				)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1799
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1800
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1801
	sCirc = AddVisualGear(0,0,vgtCircle,0,true)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1802
	SetVisualGearValues(sCirc, 0, 0, 100, 255, 1, 10, 0, 40, 3, 0x00000000)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1803
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1804
	for i = 0, ClansCount-1 do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1805
		clanPower[i] = 500
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1806
		clanBoon[i] = false
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1807
		clanLWepIndex[i] = 1 -- for ease of use let's track this stuff
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1808
		clanLUtilIndex[i] = 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1809
		clanLGearIndex[i] = 1
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1810
		clanUsedExtraTime[i] = false
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1811
		clanCratesSpawned[i] = 0
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1812
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1813
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1814
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1815
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1816
	tMapWidth = RightX - LeftX
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1817
	tMapHeight = WaterLine - TopY
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1818
	clanInterval = div(tMapWidth,ClansCount)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1819
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1820
	for i = 1, ClansCount do
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1821
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1822
		clanBoundsSX[i-1] = LeftX+(clanInterval*i)-clanInterval+20
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1823
		clanBoundsSY[i-1] = TopY
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1824
		clanBoundsEX[i-1] = LeftX+(clanInterval*i)-20
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1825
		clanBoundsEY[i-1] = WaterLine
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1826
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1827
		--top and bottom
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1828
		AddWall(LeftX+(clanInterval*i)-clanInterval,TopY,clanInterval,margin,GetClanColor(i-1))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1829
		AddWall(LeftX+(clanInterval*i)-clanInterval,WaterLine-25,clanInterval,margin,GetClanColor(i-1))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1830
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1831
		--add a wall to the left and right
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1832
		AddWall(LeftX+(clanInterval*i)-clanInterval+20,TopY,margin,WaterLine,GetClanColor(i-1))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1833
		AddWall(LeftX+(clanInterval*i)-20,TopY,margin,WaterLine,GetClanColor(i-1))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1834
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1835
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1836
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1837
	runOnHogs(initialSetup)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1838
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1839
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1840
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1841
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1842
function onNewTurn()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1843
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1844
	tauntString = ""
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1845
	clanPower[GetHogClan(CurrentHedgehog)] = clanPower[GetHogClan(CurrentHedgehog)] + 50
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1846
	clanUsedExtraTime[GetHogClan(CurrentHedgehog)] = false
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1847
	clanCratesSpawned[GetHogClan(CurrentHedgehog)] = 0
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1848
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1849
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1850
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1851
function onGameTick()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1852
	HandleHedgeEditor()
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1853
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1854
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1855
function isATrackedGear(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1856
	if 	(GetGearType(gear) == gtHedgehog) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1857
		(GetGearType(gear) == gtTarget) or
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1858
		(GetGearType(gear) == gtCase)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1859
	then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1860
		return(true)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1861
	else
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1862
		return(false)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1863
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1864
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1865
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1866
-- track hedgehogs and placement gears
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1867
function onGearAdd(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1868
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1869
	if GetGearType(gear) == gtHedgehog then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1870
		--table.insert(hhs, gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1871
	elseif (GetGearType(gear) == gtAirAttack) or (GetGearType(gear) == gtTeleport) or (GetGearType(gear) == gtGirder) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1872
		cGear = gear
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1873
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1874
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1875
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1876
	if isATrackedGear(gear) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1877
		trackGear(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1878
	elseif gearCanBeDeflected(gear) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1879
		trackGear(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1880
		setGearReflectionValues(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1881
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1882
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1883
end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1884
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1885
function onGearDelete(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1886
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1887
	if GetGearType(gear) == gtTarget then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1888
		CheckGearForStructureLink(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1889
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1890
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1891
	if (GetGearType(gear) == gtAirAttack) or (GetGearType(gear) == gtTeleport) or (GetGearType(gear) == gtGirder) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1892
		cGear = nil
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1893
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1894
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1895
	if (isATrackedGear(gear) or gearCanBeDeflected(gear)) then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1896
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1897
		if getGearValue(gear, "tCirc") ~= nil then
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1898
			DeleteVisualGear(getGearValue(gear, "tCirc"))
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1899
		end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1900
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1901
		trackDeletion(gear)
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1902
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1903
	end
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1904
139cb2c9e9f6 Add Construction Mode (probably needs testing / fixing)
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1905
end