| 1 |
just working on some things..
|
1 |
just working on some things..
|
| 2 |
[spoiler]
|
2 |
[spoiler]
|
| 3 |
{{{
|
3 |
{{{
|
| 4 |
local invalidUDNames = {
|
4 |
local invalidUDNames = {
|
| 5 |
["terraunit"] = true,
|
5 |
["terraunit"] = true,
|
| 6 |
["slicer"] = true
|
6 |
["slicer"] = true
|
| 7 |
}
|
7 |
}
|
| 8 |
local validUnits = {}
|
8 |
local validUnits = {}
|
| 9 |
local sortedUnits = {}
|
9 |
local sortedUnits = {}
|
| 10 |
for name, ud in pairs(UnitDefs) do
|
10 |
for name, ud in pairs(UnitDefs) do
|
| 11 |
if validunitnames[ud.name] and not invalidUDNames[ud.name] then
|
11 |
if validunitnames[ud.name] and not invalidUDNames[ud.name] then
|
| 12 |
table.insert(validUnits, ud)
|
12 |
table.insert(validUnits, ud)
|
| 13 |
end
|
13 |
end
|
| 14 |
end
|
14 |
end
|
| 15 |
table.sort(validUnits, function(a, b) return a.metalCost < b.metalCost end)
|
15 |
table.sort(validUnits, function(a, b) return a.metalCost < b.metalCost end)
|
| 16 |
for i, ud in ipairs(validUnits) do
|
16 |
for i, ud in ipairs(validUnits) do
|
| 17 |
if not ud.customparams then
|
17 |
if not ud.customparams then
|
| 18 |
ud.customparams = {}
|
18 |
ud.customparams = {}
|
| 19 |
end
|
19 |
end
|
| 20 |
if not ud.customparams.morphto then
|
20 |
if not ud.customparams.morphto then
|
| 21 |
ud.customparams.morphto = ""
|
21 |
ud.customparams.morphto = ""
|
| 22 |
end
|
22 |
end
|
| 23 |
if not ud.customparams.morphtime then
|
23 |
if not ud.customparams.morphtime then
|
| 24 |
ud.customparams.morphtime = 4
|
24 |
ud.customparams.morphtime = 4
|
| 25 |
end
|
25 |
end
|
| 26 |
if validUnits[i + 1] then
|
26 |
if validUnits[i + 1] then
|
| 27 |
ud.customparams.morphto = validUnits[i + 1].name
|
27 |
ud.customparams.morphto = validUnits[i + 1].name
|
| 28 |
else
|
28 |
else
|
| 29 |
ud.customparams.morphto = ""
|
29 |
ud.customparams.morphto = ""
|
| 30 |
end
|
30 |
end
|
| 31 |
end
|
31 |
end
|
| 32 |
}}}
|
32 |
}}}
|
| 33 |
[/spoiler]
|
33 |
[/spoiler]
|
| 34 |
eta:
1-2
days.
.
all
units
can
morph
into
next
most
expencive
unit.
.
|
34 |
eta:
1-2
days.
.
all
units
can
morph
into
next
most
expencive
unit
for
cost.
.
|