Skip to content

Commit

Permalink
Revert "Shields Re-Rework" (#4107)
Browse files Browse the repository at this point in the history
Revert "Shields Re-Rework (#4077)"

This reverts commit c4b018b.
  • Loading branch information
Damgam authored Jan 4, 2025
1 parent c4b018b commit d6aac4d
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 284 deletions.
8 changes: 3 additions & 5 deletions gamedata/alldefs_post.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ function WeaponDef_Post(name, wDef)

local shieldCollisionExemptions = { --add the name of the weapons (or just the name of the unit followed by _ ) to this table to exempt from shield collision.
'corsilo_', 'armsilo_', 'armthor_empmissile', 'armemp_', 'cortron_', 'corjuno_', 'armjuno_'
}
}

if wDef.damage ~= nil then
-- Due to the engine not handling overkill damage, we have to store the original shield damage values as a customParam for unit_shield_behavior.lua to reference
Expand Down Expand Up @@ -1527,12 +1527,10 @@ function WeaponDef_Post(name, wDef)
wDef.shield.exterior = true
end

if ((not wDef.interceptedbyshieldtype or wDef.interceptedbyshieldtype ~= 1) and wDef.weapontype ~= "Cannon") then
wDef.customparams.shield_aoe_penetration = true
end
wDef.interceptedbyshieldtype = 1

for _, exemption in ipairs(shieldCollisionExemptions) do
if string.find(name, exemption) then
if string.find(name, exemption)then
wDef.interceptedbyshieldtype = 2
wDef.customparams.shield_aoe_penetration = true
break
Expand Down
10 changes: 1 addition & 9 deletions luarules/gadgets/lups_shield.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ end
local GAMESPEED = Game.gameSpeed
local SHIELDARMORID = 4
local SHIELDARMORIDALT = 0
local SHIELDONRULESPARAMINDEX = 531313 -- not a string due to perfmaxxing

-----------------------------------------------------------------
-- Small vector math lib
Expand Down Expand Up @@ -229,19 +228,12 @@ local function UpdateVisibility(unitID, unitData, unitVisible, forceUpdate)
unitVisible = GetVisibleSearch(ux, uz, unitData.search)
end

local unitIsActive = Spring.GetUnitIsActive(unitID)
local unitIsActive = Spring.GetUnitIsActive(unitID)
if unitIsActive ~= unitData.isActive then
forceUpdate = true
unitData.isActive = unitIsActive
end

local shieldEnabled = Spring.GetUnitRulesParam (unitID, SHIELDONRULESPARAMINDEX)
if shieldEnabled == 1 then
unitVisible = true
elseif shieldEnabled == 0 then
unitVisible = false
end

if unitVisible == unitData.unitVisible and not forceUpdate then
return
end
Expand Down
Loading

0 comments on commit d6aac4d

Please sign in to comment.