1 |
Try this:
|
1 |
Try this:
|
2 |
\n
|
2 |
\n
|
3 |
\n
|
3 |
\n
|
4 |
[spoiler]
|
4 |
[spoiler]
|
5 |
{{{
|
5 |
{{{
|
6 |
local oldEcho = Spring.Echo
|
6 |
local oldEcho = Spring.Echo
|
7 |
\n
|
7 |
\n
|
8 |
local function CopyTable(orig, deep)
|
8 |
local function CopyTable(orig, deep)
|
9 |
if type(orig) ~= "table" then return orig end
|
9 |
if type(orig) ~= "table" then return orig end
|
10 |
local copy = {}
|
10 |
local copy = {}
|
11 |
for k, v in pairs(orig) do
|
11 |
for k, v in pairs(orig) do
|
12 |
copy[k] = (deep and type(v) == "table") and CopyTable(v, true) or v
|
12 |
copy[k] = (deep and type(v) == "table") and CopyTable(v, true) or v
|
13 |
end
|
13 |
end
|
14 |
return copy
|
14 |
return copy
|
15 |
end
|
15 |
end
|
16 |
\n
|
16 |
\n
|
17 |
local function EchoHijack(str)
|
17 |
local function EchoHijack(str)
|
18 |
oldEcho(str)
|
18 |
oldEcho(str)
|
19 |
\n
|
19 |
\n
|
20 |
if WeaponDefs and UnitDefs and UnitDefs["seismic"] and UnitDefs["seismic"].weapondefs and UnitDefs["seismic"].weapondefs.seismic_weapon then
|
20 |
if WeaponDefs and UnitDefs and UnitDefs["seismic"] and UnitDefs["seismic"].weapondefs and UnitDefs["seismic"].weapondefs.seismic_weapon then
|
21 |
local src = UnitDefs["seismic"]
|
21 |
local src = UnitDefs["seismic"]
|
22 |
local craterWeapon = CopyTable(src.weapondefs.seismic_weapon, true)
|
22 |
local craterWeapon = CopyTable(src.weapondefs.seismic_weapon, true)
|
23 |
craterWeapon.name = "lakenuke"
|
23 |
craterWeapon.name = "lakenuke"
|
24 |
craterWeapon.areaOfEffect = 1000
|
24 |
craterWeapon.areaOfEffect = 1000
|
25 |
craterWeapon.craterAreaOfEffect = 1500
|
25 |
craterWeapon.craterAreaOfEffect = 1500
|
26 |
craterWeapon.craterBoost = 20000
|
26 |
craterWeapon.craterBoost = 20000
|
27 |
craterWeapon.craterMult = 20000
|
27 |
craterWeapon.craterMult = 20000
|
28 |
craterWeapon.edgeEffectiveness = 1
|
28 |
craterWeapon.edgeEffectiveness = 1
|
29 |
craterWeapon.explosionGenerator = "custom:FLASHNUKE480"
|
29 |
craterWeapon.explosionGenerator = "custom:FLASHNUKE480"
|
30 |
craterWeapon.weaponType = "Cannon"
|
30 |
craterWeapon.weaponType = "Cannon"
|
31 |
craterWeapon.damage = { default = 5000 }
|
31 |
craterWeapon.damage = { default = 5000 }
|
32 |
craterWeapon.noSelfDamage = true
|
32 |
craterWeapon.noSelfDamage = true
|
33 |
craterWeapon.customParams = {
|
33 |
craterWeapon.customParams = {
|
34 |
smoothradius = "8000",
|
34 |
smoothradius = "8000",
|
35 |
detachmentradius = "12000",
|
35 |
detachmentradius = "12000",
|
36 |
smoothmult = "1",
|
36 |
smoothmult = "1",
|
37 |
smoothexponent = "0.8",
|
37 |
smoothexponent = "0.8",
|
38 |
movestructures = "1",
|
38 |
movestructures = "1",
|
39 |
}
|
39 |
}
|
40 |
\n
|
40 |
\n
|
41 |
-
|
41 |
-
|
42 |
-
|
42 |
-
|
43 |
-
|
43 |
-
|
44 |
-
|
44 |
-
|
45 |
-
|
45 |
-
|
46 |
\n
|
46 |
\n
|
47 |
\n
|
47 |
\n
|
48 |
for name, ud in pairs(UnitDefs) do
|
48 |
for name, ud in pairs(UnitDefs) do
|
49 |
+ if ud.customparams.commtype then
|
49 |
+ if ud.customparams.commtype then
|
50 |
ud.weapondefs = ud.weapondefs or {}
|
50 |
ud.weapondefs = ud.weapondefs or {}
|
51 |
ud.weapondefs.lakenuke = craterWeapon
|
51 |
ud.weapondefs.lakenuke = craterWeapon
|
52 |
\n
|
52 |
\n
|
53 |
ud.weapons = ud.weapons or {}
|
53 |
ud.weapons = ud.weapons or {}
|
54 |
table.insert(ud.weapons, { def = "lakenuke", onlyTargetCategory = [[NONE]] })
|
54 |
table.insert(ud.weapons, { def = "lakenuke", onlyTargetCategory = [[NONE]] })
|
55 |
\n
|
55 |
\n
|
56 |
ud.explodeAs = "lakenuke"
|
56 |
ud.explodeAs = "lakenuke"
|
57 |
ud.selfDestructAs = "lakenuke"
|
57 |
ud.selfDestructAs = "lakenuke"
|
58 |
ud.myGravity = 0.1
|
58 |
ud.myGravity = 0.1
|
59 |
\n
|
59 |
\n
|
60 |
ud.customParams = ud.customParams or {}
|
60 |
ud.customParams = ud.customParams or {}
|
61 |
ud.customParams.stats_show_death_explosion = true
|
61 |
ud.customParams.stats_show_death_explosion = true
|
62 |
\n
|
62 |
\n
|
63 |
oldEcho("Added lakenuke explosion to unit: " .. name)
|
63 |
oldEcho("Added lakenuke explosion to unit: " .. name)
|
64 |
end
|
64 |
end
|
65 |
end
|
65 |
end
|
66 |
Spring.Echo = oldEcho
|
66 |
Spring.Echo = oldEcho
|
67 |
end
|
67 |
end
|
68 |
end
|
68 |
end
|
69 |
\n
|
69 |
\n
|
70 |
Spring.Echo = EchoHijack
|
70 |
Spring.Echo = EchoHijack
|
71 |
}}}
|
71 |
}}}
|
|
|
72 |
[/spoiler]
|
72 |
\n
|
73 |
\n
|
73 |
Looking at the minus and the plus lines, stop identifying coms by their names or whatever, but just see if the unit def has the commtype customparam. All unitdefs with the commtype customparam will be the commanders you're looking for.
|
74 |
Looking at the minus and the plus lines, stop identifying coms by their names or whatever, but just see if the unit def has the commtype customparam. All unitdefs with the commtype customparam will be the commanders you're looking for.
|
74 |
[/spoiler]
|
|
|