share/hedgewars/Data/Maps/Control/map.lua
author Wuzzy <Wuzzy2@mail.ru>
Fri, 07 Jun 2019 15:09:42 +0200
changeset 15151 13e7d4eccb67
parent 15150 a41b8b154f74
permissions -rw-r--r--
CTF/Control: Fix incomplete hedgehog loop bounds
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15003
980a948a5dff Control (style): Dump dead code and ancient changelog
Wuzzy <Wuzzy2@mail.ru>
parents: 13742
diff changeset
     1
-------------
980a948a5dff Control (style): Dump dead code and ancient changelog
Wuzzy <Wuzzy2@mail.ru>
parents: 13742
diff changeset
     2
-- CONTROL --
980a948a5dff Control (style): Dump dead code and ancient changelog
Wuzzy <Wuzzy2@mail.ru>
parents: 13742
diff changeset
     3
-------------
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
     4
15003
980a948a5dff Control (style): Dump dead code and ancient changelog
Wuzzy <Wuzzy2@mail.ru>
parents: 13742
diff changeset
     5
-- Goal: Stand on pillars to score points over time.
980a948a5dff Control (style): Dump dead code and ancient changelog
Wuzzy <Wuzzy2@mail.ru>
parents: 13742
diff changeset
     6
-- First clan to hit the score limit wins!
4953
ebd3dae634ca Fixed scoring exploit on Control and removed user branding from the map
mikade
parents: 4767
diff changeset
     7
15003
980a948a5dff Control (style): Dump dead code and ancient changelog
Wuzzy <Wuzzy2@mail.ru>
parents: 13742
diff changeset
     8
-- Rules:
15007
d09208b34713 Control (style): Use onSkipTurn
Wuzzy <Wuzzy2@mail.ru>
parents: 15006
diff changeset
     9
-- * Each pillar you control generates 1 point every 2 seconds.
15003
980a948a5dff Control (style): Dump dead code and ancient changelog
Wuzzy <Wuzzy2@mail.ru>
parents: 13742
diff changeset
    10
-- * If multiple clans compete for a pillar, no one generates points for this pillar.
980a948a5dff Control (style): Dump dead code and ancient changelog
Wuzzy <Wuzzy2@mail.ru>
parents: 13742
diff changeset
    11
-- * If you skip turn, you win the same points as if you would have just waited out the turn
15007
d09208b34713 Control (style): Use onSkipTurn
Wuzzy <Wuzzy2@mail.ru>
parents: 15006
diff changeset
    12
-- * Hogs get revived.
5842
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
    13
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    14
-----------------
15003
980a948a5dff Control (style): Dump dead code and ancient changelog
Wuzzy <Wuzzy2@mail.ru>
parents: 13742
diff changeset
    15
-- script begins
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    16
-----------------
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    17
9093
4114ce5d885d fix locale load
nemo
parents: 8349
diff changeset
    18
HedgewarsScriptLoad("/Scripts/Locale.lua")
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    19
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    20
---------------------------------------------------------------
15003
980a948a5dff Control (style): Dump dead code and ancient changelog
Wuzzy <Wuzzy2@mail.ru>
parents: 13742
diff changeset
    21
-- lots variables and things
980a948a5dff Control (style): Dump dead code and ancient changelog
Wuzzy <Wuzzy2@mail.ru>
parents: 13742
diff changeset
    22
---------------------------------------------------------------
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    23
4953
ebd3dae634ca Fixed scoring exploit on Control and removed user branding from the map
mikade
parents: 4767
diff changeset
    24
local TimeCounter = 0
ebd3dae634ca Fixed scoring exploit on Control and removed user branding from the map
mikade
parents: 4767
diff changeset
    25
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    26
local gameWon = false
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4662
diff changeset
    27
local pointLimit = 300
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    28
12080
6c734d8defef Clean up strings in Control mission maps (more translator-friendly)
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
    29
local missionName = loc("Control")
6c734d8defef Clean up strings in Control mission maps (more translator-friendly)
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
    30
local missionCaption = loc("Domination game")
6c734d8defef Clean up strings in Control mission maps (more translator-friendly)
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
    31
