1 |
getting closer but cant seem to get the holes to be huge.. will keep working on this..
|
1 |
getting closer but cant seem to get the holes to be huge.. will keep working on this..
|
2 |
if somone knows a better way to make coms create huge lakes on death then please let me know as it will help me..
|
2 |
if somone knows a better way to make coms create huge lakes on death then please let me know as it will help me..
|
3 |
i
know
if
i
directly
modify
weapon
defs
it
is
easy
but
i
prefer
for
the
moment
to
stick
with
tweakdefs
is
possible.
|
3 |
i
know
if
i
directly
modify
weapon
defs
it
is
easy
but
i
prefer
for
the
moment
to
stick
with
tweakdefs
if
possible.
|
4 |
[spoiler]
|
4 |
[spoiler]
|
5 |
{{{
|
5 |
{{{
|
6 |
local validUnitNames = {
|
6 |
local validUnitNames = {
|
7 |
dynrecon1 = true,
|
7 |
dynrecon1 = true,
|
8 |
dynstrike1 = true,
|
8 |
dynstrike1 = true,
|
9 |
dynsupport1 = true,
|
9 |
dynsupport1 = true,
|
10 |
dynassault1 = true,
|
10 |
dynassault1 = true,
|
11 |
}
|
11 |
}
|
12 |
\n
|
12 |
\n
|
13 |
Spring.Echo("[LakeNuke] Crater test weapon script loaded")
|
13 |
Spring.Echo("[LakeNuke] Crater test weapon script loaded")
|
14 |
\n
|
14 |
\n
|
15 |
local function DeepCopyTable(t)
|
15 |
local function DeepCopyTable(t)
|
16 |
if type(t) ~= "table" then return t end
|
16 |
if type(t) ~= "table" then return t end
|
17 |
local copy = {}
|
17 |
local copy = {}
|
18 |
for k, v in pairs(t) do
|
18 |
for k, v in pairs(t) do
|
19 |
copy[k] = DeepCopyTable(v)
|
19 |
copy[k] = DeepCopyTable(v)
|
20 |
end
|
20 |
end
|
21 |
return copy
|
21 |
return copy
|
22 |
end
|
22 |
end
|
23 |
\n
|
23 |
\n
|
24 |
local function MakeClonedWeaponDef()
|
24 |
local function MakeClonedWeaponDef()
|
25 |
local srcUnit = UnitDefs["jumpbomb"]
|
25 |
local srcUnit = UnitDefs["jumpbomb"]
|
26 |
if not srcUnit or not srcUnit.weapondefs or not srcUnit.weapondefs.jumpbomb_death then
|
26 |
if not srcUnit or not srcUnit.weapondefs or not srcUnit.weapondefs.jumpbomb_death then
|
27 |
Spring.Echo("[LakeNuke] ERROR: Source weapon 'jumpbomb_death' not found!")
|
27 |
Spring.Echo("[LakeNuke] ERROR: Source weapon 'jumpbomb_death' not found!")
|
28 |
return nil
|
28 |
return nil
|
29 |
end
|
29 |
end
|
30 |
\n
|
30 |
\n
|
31 |
local cloned = DeepCopyTable(srcUnit.weapondefs.jumpbomb_death)
|
31 |
local cloned = DeepCopyTable(srcUnit.weapondefs.jumpbomb_death)
|
32 |
\n
|
32 |
\n
|
33 |
cloned.name = "Lake Make"
|
33 |
cloned.name = "Lake Make"
|
34 |
cloned.areaOfEffect = 4000
|
34 |
cloned.areaOfEffect = 4000
|
35 |
cloned.craterAreaOfEffect = 4000
|
35 |
cloned.craterAreaOfEffect = 4000
|
36 |
cloned.craterBoost = 1000
|
36 |
cloned.craterBoost = 1000
|
37 |
cloned.craterMult = 1250
|
37 |
cloned.craterMult = 1250
|
38 |
cloned.edgeEffectiveness = 1
|
38 |
cloned.edgeEffectiveness = 1
|
39 |
cloned.explosionGenerator = "custom:NUKE_150"
|
39 |
cloned.explosionGenerator = "custom:NUKE_150"
|
40 |
cloned.explosionSpeed = 10000
|
40 |
cloned.explosionSpeed = 10000
|
41 |
cloned.impulseBoost = 10
|
41 |
cloned.impulseBoost = 10
|
42 |
cloned.impulseFactor = -10
|
42 |
cloned.impulseFactor = -10
|
43 |
cloned.soundHit = "explosion/ex_ultra1"
|
43 |
cloned.soundHit = "explosion/ex_ultra1"
|
44 |
cloned.damage = { default = 9500 }
|
44 |
cloned.damage = { default = 9500 }
|
45 |
cloned.range = 300
|
45 |
cloned.range = 300
|
46 |
cloned.reloadtime = 5
|
46 |
cloned.reloadtime = 5
|
47 |
cloned.weaponType = "Cannon"
|
47 |
cloned.weaponType = "Cannon"
|
48 |
cloned.customParams = {
|
48 |
cloned.customParams = {
|
49 |
burst = "1",
|
49 |
burst = "1",
|
50 |
lups_explodelife = 1.5,
|
50 |
lups_explodelife = 1.5,
|
51 |
smoothradius = "6000",
|
51 |
smoothradius = "6000",
|
52 |
detachmentradius = "10000",
|
52 |
detachmentradius = "10000",
|
53 |
smoothmult = "1",
|
53 |
smoothmult = "1",
|
54 |
smoothexponent = "0.8",
|
54 |
smoothexponent = "0.8",
|
55 |
movestructures = "1",
|
55 |
movestructures = "1",
|
56 |
}
|
56 |
}
|
57 |
\n
|
57 |
\n
|
58 |
Spring.Echo("[LakeNuke] Created cloned weapon: Lake Make")
|
58 |
Spring.Echo("[LakeNuke] Created cloned weapon: Lake Make")
|
59 |
return cloned
|
59 |
return cloned
|
60 |
end
|
60 |
end
|
61 |
\n
|
61 |
\n
|
62 |
local function SetWeaponDefForUnit(ud, unitName)
|
62 |
local function SetWeaponDefForUnit(ud, unitName)
|
63 |
Spring.Echo("[LakeNuke] Assigning weapon to unit: " .. unitName)
|
63 |
Spring.Echo("[LakeNuke] Assigning weapon to unit: " .. unitName)
|
64 |
\n
|
64 |
\n
|
65 |
local weaponDef = MakeClonedWeaponDef()
|
65 |
local weaponDef = MakeClonedWeaponDef()
|
66 |
if not weaponDef then
|
66 |
if not weaponDef then
|
67 |
Spring.Echo("[LakeNuke] Failed to assign weapon to: " .. unitName)
|
67 |
Spring.Echo("[LakeNuke] Failed to assign weapon to: " .. unitName)
|
68 |
return
|
68 |
return
|
69 |
end
|
69 |
end
|
70 |
\n
|
70 |
\n
|
71 |
ud.weapondefs = ud.weapondefs or {}
|
71 |
ud.weapondefs = ud.weapondefs or {}
|
72 |
ud.weapondefs.lakenuke = weaponDef
|
72 |
ud.weapondefs.lakenuke = weaponDef
|
73 |
\n
|
73 |
\n
|
74 |
ud.weapons = ud.weapons or {}
|
74 |
ud.weapons = ud.weapons or {}
|
75 |
table.insert(ud.weapons, {
|
75 |
table.insert(ud.weapons, {
|
76 |
def = "lakenuke",
|
76 |
def = "lakenuke",
|
77 |
onlyTargetCategory = [[LAND]],
|
77 |
onlyTargetCategory = [[LAND]],
|
78 |
})
|
78 |
})
|
79 |
\n
|
79 |
\n
|
80 |
Spring.Echo("[LakeNuke] Weapon attached to unit: " .. unitName)
|
80 |
Spring.Echo("[LakeNuke] Weapon attached to unit: " .. unitName)
|
81 |
end
|
81 |
end
|
82 |
\n
|
82 |
\n
|
83 |
for unitName, ud in pairs(UnitDefs) do
|
83 |
for unitName, ud in pairs(UnitDefs) do
|
84 |
local isValid = validUnitNames[unitName]
|
84 |
local isValid = validUnitNames[unitName]
|
85 |
local hasMetalCost = ud.metalcost and ud.metalcost > 0
|
85 |
local hasMetalCost = ud.metalcost and ud.metalcost > 0
|
86 |
local validSelfDestruct = not (ud.selfDestructCountdown and ud.selfDestructCountdown < 1)
|
86 |
local validSelfDestruct = not (ud.selfDestructCountdown and ud.selfDestructCountdown < 1)
|
87 |
\n
|
87 |
\n
|
88 |
Spring.Echo("[LakeNuke] Checking unit: " .. unitName)
|
88 |
Spring.Echo("[LakeNuke] Checking unit: " .. unitName)
|
89 |
Spring.Echo(" - isValid: " .. tostring(isValid))
|
89 |
Spring.Echo(" - isValid: " .. tostring(isValid))
|
90 |
Spring.Echo(" - hasMetalCost: " .. tostring(hasMetalCost))
|
90 |
Spring.Echo(" - hasMetalCost: " .. tostring(hasMetalCost))
|
91 |
Spring.Echo(" - validSelfDestruct: " .. tostring(validSelfDestruct))
|
91 |
Spring.Echo(" - validSelfDestruct: " .. tostring(validSelfDestruct))
|
92 |
\n
|
92 |
\n
|
93 |
if isValid and hasMetalCost and validSelfDestruct then
|
93 |
if isValid and hasMetalCost and validSelfDestruct then
|
94 |
Spring.Echo("[LakeNuke] Unit is valid, applying changes: " .. unitName)
|
94 |
Spring.Echo("[LakeNuke] Unit is valid, applying changes: " .. unitName)
|
95 |
\n
|
95 |
\n
|
96 |
SetWeaponDefForUnit(ud, unitName)
|
96 |
SetWeaponDefForUnit(ud, unitName)
|
97 |
ud.explodeas = "lakenuke"
|
97 |
ud.explodeas = "lakenuke"
|
98 |
ud.selfdestructas = "lakenuke"
|
98 |
ud.selfdestructas = "lakenuke"
|
99 |
ud.myGravity = 0.1
|
99 |
ud.myGravity = 0.1
|
100 |
\n
|
100 |
\n
|
101 |
ud.customParams = ud.customParams or {}
|
101 |
ud.customParams = ud.customParams or {}
|
102 |
ud.customParams.stats_show_death_explosion = true
|
102 |
ud.customParams.stats_show_death_explosion = true
|
103 |
\n
|
103 |
\n
|
104 |
Spring.Echo("[LakeNuke] Successfully modified: " .. unitName)
|
104 |
Spring.Echo("[LakeNuke] Successfully modified: " .. unitName)
|
105 |
else
|
105 |
else
|
106 |
Spring.Echo("[LakeNuke] Skipping unit: " .. unitName)
|
106 |
Spring.Echo("[LakeNuke] Skipping unit: " .. unitName)
|
107 |
end
|
107 |
end
|
108 |
end
|
108 |
end
|
109 |
}}}
|
109 |
}}}
|
110 |
[/spoiler]
|
110 |
[/spoiler]
|