Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making the funnelweb a heavy shield support strider #3247

Merged
merged 55 commits into from
Mar 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
c6fe510
Initial work on making the funnelweb a utility/support strider.
danfireman Sep 21, 2018
939d3bf
Deduplicating buildpower_mult calculation
danfireman Sep 21, 2018
5b4ab62
Making the funnelweb not resurrect and have consistent buildpower
danfireman Sep 22, 2018
e15c963
Funnelweb getting actual energy depletion on shield charge
danfireman Sep 22, 2018
3f85869
GUI context menu now handles builders that can't assist (ie. new Funn…
danfireman Sep 22, 2018
95b6f5e
Trivial refactoring: Pulling out buildpower_mult in another place
danfireman Sep 22, 2018
36ced3b
Adding placeholder for new look for very powerful shields (ie. new Fu…
danfireman Sep 22, 2018
67627f3
Making the funnelweb shield not link to other shields
danfireman Oct 9, 2018
a09e9c6
Decreasing funnelweb build power 100->50
danfireman Oct 10, 2018
79f0f9c
Funnelweb can now assist in construction
danfireman Oct 10, 2018
ef9226b
Properly getting Funnelweb's shieldRechargeDelay working
danfireman Oct 15, 2018
64e00dc
Funnelwebs are unarmed and should have metadata to that effect
danfireman Oct 16, 2018
55eeb51
Shield rechargeDelay can now be nil
danfireman Oct 16, 2018
a8db2f6
Tidying up funnelweb nanopiece code a bit
danfireman Oct 21, 2018
6b2bbb6
Funnelweb should no longer have the shield disappearing when turned off
danfireman Oct 21, 2018
490d2c7
Funnelweb shield recharge delay 60s -> 10s
danfireman Oct 21, 2018
f5f43e5
Funnelweb shields now dimmer when low on charge
danfireman Oct 21, 2018
67351b2
Fixing Funnelweb nano emission
danfireman Oct 21, 2018
81b8369
Removing redundant Funnelweb script code from when it was armed
danfireman Oct 21, 2018
b5f95bc
Funnelweb tweaks following campaign testing:
danfireman Oct 23, 2018
2a37f21
Making the Funnelweb's shield properly centred
danfireman Oct 27, 2018
b020dcb
Reducing Funnelweb weight to 2/3rds of former amount.
danfireman Oct 31, 2018
aa6ea22
Funnelweb shield recharge delay 10s -> 15s
danfireman Oct 31, 2018
4704ed6
Adding short ranged radar to Funnelweb
danfireman Nov 3, 2018
7397ff4
Some tidying up:
danfireman Nov 9, 2018
838eb08
Smoothing very large shields
danfireman Dec 31, 2018
0e0c27f
Funnelweb buildpower bump 35->40
danfireman Dec 31, 2018
8cc434e
Funnelweb: The purple shield decoration doesn't fit and has been comm…
danfireman Dec 31, 2018
5b30ba6
Switching Funnelweb smoke emitter to the eye.
danfireman Dec 31, 2018
5530f22
Barebones attempt at making a visual effect for shield recharge
danfireman Jan 13, 2019
24dcec9
Funnelweb can now build like a normal constructor
danfireman Jan 13, 2019
d12eb0f
Upping Funnelweb cost and shield hp to make Shockley a counter
danfireman Feb 6, 2019
bfb14f3
Improving Funnelweb shield visuals
danfireman Feb 6, 2019
0afc3da
Making funnelweb shield less chickeny
danfireman Feb 6, 2019
6239979
A bit more transparency and a bit more blue for the funnelweb shield
danfireman Feb 6, 2019
729ea3f
More work on the Funnelweb shield, also changing the way shield hit f…
danfireman Feb 7, 2019
3734f3f
Removing dead shield graphics code
danfireman Feb 8, 2019
502365d
Making Funnelweb recharge status more obvious using "wobbles"
danfireman Feb 9, 2019
42bc989
Improving Funnelweb shield charging indicators and removing hex mesh.
danfireman Feb 10, 2019
2731c37
Adding in distortion effect for Funnelweb style shields
danfireman Feb 10, 2019
517e18c
Ensuring that the distortion effect appears on top of Funnelweb shields.
danfireman Feb 11, 2019
45da182
Funnelweb: Reducing build range to reduce porc creep potential and im…
danfireman Feb 11, 2019
4dd5c68
Improving code quality of ShieldSphereColorHQ by getting rid of "vari…
danfireman Feb 15, 2019
407e0aa
Replaced global variable with a function call in Bursts.
GoogleFrog Feb 26, 2019
af7cfc6
Fixed some whitespace and evilness.
GoogleFrog Feb 26, 2019
51d0333
Improved Funnelweb wobbly balls.
GoogleFrog Feb 26, 2019
1202b49
Tweaked balls.
GoogleFrog Feb 26, 2019
c086653
Shifting Funnelweb shield around a bit so it matches hitbox
danfireman Mar 8, 2019
1535236
Fixed Funnelweb shield graphics by setting a lower shield capacity an…
GoogleFrog Mar 15, 2019
de46559
Lowered big shield response.
GoogleFrog Mar 15, 2019
006a9ac
Added autoregen-style selected unit countdown to funnelweb shield.
GoogleFrog Mar 15, 2019
f2d299e
Fixed (or made rare) the Funnelweb shield lag issue.
GoogleFrog Mar 15, 2019
a8b42cf
Improved hash.
GoogleFrog Mar 15, 2019
97879ce
Fix seed.
GoogleFrog Mar 15, 2019
ad9d9a0
Fix shield colour.
GoogleFrog Mar 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions LuaRules/Configs/drone_defs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,6 @@ local carrierDefNames = {
},
--gunshipkrow = { {drone = UnitDefNames.dronelight.id, reloadTime = 15, maxDrones = 6, spawnSize = 2, range = 900, buildTime=3,
-- offsets = {0,0,0,colvolMidX=0, colvolMidY=0,colvolMidZ=0,aimX=0,aimY=0,aimZ=0}},
striderfunnelweb = {
spawnPieces = {"emitl", "emitr"},
{
drone = UnitDefNames.dronelight.id,
reloadTime = 15,
maxDrones = 6,
spawnSize = 2,
range = 800,
buildTime = 6,
maxBuild = 1,
offsets = {0, 35, 0, colvolMidX = 0, colvolMidY = 0, colvolMidZ = 0, aimX = 0, aimY = 0, aimZ = 0}
},
{
drone = UnitDefNames.droneheavyslow.id,
reloadTime = 25,
maxDrones = 2,
spawnSize = 1,
range = 800,
buildTime = 9,
maxBuild = 1,
offsets = {0, 35, 0, colvolMidX = 0, colvolMidY = 0, colvolMidZ = 0, aimX = 0, aimY = 0, aimZ = 0}
},
},
nebula = {
spawnPieces = {"pad1", "pad2", "pad3", "pad4"},
{
Expand Down
38 changes: 31 additions & 7 deletions LuaRules/Configs/lups_shield_fxs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,27 @@ for unitDefID = 1, #UnitDefs do

local myShield = Spring.Utilities.CopyTable(ShieldSphereBase, true)
if radius > 250 then
myShield.shieldSize = "large"
if radius > 400 then
myShield.shieldSize = "huge"
--== HQ ==--
myShield.sizeDrift = 0.0;
myShield.marginHQ = 2.8
myShield.uvMul = 1.0
--== /HQ ==--
myShield.hitResposeMult = 0.5
else
myShield.shieldSize = "large"
--== HQ ==--
myShield.sizeDrift = 0.008;
myShield.marginHQ = 2.8
myShield.uvMul = 1.0
--== /HQ ==--
myShield.hitResposeMult = 0.6
end
myShield.drawBack = 0.55
myShield.drawBackCol = 0.3
myShield.drawBackMargin = 4.5
myShield.margin = 4
myShield.hitResposeMult = 0.6
--== HQ ==--
myShield.sizeDrift = 0.008;
myShield.marginHQ = 2.8
myShield.uvMul = 1.0
--== /HQ ==--
else
myShield.shieldSize = "small"
if radius > 100 then
Expand All @@ -90,6 +100,7 @@ for unitDefID = 1, #UnitDefs do
myShield.margin = 1.8
myShield.hitResposeMult = 1
end
myShield.rechargeDelay = tonumber(ud.customParams.shield_recharge_delay) or 0

myShield.size = radius
myShield.radius = radius
Expand All @@ -100,6 +111,17 @@ for unitDefID = 1, #UnitDefs do
myShield.colormap1[1][4] = strengthMult*myShield.colormap1[1][4]
myShield.colormap1[2][4] = strengthMult*myShield.colormap1[2][4]
end

-- Very powerful non-chicken shields get a different look
local shieldPower = tonumber(ud.customParams.shield_power)
local decayFactor = 0.1
if shieldPower > 10000 then
myShield.texture = "bitmaps/PD/shieldblank.png"
myShield.colormap1 = {{0.4, 0.4, 1.3, 0.8}, {0.5, 0.1, 0.1, 0.3}}
myShield.colormap2 = {{0.0, 0.2, 0.2, 0.03}, {0.0, 0.2, 0.0, 0.02}}
myShield.hitResposeMult = 0.15
decayFactor = 0.05
end

local isChicken = false
if string.find(ud.name, "chicken_") then
Expand Down Expand Up @@ -138,6 +160,8 @@ for unitDefID = 1, #UnitDefs do
fx = fxTable,
search = searchSizes[radius],
shieldCapacity = tonumber(ud.customParams.shield_power),
damageMultShieldCapacity = tonumber(ud.customParams.shield_power_gfx_override or ud.customParams.shield_power),
decayFactor = decayFactor,
shieldPos = myShield.pos,
shieldRadius = radius,
}
Expand Down
16 changes: 8 additions & 8 deletions LuaRules/Gadgets/lups_shield.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,13 @@ local function AddUnit(unitID, unitDefID)
end

local unitData = {
unitDefID = unitDefID,
search = def.search,
capacity = def.shieldCapacity,
radius = def.shieldRadius,
fxTable = fxTable,
allyTeamID = Spring.GetUnitAllyTeam(unitID)
unitDefID = unitDefID,
search = def.search,
capacity = def.damageMultShieldCapacity,
decayFactor = def.decayFactor,
radius = def.shieldRadius,
fxTable = fxTable,
allyTeamID = Spring.GetUnitAllyTeam(unitID)
}

if highEnoughQuality then
Expand Down Expand Up @@ -247,7 +248,6 @@ local function DoAddShieldHitData(unitData, hitFrame, dmg, theta, phi)
unitData.needsUpdate = true
end

local DECAY_FACTOR = 0.1
local MIN_DAMAGE = 1

local function GetShieldHitPositions(unitID)
Expand All @@ -263,7 +263,7 @@ local function ProcessHitTable(unitData, gameFrame)
for i = #hitData, 1, -1 do
local hitInfo = hitData[i]
if hitInfo then
local mult = math.exp(-DECAY_FACTOR*(gameFrame - hitInfo.hitFrame))
local mult = math.exp(-unitData.decayFactor*(gameFrame - hitInfo.hitFrame))
--Spring.Echo(gameFrame, hitInfo.dmg, mult, hitInfo.dmg * mult)
hitInfo.dmg = hitInfo.dmg * mult
hitInfo.hitFrame = gameFrame
Expand Down
8 changes: 4 additions & 4 deletions LuaRules/Gadgets/unit_regeneration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ for id, def in pairs(UnitDefs) do
end

local currentFrame
function gadget:GameFrame (frame)
function gadget:GameFrame(frame)
currentFrame = frame
if ((frame % 15) == 7) then
local setParam = ((frame % 30) == 7)
if ((frame % 15) == 8) then
local setParam = ((frame % 30) == 8)
for i = 1, unitCount do
local unitID = unitList[i]
local data = units[unitID]
Expand All @@ -42,7 +42,7 @@ function gadget:GameFrame (frame)
spSetUnitHealth(unitID, health + amount)
end
end
if setParam then
if setParam and data.idleFrame - frame > -70 then
spSetUnitRulesParam(unitID, "idleRegenTimer", data.idleFrame - frame, losTable)
end
end
Expand Down
16 changes: 14 additions & 2 deletions LuaRules/Gadgets/unit_shield_charge.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ local spGetUnitIsStunned = Spring.GetUnitIsStunned
local spUseUnitResource = Spring.UseUnitResource
local spGetUnitRulesParam = Spring.GetUnitRulesParam
local spSetUnitRulesParam = Spring.SetUnitRulesParam
local losTable = {inlos = true}

local unitMap = {}
local unitList = {}
Expand All @@ -53,6 +54,7 @@ for unitDefID = 1, #UnitDefs do
chargePerUpdate = PERIOD*tonumber(shieldWep.customParams.shield_rate)/TEAM_SLOWUPDATE_RATE,
perSecondCost = tonumber(shieldWep.customParams.shield_drain),
startPower = shieldWep.customParams.shieldstartingpower and tonumber(shieldWep.customParams.shieldstartingpower),
rechargeDelay = shieldWep.customParams.shield_recharge_delay and tonumber(shieldWep.customParams.shield_recharge_delay),
}
else
shieldUnitDefID[unitDefID] = {
Expand Down Expand Up @@ -90,6 +92,7 @@ function gadget:GameFrame(n)
end

local updatePriority = (n % TEAM_SLOWUPDATE_RATE == 0)
local setParam = ((n % 30) == 8)

for i = 1, unitCount do
local data = unitList[i]
Expand All @@ -98,8 +101,17 @@ function gadget:GameFrame(n)
local enabled, charge = IsShieldEnabled(unitID)

local def = data.def
if enabled and charge < def.maxCharge and spGetUnitRulesParam(unitID, "shieldChargeDisabled") ~= 1 then

local hitTime = Spring.GetUnitRulesParam(unitID, "shieldHitFrame") or -999999
local currTime = Spring.GetGameFrame()
local inCooldown = false
if def.rechargeDelay then
local remainingTime = hitTime + def.rechargeDelay * 30 - currTime
inCooldown = (remainingTime >= 0)
if (setParam or currTime - hitTime < 3) and remainingTime > -70 then
spSetUnitRulesParam(unitID, "shieldRegenTimer", remainingTime, losTable)
end
end
if enabled and charge < def.maxCharge and not inCooldown and spGetUnitRulesParam(unitID, "shieldChargeDisabled") ~= 1 then
-- Get changed charge rate based on slow
local newChargeRate = GetChargeRate(unitID)
if data.oldChargeRate ~= newChargeRate then
Expand Down
54 changes: 28 additions & 26 deletions LuaRules/Gadgets/unit_shield_link.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,34 +117,36 @@ function gadget:UnitCreated(unitID, unitDefID)

if shieldWeaponDefID then
local shieldWep = WeaponDefs[shieldWeaponDefID]
--local x,y,z = spGetUnitPosition(unitID)
local allyTeamID = spGetUnitAllyTeam(unitID)
if not (allyTeamShields[allyTeamID] and allyTeamShields[allyTeamID][unitID]) then -- not need to redo table if already have table (UnitFinished() will call this function 2nd time)
allyTeamShields[allyTeamID] = allyTeamShields[allyTeamID] or {}
allyTeamShieldList[allyTeamID] = allyTeamShieldList[allyTeamID] or {count = 0}

local shieldRegen = shieldWep.shieldPowerRegen
if shieldRegen == 0 and shieldWep.customParams and shieldWep.customParams.shield_rate then
shieldRegen = tonumber(shieldWep.customParams.shield_rate)
if not shieldWep.customParams.unlinked then
--local x,y,z = spGetUnitPosition(unitID)
local allyTeamID = spGetUnitAllyTeam(unitID)
if not (allyTeamShields[allyTeamID] and allyTeamShields[allyTeamID][unitID]) then -- not need to redo table if already have table (UnitFinished() will call this function 2nd time)
allyTeamShields[allyTeamID] = allyTeamShields[allyTeamID] or {}
allyTeamShieldList[allyTeamID] = allyTeamShieldList[allyTeamID] or {count = 0}

local shieldRegen = shieldWep.shieldPowerRegen
if shieldRegen == 0 and shieldWep.customParams and shieldWep.customParams.shield_rate then
shieldRegen = tonumber(shieldWep.customParams.shield_rate)
end

local shieldUnit = {
shieldMaxCharge = shieldWep.shieldPower,
shieldNum = shieldNum,
shieldRadius = shieldWep.shieldRadius,
shieldRegen = shieldRegen,
shieldRank = ((shieldWep.shieldRadius > 400) and 3) or ((shieldWep.shieldRadius > 200) and 2) or 1,
unitDefID = unitDefID,
neighbors = {},
neighborList = {count = 0},
allyTeamID = allyTeamID,
enabled = false,
oldEnabled = false,
oldFastEnabled = false,
}
AddDataThingToIterable(unitID, shieldUnit, allyTeamShields[allyTeamID], allyTeamShieldList[allyTeamID])
end

local shieldUnit = {
shieldMaxCharge = shieldWep.shieldPower,
shieldNum = shieldNum,
shieldRadius = shieldWep.shieldRadius,
shieldRegen = shieldRegen,
shieldRank = ((shieldWep.shieldRadius > 200) and 2) or 1,
unitDefID = unitDefID,
neighbors = {},
neighborList = {count = 0},
allyTeamID = allyTeamID,
enabled = false,
oldEnabled = false,
oldFastEnabled = false,
}
AddDataThingToIterable(unitID, shieldUnit, allyTeamShields[allyTeamID], allyTeamShieldList[allyTeamID])
QueueLinkUpdate(allyTeamID,unitID)
end
QueueLinkUpdate(allyTeamID,unitID)
end
end

Expand Down
4 changes: 2 additions & 2 deletions LuaUI/Configs/lang/units.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -706,8 +706,8 @@
},
"striderfunnelweb" : {
"name" : "Funnelweb",
"description" : "Drone/Shield Support Strider",
"helptext" : "The slow all-terrain Funnelweb features an area shield and a powerful drone complement."
"description" : "Shield Support Strider",
"helptext" : "The slow all-terrain Funnelweb features an extremely powerful wide-area shield and high nano power for post-battle utility. It is otherwise unarmed."
},
"cloakriot" : {
"name" : "Reaver",
Expand Down
7 changes: 4 additions & 3 deletions LuaUI/Configs/lupsUnitFXs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@ effectUnitDefs = {
},

striderfunnelweb = {
--{class='ShieldJitter', options={delay=0, life=math.huge, pos={0,25,-10}, size=400, strength = .002, precision=50, repeatEffect=true, quality = 4, onActive = true}},
{class='Bursts', options=MergeTable(staticshieldBursts, {piece="aimpoint"})},
{class='ShieldSphere', options=staticshieldBall},
{class='Bursts', options=MergeTable(staticshieldBursts, {piece="emitl", pos={0,9.8,0}, shieldRechargeDelay = tonumber(WeaponDefNames["striderfunnelweb_shield"].customParams.shield_recharge_delay), colormap = { {0.3, 0.3, 1, 0.8} }})},
{class='Bursts', options=MergeTable(staticshieldBursts, {piece="emitr", pos={0,9.8,0}, shieldRechargeDelay = tonumber(WeaponDefNames["striderfunnelweb_shield"].customParams.shield_recharge_delay), colormap = { {0.3, 0.3, 1, 0.8} }})},
{class='ShieldSphere', options={piece="emitl", life=math.huge, size=10, pos={0,9.8,0}, colormap1 = {{0.4, 0.1, 0.95, 1.0}}, rechargingColor1 = {0.95, 0.4, 0.4, 1.0}, rechargingColor2 = {0.95, 0.1, 0.4, 0.2}, shieldRechargeDelay = 30*tonumber(WeaponDefNames["striderfunnelweb_shield"].customParams.shield_recharge_delay), shieldRechargeSize = 7, repeatEffect=true}},
{class='ShieldSphere', options={piece="emitr", life=math.huge, size=10, pos={0,9.8,0}, colormap1 = {{0.4, 0.1, 0.95, 1.0}}, rechargingColor1 = {0.95, 0.4, 0.4, 1.0}, rechargingColor2 = {0.95, 0.1, 0.4, 0.2}, shieldRechargeDelay = 30*tonumber(WeaponDefNames["striderfunnelweb_shield"].customParams.shield_recharge_delay), shieldRechargeSize = 7, repeatEffect=false}},
},

--// ENERGY STORAGE //--------------------
Expand Down
7 changes: 7 additions & 0 deletions LuaUI/Widgets/gui_chili_selections_and_cursortip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,13 @@ local function GetUnitRegenString(unitID, ud)
end

local function GetUnitShieldRegenString(unitID, ud)
if ud.customParams.shield_recharge_delay or true then
local shieldRegen = spGetUnitRulesParam(unitID, "shieldRegenTimer")
if shieldRegen and shieldRegen > 0 then
return " (" .. math.ceil(shieldRegen / 30) .. "s)"
end
end

local mult = spGetUnitRulesParam(unitID,"totalReloadSpeedChange") or 1 * (1 - (spGetUnitRulesParam(unitID, "shieldChargeDisabled") or 0))
if mult == 0 then
return ""
Expand Down
9 changes: 9 additions & 0 deletions LuaUI/Widgets/gui_contextmenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,17 @@ local function weapons2Table(cells, ws, unitID)
cells[#cells+1] = regen .. " HP/s"
cells[#cells+1] = ' - Regen cost:'
cells[#cells+1] = drain .. " E/s"
local rechargeDelay = tonumber(wd.shieldrechargedelay or wd.customParams.shield_recharge_delay)
if rechargeDelay and rechargeDelay > 0 then
cells[#cells+1] = ' - Regen delay:'
cells[#cells+1] = rechargeDelay .. " s"
end
cells[#cells+1] = ' - Radius:'
cells[#cells+1] = wd.shieldRadius .. " elmo"
if wd.customParams.unlinked then
cells[#cells+1] = ' - Does not link with other shields'
cells[#cells+1] = ''
end
else
-- calculate damages

Expand Down
Binary file added bitmaps/PD/shieldblank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions gamedata/unitdefs_post.lua
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ for name, ud in pairs(UnitDefs) do
hasShield = true
ud.customparams.shield_radius = wd.shieldradius
ud.customparams.shield_power = wd.shieldpower
ud.customparams.shield_recharge_delay = (wd.customparams or {}).shield_recharge_delay or wd.shieldrechargedelay
ud.customparams.shield_rate = (wd.customparams or {}).shield_rate or wd.shieldpowerregen
break
end
Expand Down
Loading