local missionHelp
6c734d8defef Clean up strings in Control mission maps (more translator-friendly)
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
    32
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    33
local vCirc = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    34
local vCircCount = 0
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    35
4953
ebd3dae634ca Fixed scoring exploit on Control and removed user branding from the map
mikade
parents: 4767
diff changeset
    36
--local hGCount = 0
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    37
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    38
local vCircX = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    39
local vCircY = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    40
local vCircMinA = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    41
local vCircMaxA = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    42
local vCircType = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    43
local vCircPulse = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    44
local vCircFuckAll = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    45
local vCircRadius = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    46
local vCircWidth = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    47
local vCircCol = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    48
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    49
--------------------------
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    50
-- hog and team tracking variales
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    51
--------------------------
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    52
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    53
local numhhs = 0 -- store number of hedgehogs
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    54
local hhs = {} -- store hedgehog gears
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    55
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    56
local teamNameArr = {}	-- store the list of teams
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    57
local teamClan = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    58
local teamSize = {}	-- store how many hogs per team
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    59
local teamIndex = {} -- at what point in the hhs{} does each team begin
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    60
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    61
local teamComment = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    62
local teamScore = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    63
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    64
--------------------------------
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    65
--zone and teleporter variables
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    66
--------------------------------
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    67
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    68
local cPoint = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    69
local cOwnerClan = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    70
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    71
local zXMin = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    72
local zWidth = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    73
local zYMin = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    74
local zHeight = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    75
local zOccupied = {}
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    76
local zCount = 0
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    77
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    78
------------------------
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    79
-- zone methods
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    80
------------------------
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    81
-- see on gameTick also
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    82
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    83
function CreateZone(xMin, yMin, width, height)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    84
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    85
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    86
	zXMin[zCount] = xMin
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    87
	zYMin[zCount] = yMin
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    88
	zWidth[zCount] = width
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    89
	zHeight[zCount] = height
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    90
	zOccupied[zCount] = false
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    91
	zCount = zCount + 1
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    92
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    93
	return (zCount-1)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    94
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    95
end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    96
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    97
function GearIsInZone(gear, zI)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    98
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    99
	if (GetX(gear) > zXMin[zI]) and (GetX(gear) < (zXMin[zI]+zWidth[zI])) and (GetY(gear) > zYMin[zI]) and (GetY(gear) < (zYMin[zI]+zHeight[zI])) then
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   100
		zOccupied[zI] = true
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   101
	else
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   102
		zOccupied[zI] = false
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   103
	end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   104
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   105
	return zOccupied[zI]
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   106
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   107
end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   108
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   109
function ZonesAreEmpty()
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   110
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   111
	okay = true
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   112
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   113
	for i = 0,(zCount-1) do
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   114
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   115
		for k = 0, (numhhs-1) do
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   116
			if (hhs[k] ~= nil) then
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   117
				if (GearIsInZone(hhs[k],i)) == true then
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   118
					FindPlace(hhs[k], false, 0, LAND_WIDTH, true)
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   119
					okay = false
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   120
				end
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   121
			end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   122
		end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   123
	end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   124
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   125
	return(okay)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   126
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   127
end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   128
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   129
function CheckZones()
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   130
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   131
	for i = 0,(zCount-1) do
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   132
		SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], 0xffffffff)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   133
		cOwnerClan[i] = nil
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   134
		for k = 0, (numhhs-1) do
