author | tiyuri@gmail.com |
Sat, 07 Aug 2010 13:09:32 +0100 | |
changeset 3732 | ec1c81d8c05a |
parent 3731 | f336f8d52f7e |
child 3734 | 304a83637eb4 |
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 = {} |
3732 | 2 |
local spawncrate = 0 |
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
|
3 |
|
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 |
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
|
5 |
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
|
6 |
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
|
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 |
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
|
9 |
|
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 |
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
|
11 |
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
|
12 |
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
|
13 |
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
|
14 |
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
|
15 |
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
|
16 |
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
|
17 |
|
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 |
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
|
19 |
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
|
20 |
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
|
21 |
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
|
22 |
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
|
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 |
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
|
25 |
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
|
26 |
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
|
27 |
|
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 |
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
|
29 |
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
|
30 |
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
|
31 |
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
|
32 |
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
|
33 |
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
|
34 |
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
|
35 |
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
|
36 |
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
|
37 |
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
|
38 |
|
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 |
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
|
40 |
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
|
41 |
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
|
42 |
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
|
43 |
|
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 |
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
|
45 |
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
|
46 |
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
|
47 |
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
|
48 |
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
|
49 |
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
|
50 |
|
3732 | 51 |
SpawnHealthCrate(1800, 1150) |
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
|
52 |
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
|
53 |
|
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 |
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
|
55 |
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
|
56 |
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
|
57 |
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
|
58 |
|
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 |
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
|
60 |
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
|
61 |
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
|
62 |
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
|
63 |
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
|
64 |
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
|
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 |
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
|
67 |
|
3732 | 68 |
function onGameTick() |
69 |
if (TurnTimeLeft == 9999 and spawncrate == 1) then |
|
70 |
SpawnHealthCrate(1800, 1150) |
|
71 |
spawncrate = 0 |
|
72 |
end |
|
73 |
end |
|
74 |
||
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
|
75 |
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
|
76 |
if GetGearType(gear) == gtCase then |
3732 | 77 |
spawncrate = 1 |
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
|
78 |
end |
3732 | 79 |
end |