Skip to content

Commit

Permalink
Merge branch 'develop' into AeonScriptEnhancemntsSACU
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRowey authored Nov 19, 2024
2 parents e33152d + 1edef55 commit 9c15c0e
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 25 deletions.
1 change: 1 addition & 0 deletions changelog/snippets/fix.6426.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- (#6426) Fix the "Active game mods for blueprint loading" log message.
5 changes: 5 additions & 0 deletions changelog/snippets/fix.6445.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- (#6445) Fix overcharge dealing half damage to static and ACU shields.

- (#6445) Shields now block damage from knocking down/setting fire to trees.

- (#6445) Fix normal damage being applied before anti-shield damage, which didn't let the normal damage overkill under a shield.
5 changes: 4 additions & 1 deletion lua/RuleInit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ doscript '/lua/system/utils.lua'
doscript '/lua/system/repr.lua'
doscript '/lua/system/debug.lua'

LOG('Active game mods for blueprint loading: ',repr(__active_mods))
LOG('Active game mods for blueprint loading:')
for _, mod in __active_mods do
LOG(string.format('\t"%-30s v%02d (%-37s by %s', tostring(mod.name) .. '"', tostring(mod.version), tostring(mod.uid) .. ')', tostring(mod.author)))
end

doscript '/lua/footprints.lua'
doscript '/lua/system/Blueprints.lua'
Expand Down
18 changes: 12 additions & 6 deletions lua/shield.lua
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ Shield = ClassShield(moho.shield_methods, Entity) {
---@return number damageAbsorbed If not all damage is absorbed, the remainder passes to targets under the shield.
OnGetDamageAbsorption = function(self, instigator, amount, type)
if type == "TreeForce" or type == "TreeFire" then
return
return amount
end
-- Allow decoupling the shield from the owner's armor multiplier
local absorptionMulti = self.AbsorptionTypeDamageTypeToMulti[type] or self.Owner:GetArmorMult(type)
Expand Down Expand Up @@ -516,13 +516,19 @@ Shield = ClassShield(moho.shield_methods, Entity) {
local tick = GetGameTick()

-- damage correction for overcharge
-- These preset damages deal `2 * dmg * absorbMult or armorMult`, currently absorption multiplier is 1x so we need to divide by 2

-- If the absorption multiplier is less than 1, then the shield will get hit by two instances of area damage, the absorbed amount and the remainder.
-- This means that the following code then requires a multiplier to correct the total damage amount since both instances will be overriden.
-- For example with 0.25 absorption we would have a 0.25 damage and 0.75 damage instance hitting the shield. Both get set to 800 OC structure damage,
-- but then 0.25x armor is applied again (second OnGetDamageAbsorption call), reducing it to 2x200 damage, which requires a 2x multiplication to bring it to the expected 800.
-- Currently the absorption multiplier is 1, so we don't need a multiplier on the damage to balance it out.

if dmgType == 'Overcharge' then
local wep = instigator:GetWeaponByLabel('OverCharge')
if self.StaticShield then -- fixed damage for static shields
amount = wep:GetBlueprint().Overcharge.structureDamage / 2
elseif self.CommandShield then -- fixed damage for UEF bubble shield
amount = wep:GetBlueprint().Overcharge.commandDamage / 2
if self.StaticShield then
amount = wep:GetBlueprint().Overcharge.structureDamage
elseif self.CommandShield then
amount = wep:GetBlueprint().Overcharge.commandDamage
end
end

Expand Down
38 changes: 20 additions & 18 deletions lua/sim/Projectile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -637,16 +637,7 @@ Projectile = ClassProjectile(ProjectileMethods, DebugProjectileComponent) {
local damageSelf = DamageData.DamageSelf or false

-- do initial damage in a radius
DamageArea(
instigator,
cachedPosition,
radius,
damage + (DamageData.InitialDamageAmount or 0),
damageType,
damageFriendly,
damageSelf
)

-- anti-shield damage first so that the remaining damage can overkill under the shield
local damageToShields = DamageData.DamageToShields
if damageToShields then
DamageArea(
Expand All @@ -660,6 +651,16 @@ Projectile = ClassProjectile(ProjectileMethods, DebugProjectileComponent) {
)
end

DamageArea(
instigator,
cachedPosition,
radius,
damage + (DamageData.InitialDamageAmount or 0),
damageType,
damageFriendly,
damageSelf
)

-- check for and deal damage over time
local DoTTime = DamageData.DoTTime
if DoTTime > 0 then
Expand All @@ -685,14 +686,7 @@ Projectile = ClassProjectile(ProjectileMethods, DebugProjectileComponent) {
local damageType = DamageData.DamageType

-- do initial damage
Damage(
instigator,
cachedPosition,
targetEntity,
damage + (DamageData.InitialDamageAmount or 0),
damageType
)

-- anti-shield damage first so remainder can overkill under the shield
local damageToShields = DamageData.DamageToShields
if damageToShields then
Damage(
Expand All @@ -704,6 +698,14 @@ Projectile = ClassProjectile(ProjectileMethods, DebugProjectileComponent) {
)
end

Damage(
instigator,
cachedPosition,
targetEntity,
damage + (DamageData.InitialDamageAmount or 0),
damageType
)

-- check for and apply damage over time
local DoTTime = DamageData.DoTTime
if DoTTime > 0 then
Expand Down

0 comments on commit 9c15c0e

Please sign in to comment.