15003
980a948a5dff Control (style): Dump dead code and ancient changelog
Wuzzy <Wuzzy2@mail.ru>
parents: 13742
diff changeset
   135
			if (hhs[k] ~= nil) then
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   136
				if (GearIsInZone(hhs[k],i)) == true then
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   137
					if cOwnerClan[i] ~= nil then
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   138
						if cOwnerClan[i] ~= GetHogClan(hhs[k]) then
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   139
							--if the hog now being compared is different to one that is also here and was previously compared
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   140
							SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], 0xffffffff)
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   141
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   142
							cOwnerClan[i] = 10 -- this means conflicted
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   143
						end
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   144
					elseif cOwnerClan[i] == nil then
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   145
						cOwnerClan[i] = GetHogClan(hhs[k])
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   146
						SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], GetClanColor( GetHogClan(hhs[k])))
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   147
					end
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   148
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   149
				end
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   150
			end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   151
		end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   152
	end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   153
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   154
end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   155
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   156
function AwardPoints()
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   157
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   158
	for i = 0,(zCount-1) do
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   159
		-- give score to all players controlling points
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   160
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   161
		-- only give score to the player currently in control
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   162
		if CurrentHedgehog ~= nil then
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   163
			if cOwnerClan[i] == GetHogClan(CurrentHedgehog) then
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   164
				teamScore[cOwnerClan[i]] = teamScore[cOwnerClan[i]] + 1
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   165
			end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   166
		end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   167
	end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   168
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   169
	-- i want to show all the tags at once as having the SAME score not 1,2,3,4 so alas, repeating the loop seems needed
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   170
	for i = 0,(zCount-1) do
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   171
		if CurrentHedgehog ~= nil then
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   172
			if cOwnerClan[i] == GetHogClan(CurrentHedgehog) then
13687
a8b2a5e7e9db Clean up more visual gears stuff in scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13630
diff changeset
   173
				local g = AddVisualGear(vCircX[i], vCircY[i]-100, vgtHealthTag, 100, false)
a8b2a5e7e9db Clean up more visual gears stuff in scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13630
diff changeset
   174
				SetVisualGearValues(g, vCircX[i], vCircY[i]-100, 0, 0, 0, 0, 0, teamScore[cOwnerClan[i]], 1500, GetClanColor(cOwnerClan[i]))
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   175
			end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   176
		end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   177
	end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   178
15006
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   179
	-- Update team labels and graph
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   180
	local clanGraphPointWritten = {}
13019
880662cf41ee Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 12080
diff changeset
   181
	for i = 0,(TeamsCount-1) do
880662cf41ee Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 12080
diff changeset
   182
		if teamNameArr[i] ~= " " then
880662cf41ee Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 12080
diff changeset
   183
			SetTeamLabel(teamNameArr[i], teamScore[teamClan[i]])
15006
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   184
			if not clanGraphPointWritten[teamClan[i]] then
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   185
				SendStat(siClanHealth, teamScore[teamClan[i]], teamNameArr[i])
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   186
				clanGraphPointWritten[teamClan[i]] = true
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   187
			end
13019
880662cf41ee Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 12080
diff changeset
   188
		end
880662cf41ee Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 12080
diff changeset
   189
	end
880662cf41ee Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 12080
diff changeset
   190
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   191
end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   192
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   193
-----------------
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   194
-- general methods
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   195
------------------
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   196
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   197
function RebuildTeamInfo()
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   198
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   199
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   200
	-- make a list of individual team names
5842
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   201
	for i = 0, (TeamsCount-1) do
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   202
		teamNameArr[i] = " " -- = i
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   203
		teamSize[i] = 0
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   204
		teamIndex[i] = 0
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   205
		teamScore[i] = 0
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   206
	end
15011
c52aa7ba2e16 Control (style): Adjust score limit according to clans count instead of teams count
Wuzzy <Wuzzy2@mail.ru>
parents: 15010
diff changeset
   207
	local numTeams = 0
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   208
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   209
	for i = 0, (numhhs-1) do
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   210
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   211
		z = 0
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   212
		unfinished = true
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   213
		while(unfinished == true) do
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   214
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   215
			newTeam = true
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   216
			tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   217
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   218
			if tempHogTeamName == teamNameArr[z] then
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   219
				newTeam = false
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   220
				unfinished = false
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   221
			end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   222
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   223
			z = z + 1
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   224
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   225
			if z == TeamsCount then
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   226
				unfinished = false
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   227
				if newTeam == true then
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   228
					teamNameArr[numTeams] = tempHogTeamName
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   229
					numTeams = numTeams + 1
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   230
				end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   231
			end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   232
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   233
		end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   234
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   235
	end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   236
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   237
	-- find out how many hogs per team, and the index of the first hog in hhs
