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 |
Delay = 500
|
|
35 |
SuddenDeathTurns = 99999 -- "disable" sudden death
|
|
36 |
Theme = Compost
|
|
37 |
end
|
|
38 |
|
|
39 |
function onGameStart()
|
|
40 |
local offset = 50
|
|
41 |
local team1hh = filter(function(h) return GetHogClan(h) == 0 end, hogs)
|
|
42 |
local team2hh = filter(function(h) return GetHogClan(h) == 1 end, hogs)
|
|
43 |
|
|
44 |
for i,h in ipairs(team1hh) do
|
|
45 |
SetGearPosition(h, 250+(i-1)*offset, 1000)
|
|
46 |
end
|
|
47 |
for i,h in ipairs(team2hh) do
|
|
48 |
SetGearPosition(h, 3500-(i-1)*offset, 1000)
|
|
49 |
end
|
|
50 |
|
|
51 |
SpawnHealthCrate(1800, 1150)
|
|
52 |
end
|
|
53 |
|
|
54 |
function onAmmoStoreInit()
|
|
55 |
SetAmmo(amRCPlane, 9, 0, 0, 0)
|
|
56 |
SetAmmo(amSkip, 9, 0, 0, 0)
|
|
57 |
end
|
|
58 |
|
|
59 |
function onGearAdd(gear)
|
|
60 |
if GetGearType(gear) == gtRCPlane then
|
|
61 |
SetTimer(gear,60000)
|
|
62 |
end
|
|
63 |
if GetGearType(gear) == gtHedgehog then
|
|
64 |
table.insert(hogs, gear)
|
|
65 |
end
|
|
66 |
end
|
|
67 |
|
|
68 |
function onGameTick()
|
|
69 |
if (TurnTimeLeft == 9999 and spawncrate == 1) then
|
|
70 |
SpawnHealthCrate(1800, 1150)
|
|
71 |
spawncrate = 0
|
|
72 |
end
|
|
73 |
end
|
|
74 |
|
|
75 |
function onGearDelete(gear)
|
|
76 |
if GetGearType(gear) == gtCase then
|
|
77 |
spawncrate = 1
|
|
78 |
end
|
4162
|
79 |
end
|