author | Wuzzy <Wuzzy2@mail.ru> |
Thu, 22 Feb 2018 01:03:40 +0100 | |
changeset 13059 | 2d0f3e12fcad |
parent 11738 | 67049c8dedd1 |
child 14235 | 8edbdd3a1fe7 |
permissions | -rw-r--r-- |
4854
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
1 |
-- Library for keeping track of gears in the game |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
2 |
-- and running functions on them |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
3 |
-- also keeps track of clans and teams |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
4 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
5 |
local trackingTeams = false |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
6 |
local resurrecting = false |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
7 |
local gears = {} |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
8 |
local teams = {} |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
9 |
local clans = {} |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
10 |
local resurrectedHogs = {} |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
11 |
local gearValues = {} |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
12 |
local teamValues = {} |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
13 |
local clanValues = {} |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
14 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
15 |
-- Registers when a gear is added |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
16 |
function trackGear(gear) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
17 |
table.insert(gears, gear) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
18 |
if trackingTeams and GetGearType(gear) == gtResurrector then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
19 |
resurrecting = true |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
20 |
elseif resurrecting and GetGearType(gear) == gtHedgehog then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
21 |
table.insert(resurrectedHogs, gear) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
22 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
23 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
24 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
25 |
-- Registers when a gear is deleted |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
26 |
function trackDeletion(gear) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
27 |
gearValues[gear] = nil |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
28 |
for k, g in ipairs(gears) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
29 |
if g == gear then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
30 |
table.remove(gears, k) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
31 |
break |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
32 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
33 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
34 |
if trackingTeams and GetGearType(gear) == gtHedgehog then |
6438
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
35 |
hogs = teams[GetHogTeamName(gear)] |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
36 |
if hogs ~= nil then |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
37 |
if table.maxn(hogs) == 1 then |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
38 |
hogs = nil |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
39 |
else |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
40 |
for k, hog in ipairs(hogs) do |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
41 |
if hog == gear then |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
42 |
table.remove(hogs, k) |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
43 |
break |
4854
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
44 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
45 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
46 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
47 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
48 |
elseif resurrecting and GetGearType(gear) == gtResurrector then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
49 |
for k, gear in ipairs(resurrectedHogs) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
50 |
team = GetHogTeamName(gear) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
51 |
if teams[team] == nil then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
52 |
teams[team] = {} |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
53 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
54 |
table.insert(teams[team], gear) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
55 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
56 |
resurrecting = false |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
57 |
resurrectedHogs = {} |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
58 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
59 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
60 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
61 |
-- Start to keep track of teams |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
62 |
function trackTeams() |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
63 |
if not trackingTeams then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
64 |
trackingTeams = true |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
65 |
for k, gear in ipairs(gears) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
66 |
if GetGearType(gear) == gtHedgehog then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
67 |
team = GetHogTeamName(gear) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
68 |
if teams[team] == nil then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
69 |
teams[team] = { gear } |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
70 |
clans[team] = GetHogClan(gear) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
71 |
else |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
72 |
table.insert(teams[team], gear) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
73 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
74 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
75 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
76 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
77 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
78 |
|
6438
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
79 |
-- Registers when a hog is hidden |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
80 |
function trackHiding(gear) |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
81 |
for k, g in ipairs(gears) do |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
82 |
if g == gear then |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
83 |
table.remove(gears, k) |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
84 |
break |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
85 |
end |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
86 |
end |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
87 |
|
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
88 |
if trackingTeams then |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
89 |
hogs = teams[GetHogTeamName(gear)] |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
90 |
|
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
91 |
if hogs ~= nil then |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
92 |
if table.maxn(hogs) == 1 then |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
93 |
hogs = nil |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
94 |
else |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
95 |
for k, hog in ipairs(hogs) do |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
96 |
if hog == gear then |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
97 |
table.remove(hogs, k) |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
98 |
break |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
99 |
end |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
100 |
end |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
101 |
end |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
102 |
end |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
103 |
end |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
104 |
end |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
105 |
|
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
106 |
-- Registers when a hog is restored |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
107 |
function trackRestoring(gear) |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
108 |
table.insert(gears, gear) |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
109 |
|
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
110 |
if trackingTeams then |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
111 |
team = GetHogTeamName(gear) |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
112 |
if teams[team] == nil then |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
113 |
teams[team] = {} |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
114 |
end |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
115 |
table.insert(teams[team], gear) |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
116 |
end |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
117 |
end |
b3a8718ac2a0
Updated the Tracker to handle hog hiding and restoring.
Henek
parents:
5138
diff
changeset
|
118 |
|
4854
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
119 |
-- Get a value for a specific gear |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
120 |
function getGearValue(gear, key) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
121 |
if gearValues[gear] ~= nil then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
122 |
return gearValues[gear][key] |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
123 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
124 |
return nil |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
125 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
126 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
127 |
-- Set a value for a specific gear |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
128 |
function setGearValue(gear, key, value) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
129 |
found = false |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
130 |
for id, values in pairs(gearValues) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
131 |
if id == gear then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
132 |
values[key] = value |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
133 |
found = true |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
134 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
135 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
136 |
if not found then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
137 |
gearValues[gear] = { [key] = value } |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
138 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
139 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
140 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
141 |
-- Increase a value for a specific gear |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
142 |
function increaseGearValue(gear, key) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
143 |
for id, values in pairs(gearValues) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
144 |
if id == gear then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
145 |
values[key] = values[key] + 1 |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
146 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
147 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
148 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
149 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
150 |
-- Decrease a value for a specific gear |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
151 |
function decreaseGearValue(gear, key) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
152 |
for id, values in pairs(gearValues) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
153 |
if id == gear then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
154 |
values[key] = values[key] - 1 |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
155 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
156 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
157 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
158 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
159 |
-- Get a value for a specific team |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
160 |
function getTeamValue(team, key) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
161 |
if teamValues[team] ~= nil then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
162 |
return teamValues[team][key] |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
163 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
164 |
return nil |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
165 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
166 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
167 |
-- Set a value for a specific team |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
168 |
function setTeamValue(team, key, value) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
169 |
found = false |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
170 |
for name, values in pairs(teamValues) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
171 |
if name == team then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
172 |
values[key] = value |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
173 |
found = true |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
174 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
175 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
176 |
if not found then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
177 |
teamValues[team] = { [key] = value } |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
178 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
179 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
180 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
181 |
-- Increase a value for a specific team |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
182 |
function increaseTeamValue(team, key) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
183 |
for name, values in pairs(teamValues) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
184 |
if name == team then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
185 |
values[key] = values[key] + 1 |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
186 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
187 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
188 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
189 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
190 |
-- Decrease a value for a specific team |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
191 |
function decreaseTeamValue(team, key) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
192 |
for name, values in pairs(teamValues) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
193 |
if name == team then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
194 |
values[key] = values[key] - 1 |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
195 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
196 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
197 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
198 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
199 |
-- Get a value for a specific clan |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
200 |
function getClanValue(clan, key) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
201 |
if clanValues[clan] ~= nil then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
202 |
return clanValues[clan][key] |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
203 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
204 |
return nil |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
205 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
206 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
207 |
-- Set a value for a specific clan |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
208 |
function setClanValue(clan, key, value) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
209 |
found = false |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
210 |
for num, values in ipairs(clanValues) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
211 |
if num == clan then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
212 |
values[key] = value |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
213 |
found = true |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
214 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
215 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
216 |
if not found then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
217 |
clanValues[clan] = { [key] = value } |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
218 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
219 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
220 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
221 |
-- Increase a value for a specific clan |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
222 |
function increaseClanValue(clan, key) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
223 |
for num, values in ipairs(clanValues) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
224 |
if num == clan then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
225 |
values[key] = values[key] + 1 |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
226 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
227 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
228 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
229 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
230 |
-- Decrease a value for a specific clan |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
231 |
function decreaseClanValue(clan, key) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
232 |
for num, values in ipairs(clanValues) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
233 |
if num == clan then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
234 |
values[key] = values[key] - 1 |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
235 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
236 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
237 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
238 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
239 |
-- Run a function on all tracked gears |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
240 |
function runOnGears(func) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
241 |
for k, gear in ipairs(gears) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
242 |
func(gear) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
243 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
244 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
245 |
|
11738
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
6438
diff
changeset
|
246 |
-- Returns the first hog (alive or not) in the given clan |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
6438
diff
changeset
|
247 |
function getFirstHogOfClan(clan) |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
6438
diff
changeset
|
248 |
for k, hogs in pairs(teams) do |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
6438
diff
changeset
|
249 |
for m, hog in ipairs(hogs) do |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
6438
diff
changeset
|
250 |
if GetHogClan(hog) == clan then |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
6438
diff
changeset
|
251 |
return hog |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
6438
diff
changeset
|
252 |
end |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
6438
diff
changeset
|
253 |
end |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
6438
diff
changeset
|
254 |
end |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
6438
diff
changeset
|
255 |
return nil |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
6438
diff
changeset
|
256 |
end |
67049c8dedd1
make construction mode work with fort mode without mixing up clans and forts
sheepluva
parents:
6438
diff
changeset
|
257 |
|
4854
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
258 |
-- Run a function on all tracked hogs |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
259 |
function runOnHogs(func) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
260 |
for k, hogs in pairs(teams) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
261 |
for m, hog in ipairs(hogs) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
262 |
func(hog) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
263 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
264 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
265 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
266 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
267 |
-- Run a function on hogs in a team |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
268 |
function runOnHogsInTeam(func, team) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
269 |
if teams[team] ~= nil then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
270 |
for k, hog in ipairs(teams[team]) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
271 |
func(hog) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
272 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
273 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
274 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
275 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
276 |
-- Run a function on hogs in other teams |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
277 |
function runOnHogsInOtherTeams(func, team) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
278 |
for k, hogs in pairs(teams) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
279 |
if k ~= team then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
280 |
for m, hog in ipairs(hogs) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
281 |
func(hog) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
282 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
283 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
284 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
285 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
286 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
287 |
-- Run a function on hogs in a clan |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
288 |
function runOnHogsInClan(func, clan) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
289 |
for i = 1, table.maxn(clans) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
290 |
if clans[i] == clan then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
291 |
for k, hog in ipairs(teams[i]) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
292 |
func(hog) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
293 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
294 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
295 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
296 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
297 |
|
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
298 |
-- Run a function on hogs in other clans |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
299 |
function runOnHogsInOtherClans(func, clan) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
300 |
for i = 1, table.maxn(clans) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
301 |
if clans[i] ~= clan then |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
302 |
for k, hog in ipairs(teams[i]) do |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
303 |
func(hog) |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
304 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
305 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
306 |
end |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
diff
changeset
|
307 |
end |