15011
c52aa7ba2e16 Control (style): Adjust score limit according to clans count instead of teams count
Wuzzy <Wuzzy2@mail.ru>
parents: 15010
diff changeset
   238
	for i = 0, TeamsCount-1 do
13019
880662cf41ee Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 12080
diff changeset
   239
		SetTeamLabel(GetTeamName(i), "0")
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   240
		for z = 0, (numhhs-1) do
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   241
			if GetHogTeamName(hhs[z]) == teamNameArr[i] then
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   242
				teamClan[i] = GetHogClan(hhs[z])
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   243
				if teamSize[i] == 0 then
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   244
					teamIndex[i] = z -- should give starting index
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   245
				end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   246
				teamSize[i] = teamSize[i] + 1
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   247
				--add a pointer so this hog appears at i in hhs
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   248
			end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   249
		end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   250
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   251
	end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   252
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   253
end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   254
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   255
------------------------
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   256
-- game methods
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   257
------------------------
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   258
15007
d09208b34713 Control (style): Use onSkipTurn
Wuzzy <Wuzzy2@mail.ru>
parents: 15006
diff changeset
   259
function onSkipTurn()
5842
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   260
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   261
	if CurrentHedgehog ~= nil then
15007
d09208b34713 Control (style): Use onSkipTurn
Wuzzy <Wuzzy2@mail.ru>
parents: 15006
diff changeset
   262
		z = (TurnTimeLeft / 2000) - (TurnTimeLeft / 2000)%2
d09208b34713 Control (style): Use onSkipTurn
Wuzzy <Wuzzy2@mail.ru>
parents: 15006
diff changeset
   263
		for i = 0, z do
d09208b34713 Control (style): Use onSkipTurn
Wuzzy <Wuzzy2@mail.ru>
parents: 15006
diff changeset
   264
			AwardPoints()
5842
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   265
		end
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   266
	end
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   267
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   268
end
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   269
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   270
function onGameInit()
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   271
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   272
	-- Things we don't modify here will use their default values.
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   273
13102
a4872ca7f17c Control: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents: 13019
diff changeset
   274
	EnableGameFlags(gfInfAttack, gfSolidLand)
13272
5984e8c6cbeb Add new game flag gfSwitchHog, enable hog switching at turn start
Wuzzy <Wuzzy2@mail.ru>
parents: 13103
diff changeset
   275
	DisableGameFlags(gfKing, gfAISurvival)
5842
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   276
	WaterRise = 0
12079
8f222872d432 Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents: 12077
diff changeset
   277
	HealthDecrease = 0
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   278
15006
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   279
	SendHealthStatsOff()
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   280
	SendRankingStatsOff()
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   281
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   282
end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   283
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   284
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   285
function onGameStart()
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   286
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   287
	-- build zones
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   288
	cPoint[0] = CreateZone(571,47,120,80)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   289
	cPoint[1] = CreateZone(1029,643,120,80)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   290
	cPoint[2] = CreateZone(322,1524,120,80)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   291
	cPoint[3] = CreateZone(1883,38,120,80)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   292
	cPoint[4] = CreateZone(3821,46,120,80)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   293
	cPoint[5] = CreateZone(2679,1338,120,80)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   294
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   295
	vCircX[0], vCircY[0] = 631, 82
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   296
	vCircX[1], vCircY[1] = 1088, 684
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   297
	vCircX[2], vCircY[2] = 381, 1569
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   298
	vCircX[3], vCircY[3] = 1942, 77
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   299
	vCircX[4], vCircY[4] = 3883, 89
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   300
	vCircX[5], vCircY[5] = 2739, 1378
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   301
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   302
	for i = 0, 5 do
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   303
		vCirc[i] = AddVisualGear(0,0,vgtCircle,0,true)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   304
		vCircMinA[i] = 20
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   305
		vCircMaxA[i] = 255
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   306
		vCircType[i] = 1
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   307
		vCircPulse[i] = 10
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   308
		vCircFuckAll[i] = 0
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   309
		vCircRadius[i] = 300
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   310
		vCircWidth[i] = 5
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   311
		vCircCol[i] = 0xffffffff
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   312
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   313
		SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i])
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   314
	end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   315
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   316
	--new improved placement schematics aw yeah
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   317
	RebuildTeamInfo()
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   318
15011
c52aa7ba2e16 Control (style): Adjust score limit according to clans count instead of teams count
Wuzzy <Wuzzy2@mail.ru>
parents: 15010
diff changeset
   319
	for i = 0, ClansCount - 1 do
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4662
diff changeset
   320
		pointLimit = pointLimit - 25
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4662
diff changeset
   321
	end
