3734
|
1 |
local hogs = {}
|
|
2 |
local spawncrate = 0
|
|
3 |
|
|
4 |
function mapM_(func, tbl)
|
|
5 |
for i,v in pairs(tbl) do
|
|
6 |
func(v)
|
|
7 |
end
|
|
8 |
end
|
|
9 |
|
|
10 |
function map(func, tbl)
|
|
11 |
local newtbl = {}
|
|
12 |
for i,v in pairs(tbl) do
|
|
13 |
newtbl[i] = func(v)
|
|
14 |
end
|
|
15 |
return newtbl
|
|
16 |
end
|
|
17 |
|
|
18 |
function filter(func, tbl)
|
|
19 |
local newtbl = {}
|
|
20 |
for i,v in pairs(tbl) do
|
|
21 |
if func(v) then
|
|
22 |
table.insert(newtbl, v)
|
|
23 |
end
|
|
24 |
end
|
|
25 |
return newtbl
|
|
26 |
end
|
|
27 |
|
|
28 |
function onGameInit()
|
|
29 |
GameFlags = gfSolidLand + gfDivideTeams
|
|
30 |
TurnTime = 10000
|
|
31 |
CaseFreq = 0
|
4162
|
32 |
MinesNum = 0
|
3734
|
33 |
Explosives = 0
|
|
34 |
SuddenDeathTurns = 99999 -- "disable" sudden death
|
|
35 |
Theme = Compost
|
|
36 |
end
|
|
37 |
|
|
38 |
function onGameStart()
|
|
39 |
local offset = 50
|
|
40 |
local team1hh = filter(function(h) return GetHogClan(h) == 0 end, hogs)
|
|
41 |
local team2hh = filter(function(h) return GetHogClan(h) == 1 end, hogs)
|
|
42 |
|
|
43 |
for i,h in ipairs(team1hh) do
|
|
44 |
SetGearPosition(h, 250+(i-1)*offset, 1000)
|
|
45 |
end
|
|
46 |
for i,h in ipairs(team2hh) do
|
|
47 |
SetGearPosition(h, 3500-(i-1)*offset, 1000)
|
|
48 |
end
|
|
49 |
|
|
50 |
SpawnHealthCrate(1800, 1150)
|
|
51 |
end
|
|
52 |
|
|
53 |
function onAmmoStoreInit()
|
|
54 |
SetAmmo(amRCPlane, 9, 0, 0, 0)
|
|
55 |
SetAmmo(amSkip, 9, 0, 0, 0)
|
|
56 |
end
|
|
57 |
|
|
58 |
function onGearAdd(gear)
|
|
59 |
if GetGearType(gear) == gtRCPlane then
|
|
60 |
SetTimer(gear,60000)
|
|
61 |
end
|
|
62 |
if GetGearType(gear) == gtHedgehog then
|
|
63 |
table.insert(hogs, gear)
|
|
64 |
end
|
|
65 |
end
|
|
66 |
|
|
67 |
function onGameTick()
|
|
68 |
if (TurnTimeLeft == 9999 and spawncrate == 1) then
|
|
69 |
SpawnHealthCrate(1800, 1150)
|
|
70 |
spawncrate = 0
|
|
71 |
end
|
|
72 |
end
|
|
73 |
|
|
74 |
function onGearDelete(gear)
|
|
75 |
if GetGearType(gear) == gtCase then
|
|
76 |
spawncrate = 1
|
|
77 |
end
|
4162
|
78 |
end
|