share/hedgewars/Data/Scripts/Multiplayer/Continental_supplies.lua
changeset 8618 7e71dba4e7f3
parent 8043 da083f8d95e6
child 9805 1795c34ab8db
equal deleted inserted replaced
8617:e7bea88096d2 8618:7e71dba4e7f3
     1 --[[
     1 --[[
     2 Continental Supplies version 1.1a
     2 Version 1.1c
     3 
     3 
     4 Copyright (C) 2012 Vatten
     4 Copyright (C) 2012 Vatten
     5 
     5 
     6 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
     6 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
     7 
     7 
    13 HedgewarsScriptLoad("/Scripts/Locale.lua")
    13 HedgewarsScriptLoad("/Scripts/Locale.lua")
    14 HedgewarsScriptLoad("/Scripts/Utils.lua")
    14 HedgewarsScriptLoad("/Scripts/Utils.lua")
    15 HedgewarsScriptLoad("/Scripts/Tracker.lua")
    15 HedgewarsScriptLoad("/Scripts/Tracker.lua")
    16 
    16 
    17 function int_sqrt(num)
    17 function int_sqrt(num)
    18 	temp=num
    18 	local temp=num
    19 	while(temp*temp-div(temp,2)>num)
    19 	while(temp*temp-div(temp,2)>num)
    20 	do
    20 	do
    21 		temp=div((temp+div(num,temp)),2)
    21 		temp=div((temp+div(num,temp)),2)
    22 	end
    22 	end
       
    23 	
    23 	return math.abs(temp)
    24 	return math.abs(temp)
    24 end
    25 end
    25 
    26 
    26 function norm(xx,yy)
    27 function norm(xx,yy)
    27 	return int_sqrt((xx^2)+(yy^2))
    28 	--to fix overflows
       
    29 	if(((math.abs(xx)^2)+(math.abs(yy)^2))>2^26)
       
    30 	then
       
    31 		local bitr=2^13
       
    32 		return int_sqrt((div(math.abs(xx),bitr)^2)+(div(math.abs(yy),bitr)^2))*bitr
       
    33 	else
       
    34 		return int_sqrt((math.abs(xx)^2)+(math.abs(yy)^2))
       
    35 	end
    28 end
    36 end
    29 
    37 
    30 function positive(num)
    38 function positive(num)
    31 	if(num<0)
    39 	if(num<0)
    32 	then
    40 	then
    38 
    46 
    39 local teams_ok = {}
    47 local teams_ok = {}
    40 local wepcode_teams={}
    48 local wepcode_teams={}
    41 local swapweps=false
    49 local swapweps=false
    42 
    50 
    43 --run when game starts on real
    51 --variables for seeing if you have swaped around on a weapon
    44 local australianSpecial=false
    52 local australianSpecial=false
    45 local africanSpecial=0
    53 local africanSpecial=0
    46 local africaspecial2=0
    54 local africaspecial2=0
    47 local asianSpecial=false
    55 local asianSpecial=false
    48 local samericanSpecial=false
    56 local samericanSpecial=false
    49 local namericanSpecial=1
    57 local namericanSpecial=1
    50 local sniper_s_in_use=false
    58 local sniper_s_in_use=false
    51 local kergulenSpecial=1
    59 local kergulenSpecial=1
    52 local shotgun_s=false
    60 local shotgun_s=false
    53 local europe_s=0
    61 local europe_s=0
       
    62 local VampOn=0
    54 
    63 
    55 local austmine=nil
    64 local austmine=nil
    56 local inpara=false
    65 local inpara=false
    57 local asianflame=0
    66 local asianflame=0
    58 
    67 
       
    68 local visualcircle=nil
       
    69 
    59 local temp_val=0
    70 local temp_val=0
    60 
    71 
    61 --f?r sabotage
    72 --for sabotage
    62 local disallowattack=0
    73 local disallowattack=0
    63 local disallowleft=true
       
    64 local disable_moving={}
    74 local disable_moving={}
    65 
    75 local disableoffsetai=0
    66 --skall bytas till f?r alla teams
    76 local onsabotageai=false
       
    77 
    67 local continent = {}
    78 local continent = {}
       
    79 
       
    80 local generalinfo=loc("- Per team weapons|- 9 weaponschemes|- Unique new weapons| |Select continent first round with the Weapon Menu or by ([switch/tab]=Increase,[presice/left shift]=Decrease) on Skip|Some weapons have a second option. Find them with [switch/tab]")
    68 
    81 
    69 local weapontexts = {
    82 local weapontexts = {
    70 loc("Green lipstick bullet: [Is poisonous]"),
    83 loc("Green lipstick bullet: [Is poisonous]"),
    71 loc("Piñata bullet: [Contains some sweet candy!]"),
    84 loc("Piñata bullet: [Contains some sweet candy!]"),
    72 loc("Anno 1032: [The explosion will make a strong push ~ wide range, wont affect hogs close to the target]"),
    85 loc("Anno 1032: [The explosion will make a strong push ~ wide range, wont affect hogs close to the target]"),
    73 loc("Dust storm: [Deals 20 damage to all enemies in the circle]"),
    86 loc("Dust storm: [Deals 15 damage to all enemies in the circle]"),
    74 loc("Fire a mine: [Does what it says ~ Cant be dropped close to an enemy ~ 1 sec]"),
    87 loc("Fire a mine: [Does what it says ~ Cant be dropped close to an enemy ~ 1 sec]"),
    75 loc("Drop a bomb: [drop some heroic wind that will turn into a bomb on impact]"),
    88 loc("Drop a bomb: [drop some heroic wind that will turn into a bomb on impact ~ once per turn]"),
    76 loc("Scream from a Walrus: [Deal 20 damage + 10% of your hogs health to all hogs around you and get half back]"),
    89 loc("Scream from a Walrus: [Deal 20 damage + 10% of your hogs health to all hogs around you and get half back]"),
    77 loc("Disguise as a Rockhopper Penguin: [Swap place with a random enemy hog in the circle]"),
    90 loc("Disguise as a Rockhopper Penguin: [Swap place with a random enemy hog in the circle]"),
    78 loc("Flare: [fire up some bombs depending on hogs depending on hogs in the circle"),
    91 loc("Flare: [fire up some bombs depending on hogs depending on hogs in the circle"),
    79 loc("Lonely Cries: [Rise the water if no hog is in the circle and deal 1 damage to all hogs]"),
    92 loc("Lonely Cries: [Rise the water if no hog is in the circle and deal 7 damage to all enemy hogs]"),
    80 loc("Hedgehog projectile: [fire your hog like a Sticky Bomb]"),
    93 loc("Hedgehog projectile: [fire your hog like a Sticky Bomb]"),
    81 loc("Napalm rocket: [Fire a bomb with napalm!]"),
    94 loc("Napalm rocket: [Fire a bomb with napalm!]"),
    82 loc("Eagle Eye: [Blink to the impact ~ one shot]"),
    95 loc("Eagle Eye: [Blink to the impact ~ one shot]"),
    83 loc("Medicine: [Fire some exploding medicine that will heal all hogs effected by the explosion]"),
    96 loc("Medicine: [Fire some exploding medicine that will heal all hogs effected by the explosion]"),
    84 loc("Sabotage: [Sabotage all hogs in the circle and deal ~10 dmg]")
    97 loc("Sabotage: [Sabotage all hogs in the circle and deal ~10 dmg]")
    88 {
   101 {
    89 {loc("North America"),"Area: 24,709,000 km2, Population: 528,720,588",loc("Special Weapons:").."|"..loc("Shotgun")..": "..weapontexts[13].."|"..loc("Sniper Rifle")..": "..weapontexts[1].."|"..loc("Sniper Rifle")..": "..weapontexts[2],amSniperRifle,
   102 {loc("North America"),"Area: 24,709,000 km2, Population: 528,720,588",loc("Special Weapons:").."|"..loc("Shotgun")..": "..weapontexts[13].."|"..loc("Sniper Rifle")..": "..weapontexts[1].."|"..loc("Sniper Rifle")..": "..weapontexts[2],amSniperRifle,
    90 {{amShotgun,100},{amDEagle,100},{amLaserSight,4},{amSniperRifle,100},{amCake,1},{amAirAttack,2},{amSwitch,6}}},
   103 {{amShotgun,100},{amDEagle,100},{amLaserSight,4},{amSniperRifle,100},{amCake,1},{amAirAttack,2},{amSwitch,6}}},
    91 
   104 
    92 {loc("South America"),"Area: 17,840,000 km2, Population: 387,489,196 ",loc("Special Weapons:").."|"..loc("GasBomb")..": "..weapontexts[3],amGasBomb,
   105 {loc("South America"),"Area: 17,840,000 km2, Population: 387,489,196 ",loc("Special Weapons:").."|"..loc("GasBomb")..": "..weapontexts[3],amGasBomb,
    93 {{amBirdy,5},{amHellishBomb,1},{amBee,100},{amWhip,100},{amGasBomb,100},{amFlamethrower,100},{amNapalm,1},{amExtraDamage,2}}},
   106 {{amBirdy,6},{amHellishBomb,1},{amBee,100},{amWhip,100},{amGasBomb,100},{amFlamethrower,100},{amNapalm,1},{amExtraDamage,2}}},
    94 
   107 
    95 {loc("Europe"),"Area: 10,180,000 km2, Population: 739,165,030",loc("Special Weapons:").."|"..loc("Molotov")..": "..weapontexts[14],amBazooka,
   108 {loc("Europe"),"Area: 10,180,000 km2, Population: 739,165,030",loc("Special Weapons:").."|"..loc("Molotov")..": "..weapontexts[14],amBazooka,
    96 {{amBazooka,100},{amGrenade,100},{amMortar,100},{amClusterBomb,5},{amMolotov,5},{amVampiric,4},{amPiano,1},{amResurrector,2},{amJetpack,2}}},
   109 {{amBazooka,100},{amGrenade,100},{amMortar,100},{amClusterBomb,5},{amMolotov,5},{amVampiric,4},{amPiano,1},{amResurrector,2},{amJetpack,2}}},
    97 
   110 
    98 {loc("Africa"),"Area: 30,221,532 km2, Population: 1,032,532,974",loc("Special Weapons:").."|"..loc("Seduction")..": "..weapontexts[4].."|"..loc("Sticky Mine")..": "..weapontexts[11].."|"..loc("Sticky Mine")..": "..weapontexts[12],amSMine,
   111 {loc("Africa"),"Area: 30,221,532 km2, Population: 1,032,532,974",loc("Special Weapons:").."|"..loc("Seduction")..": "..weapontexts[4].."|"..loc("Sticky Mine")..": "..weapontexts[11].."|"..loc("Sticky Mine")..": "..weapontexts[12],amSMine,
    99 {{amSMine,6},{amWatermelon,1},{amDrillStrike,1},{amExtraTime,2},{amDrill,100},{amLandGun,3},{amSeduction,100}}},
   112 {{amSMine,100},{amWatermelon,1},{amDrillStrike,1},{amExtraTime,2},{amDrill,100},{amLandGun,3},{amSeduction,100}}},
   100 
   113 
   101 {loc("Asia"),"Area: 44,579,000 km2, Population: 3,879,000,000",loc("- Will refresh Parachute each turn.").."|"..loc("Special Weapons:").."|"..loc("Parachute")..": "..weapontexts[6],amRope,
   114 {loc("Asia"),"Area: 44,579,000 km2, Population: 3,879,000,000",loc("- Will give you a parachute each turn.").."|"..loc("Special Weapons:").."|"..loc("Parachute")..": "..weapontexts[6],amRope,
   102 {{amKamikaze,4},{amRope,100},{amFirePunch,100},{amParachute,1},{amKnife,4},{amDynamite,1}}},
   115 {{amKamikaze,4},{amRope,100},{amFirePunch,100},{amParachute,1},{amKnife,2},{amDynamite,1}}},
   103 
   116 
   104 {loc("Australia"),"Area:  8,468,300 km2, Population: 31,260,000",loc("Special Weapons:").."|"..loc("Baseballbat")..": "..weapontexts[5],amBaseballBat,
   117 {loc("Australia"),"Area:  8,468,300 km2, Population: 31,260,000",loc("Special Weapons:").."|"..loc("Baseballbat")..": "..weapontexts[5],amBaseballBat,
   105 {{amBaseballBat,100},{amMine,100},{amLowGravity,6},{amBlowTorch,100},{amRCPlane,2},{amTardis,100}}},
   118 {{amBaseballBat,100},{amMine,100},{amLowGravity,6},{amBlowTorch,100},{amRCPlane,2},{amTardis,100}}},
   106 
   119 
   107 {loc("Antarctica"),"Area: 14,000,000 km2, Population: ~1,000",loc("- Will refresh portalgun each turn."),amTeleport,
   120 {loc("Antarctica"),"Area: 14,000,000 km2, Population: ~1,000",loc("- Will give you a portalgun every second turn."),amTeleport,
   108 {{amSnowball,4},{amTeleport,2},{amInvulnerable,6},{amPickHammer,100},{amSineGun,100},{amGirder,4},{amPortalGun,1}}},
   121 {{amSnowball,4},{amTeleport,2},{amInvulnerable,6},{amPickHammer,100},{amSineGun,100},{amGirder,3},{amPortalGun,2}}},
   109 
   122 
   110 {loc("Kerguelen"),"Area: 1,100,000 km2, Population: ~70",loc("Special Weapons:").."|"..loc("Structure")..": "..weapontexts[7].."|"..loc("Structure")..": "..weapontexts[8].." ("..loc("Duration")..": 2)|"..loc("Structure")..": "..weapontexts[9].."|"..loc("Structure")..": "..weapontexts[10],amStructure,
   123 {loc("Kerguelen"),"Area: 1,100,000 km2, Population: ~70",loc("Special Weapons:").."|"..loc("Hammer")..": "..weapontexts[7].."|"..loc("Hammer")..": "..weapontexts[8].." ("..loc("Duration")..": 2)|"..loc("Hammer")..": "..weapontexts[9].."|"..loc("Hammer")..": "..weapontexts[10].."|"..loc("Hammer")..": "..weapontexts[15],amHammer,
   111 {{amHammer,100},{amMineStrike,2},{amBallgun,1},{amStructure,100}}},
   124 {{amHammer,100},{amMineStrike,2},{amBallgun,1},{amIceGun,2}}},
   112 --no ,{amIceGun,4} for 0.9.18
       
   113 
   125 
   114 {loc("Zealandia"),"Area: 3,500,000 km2, Population: 4,650,000",loc("- Will Get 1-3 random weapons"),amInvulnerable,
   126 {loc("Zealandia"),"Area: 3,500,000 km2, Population: 4,650,000",loc("- Will Get 1-3 random weapons"),amInvulnerable,
   115 {{amBazooka,1},{amBlowTorch,1},{amSwitch,1}}}
   127 {{amBazooka,1},{amBlowTorch,1},{amSwitch,1}}}
       
   128 }
       
   129 
       
   130 local weaponsetssounds=
       
   131 {
       
   132 {sndShotgunFire,sndCover},
       
   133 {sndEggBreak,sndLaugh},
       
   134 {sndExplosion,sndEnemyDown},
       
   135 {sndMelonImpact,sndHello},
       
   136 {sndRopeAttach,sndComeonthen},
       
   137 {sndBaseballBat,sndNooo},
       
   138 {sndSineGun,sndOops},
       
   139 {sndPiano5,sndStupid},
       
   140 {sndSplash,sndFirstBlood}
   116 }
   141 }
   117 
   142 
   118 --weapontype,ammo,?,duration,*times your choice,affect on random team (should be placed with 1,0,1,0,1 on the 6th option for better randomness)
   143 --weapontype,ammo,?,duration,*times your choice,affect on random team (should be placed with 1,0,1,0,1 on the 6th option for better randomness)
   119 local weapons_dmg = {
   144 local weapons_dmg = {
   120 	{amKamikaze, 0, 1, 0, 1, 0},
   145 	{amKamikaze, 0, 1, 0, 1, 0},
   150 	{amAirAttack, 0, 1, 4, 1, 1},
   175 	{amAirAttack, 0, 1, 4, 1, 1},
   151 	{amFlamethrower, 0, 1, 0, 1, 0},
   176 	{amFlamethrower, 0, 1, 0, 1, 0},
   152 	{amSMine, 0, 1, 0, 1, 1},
   177 	{amSMine, 0, 1, 0, 1, 1},
   153 	{amHammer, 0, 1, 0, 1, 0},
   178 	{amHammer, 0, 1, 0, 1, 0},
   154 	{amDrillStrike, 0, 1, 4, 1, 2},
   179 	{amDrillStrike, 0, 1, 4, 1, 2},
   155 	{amSnowball, 0, 1, 0, 1, 0},
   180 	{amSnowball, 0, 1, 0, 1, 0}
   156 	{amStructure, 0, 0, 0, 1, 1}
   181 	--{amStructure, 0, 0, 0, 1, 1}
   157 }
   182 }
   158 local weapons_supp = {
   183 local weapons_supp = {
   159 	{amParachute, 0, 1, 0, 1, 0},
   184 	{amParachute, 0, 1, 0, 1, 0},
   160 	{amGirder, 0, 1, 0, 1, 0},
   185 	{amGirder, 0, 1, 0, 1, 0},
   161 	{amSwitch, 0, 1, 0, 1, 0},
   186 	{amSwitch, 0, 1, 0, 1, 0},
   173 	{amLandGun, 0, 1, 0, 1, 0},
   198 	{amLandGun, 0, 1, 0, 1, 0},
   174 	{amTardis, 0, 1, 0, 1, 0},
   199 	{amTardis, 0, 1, 0, 1, 0},
   175 	{amIceGun, 0, 1, 0, 1, 0},
   200 	{amIceGun, 0, 1, 0, 1, 0},
   176 	{amKnife, 0, 1, 0, 1, 0}
   201 	{amKnife, 0, 1, 0, 1, 0}
   177 }
   202 }
   178 	
   203 
       
   204 --will check after borders and stuff
   179 function validate_weapon(hog,weapon,amount)
   205 function validate_weapon(hog,weapon,amount)
   180 	if(MapHasBorder() == false or (MapHasBorder() == true and weapon ~= amAirAttack and weapon ~= amMineStrike and weapon ~= amNapalm and weapon ~= amDrillStrike and weapon ~= amPiano))
   206 	if(MapHasBorder() == false or (MapHasBorder() == true and weapon ~= amAirAttack and weapon ~= amMineStrike and weapon ~= amNapalm and weapon ~= amDrillStrike and weapon ~= amPiano))
   181 	then
   207 	then
   182 		AddAmmo(hog, weapon,amount)
   208 		AddAmmo(hog, weapon,amount)
   183 	end
   209 	end
   185 
   211 
   186 --reset all weapons for a team
   212 --reset all weapons for a team
   187 function cleanweps(hog)
   213 function cleanweps(hog)
   188 
   214 
   189 	local i=1
   215 	local i=1
   190 	--+1 for skip
   216 	--+1 for skip +1 for freezer
   191 	while(i<=table.getn(weapons_supp)+table.getn(weapons_dmg)+1)
   217 	while(i<=table.maxn(weapons_supp)+table.maxn(weapons_dmg)+2)
   192 	do
   218 	do
   193 		AddAmmo(hog,i,0)
   219 		AddAmmo(hog,i,0)
   194 		i=i+1
   220 		i=i+1
   195 	end
   221 	end
   196 	
   222 	
   197 	AddAmmo(hog,amSkip,100)
   223 	AddAmmo(hog,amSkip,100)
   198 end
   224 end
   199 
   225 
       
   226 --get the weapons from a weaponset
   200 function load_weaponset(hog, num)
   227 function load_weaponset(hog, num)
   201 	for v,w in pairs(weaponsets[num][5]) 
   228 	for v,w in pairs(weaponsets[num][5]) 
   202 	do
   229 	do
   203 		validate_weapon(hog, w[1],w[2])
   230 		validate_weapon(hog, w[1],w[2])
   204 	end
   231 	end
   205 end
   232 end
   206 
   233 
       
   234 --list up all weapons from the icons for each continent
   207 function load_continent_selection(hog)
   235 function load_continent_selection(hog)
   208 	for v,w in pairs(weaponsets) 
   236 	for v,w in pairs(weaponsets) 
   209 	do
   237 	do
   210 		validate_weapon(hog, weaponsets[v][4],1)
   238 		validate_weapon(hog, weaponsets[v][4],1)
   211 	end
   239 	end
   212 	AddAmmo(hog,amSwitch) --random continent
   240 	AddAmmo(hog,amSwitch) --random continent
   213 end
   241 end
   214 
   242 
   215 function show_continent_info(continent,time)
   243 --shows the continent info
       
   244 function show_continent_info(continent,time,generalinf)
       
   245 	local geninftext=""
   216 	local ns=false
   246 	local ns=false
   217 	if(time==-1)
   247 	if(time==-1)
   218 	then
   248 	then
   219 		time=0
   249 		time=0
   220 		ns=true
   250 		ns=true
   221 	end
   251 	end
   222 	ShowMission(weaponsets[continent][1],weaponsets[continent][2],weaponsets[continent][3], -weaponsets[continent][4], time)
   252 	if(generalinf)
       
   253 	then
       
   254 		geninftext="| |"..loc("General information")..": |"..generalinfo
       
   255 	end
       
   256 	ShowMission(weaponsets[continent][1],weaponsets[continent][2],weaponsets[continent][3]..geninftext, -weaponsets[continent][4], time)
   223 	if(ns)
   257 	if(ns)
   224 	then
   258 	then
   225 		HideMission()
   259 		HideMission()
   226 	end
   260 	end
   227 end
   261 end
   228 
   262 
       
   263 --will show a circle of gears (eye candy)
   229 function visual_gear_explosion(range,xpos,ypos,gear1,gear2)
   264 function visual_gear_explosion(range,xpos,ypos,gear1,gear2)
   230 	local degr=0
   265 	local degr=0
   231 	local lap=30
   266 	local lap=30
   232 	while(lap<range)
   267 	while(lap<range)
   233 	do
   268 	do
   243 		lap=lap+30
   278 		lap=lap+30
   244 		degr=degr-6.2831
   279 		degr=degr-6.2831
   245 	end
   280 	end
   246 end
   281 end
   247 
   282 
   248 --zealandia
   283 --zealandia (generates weapons from the weaponinfo above
   249 function get_random_weapon(hog)
   284 function get_random_weapon(hog)
   250 	if(GetGearType(hog) == gtHedgehog)
   285 	if(GetGearType(hog) == gtHedgehog and continent[GetHogTeamName(hog)]==9 and getTeamValue(GetHogTeamName(hog), "rand-done-turn")==nil)
   251 	then
   286 	then
       
   287 		cleanweps(hog)
       
   288 	
   252 		local random_weapon = 0
   289 		local random_weapon = 0
   253 		local old_rand_weap = 0
   290 		local old_rand_weap = 0
   254 		local rand_weaponset_power = 0
   291 		local rand_weaponset_power = 0
   255 		
   292 		
   256 		if(continent[GetHogTeamName(hog)]==9 and (getTeamValue(GetHogTeamName(hog), "rand-done-turn")==false or getTeamValue(GetHogTeamName(hog), "rand-done-turn")==nil))
   293 		local numberof_weapons_supp=table.maxn(weapons_supp)
   257 		then
   294 		local numberof_weapons_dmg=table.maxn(weapons_dmg)
   258 			cleanweps(hog)
   295 		
   259 		
   296 		local rand1=GetRandom(table.maxn(weapons_supp))+1
   260 			random_weapon = GetRandom(table.getn(weapons_dmg))+1
   297 		local rand2=GetRandom(table.maxn(weapons_dmg))+1
   261 			while(weapons_dmg[random_weapon][4]>TotalRounds)
   298 		
       
   299 		random_weapon = GetRandom(table.maxn(weapons_dmg))+1
       
   300 		
       
   301 		while(weapons_dmg[random_weapon][4]>TotalRounds)
       
   302 		do
       
   303 			if(random_weapon>=numberof_weapons_dmg)
       
   304 			then
       
   305 				random_weapon=0
       
   306 			end
       
   307 			random_weapon = random_weapon+1
       
   308 		end
       
   309 		validate_weapon(hog, weapons_dmg[random_weapon][1],1)
       
   310 		rand_weaponset_power=weapons_dmg[random_weapon][6]
       
   311 		old_rand_weap = random_weapon
       
   312 		
       
   313 		if(rand_weaponset_power <2)
       
   314 		then
       
   315 			random_weapon = rand1
       
   316 			while(weapons_supp[random_weapon][4]>TotalRounds or rand_weaponset_power+weapons_supp[random_weapon][6]>2)
   262 			do
   317 			do
   263 				if(random_weapon>=table.getn(weapons_dmg))
   318 				if(random_weapon>=numberof_weapons_supp)
       
   319 				then
       
   320 					random_weapon=0
       
   321 				end
       
   322 				random_weapon = random_weapon+1
       
   323 			end
       
   324 			validate_weapon(hog, weapons_supp[random_weapon][1],1)
       
   325 			rand_weaponset_power=rand_weaponset_power+weapons_supp[random_weapon][6]
       
   326 		end
       
   327 		--check again if  the power is enough
       
   328 		if(rand_weaponset_power <1)
       
   329 		then
       
   330 			random_weapon = rand2
       
   331 			while(weapons_dmg[random_weapon][4]>TotalRounds or old_rand_weap == random_weapon or weapons_dmg[random_weapon][6]>0)
       
   332 			do
       
   333 				if(random_weapon>=numberof_weapons_dmg)
   264 				then
   334 				then
   265 					random_weapon=0
   335 					random_weapon=0
   266 				end
   336 				end
   267 				random_weapon = random_weapon+1
   337 				random_weapon = random_weapon+1
   268 			end
   338 			end
   269 			validate_weapon(hog, weapons_dmg[random_weapon][1],1)
   339 			validate_weapon(hog, weapons_dmg[random_weapon][1],1)
   270 			rand_weaponset_power=weapons_dmg[random_weapon][6]
   340 		end
   271 			old_rand_weap = random_weapon
       
   272 			
   341 			
   273 			if(rand_weaponset_power <2)
   342 		setTeamValue(GetHogTeamName(hog), "rand-done-turn", true)
   274 			then
   343 	end
   275 				random_weapon = GetRandom(table.getn(weapons_supp))+1
   344 end
   276 				while(weapons_supp[random_weapon][4]>TotalRounds or rand_weaponset_power+weapons_supp[random_weapon][6]>2)
   345 
   277 				do
   346 --this will take that hogs settings for the weapons and add them
   278 					if(random_weapon>=table.getn(weapons_supp))
   347 function setweapons()
   279 					then
       
   280 						random_weapon=0
       
   281 					end
       
   282 					random_weapon = random_weapon+1
       
   283 				end
       
   284 				validate_weapon(hog, weapons_supp[random_weapon][1],1)
       
   285 				rand_weaponset_power=rand_weaponset_power+weapons_supp[random_weapon][6]
       
   286 			end
       
   287 			--check again if  the power is enough
       
   288 			if(rand_weaponset_power <1)
       
   289 			then
       
   290 				random_weapon = GetRandom(table.getn(weapons_dmg))+1
       
   291 				while(weapons_dmg[random_weapon][4]>TotalRounds or old_rand_weap == random_weapon or weapons_dmg[random_weapon][6]>0)
       
   292 				do
       
   293 					if(random_weapon>=table.getn(weapons_dmg))
       
   294 					then
       
   295 						random_weapon=0
       
   296 					end
       
   297 					random_weapon = random_weapon+1
       
   298 				end
       
   299 				validate_weapon(hog, weapons_dmg[random_weapon][1],1)
       
   300 			end
       
   301 				
       
   302 			setTeamValue(GetHogTeamName(hog), "rand-done-turn", true)
       
   303 			
       
   304 			if(GetHogTeamName(hog)==GetHogTeamName(CurrentHedgehog))
       
   305 			then
       
   306 				temp_val=false
       
   307 			end
       
   308 		end
       
   309 	end
       
   310 end
       
   311 
       
   312 
       
   313 function setweapons(skipafter)
       
   314 
   348 
   315 	cleanweps(CurrentHedgehog)
   349 	cleanweps(CurrentHedgehog)
   316 	load_weaponset(CurrentHedgehog,continent[GetHogTeamName(CurrentHedgehog)])
   350 	load_weaponset(CurrentHedgehog,continent[GetHogTeamName(CurrentHedgehog)])
   317 	if(skipafter==true)
   351 	
   318 	then
   352 	visualstuff=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-5, vgtDust,0, false)
   319 		ParseCommand("setweap " .. string.char(amSkip))
   353 	v1, v2, v3, v4, v5, v6, v7, v8, v9, v10 = GetVisualGearValues(visualstuff)
   320 	end
   354 	SetVisualGearValues(visualstuff, v1, v2, v3, v4, v5, v6, v7, 2, v9, GetClanColor(GetHogClan(CurrentHedgehog)))
   321 
   355 	
   322 	show_continent_info(continent[GetHogTeamName(CurrentHedgehog)],0)
   356 	show_continent_info(continent[GetHogTeamName(CurrentHedgehog)],0,false)
   323 end
   357 end
   324 
   358 
       
   359 --show health tag (will mostly be used when a hog is damaged)
   325 function show_damage_tag(hog,damage)
   360 function show_damage_tag(hog,damage)
   326 	healthtag=AddVisualGear(GetX(hog), GetY(hog), vgtHealthTag, damage, false)
   361 	healthtag=AddVisualGear(GetX(hog), GetY(hog), vgtHealthTag, damage, false)
   327 	v1, v2, v3, v4, v5, v6, v7, v8, v9, v10 = GetVisualGearValues(healthtag)
   362 	v1, v2, v3, v4, v5, v6, v7, v8, v9, v10 = GetVisualGearValues(healthtag)
   328 	SetVisualGearValues(healthtag, v1, v2, v3, v4, v5, v6, v7, v8, v9, GetClanColor(GetHogClan(hog)))
   363 	SetVisualGearValues(healthtag, v1, v2, v3, v4, v5, v6, v7, v8, v9, GetClanColor(GetHogClan(hog)))
   329 end
   364 end
   330 
   365 
       
   366 --will use int_sqrt
   331 function fire_gear(hedgehog,geartype,vx,vy,timer)
   367 function fire_gear(hedgehog,geartype,vx,vy,timer)
   332 	return AddGear(div((GetGearRadius(hedgehog)*2*vx),norm(vx,vy))+GetX(hedgehog), div((GetGearRadius(hedgehog)*2*vy),norm(vx,vy))+GetY(hedgehog), geartype, 0, vx, vy, timer)
   368 	local hypo=norm(vx,vy)
       
   369 	return AddGear(div((GetGearRadius(hedgehog)*2*vx),hypo)+GetX(hedgehog), div((GetGearRadius(hedgehog)*2*vy),hypo)+GetY(hedgehog), geartype, 0, vx, vy, timer)
   333 end
   370 end
   334 
   371 
   335 --==========================run throw all hog/gear weapons ==========================
   372 --==========================run throw all hog/gear weapons ==========================
       
   373 --will check if the mine is nicely placed 
   336 function weapon_aust_check(hog)
   374 function weapon_aust_check(hog)
   337 	if(GetGearType(hog) == gtHedgehog)
   375 	if(GetGearType(hog) == gtHedgehog)
   338 	then
   376 	then
   339 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 50, false)==true and hog ~= CurrentHedgehog)
   377 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 50, false)==true and hog ~= CurrentHedgehog)
   340 		then
   378 		then
   341 			temp_val=1
   379 			temp_val=1
   342 		end
   380 		end
   343 	end
   381 	end
   344 end
   382 end
   345 
   383 
       
   384 --african special on sedunction
   346 function weapon_duststorm(hog)
   385 function weapon_duststorm(hog)
   347 	if(GetGearType(hog) == gtHedgehog)
   386 	if(GetGearType(hog) == gtHedgehog)
   348 	then
   387 	then
   349 		local dmg=20
   388 		local dmg=15
   350 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 250, false)==true and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   389 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 250, false)==true and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   351 		then
   390 		then
   352 			if(GetHealth(hog) > dmg)
   391 			if(GetHealth(hog) > dmg)
   353 			then
   392 			then
       
   393 				temp_val=temp_val+div(dmg*VampOn,100)
   354 				SetHealth(hog, GetHealth(hog)-dmg)
   394 				SetHealth(hog, GetHealth(hog)-dmg)
   355 			else
   395 			else
       
   396 				temp_val=temp_val+div(GetHealth(hog)*VampOn,100)
   356 				SetHealth(hog, 0)
   397 				SetHealth(hog, 0)
   357 			end
   398 			end
   358 			show_damage_tag(hog,dmg)
   399 			show_damage_tag(hog,dmg)
   359 		end
   400 		end
   360 	end
   401 	end
   361 end
   402 end
   362 
   403 
       
   404 --kerguelen special on structure 
   363 function weapon_scream_walrus(hog)
   405 function weapon_scream_walrus(hog)
   364 	if(GetGearType(hog) == gtHedgehog)
   406 	if(GetGearType(hog) == gtHedgehog)
   365 	then
   407 	then
   366 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 120, false)==true and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   408 		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 120, false)==true and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   367 		then
   409 		then
   368 			if(GetHealth(hog)>(20+GetHealth(CurrentHedgehog)*0.1))
   410 			if(GetHealth(hog)>(20+GetHealth(CurrentHedgehog)*0.1))
   369 			then
   411 			then
       
   412 				temp_val=temp_val+10+(GetHealth(CurrentHedgehog)*0.05)+div((20+GetHealth(CurrentHedgehog)*0.1)*VampOn,100)
   370 				SetHealth(hog, GetHealth(hog)-(20+GetHealth(CurrentHedgehog)*0.1))
   413 				SetHealth(hog, GetHealth(hog)-(20+GetHealth(CurrentHedgehog)*0.1))
   371 				temp_val=temp_val+10+GetHealth(CurrentHedgehog)*0.05
       
   372 			else
   414 			else
       
   415 				temp_val=temp_val+(GetHealth(hog)*0.5)+(GetHealth(CurrentHedgehog)*0.05)+div((GetHealth(hog)+(GetHealth(CurrentHedgehog)*0.1))*VampOn,100)
   373 				SetHealth(hog, 0)
   416 				SetHealth(hog, 0)
   374 				temp_val=temp_val+(GetHealth(hog)*0.5)+(GetHealth(CurrentHedgehog)*0.05)
       
   375 			end
   417 			end
   376 			show_damage_tag(hog,(20+GetHealth(CurrentHedgehog)*0.1))
   418 			show_damage_tag(hog,(20+GetHealth(CurrentHedgehog)*0.1))
   377 			AddVisualGear(GetX(hog), GetY(hog), vgtExplosion, 0, false)
   419 			AddVisualGear(GetX(hog), GetY(hog), vgtExplosion, 0, false)
   378 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
   420 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
   379 		end
   421 		end
   380 	end
   422 	end
   381 end
   423 end
   382 
   424 
       
   425 --kerguelen special swap hog
   383 function weapon_swap_kerg(hog)
   426 function weapon_swap_kerg(hog)
   384 	if(GetGearType(hog) == gtHedgehog)
   427 	if(GetGearType(hog) == gtHedgehog)
   385 	then
   428 	then
   386 		if(kergulenSpecial ~= -1 and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 450, false))
   429 		if(kergulenSpecial ~= -1 and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 450, false))
   387 		then
   430 		then
   392 			kergulenSpecial=-1
   435 			kergulenSpecial=-1
   393 		end
   436 		end
   394 	end
   437 	end
   395 end
   438 end
   396 
   439 
       
   440 --kerguelen special on structure
   397 function weapon_flare(hog)
   441 function weapon_flare(hog)
   398 	if(GetGearType(hog) == gtHedgehog)
   442 	if(GetGearType(hog) == gtHedgehog)
   399 	then
   443 	then
   400 		if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 45, false))
   444 		if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 45, false))
   401 		then
   445 		then
   412 			PlaySound(sndHellishImpact2)
   456 			PlaySound(sndHellishImpact2)
   413 		end
   457 		end
   414 	end
   458 	end
   415 end
   459 end
   416 
   460 
       
   461 --kerguelen special will apply sabotage
   417 function weapon_sabotage(hog)
   462 function weapon_sabotage(hog)
   418 	if(GetGearType(hog) == gtHedgehog)
   463 	if(GetGearType(hog) == gtHedgehog)
   419 	then
   464 	then
   420 		if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 100, false))
   465 		if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 100, false))
   421 		then
   466 		then
   424 			PlaySound(sndNooo,hog)
   469 			PlaySound(sndNooo,hog)
   425 		end
   470 		end
   426 	end
   471 	end
   427 end
   472 end
   428 
   473 
       
   474 --south american special (used fire gear)
   429 function weapon_anno_south(hog)
   475 function weapon_anno_south(hog)
   430 	local power_radius_outer=250
   476 	local power_radius_outer=230
   431 	local power_radius_inner=40
   477 	local power_radius_inner=45
   432 	local power_sa=500000
   478 	local power_sa=500000
       
   479 	local hypo=0
   433 	if(gearIsInCircle(hog,GetX(temp_val), GetY(temp_val), power_radius_outer, false) and gearIsInCircle(hog,GetX(temp_val), GetY(temp_val), power_radius_inner, false)==false)
   480 	if(gearIsInCircle(hog,GetX(temp_val), GetY(temp_val), power_radius_outer, false) and gearIsInCircle(hog,GetX(temp_val), GetY(temp_val), power_radius_inner, false)==false)
   434 	then
   481 	then
   435 		if(hog == CurrentHedgehog)
   482 		if(hog == CurrentHedgehog)
   436 		then
   483 		then
   437 			SetState(CurrentHedgehog, gstMoving)
   484 			SetState(CurrentHedgehog, gstMoving)
   438 		end
   485 		end
   439 		SetGearPosition(hog, GetX(hog),GetY(hog)-3)
   486 		SetGearPosition(hog, GetX(hog),GetY(hog)-3)
   440 		SetGearVelocity(hog, div((power_radius_outer-norm(math.abs(GetX(hog)-GetX(temp_val)),math.abs(GetY(hog)-GetY(temp_val))))*power_sa*positive(GetX(hog)-GetX(temp_val)),power_radius_outer), div((power_radius_outer-norm(math.abs(GetX(hog)-GetX(temp_val)),math.abs(GetY(hog)-GetY(temp_val))))*power_sa*positive(GetY(hog)-GetY(temp_val)),power_radius_outer))
   487 		hypo=norm(math.abs(GetX(hog)-GetX(temp_val)),math.abs(GetY(hog)-GetY(temp_val)))
   441 	end
   488 		SetGearVelocity(hog, div((power_radius_outer-hypo)*power_sa*positive(GetX(hog)-GetX(temp_val)),power_radius_outer), div((power_radius_outer-hypo)*power_sa*positive(GetY(hog)-GetY(temp_val)),power_radius_outer))
   442 end
   489 	end
   443 
   490 end
       
   491 
       
   492 --first part on kerguelen special (lonely cries)
   444 function weapon_cries_a(hog)
   493 function weapon_cries_a(hog)
   445 	if(GetGearType(hog) == gtHedgehog)
   494 	if(GetGearType(hog) == gtHedgehog and hog ~= CurrentHedgehog and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 500, false))
   446 	then
   495 	then
   447 		if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 500, false))
   496 		kergulenSpecial=-1
   448 		then
   497 	end
   449 			kergulenSpecial=-1
   498 end
   450 		end
   499 
   451 	end
   500 --second part on kerguelen special (lonely cries)
   452 end
       
   453 
       
   454 function weapon_cries_b(hog)
   501 function weapon_cries_b(hog)
   455 	if(GetGearType(hog) == gtHedgehog)
   502 	if(GetGearType(hog) == gtHedgehog)
   456 	then
   503 	then
       
   504 		local dmg=7
   457 		if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   505 		if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
   458 		then
   506 		then
   459 			SetHealth(hog, GetHealth(hog)-1)
   507 			if(GetHealth(hog) > dmg)
   460 			show_damage_tag(hog,1)
   508 			then
       
   509 				temp_val=temp_val+div(dmg*VampOn,100)
       
   510 				SetHealth(hog, GetHealth(hog)-dmg)
       
   511 			else
       
   512 				temp_val=temp_val+div(GetHealth(hog)*VampOn,100)
       
   513 				SetHealth(hog, 0)
       
   514 			end
       
   515 			show_damage_tag(hog,dmg)
   461 			AddVisualGear(GetX(hog), GetY(hog)-30, vgtEvilTrace, 0, false)
   516 			AddVisualGear(GetX(hog), GetY(hog)-30, vgtEvilTrace, 0, false)
   462 		end
   517 		end
   463 	end
   518 	end
   464 end
   519 end
   465 
   520 
       
   521 --north american special on sniper
   466 function weapon_lipstick(hog)
   522 function weapon_lipstick(hog)
   467 	if(GetGearType(hog) == gtHedgehog)
   523 	if(GetGearType(hog) == gtHedgehog)
   468 	then
   524 	then
   469 		if(gearIsInCircle(temp_val,GetX(hog), GetY(hog), 20, false))
   525 		if(gearIsInCircle(temp_val,GetX(hog), GetY(hog), 20, false))
   470 		then
   526 		then
   472 			PlaySound(sndBump)
   528 			PlaySound(sndBump)
   473 		end
   529 		end
   474 	end
   530 	end
   475 end
   531 end
   476 
   532 
       
   533 --european special on molotov (used fire gear)
   477 function weapon_health(hog)
   534 function weapon_health(hog)
   478 	if(GetGearType(hog) == gtHedgehog)
   535 	if(GetGearType(hog) == gtHedgehog)
   479 	then
   536 	then
   480 		if(gearIsInCircle(temp_val,GetX(hog), GetY(hog), 100, false))
   537 		if(gearIsInCircle(temp_val,GetX(hog), GetY(hog), 100, false))
   481 		then
   538 		then
   503 end
   560 end
   504 
   561 
   505 function onGameStart()
   562 function onGameStart()
   506 	--trackTeams()
   563 	--trackTeams()
   507 
   564 
   508 	ShowMission(loc("Continental supplies").." 1.1a",loc("Let a Continent provide your weapons!"),
   565 	ShowMission(loc("Continental supplies").." 1.1c",loc("Let a Continent provide your weapons!"),
   509 	loc("- Per team weapons|- 9 weaponschemes|- Unique new weapons| |Select continent first round with the Weapon Menu or by ([switch/tab]=Increase,[precise/left shift]=Decrease) on Skip|Some weapons have a second option. Find them with [switch/tab]"), -amLowGravity, 0)
   566 	loc(generalinfo), -amLowGravity, 0)
   510 end
   567 end
   511 
   568 
   512 --what happen when a turn starts
   569 --what happen when a turn starts
   513 function onNewTurn()
   570 function onNewTurn()
   514 
   571 	
       
   572 	--will refresh the info on each tab weapon
   515 	australianSpecial=true
   573 	australianSpecial=true
   516 	asianSpecial=false
   574 	asianSpecial=false
   517 	austmine=nil
   575 	austmine=nil
   518 	africanSpecial=0
   576 	africanSpecial=0
   519 	samericanSpecial=false
   577 	samericanSpecial=false
   522 	namericanSpecial=1
   580 	namericanSpecial=1
   523 	asianflame=0
   581 	asianflame=0
   524 	shotgun_s=false
   582 	shotgun_s=false
   525 	sniper_s_in_use=false
   583 	sniper_s_in_use=false
   526 	europe_s=0
   584 	europe_s=0
       
   585 	VampOn=0
   527 	
   586 	
   528 	temp_val=0
   587 	temp_val=0
   529 	
   588 	
       
   589 	--for sabotage
   530 	disallowattack=0
   590 	disallowattack=0
   531 	disallowleft=true
   591 	if(disable_moving[CurrentHedgehog]==true)
       
   592 	then
       
   593 		disableoffsetai=GetHogLevel(CurrentHedgehog)
       
   594 	end
       
   595 	
   532 	--when all hogs are "placed"
   596 	--when all hogs are "placed"
   533 	
       
   534 	if(GetCurAmmoType()~=amTeleport)
   597 	if(GetCurAmmoType()~=amTeleport)
   535 	then
   598 	then
   536 		--will run once when the game really starts (after placing hogs and so on
   599 		--will run once when the game really starts (after placing hogs and so on
   537 		if(teams_ok[GetHogTeamName(CurrentHedgehog)] == nil)
   600 		if(teams_ok[GetHogTeamName(CurrentHedgehog)] == nil)
   538 		then
   601 		then
   541 			load_continent_selection(CurrentHedgehog)
   604 			load_continent_selection(CurrentHedgehog)
   542 			continent[GetHogTeamName(CurrentHedgehog)]=0
   605 			continent[GetHogTeamName(CurrentHedgehog)]=0
   543 			swapweps=true
   606 			swapweps=true
   544 			teams_ok[GetHogTeamName(CurrentHedgehog)] = 2
   607 			teams_ok[GetHogTeamName(CurrentHedgehog)] = 2
   545 		else
   608 		else
       
   609 			--if its not the initialization turn
   546 			swapweps=false
   610 			swapweps=false
   547 			if(continent[GetHogTeamName(CurrentHedgehog)]==0)
   611 			if(continent[GetHogTeamName(CurrentHedgehog)]==0)
   548 			then
   612 			then
   549 				continent[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.getn(weaponsets))+1
   613 				continent[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.maxn(weaponsets))+1
   550 				setweapons(false)
   614 				setweapons()
   551 			end
   615 			end
   552 			show_continent_info(continent[GetHogTeamName(CurrentHedgehog)],-1)
   616 			show_continent_info(continent[GetHogTeamName(CurrentHedgehog)],-1,true)
   553 		end
   617 			
   554 	end
   618 			--give zeelandia-teams new weapons so they can plan for the next turn
   555 	
   619 			runOnGears(get_random_weapon)
   556 	if(continent[GetHogTeamName(CurrentHedgehog)]==7)
   620 			
   557 	then
   621 			--some specials for some continents (temp_val is from get random weapons)
   558 		AddAmmo(CurrentHedgehog,amPortalGun,0)
   622 			if(continent[GetHogTeamName(CurrentHedgehog)]==9)
   559 		AddAmmo(CurrentHedgehog,amPortalGun,1)
   623 			then
   560 	elseif(continent[GetHogTeamName(CurrentHedgehog)]==5)
   624 				setTeamValue(GetHogTeamName(CurrentHedgehog), "rand-done-turn", nil)
   561 	then
   625 			elseif(continent[GetHogTeamName(CurrentHedgehog)]==7)
   562 		AddAmmo(CurrentHedgehog,amParachute,0)
   626 			then
   563 		AddAmmo(CurrentHedgehog,amParachute,1)
   627 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica-turntick")==nil)
   564 	end
   628 				then
   565 	
   629 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica-turntick", 1)
   566 	temp_val=true
   630 				end
   567 	runOnGears(get_random_weapon)
   631 				
   568 	
   632 				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica-turntick")>=2)
   569 	if(temp_val==true and continent[GetHogTeamName(CurrentHedgehog)]==9 and getTeamValue(GetHogTeamName(CurrentHedgehog), "rand-done-turn")==true)
   633 				then
   570 	then
   634 					AddAmmo(CurrentHedgehog,amPortalGun)
   571 		setTeamValue(GetHogTeamName(CurrentHedgehog), "rand-done-turn", false)
   635 					setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica-turntick", 0)
   572 	end
   636 				end
   573 
   637 				setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica-turntick")+1)
       
   638 				
       
   639 			elseif(continent[GetHogTeamName(CurrentHedgehog)]==5)
       
   640 			then
       
   641 				AddAmmo(CurrentHedgehog,amParachute)
       
   642 			end
       
   643 		end
       
   644 	end
   574 end
   645 end
   575 
   646 
   576 --what happens when you press "tab" (common button)
   647 --what happens when you press "tab" (common button)
   577 function onSwitch()
   648 function onSwitch()
   578 	
   649 	
   643 			africaspecial2 = 0
   714 			africaspecial2 = 0
   644 			AddCaption(loc("NORMAL"))
   715 			AddCaption(loc("NORMAL"))
   645 		end
   716 		end
   646 	end
   717 	end
   647 	
   718 	
   648 	--north america
   719 	--north america (sniper)
   649 	if(GetCurAmmoType() == amSniperRifle and sniper_s_in_use==false)
   720 	if(GetCurAmmoType() == amSniperRifle and sniper_s_in_use==false)
   650 	then
   721 	then
   651 		if(namericanSpecial==3)
   722 		if(namericanSpecial==3)
   652 		then
   723 		then
   653 			namericanSpecial = 1
   724 			namericanSpecial = 1
   661 			namericanSpecial = 3
   732 			namericanSpecial = 3
   662 			AddCaption("##"..weapontexts[2])
   733 			AddCaption("##"..weapontexts[2])
   663 		end
   734 		end
   664 	end
   735 	end
   665 	
   736 	
       
   737 	--north america (shotgun)
   666 	if(GetCurAmmoType() == amShotgun and shotgun_s~=nil)
   738 	if(GetCurAmmoType() == amShotgun and shotgun_s~=nil)
   667 	then
   739 	then
   668 		if(shotgun_s==false)
   740 		if(shotgun_s==false)
   669 		then
   741 		then
   670 			shotgun_s = true
   742 			shotgun_s = true
   673 			shotgun_s = false
   745 			shotgun_s = false
   674 			AddCaption(loc("NORMAL"))
   746 			AddCaption(loc("NORMAL"))
   675 		end
   747 		end
   676 	end
   748 	end
   677 	
   749 	
       
   750 	--europe
   678 	if(GetCurAmmoType() == amMolotov)
   751 	if(GetCurAmmoType() == amMolotov)
   679 	then
   752 	then
   680 		if(europe_s==0)
   753 		if(europe_s==0)
   681 		then
   754 		then
   682 			europe_s = 1
   755 			europe_s = 1
   685 			europe_s = 0
   758 			europe_s = 0
   686 			AddCaption(loc("NORMAL"))
   759 			AddCaption(loc("NORMAL"))
   687 		end
   760 		end
   688 	end
   761 	end
   689 	
   762 	
   690 	if(swapweps==true and GetCurAmmoType() == amSkip)
   763 	--swap forward in the weaponmenu (1.0 style)
       
   764 	if(swapweps==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing))
   691 	then
   765 	then
   692 		continent[GetHogTeamName(CurrentHedgehog)]=continent[GetHogTeamName(CurrentHedgehog)]+1
   766 		continent[GetHogTeamName(CurrentHedgehog)]=continent[GetHogTeamName(CurrentHedgehog)]+1
   693 		
   767 		
   694 		if(continent[GetHogTeamName(CurrentHedgehog)]> table.getn(weaponsets))
   768 		if(continent[GetHogTeamName(CurrentHedgehog)]> table.maxn(weaponsets))
   695 		then
   769 		then
   696 			continent[GetHogTeamName(CurrentHedgehog)]=1
   770 			continent[GetHogTeamName(CurrentHedgehog)]=1
   697 		end
   771 		end
   698 		setweapons(true)
   772 		setweapons()
   699 	end
   773 	end
   700 	
   774 	
   701 	if(GetCurAmmoType() == amStructure)
   775 	--kerguelen
   702 	then
   776 	if(GetCurAmmoType() == amHammer)
   703 		if(kergulenSpecial==5)
   777 	then
       
   778 		if(kergulenSpecial==6)
   704 		then
   779 		then
   705 			kergulenSpecial = 1
   780 			kergulenSpecial = 1
       
   781 			AddCaption("Normal")
       
   782 		elseif(kergulenSpecial==1)
       
   783 		then
       
   784 			kergulenSpecial = 2
   706 			AddCaption("#"..weapontexts[7])
   785 			AddCaption("#"..weapontexts[7])
   707 		elseif(kergulenSpecial==1 and TotalRounds>=1)
   786 		elseif(kergulenSpecial==2 and TotalRounds>=1)
   708 		then
   787 		then
   709 			kergulenSpecial = 2
   788 			kergulenSpecial = 3
   710 			AddCaption("##"..weapontexts[8])
   789 			AddCaption("##"..weapontexts[8])
   711 		elseif(kergulenSpecial==2 or (kergulenSpecial==1 and TotalRounds<1))
   790 		elseif(kergulenSpecial==3 or (kergulenSpecial==2 and TotalRounds<1))
   712 		then
   791 		then
   713 			kergulenSpecial = 3
   792 			kergulenSpecial = 4
   714 			AddCaption("###"..weapontexts[9])
   793 			AddCaption("###"..weapontexts[9])
   715 		elseif(kergulenSpecial==3)
   794 		elseif(kergulenSpecial==4)
   716 		then
   795 		then
   717 			kergulenSpecial = 4
   796 			kergulenSpecial = 5
   718 			AddCaption("####"..weapontexts[10])
   797 			AddCaption("####"..weapontexts[10])
   719 		elseif(kergulenSpecial==4)
   798 		elseif(kergulenSpecial==5)
   720 		then
   799 		then
   721 			kergulenSpecial = 5
   800 			kergulenSpecial = 6
   722 			AddCaption("#####"..weapontexts[15])
   801 			AddCaption("#####"..weapontexts[15])
   723 		end
   802 		end
   724 	end
   803 	end
   725 end
   804 end
   726 
   805 
   727 function onPrecise()
   806 function onPrecise()
   728 	if(swapweps==true and GetCurAmmoType() == amSkip)
   807 	--swap backwards in the weaponmenu (1.0 style)
       
   808 	if(swapweps==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing))
   729 	then
   809 	then
   730 		continent[GetHogTeamName(CurrentHedgehog)]=continent[GetHogTeamName(CurrentHedgehog)]-1
   810 		continent[GetHogTeamName(CurrentHedgehog)]=continent[GetHogTeamName(CurrentHedgehog)]-1
   731 		
   811 		
   732 		if(continent[GetHogTeamName(CurrentHedgehog)]<=0)
   812 		if(continent[GetHogTeamName(CurrentHedgehog)]<=0)
   733 		then
   813 		then
   734 			continent[GetHogTeamName(CurrentHedgehog)]=9
   814 			continent[GetHogTeamName(CurrentHedgehog)]=9
   735 		end
   815 		end
   736 		setweapons(true)
   816 		setweapons()
   737 	end
       
   738 end
       
   739 
       
   740 function onSlot()
       
   741 	if(continent[GetHogTeamName(CurrentHedgehog)]==0) then
       
   742 		ParseCommand("setweap " .. string.char(amSkip))
       
   743 	end
   817 	end
   744 end
   818 end
   745 
   819 
   746 function onGameTick20()
   820 function onGameTick20()
   747 
   821 	--if you picked a weaponset from the weaponmenu (icon)
   748 	if(teams_ok[GetHogTeamName(CurrentHedgehog)] == 2)
       
   749 	then
       
   750 		if(GetCurAmmoType()~=amTeleport and swapweps==true and TurnTime-TurnTimeLeft>=100)
       
   751 		then
       
   752 			teams_ok[GetHogTeamName(CurrentHedgehog)] = true
       
   753 			ParseCommand("setweap " .. string.char(amSkip))
       
   754 		end
       
   755 	end
       
   756 	
       
   757 	if(continent[GetHogTeamName(CurrentHedgehog)]==0)
   822 	if(continent[GetHogTeamName(CurrentHedgehog)]==0)
   758 	then
   823 	then
   759 		if(GetCurAmmoType()==amSniperRifle) then
   824 		if(GetCurAmmoType()==amSwitch)
   760 			continent[GetHogTeamName(CurrentHedgehog)]=1
   825 		then
   761 			setweapons(false)
   826 			continent[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.maxn(weaponsets))+1
   762 		elseif(GetCurAmmoType()==amGasBomb) then
   827 			setweapons()
   763 			continent[GetHogTeamName(CurrentHedgehog)]=2
   828 			PlaySound(sndMineTick)
   764 			setweapons(false)
   829 		else
   765 		elseif(GetCurAmmoType()==amBazooka) then
   830 			for v,w in pairs(weaponsets) 
   766 			continent[GetHogTeamName(CurrentHedgehog)]=3
   831 			do
   767 			setweapons(false)
   832 				if(GetCurAmmoType()==weaponsets[v][4])
   768 		elseif(GetCurAmmoType()==amSMine) then
   833 				then
   769 			continent[GetHogTeamName(CurrentHedgehog)]=4
   834 					continent[GetHogTeamName(CurrentHedgehog)]=v
   770 			setweapons(false)
   835 					setweapons()
   771 		elseif(GetCurAmmoType()==amRope) then
   836 					PlaySound(weaponsetssounds[v][1])
   772 			continent[GetHogTeamName(CurrentHedgehog)]=5
   837 					PlaySound(weaponsetssounds[v][2],CurrentHedgehog)
   773 			setweapons(false)
   838 				end
   774 		elseif(GetCurAmmoType()==amBaseballBat) then
       
   775 			continent[GetHogTeamName(CurrentHedgehog)]=6
       
   776 			setweapons(false)
       
   777 		elseif(GetCurAmmoType()==amTeleport) then
       
   778 			continent[GetHogTeamName(CurrentHedgehog)]=7
       
   779 			setweapons(false)
       
   780 		elseif(GetCurAmmoType()==amStructure) then
       
   781 			continent[GetHogTeamName(CurrentHedgehog)]=8
       
   782 			setweapons(false)
       
   783 		elseif(GetCurAmmoType()==amInvulnerable) then
       
   784 			continent[GetHogTeamName(CurrentHedgehog)]=9
       
   785 			setweapons(false)
       
   786 		elseif(GetCurAmmoType()==amSwitch) then
       
   787 			continent[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.getn(weaponsets))+1
       
   788 			setweapons(false)
       
   789 		end
       
   790 	end
       
   791 	
       
   792 	if(kergulenSpecial ~= 0 and GetCurAmmoType() == amStructure)
       
   793 	then
       
   794 		if(kergulenSpecial == 1)
       
   795 		then
       
   796 			if(visualcircle==nil)
       
   797 			then
       
   798 				visualcircle=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtCircle, 120, false)
       
   799 			end
   839 			end
       
   840 		end
       
   841 	end
       
   842 	
       
   843 	--show the kerguelen ring
       
   844 	if(kergulenSpecial > 1 and GetCurAmmoType() == amHammer)
       
   845 	then
       
   846 		if(visualcircle==nil)
       
   847 		then
       
   848 			visualcircle=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtCircle, 0, false)
       
   849 		end
       
   850 		
       
   851 		if(kergulenSpecial == 2) --walrus scream
       
   852 		then
   800 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 120, 4, 0xff0000ee)
   853 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 120, 4, 0xff0000ee)
   801 		elseif(kergulenSpecial == 2)
   854 		elseif(kergulenSpecial == 3) --swap hog
   802 		then
   855 		then
   803 			if(visualcircle==nil)
       
   804 			then
       
   805 				visualcircle=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtCircle, 450, false)
       
   806 			end
       
   807 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 450, 3, 0xffff00ee)
   856 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 450, 3, 0xffff00ee)
   808 		elseif(kergulenSpecial == 3)
   857 		elseif(kergulenSpecial == 4) --flare
   809 		then
   858 		then
   810 			if(visualcircle==nil)
       
   811 			then
       
   812 				visualcircle=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtCircle, 45, false)
       
   813 			end
       
   814 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 45, 6, 0x00ff00ee)
   859 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 45, 6, 0x00ff00ee)
   815 		elseif(kergulenSpecial == 4)
   860 		elseif(kergulenSpecial == 5) --cries
   816 		then
   861 		then
   817 			if(visualcircle==nil)
       
   818 			then
       
   819 				visualcircle=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtCircle, 500, false)
       
   820 			end
       
   821 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 500, 1, 0x0000ffee)
   862 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 500, 1, 0x0000ffee)
   822 		elseif(kergulenSpecial == 5)
   863 		elseif(kergulenSpecial == 6) --sabotage
   823 		then
   864 		then
   824 			if(visualcircle==nil)
       
   825 			then
       
   826 				visualcircle=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtCircle, 100, false)
       
   827 			end
       
   828 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 100, 10, 0xeeeeeeee)
   865 			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 100, 10, 0xeeeeeeee)
   829 		end
   866 		end
   830 	
   867 	
   831 	elseif(visualcircle~=nil)
   868 	elseif(visualcircle~=nil)
   832 	then
   869 	then
   833 		DeleteVisualGear(visualcircle)
   870 		DeleteVisualGear(visualcircle)
   834 		visualcircle=nil
   871 		visualcircle=nil
   835 	end
   872 	end
   836 	
   873 	
       
   874 	--sabotage
   837 	if(disable_moving[CurrentHedgehog]==true)
   875 	if(disable_moving[CurrentHedgehog]==true)
   838 	then
   876 	then
   839 	
   877 	
   840 		if(TurnTimeLeft<=150)
   878 		if(TurnTimeLeft<=150)
   841 		then
   879 		then
   842 			disable_moving[CurrentHedgehog]=false
   880 			disable_moving[CurrentHedgehog]=false
   843 			SetHogLevel(CurrentHedgehog,0)
   881 			SetHogLevel(CurrentHedgehog,disableoffsetai)
       
   882 			onsabotageai=false
   844 		elseif(disallowattack>=15 and disallowattack >= 20)
   883 		elseif(disallowattack>=15 and disallowattack >= 20)
   845 		then
   884 		then
   846 			disallowattack=0
   885 			disallowattack=0
       
   886 			onsabotageai=true
   847 			SetHogLevel(CurrentHedgehog,1)
   887 			SetHogLevel(CurrentHedgehog,1)
   848 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
   888 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
   849 		elseif(GetHogLevel(CurrentHedgehog)==1)
   889 		elseif(onsabotageai==true)
   850 		then
   890 		then
   851 			SetHogLevel(CurrentHedgehog,0)
   891 			SetHogLevel(CurrentHedgehog,disableoffsetai)
       
   892 			onsabotageai=false
   852 		else
   893 		else
   853 			disallowattack=disallowattack+1
   894 			disallowattack=disallowattack+1
   854 		end
   895 		end
   855 	
   896 	
   856 	end
   897 	end
   858 end
   899 end
   859 
   900 
   860 --if you used hogswitch or any similar weapon, dont enable any weaponchange
   901 --if you used hogswitch or any similar weapon, dont enable any weaponchange
   861 function onAttack()
   902 function onAttack()
   862 	swapweps=false
   903 	swapweps=false
   863 	local around=false
       
   864 	
   904 	
   865 	--african special
   905 	--african special
   866 	if(africanSpecial == 1 and GetCurAmmoType() == amSeduction)
   906 	if(africanSpecial == 1 and GetCurAmmoType() == amSeduction)
   867 	then
   907 	then
   868 		SetState(CurrentHedgehog, gstAttacked)
   908 		SetState(CurrentHedgehog, gstAttacked)
   869 		
   909 		
       
   910 		temp_val=0
   870 		runOnGears(weapon_duststorm)
   911 		runOnGears(weapon_duststorm)
       
   912 		SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+temp_val)
   871 
   913 
   872 		--visual stuff
   914 		--visual stuff
   873 		visual_gear_explosion(250,GetX(CurrentHedgehog), GetY(CurrentHedgehog),vgtSmoke,vgtSmokeWhite)
   915 		visual_gear_explosion(250,GetX(CurrentHedgehog), GetY(CurrentHedgehog),vgtSmoke,vgtSmokeWhite)
   874 		PlaySound(sndParachute)
   916 		PlaySound(sndParachute)
   875 	end
   917 
   876 	
       
   877 	--Kerguelen specials
   918 	--Kerguelen specials
   878 	if(GetCurAmmoType() == amStructure)
   919 	elseif(GetCurAmmoType() == amHammer and kergulenSpecial > 1)
   879 	then
   920 	then
   880 		SetState(CurrentHedgehog, gstAttacked)
   921 		SetState(CurrentHedgehog, gstAttacked)
   881 		if(kergulenSpecial == 1)
   922 		--scream
       
   923 		if(kergulenSpecial == 2)
   882 		then
   924 		then
   883 			temp_val=0
   925 			temp_val=0
   884 			runOnGears(weapon_scream_walrus)
   926 			runOnGears(weapon_scream_walrus)
   885 			SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+temp_val)
   927 			SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+temp_val)
   886 			PlaySound(sndHellish)
   928 			PlaySound(sndHellish)
   887 			
   929 		
   888 		elseif(kergulenSpecial == 2 and TotalRounds>=1)
   930 		--swap
       
   931 		elseif(kergulenSpecial == 3 and TotalRounds>=1)
   889 		then
   932 		then
   890 			runOnGears(weapon_swap_kerg)
   933 			runOnGears(weapon_swap_kerg)
   891 			PlaySound(sndPiano3)
   934 			PlaySound(sndPiano3)
   892 		elseif(kergulenSpecial == 3)
   935 			
       
   936 		--flare
       
   937 		elseif(kergulenSpecial == 4)
   893 		then
   938 		then
   894 			runOnGears(weapon_flare)
   939 			runOnGears(weapon_flare)
   895 			PlaySound(sndThrowRelease)
   940 			PlaySound(sndThrowRelease)
   896 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
   941 			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
   897 			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-20, gtCluster, 0, 0, -1000000, 30)
   942 			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-20, gtCluster, 0, 0, -1000000, 34)
   898 				
   943 		
   899 		elseif(kergulenSpecial == 4)
   944 		--cries
       
   945 		elseif(kergulenSpecial == 5)
   900 		then
   946 		then
   901 			runOnGears(weapon_cries_a)
   947 			runOnGears(weapon_cries_a)
   902 			if(kergulenSpecial~=-1)
   948 			if(kergulenSpecial~=-1)
   903 			then
   949 			then
   904 				AddGear(0, 0, gtWaterUp, 0, 0,0,0)
   950 				AddGear(0, 0, gtWaterUp, 0, 0,0,0)
   905 				PlaySound(sndWarp)
   951 				PlaySound(sndWarp)
   906 				PlaySound(sndMolotov)
   952 				PlaySound(sndMolotov)
   907 				
   953 				
       
   954 				temp_val=0
   908 				runOnGears(weapon_cries_b)
   955 				runOnGears(weapon_cries_b)
       
   956 				SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+temp_val)
   909 			else
   957 			else
   910 				HogSay(CurrentHedgehog, loc("Hogs in sight!"), SAY_SAY)
   958 				HogSay(CurrentHedgehog, loc("Hogs in sight!"), SAY_SAY)
   911 			end
   959 			end
   912 		elseif(kergulenSpecial == 5)
   960 		
       
   961 		--sabotage
       
   962 		elseif(kergulenSpecial == 6)
   913 		then
   963 		then
   914 			runOnGears(weapon_sabotage)
   964 			runOnGears(weapon_sabotage)
   915 		end
   965 		end
   916 		DeleteVisualGear(visualcircle)
   966 		DeleteVisualGear(visualcircle)
   917 		visualcircle=nil
   967 		visualcircle=nil
   918 	end
   968 		
   919 
   969 	elseif(GetCurAmmoType() == amVampiric)
       
   970 	then
       
   971 		VampOn=75
       
   972 	end
   920 	--Australian special
   973 	--Australian special
   921 	if(GetGearType(austmine) == gtMine and austmine ~= nil)
   974 	if(GetGearType(austmine) == gtMine and austmine ~= nil)
   922 	then
   975 	then
   923 		temp_val=0
   976 		temp_val=0
   924 		runOnGears(weapon_aust_check)
   977 		runOnGears(weapon_aust_check)
   931 		end
   984 		end
   932 		
   985 		
   933 		austmine=nil
   986 		austmine=nil
   934 	end
   987 	end
   935 	
   988 	
       
   989 	--stop sabotage (avoiding a bug)
   936 	if(disable_moving[CurrentHedgehog]==true)
   990 	if(disable_moving[CurrentHedgehog]==true)
   937 	then
   991 	then
   938 		disable_moving[CurrentHedgehog]=false
   992 		disable_moving[CurrentHedgehog]=false
   939 		SetHogLevel(CurrentHedgehog,0)
   993 		onsabotageai=false
       
   994 		SetHogLevel(CurrentHedgehog,disableoffsetai)
   940 	end
   995 	end
   941 	
   996 	
   942 	australianSpecial=false
   997 	australianSpecial=false
   943 end
   998 end
   944 
   999 
   945 function onGearAdd(gearUid)
  1000 function onGearAdd(gearUid)
   946 	swapweps=false
  1001 	swapweps=false
   947 	
  1002 	
       
  1003 	--track the gears im using
   948 	if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives) 
  1004 	if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives) 
   949 	then
  1005 	then
   950 		trackGear(gearUid)
  1006 		trackGear(gearUid)
   951 	end
  1007 	end
   952 	
  1008 	
  1008 
  1064 
  1009 	if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives) 
  1065 	if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives) 
  1010 	then
  1066 	then
  1011 		trackDeletion(gearUid)
  1067 		trackDeletion(gearUid)
  1012 	end
  1068 	end
  1013 	--north american specials
  1069 	
       
  1070 	--north american lipstick
  1014 	if(GetGearType(gearUid)==gtSniperRifleShot )
  1071 	if(GetGearType(gearUid)==gtSniperRifleShot )
  1015 	then
  1072 	then
  1016 		sniper_s_in_use=false
  1073 		sniper_s_in_use=false
  1017 		if(namericanSpecial==2)
  1074 		if(namericanSpecial==2)
  1018 		then
  1075 		then
  1025 			
  1082 			
  1026 			pinata=AddGear(GetX(gearUid), GetY(gearUid), gtCluster, 0, 0, 0, 5)
  1083 			pinata=AddGear(GetX(gearUid), GetY(gearUid), gtCluster, 0, 0, 0, 5)
  1027 			SetGearMessage(pinata,1)
  1084 			SetGearMessage(pinata,1)
  1028 		end
  1085 		end
  1029 		
  1086 		
       
  1087 	--north american pinata
  1030 	elseif(GetGearType(gearUid)==gtCluster and GetGearMessage(gearUid)==1 and namericanSpecial==3)
  1088 	elseif(GetGearType(gearUid)==gtCluster and GetGearMessage(gearUid)==1 and namericanSpecial==3)
  1031 	then
  1089 	then
  1032 		AddGear(GetX(gearUid), GetY(gearUid), gtCluster, 0, 0, 0, 20)
  1090 		AddGear(GetX(gearUid), GetY(gearUid), gtCluster, 0, 0, 0, 20)
  1033 	
  1091 	
       
  1092 	--north american eagle eye
  1034 	elseif(GetGearType(gearUid)==gtShotgunShot and shotgun_s==true)
  1093 	elseif(GetGearType(gearUid)==gtShotgunShot and shotgun_s==true)
  1035 	then
  1094 	then
  1036 		SetState(CurrentHedgehog, gstMoving)
  1095 		SetState(CurrentHedgehog, gstMoving)
  1037 		SetGearPosition(CurrentHedgehog, GetX(gearUid), GetY(gearUid)+7)
  1096 		SetGearPosition(CurrentHedgehog, GetX(gearUid), GetY(gearUid)+7)
  1038 		PlaySound(sndWarp)
  1097 		PlaySound(sndWarp)
  1041 	elseif(GetGearType(gearUid)==gtGasBomb and samericanSpecial == true)
  1100 	elseif(GetGearType(gearUid)==gtGasBomb and samericanSpecial == true)
  1042 	then
  1101 	then
  1043 		temp_val=gearUid
  1102 		temp_val=gearUid
  1044 		runOnGears(weapon_anno_south)
  1103 		runOnGears(weapon_anno_south)
  1045 		AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false)
  1104 		AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false)
  1046 
  1105 	
       
  1106 	--asian special
  1047 	elseif(GetGearType(gearUid)==gtSnowball and GetGearMessage(gearUid)==1)
  1107 	elseif(GetGearType(gearUid)==gtSnowball and GetGearMessage(gearUid)==1)
  1048 	then
  1108 	then
  1049 		AddGear(GetX(gearUid), GetY(gearUid)+3, gtCluster, 0, 0, 0, 22)
  1109 		AddGear(GetX(gearUid), GetY(gearUid), gtCluster, 0, 0, 0, 22)
  1050 		
  1110 	
       
  1111 	--europe special
  1051 	elseif(GetGearType(gearUid)==gtCluster and GetGearMessage(gearUid)==2)
  1112 	elseif(GetGearType(gearUid)==gtCluster and GetGearMessage(gearUid)==2)
  1052 	then
  1113 	then
  1053 		temp_val=gearUid
  1114 		temp_val=gearUid
  1054 		runOnGears(weapon_health)
  1115 		runOnGears(weapon_health)
  1055 		visual_gear_explosion(100,GetX(gearUid), GetY(gearUid),vgtSmokeWhite,vgtSmokeWhite)
  1116 		visual_gear_explosion(100,GetX(gearUid), GetY(gearUid),vgtSmokeWhite,vgtSmokeWhite)
  1056 		AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false)
  1117 		AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false)
  1057 		PlaySound(sndGraveImpact)
  1118 		PlaySound(sndGraveImpact)
  1058 		
  1119 	
       
  1120 	--asia (using para)
  1059 	elseif(GetGearType(gearUid)==gtParachute)
  1121 	elseif(GetGearType(gearUid)==gtParachute)
  1060 	then
  1122 	then
  1061 		inpara=false
  1123 		inpara=false
  1062 	end
  1124 	end
  1063 end
  1125 end
       
  1126 --[[
       
  1127 sources (populations & area):
       
  1128 Wikipedia
       
  1129 Own calculations
       
  1130 if you think they are wrong, then please tell me :)
       
  1131 ]]