12080
6c734d8defef Clean up strings in Control mission maps (more translator-friendly)
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
   322
6c734d8defef Clean up strings in Control mission maps (more translator-friendly)
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
   323
	missionHelp = loc("Control pillars to score points.") .. "|" ..
15005
6e17abf7b8ef Control (style): Mention revival
Wuzzy <Wuzzy2@mail.ru>
parents: 15004
diff changeset
   324
		loc("Hedgehogs will be revived after their death.") .. "|" ..
12080
6c734d8defef Clean up strings in Control mission maps (more translator-friendly)
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
   325
		string.format(loc("Score goal: %d"), pointLimit)
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   326
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   327
	-- reposition hogs if they are on control points until they are not or sanity limit kicks in
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   328
	reN = 0
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   329
	while (reN < 10) do
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   330
		if ZonesAreEmpty() == false then
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   331
			reN = reN + 1
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   332
		else
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   333
			reN = 15
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   334
		end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   335
	end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   336
15151
13e7d4eccb67 CTF/Control: Fix incomplete hedgehog loop bounds
Wuzzy <Wuzzy2@mail.ru>
parents: 15150
diff changeset
   337
	for h=0, numhhs-1 do
13102
a4872ca7f17c Control: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents: 13019
diff changeset
   338
		-- Tardis screws up the game too much, teams might not get killed correctly after victory
a4872ca7f17c Control: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents: 13019
diff changeset
   339
		-- if a hog is still in time-travel.
a4872ca7f17c Control: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents: 13019
diff changeset
   340
		-- This could be fixed, removing the Tardis is just a simple and lazy fix.
a4872ca7f17c Control: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents: 13019
diff changeset
   341
		AddAmmo(hhs[h], amTardis, 0)
a4872ca7f17c Control: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents: 13019
diff changeset
   342
		-- Resurrector is pointless, all hogs are already automatically resurrected.
a4872ca7f17c Control: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents: 13019
diff changeset
   343
		AddAmmo(hhs[h], amResurrector, 0)
15150
a41b8b154f74 Remove kamikaze and piano strike from CTF and Control
Wuzzy <Wuzzy2@mail.ru>
parents: 15026
diff changeset
   344
		-- Remove suicidal weapons as they might wipe out the team
a41b8b154f74 Remove kamikaze and piano strike from CTF and Control
Wuzzy <Wuzzy2@mail.ru>
parents: 15026
diff changeset
   345
		AddAmmo(hhs[h], amKamikaze, 0)
a41b8b154f74 Remove kamikaze and piano strike from CTF and Control
Wuzzy <Wuzzy2@mail.ru>
parents: 15026
diff changeset
   346
		AddAmmo(hhs[h], amPiano, 0)
13102
a4872ca7f17c Control: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents: 13019
diff changeset
   347
	end
a4872ca7f17c Control: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents: 13019
diff changeset
   348
