author | tiyuri@gmail.com |
Sat, 07 Aug 2010 12:44:55 +0100 | |
changeset 3731 | f336f8d52f7e |
parent 3730 | aecea9aa53dc |
child 3732 | ec1c81d8c05a |
permissions | -rw-r--r-- |
3731
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
1 |
local hogs = {} |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
2 |
|
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
3 |
function mapM_(func, tbl) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
4 |
for i,v in pairs(tbl) do |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
5 |
func(v) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
6 |
end |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
7 |
end |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
8 |
|
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
9 |
function map(func, tbl) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
10 |
local newtbl = {} |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
11 |
for i,v in pairs(tbl) do |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
12 |
newtbl[i] = func(v) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
13 |
end |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
14 |
return newtbl |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
15 |
end |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
16 |
|
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
17 |
function filter(func, tbl) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
18 |
local newtbl = {} |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
19 |
for i,v in pairs(tbl) do |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
20 |
if func(v) then |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
21 |
table.insert(newtbl, v) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
22 |
end |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
23 |
end |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
24 |
return newtbl |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
25 |
end |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
26 |
|
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
27 |
function onGameInit() |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
28 |
GameFlags = gfSolidLand + gfDivideTeams |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
29 |
TurnTime = 10000 |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
30 |
CaseFreq = 0 |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
31 |
LandAdds = 0 |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
32 |
Explosives = 0 |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
33 |
Delay = 500 |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
34 |
SuddenDeathTurns = 99999 -- "disable" sudden death |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
35 |
Theme = Compost |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
36 |
end |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
37 |
|
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
38 |
function onGameStart() |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
39 |
local offset = 50 |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
40 |
local team1hh = filter(function(h) return GetHogClan(h) == 0 end, hogs) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
41 |
local team2hh = filter(function(h) return GetHogClan(h) == 1 end, hogs) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
42 |
|
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
43 |
for i,h in ipairs(team1hh) do |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
44 |
SetGearPosition(h, 250+(i-1)*offset, 1000) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
45 |
end |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
46 |
for i,h in ipairs(team2hh) do |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
47 |
SetGearPosition(h, 3500-(i-1)*offset, 1000) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
48 |
end |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
49 |
|
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
50 |
SpawnHealthCrate(1800, 1200) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
51 |
end |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
52 |
|
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
53 |
function onAmmoStoreInit() |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
54 |
SetAmmo(amRCPlane, 9, 0, 0, 0) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
55 |
SetAmmo(amSkip, 9, 0, 0, 0) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
56 |
end |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
57 |
|
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
58 |
function onGearAdd(gear) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
59 |
if GetGearType(gear) == gtRCPlane then |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
60 |
SetTimer(gear,60000) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
61 |
end |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
62 |
if GetGearType(gear) == gtHedgehog then |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
63 |
table.insert(hogs, gear) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
64 |
end |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
65 |
end |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
66 |
|
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
67 |
function onGearDelete(gear) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
68 |
if GetGearType(gear) == gtCase then |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
69 |
SpawnHealthCrate(1880, 1150) |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
70 |
end |
f336f8d52f7e
Remove random placement of health crate, looks like LUA random function may not be synced over network.
tiyuri@gmail.com
parents:
3730
diff
changeset
|
71 |
end |