1local hogs = {} 2local spawncrate = 0 3 4function mapM_(func, tbl) 5 for i,v in pairs(tbl) do 6 func(v) 7 end 8end 9 10function map(func, tbl) 11 local newtbl = {} 12 for i,v in pairs(tbl) do 13 newtbl[i] = func(v) 14 end 15 return newtbl 16end 17 18function 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 26end 27 28function onGameInit() 29 GameFlags = gfSolidLand + gfDivideTeams 30 TurnTime = 10000 31 CaseFreq = 0 32 MinesNum = 0 33 Explosives = 0 34 SuddenDeathTurns = 99999 -- "disable" sudden death 35 Theme = Compost 36end 37 38function 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) 51end 52 53function onAmmoStoreInit() 54 SetAmmo(amRCPlane, 9, 0, 0, 0) 55 SetAmmo(amSkip, 9, 0, 0, 0) 56end 57 58function 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 65end 66 67function onGameTick() 68 if (TurnTimeLeft == 9999 and spawncrate == 1) then 69 SpawnHealthCrate(1800, 1150) 70 spawncrate = 0 71 end 72end 73 74function onGearDelete(gear) 75 if GetGearType(gear) == gtCase then 76 spawncrate = 1 77 end 78end 79