12080
6c734d8defef Clean up strings in Control mission maps (more translator-friendly)
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
   349
	ShowMission(missionName, missionCaption, missionHelp, 0, 0)
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4662
diff changeset
   350
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   351
end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   352
15010
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   353
local RankTeams = function(teamList)
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   354
	local teamRank = function(a, b)
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   355
		if a.score ~= b.score then
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   356
			return a.score > b.score
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   357
		else
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   358
			return a.clan > b.clan
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   359
		end
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   360
	end
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   361
	table.sort(teamList, teamRank)
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   362
	local rank, plusRank, score, clan
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   363
	for i=1, #teamList do
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   364
		if i == 1 then
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   365
			rank = 1
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   366
			plusRank = 1
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   367
			score = teamList[i].score
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   368
			clan = teamList[i].clan
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   369
		end
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   370
		if (teamList[i].score < score) then
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   371
			rank = rank + plusRank
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   372
			plusRank = 1
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   373
		end
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   374
		if (teamList[i].score == score and teamList[i].clan ~= clan) then
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   375
			plusRank = plusRank + 1
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   376
		end
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   377
		teamList[i].rank = rank
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   378
		score = teamList[i].score
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   379
		clan = teamList[i].clan
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   380
	end
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   381
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   382
	for i=1, #teamList do
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   383
		SendStat(siPointType, "!POINTS")
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   384
		SendStat(siTeamRank, tostring(teamList[i].rank))
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   385
		SendStat(siPlayerKills, tostring(teamList[i].score), teamList[i].name)
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   386
	end
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   387
end
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   388
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   389
function onNewTurn()
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   390
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   391
	-- reset the time counter so that it will get set to TurnTimeLeft in onGameTick
4953
ebd3dae634ca Fixed scoring exploit on Control and removed user branding from the map
mikade
parents: 4767
diff changeset
   392
	TimeCounter = 0
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   393
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   394
	if lastTeam ~= GetHogTeamName(CurrentHedgehog) then
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   395
		lastTeam = GetHogTeamName(CurrentHedgehog)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   396
	end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   397
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   398
	if gameWon == false then
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   399
15011
c52aa7ba2e16 Control (style): Adjust score limit according to clans count instead of teams count
Wuzzy <Wuzzy2@mail.ru>
parents: 15010
diff changeset
   400
		for i = 0, TeamsCount - 1 do
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4662
diff changeset
   401
			if teamScore[i] >= pointLimit then --150
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   402
				gameWon = true
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   403
				winnerClan = i
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   404
			end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   405
		end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   406
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   407
		if gameWon == true then
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   408
			for i = 0, (numhhs-1) do
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   409
				if hhs[i] ~= nil then
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   410
					if GetHogClan(hhs[i]) ~= winnerClan then
7838
5c2337f8dbb2 Issue #443 - change in syntax for effects
nemo
parents: 5842
diff changeset
   411
						SetEffect(hhs[i], heResurrectable, 0)
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   412
						SetHealth(hhs[i],0)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   413
					end
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   414
				end
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   415
			end
15006
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   416
			EndTurn(true)
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   417
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   418
			-- Rankings
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   419
			local teamList = {}
15011
c52aa7ba2e16 Control (style): Adjust score limit according to clans count instead of teams count
Wuzzy <Wuzzy2@mail.ru>
parents: 15010
diff changeset
   420
			for i=0, TeamsCount - 1 do
15006
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   421
				local name = GetTeamName(i)
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   422
				local clan = GetTeamClan(name)
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   423
				table.insert(teamList, { score = teamScore[teamClan[i]], name = name, clan = clan })
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   424
			end
15010
5188ecbf726f Rank tied teams properly in Control, CTF and Mutant
Wuzzy <Wuzzy2@mail.ru>
parents: 15009
diff changeset
   425
			RankTeams(teamList)
15006
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   426
			SendStat(siGraphTitle, loc("Score graph"))
851f1687439d Control (style): Implement proper ranking screen and score graph
Wuzzy <Wuzzy2@mail.ru>
parents: 15005
diff changeset
   427
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   428
		end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   429
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   430
	end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   431
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   432
end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   433
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   434
function onGameTick()
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   435
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   436
	vCircCount = vCircCount + 1
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   437
	if (vCircCount >= 500) and (gameWon == false) then
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   438
		vCircCount = 0
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   439
		CheckZones()
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   440
	end
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   441
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   442
	-- set TimeCounter to starting time if it is uninitialised (from onNewTurn)
4953
ebd3dae634ca Fixed scoring exploit on Control and removed user branding from the map
mikade
parents: 4767
diff changeset
   443
	if (TimeCounter == 0) and (TurnTimeLeft > 0) then
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   444
		TimeCounter = TurnTimeLeft
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   445
	end
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   446
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   447
	-- has it ACTUALLY been 2 seconds since we last did this?
4953
ebd3dae634ca Fixed scoring exploit on Control and removed user branding from the map
mikade
parents: 4767
diff changeset
   448
	if (TimeCounter - TurnTimeLeft) >= 2000 then
ebd3dae634ca Fixed scoring exploit on Control and removed user branding from the map
mikade
parents: 4767
diff changeset
   449
		TimeCounter = TurnTimeLeft
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   450
4953
ebd3dae634ca Fixed scoring exploit on Control and removed user branding from the map
mikade
parents: 4767
diff changeset
   451
		if (gameWon == false) then
15004
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   452
			AwardPoints()
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   453
		end
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   454
	end
89f6a1154f67 Control (style): Clean up whitespace and indentations
Wuzzy <Wuzzy2@mail.ru>
parents: 15003
diff changeset
   455
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   456
end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   457
15009
0ebecd424fc7 Control (style): Fix scoring breaking after using extra time
Wuzzy <Wuzzy2@mail.ru>
parents: 15008
diff changeset
   458
function onHogAttack(ammoType)
0ebecd424fc7 Control (style): Fix scoring breaking after using extra time
Wuzzy <Wuzzy2@mail.ru>
parents: 15008
diff changeset
   459
	-- Update TimeCounter after using extra time
15026
1b3d788e7350 Control (style): Fix scoring breakage after extra time for real
Wuzzy <Wuzzy2@mail.ru>
parents: 15011
diff changeset
   460
	if ammoType == amExtraTime then
15009
0ebecd424fc7 Control (style): Fix scoring breaking after using extra time
Wuzzy <Wuzzy2@mail.ru>
parents: 15008
diff changeset
   461
		if (TimeCounter == 0) and (TurnTimeLeft > 0) then
0ebecd424fc7 Control (style): Fix scoring breaking after using extra time
Wuzzy <Wuzzy2@mail.ru>
parents: 15008
diff changeset
   462
			TimeCounter = TurnTimeLeft
0ebecd424fc7 Control (style): Fix scoring breaking after using extra time
Wuzzy <Wuzzy2@mail.ru>
parents: 15008
diff changeset
   463
		end
0ebecd424fc7 Control (style): Fix scoring breaking after using extra time
Wuzzy <Wuzzy2@mail.ru>
parents: 15008
diff changeset
   464
		TimeCounter = TimeCounter + 30000
0ebecd424fc7 Control (style): Fix scoring breaking after using extra time
Wuzzy <Wuzzy2@mail.ru>
parents: 15008
diff changeset
   465
	end
0ebecd424fc7 Control (style): Fix scoring breaking after using extra time
Wuzzy <Wuzzy2@mail.ru>
parents: 15008
diff changeset
   466
end
0ebecd424fc7 Control (style): Fix scoring breaking after using extra time
Wuzzy <Wuzzy2@mail.ru>
parents: 15008
diff changeset
   467
5842
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   468
function InABetterPlaceNow(gear)
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   469
	for i = 0, (numhhs-1) do
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   470
		if gear == hhs[i] then
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   471
			hhs[i] = nil
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   472
		end
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   473
	end
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   474
end
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   475
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   476
function onGearAdd(gear)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   477
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   478
	if GetGearType(gear) == gtHedgehog then
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   479
		hhs[numhhs] = gear
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   480
		numhhs = numhhs + 1
7838
5c2337f8dbb2 Issue #443 - change in syntax for effects
nemo
parents: 5842
diff changeset
   481
		SetEffect(gear, heResurrectable, 1)
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   482
	end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   483
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   484
end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   485
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   486
function onGearDelete(gear)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   487
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   488
	if GetGearType(gear) == gtHedgehog then
5842
30e374a27269 fix timebox (differently), support for more players, remove version numbers,
mikade
parents: 5806
diff changeset
   489
		InABetterPlaceNow(gear)
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   490
	end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   491
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   492
end