From 69b24e17714c20faf36cd88236d6ce0b3896d517 Mon Sep 17 00:00:00 2001 From: Josh Date: Sun, 3 Nov 2024 11:22:46 +0000 Subject: [PATCH 1/9] Update UAL0301_script.lua --- units/UAL0301/UAL0301_script.lua | 228 +++++++++++++++++-------------- 1 file changed, 129 insertions(+), 99 deletions(-) diff --git a/units/UAL0301/UAL0301_script.lua b/units/UAL0301/UAL0301_script.lua index e26355bbb4..d551c4619d 100644 --- a/units/UAL0301/UAL0301_script.lua +++ b/units/UAL0301/UAL0301_script.lua @@ -52,112 +52,142 @@ UAL0301 = ClassUnit(CommandUnit) { EffectUtil.CreateAeonCommanderBuildingEffects(self, unitBeingBuilt, self.BuildEffectBones, self.BuildEffectsBag) end, - CreateEnhancement = function(self, enh) - CommandUnit.CreateEnhancement(self, enh) - local bp = self.Blueprint.Enhancements[enh] - if not bp then return end - -- Teleporter - if enh == 'Teleporter' then - self:AddCommandCap('RULEUCC_Teleport') - elseif enh == 'TeleporterRemove' then - self:RemoveCommandCap('RULEUCC_Teleport') - -- Shields - elseif enh == 'Shield' then - self:AddToggleCap('RULEUTC_ShieldToggle') - self:SetEnergyMaintenanceConsumptionOverride(bp.MaintenanceConsumptionPerSecondEnergy or 0) - self:SetMaintenanceConsumptionActive() - self:CreateShield(bp) - elseif enh == 'ShieldRemove' then - self:DestroyShield() - self:SetMaintenanceConsumptionInactive() - self:RemoveToggleCap('RULEUTC_ShieldToggle') - elseif enh == 'ShieldHeavy' then - self.Trash:Add(ForkThread(self.CreateHeavyShield, self, bp)) - elseif enh == 'ShieldHeavyRemove' then - self:DestroyShield() - self:SetMaintenanceConsumptionInactive() - self:RemoveToggleCap('RULEUTC_ShieldToggle') - -- ResourceAllocation - elseif enh == 'ResourceAllocation' then - local bp = self.Blueprint.Enhancements[enh] - local bpEcon = self.Blueprint.Economy - if not bp then return end - self:SetProductionPerSecondEnergy((bp.ProductionPerSecondEnergy + bpEcon.ProductionPerSecondEnergy) or 0) - self:SetProductionPerSecondMass((bp.ProductionPerSecondMass + bpEcon.ProductionPerSecondMass) or 0) - elseif enh == 'ResourceAllocationRemove' then - local bpEcon = self.Blueprint.Economy - self:SetProductionPerSecondEnergy(bpEcon.ProductionPerSecondEnergy or 0) - self:SetProductionPerSecondMass(bpEcon.ProductionPerSecondMass or 0) - -- Engineering Focus Module - elseif enh == 'EngineeringFocusingModule' then - if not Buffs['AeonSCUBuildRate'] then - BuffBlueprint { - Name = 'AeonSCUBuildRate', - DisplayName = 'AeonSCUBuildRate', - BuffType = 'SCUBUILDRATE', - Stacks = 'REPLACE', - Duration = -1, - Affects = { - BuildRate = { - Add = bp.NewBuildRate - self.Blueprint.Economy.BuildRate, - Mult = 1, - }, - }, - } - end - Buff.ApplyBuff(self, 'AeonSCUBuildRate') - elseif enh == 'EngineeringFocusingModuleRemove' then - if Buff.HasBuff(self, 'AeonSCUBuildRate') then - Buff.RemoveBuff(self, 'AeonSCUBuildRate') - end - -- SystemIntegrityCompensator - elseif enh == 'SystemIntegrityCompensator' then - local name = 'AeonSCURegenRate' - if not Buffs[name] then - BuffBlueprint { - Name = name, - DisplayName = name, - BuffType = 'SCUREGENRATE', - Stacks = 'REPLACE', - Duration = -1, - Affects = { - Regen = { - Add = bp.NewRegenRate - self.Blueprint.Defense.RegenRate, - Mult = 1, - }, - }, - } - end - Buff.ApplyBuff(self, name) - elseif enh == 'SystemIntegrityCompensatorRemove' then - if Buff.HasBuff(self, 'AeonSCURegenRate') then - Buff.RemoveBuff(self, 'AeonSCURegenRate') - end - -- Sacrifice - elseif enh == 'Sacrifice' then - self:AddCommandCap('RULEUCC_Sacrifice') - elseif enh == 'SacrificeRemove' then - self:RemoveCommandCap('RULEUCC_Sacrifice') - -- StabilitySupressant - elseif enh == 'StabilitySuppressant' then - local wep = self:GetWeaponByLabel('RightReactonCannon') - wep:AddDamageMod(bp.NewDamageMod or 0) - wep:AddDamageRadiusMod(bp.NewDamageRadiusMod or 0) - wep:ChangeMaxRadius(bp.NewMaxRadius or 40) - elseif enh == 'StabilitySuppressantRemove' then - local wep = self:GetWeaponByLabel('RightReactonCannon') - wep:AddDamageMod(-self.Blueprint.Enhancements['RightReactonCannon'].NewDamageMod) - wep:AddDamageRadiusMod(bp.NewDamageRadiusMod or 0) - wep:ChangeMaxRadius(bp.NewMaxRadius or 30) - end + -- ============================================================================================================================================ + -- ENHANCEMENTS + + ProcessEnhancementTeleporter = function (self, bp) + self:AddCommandCap('RULEUCC_Teleport') + end, + + ProcessEnhancementTeleporterRemove = function(self, bp) + self:RemoveCommandCap('RULEUCC_Teleport') + end, + + ProcessEnhancementShield = function(self, bp) + self:AddToggleCap('RULEUTC_ShieldToggle') + self:SetEnergyMaintenanceConsumptionOverride(bp.MaintenanceConsumptionPerSecondEnergy or 0) + self:SetMaintenanceConsumptionActive() + self:CreateShield(bp) + end, + + ProcessEnhancementShieldRemove = function(self, bp) + self:DestroyShield() + self:SetMaintenanceConsumptionInactive() + self:RemoveToggleCap('RULEUTC_ShieldToggle') end, - CreateHeavyShield = function(self, bp) + ProcessEnhancementShieldHeavy = function(self, bp) WaitTicks(1) self:CreateShield(bp) self:SetEnergyMaintenanceConsumptionOverride(bp.MaintenanceConsumptionPerSecondEnergy or 0) self:SetMaintenanceConsumptionActive() end, + + ProcessEnhancementShieldHeavyRemove = function(self, bp) + self:DestroyShield() + self:SetMaintenanceConsumptionInactive() + self:RemoveToggleCap('RULEUTC_ShieldToggle') + end, + + ProcessEnhancementResourceAllocation = function(self, bp) + local bpEcon = self.Blueprint.Economy + if not bp then return end + self:SetProductionPerSecondEnergy((bp.ProductionPerSecondEnergy + bpEcon.ProductionPerSecondEnergy) or 0) + self:SetProductionPerSecondMass((bp.ProductionPerSecondMass + bpEcon.ProductionPerSecondMass) or 0) + end, + + ProcessEnhancementResourceAllocationRemove = function(self, bp) + local bpEcon = self.Blueprint.Economy + self:SetProductionPerSecondEnergy(bpEcon.ProductionPerSecondEnergy or 0) + self:SetProductionPerSecondMass(bpEcon.ProductionPerSecondMass or 0) + end, + + ProcessEnhancementEngineeringFocusModule = function(self, bp) + if not Buffs['AeonSCUBuildRate'] then + BuffBlueprint { + Name = 'AeonSCUBuildRate', + DisplayName = 'AeonSCUBuildRate', + BuffType = 'SCUBUILDRATE', + Stacks = 'REPLACE', + Duration = -1, + Affects = { + BuildRate = { + Add = bp.NewBuildRate - self.Blueprint.Economy.BuildRate, + Mult = 1, + }, + }, + } + end + Buff.ApplyBuff(self, 'AeonSCUBuildRate') + end, + + ProcessEnhancementEngineeringFocusModuleRemove = function(self, bp) + if Buff.HasBuff(self, 'AeonSCUBuildRate') then + Buff.RemoveBuff(self, 'AeonSCUBuildRate') + end + end, + + ProcessEnhancementSystemIntegrityCompensator = function(self, bp) + if not Buffs['AeonSCURegenRate'] then + BuffBlueprint { + Name = 'AeonSCURegenRate', + DisplayName = 'AeonSCURegenRate', + BuffType = 'SCUREGENRATE', + Stacks = 'REPLACE', + Duration = -1, + Affects = { + Regen = { + Add = bp.NewRegenRate - self.Blueprint.Defense.RegenRate, + Mult = 1, + }, + }, + } + end + Buff.ApplyBuff(self, 'AeonSCURegenRate') + end, + + ProcessEnhancementSystemIntegrityCompensatorRemove = function(self, bp) + if Buff.HasBuff(self, 'AeonSCURegenRate') then + Buff.RemoveBuff(self, 'AeonSCURegenRate') + end + end, + + ProcessEnhancementSacrifice = function(self, bp) + self:AddCommandCap('RULEUCC_Sacrifice') + end, + + ProcessEnhancementSacrificeRemove = function(self, bp) + self:RemoveCommandCap('RULEUCC_Sacrifice') + end, + + ProcessEnhancementStabilitySuppressant = function(self, bp) + local wep = self:GetWeaponByLabel('RightReactonCannon') + wep:AddDamageMod(bp.NewDamageMod or 0) + wep:AddDamageRadiusMod(bp.NewDamageRadiusMod or 0) + wep:ChangeMaxRadius(bp.NewMaxRadius or 40) + end, + + ProcessEnhancementStabilitySuppressantRemove = function(self, bp) + local wep = self:GetWeaponByLabel('RightReactonCannon') + wep:AddDamageMod(-self.Blueprint.Enhancements['RightReactonCannon'].NewDamageMod) + wep:AddDamageRadiusMod(bp.NewDamageRadiusMod or 0) + wep:ChangeMaxRadius(bp.NewMaxRadius or 30) + end, + + CreateEnhancement = function(self, enh) + CommandUnit.CreateEnhancement(self, enh) + local bp = self.Blueprint.Enhancements[enh] + if not bp then return end + + local ref = 'ProcessEnhancement' .. enh + local handler = self[ref] + if handler then + handler(self, bp) + else + WARN("Missing enhancement: ", enh, " for unit: ", self:GetUnitId(), " note that the function name should be called: ", ref) + end + end, + } TypeClass = UAL0301 From 572470c1e52d339ccd7a771a86a2c293044df5eb Mon Sep 17 00:00:00 2001 From: Josh Date: Mon, 11 Nov 2024 20:57:57 +0000 Subject: [PATCH 2/9] Update UAL0301_script.lua --- units/UAL0301/UAL0301_script.lua | 42 +++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/units/UAL0301/UAL0301_script.lua b/units/UAL0301/UAL0301_script.lua index d551c4619d..60428abbed 100644 --- a/units/UAL0301/UAL0301_script.lua +++ b/units/UAL0301/UAL0301_script.lua @@ -26,10 +26,13 @@ UAL0301 = ClassUnit(CommandUnit) { DeathWeapon = ClassWeapon(SCUDeathWeapon) {}, }, + ---@param self UAL0301 __init = function(self) CommandUnit.__init(self, 'RightReactonCannon') end, + ---@param self UAL0301 + ---@param unitBeingBuilt Unit OnStopBuild = function(self, unitBeingBuilt) CommandUnit.OnStopBuild(self, unitBeingBuilt) self:BuildManipulatorSetEnabled(false) @@ -41,6 +44,7 @@ UAL0301 = ClassUnit(CommandUnit) { self.BuildingUnit = false end, + ---@psaram self UAL0301 OnCreate = function(self) CommandUnit.OnCreate(self) self:SetCapturable(false) @@ -48,6 +52,9 @@ UAL0301 = ClassUnit(CommandUnit) { self:SetupBuildBones() end, + ---@param self UAL0301 + ---@param unitBeingBuilt Unit + ---@param order string unused CreateBuildEffects = function(self, unitBeingBuilt, order) EffectUtil.CreateAeonCommanderBuildingEffects(self, unitBeingBuilt, self.BuildEffectBones, self.BuildEffectsBag) end, @@ -55,14 +62,20 @@ UAL0301 = ClassUnit(CommandUnit) { -- ============================================================================================================================================ -- ENHANCEMENTS + ---@param self UAL0301 + ---@param bp UnitBlueprintEnhancements unused ProcessEnhancementTeleporter = function (self, bp) self:AddCommandCap('RULEUCC_Teleport') end, + ---@param self UAL0301 + ---@param bp UnitBlueprintEnhancements unused ProcessEnhancementTeleporterRemove = function(self, bp) self:RemoveCommandCap('RULEUCC_Teleport') end, + ---@param self UAL0301 + ---@param bp UnitBlueprintEnhancements unused ProcessEnhancementShield = function(self, bp) self:AddToggleCap('RULEUTC_ShieldToggle') self:SetEnergyMaintenanceConsumptionOverride(bp.MaintenanceConsumptionPerSecondEnergy or 0) @@ -70,12 +83,16 @@ UAL0301 = ClassUnit(CommandUnit) { self:CreateShield(bp) end, + ---@param self UAL0301 + ---@param bp UnitBlueprintEnhancements unused ProcessEnhancementShieldRemove = function(self, bp) self:DestroyShield() self:SetMaintenanceConsumptionInactive() self:RemoveToggleCap('RULEUTC_ShieldToggle') end, + ---@param self UAL0301 + ---@param bp UnitBlueprintEnhancements unused ProcessEnhancementShieldHeavy = function(self, bp) WaitTicks(1) self:CreateShield(bp) @@ -83,25 +100,32 @@ UAL0301 = ClassUnit(CommandUnit) { self:SetMaintenanceConsumptionActive() end, + ---@param self UAL0301 + ---@param bp UnitBlueprintEnhancements unused ProcessEnhancementShieldHeavyRemove = function(self, bp) self:DestroyShield() self:SetMaintenanceConsumptionInactive() self:RemoveToggleCap('RULEUTC_ShieldToggle') end, + ---@param self UAL0301 + ---@param bp UnitBlueprintEnhancements ProcessEnhancementResourceAllocation = function(self, bp) local bpEcon = self.Blueprint.Economy - if not bp then return end self:SetProductionPerSecondEnergy((bp.ProductionPerSecondEnergy + bpEcon.ProductionPerSecondEnergy) or 0) self:SetProductionPerSecondMass((bp.ProductionPerSecondMass + bpEcon.ProductionPerSecondMass) or 0) end, + ---@param self UAL0301 + ---@param bp UnitBlueprintEnhancements unused ProcessEnhancementResourceAllocationRemove = function(self, bp) local bpEcon = self.Blueprint.Economy self:SetProductionPerSecondEnergy(bpEcon.ProductionPerSecondEnergy or 0) self:SetProductionPerSecondMass(bpEcon.ProductionPerSecondMass or 0) end, + ---@param self UAL0301 + ---@param bp UnitBlueprintEnhancements unused ProcessEnhancementEngineeringFocusModule = function(self, bp) if not Buffs['AeonSCUBuildRate'] then BuffBlueprint { @@ -121,12 +145,16 @@ UAL0301 = ClassUnit(CommandUnit) { Buff.ApplyBuff(self, 'AeonSCUBuildRate') end, + ---@param self UAL0301 + ---@param bp UnitBlueprintEnhancements unused ProcessEnhancementEngineeringFocusModuleRemove = function(self, bp) if Buff.HasBuff(self, 'AeonSCUBuildRate') then Buff.RemoveBuff(self, 'AeonSCUBuildRate') end end, + ---@param self UAL0301 + ---@param bp UnitBlueprintEnhancements unused ProcessEnhancementSystemIntegrityCompensator = function(self, bp) if not Buffs['AeonSCURegenRate'] then BuffBlueprint { @@ -146,20 +174,28 @@ UAL0301 = ClassUnit(CommandUnit) { Buff.ApplyBuff(self, 'AeonSCURegenRate') end, + ---@param self UAL0301 + ---@param bp UnitBlueprintEnhancements unused ProcessEnhancementSystemIntegrityCompensatorRemove = function(self, bp) if Buff.HasBuff(self, 'AeonSCURegenRate') then Buff.RemoveBuff(self, 'AeonSCURegenRate') end end, + ---@param self UAL0301 + ---@param bp UnitBlueprintEnhancements unused ProcessEnhancementSacrifice = function(self, bp) self:AddCommandCap('RULEUCC_Sacrifice') end, + ---@param self UAL0301 + ---@param bp UnitBlueprintEnhancements unused ProcessEnhancementSacrificeRemove = function(self, bp) self:RemoveCommandCap('RULEUCC_Sacrifice') end, + ---@param self UAL0301 + ---@param bp UnitBlueprintEnhancements unused ProcessEnhancementStabilitySuppressant = function(self, bp) local wep = self:GetWeaponByLabel('RightReactonCannon') wep:AddDamageMod(bp.NewDamageMod or 0) @@ -167,6 +203,8 @@ UAL0301 = ClassUnit(CommandUnit) { wep:ChangeMaxRadius(bp.NewMaxRadius or 40) end, + ---@param self UAL0301 + ---@param bp UnitBlueprintEnhancements unused ProcessEnhancementStabilitySuppressantRemove = function(self, bp) local wep = self:GetWeaponByLabel('RightReactonCannon') wep:AddDamageMod(-self.Blueprint.Enhancements['RightReactonCannon'].NewDamageMod) @@ -174,6 +212,8 @@ UAL0301 = ClassUnit(CommandUnit) { wep:ChangeMaxRadius(bp.NewMaxRadius or 30) end, + ---@param self UAL0301 + ---@param enh string CreateEnhancement = function(self, enh) CommandUnit.CreateEnhancement(self, enh) local bp = self.Blueprint.Enhancements[enh] From 9e4be7049df43940bd418f7297a74ad4b47f3fbe Mon Sep 17 00:00:00 2001 From: Josh Date: Mon, 11 Nov 2024 21:00:08 +0000 Subject: [PATCH 3/9] Update other.6498.md --- changelog/snippets/other.6498.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/snippets/other.6498.md b/changelog/snippets/other.6498.md index 237a2857b1..ceee934cfe 100644 --- a/changelog/snippets/other.6498.md +++ b/changelog/snippets/other.6498.md @@ -1 +1 @@ -- (#6498, #6502) Refactor the Enhancements section in the ACU/SACU scripts to replace the long if/else chain with a more modular design that is easier to maintain and hook. Each enhancement has its own dedicated function, named with the format `ProcessEnhancement[EnhancementName]`. The CreateEnhancement function now calls the appropriate enhancement function automatically by that name format. +- (#6498, #6502, #6516 ) Refactor the Enhancements section in the ACU/SACU scripts to replace the long if/else chain with a more modular design that is easier to maintain and hook. Each enhancement has its own dedicated function, named with the format `ProcessEnhancement[EnhancementName]`. The CreateEnhancement function now calls the appropriate enhancement function automatically by that name format. From 0b69c55d8e2d042e4a75526743e4ec68b33683df Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:30:56 -0800 Subject: [PATCH 4/9] Fix typo in `UnitBlueprintEnhancement` --- units/UAL0301/UAL0301_script.lua | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/units/UAL0301/UAL0301_script.lua b/units/UAL0301/UAL0301_script.lua index 60428abbed..6d5ce7cbb1 100644 --- a/units/UAL0301/UAL0301_script.lua +++ b/units/UAL0301/UAL0301_script.lua @@ -63,19 +63,19 @@ UAL0301 = ClassUnit(CommandUnit) { -- ENHANCEMENTS ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancements unused + ---@param bp UnitBlueprintEnhancement unused ProcessEnhancementTeleporter = function (self, bp) self:AddCommandCap('RULEUCC_Teleport') end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancements unused + ---@param bp UnitBlueprintEnhancement unused ProcessEnhancementTeleporterRemove = function(self, bp) self:RemoveCommandCap('RULEUCC_Teleport') end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancements unused + ---@param bp UnitBlueprintEnhancement unused ProcessEnhancementShield = function(self, bp) self:AddToggleCap('RULEUTC_ShieldToggle') self:SetEnergyMaintenanceConsumptionOverride(bp.MaintenanceConsumptionPerSecondEnergy or 0) @@ -84,7 +84,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancements unused + ---@param bp UnitBlueprintEnhancement unused ProcessEnhancementShieldRemove = function(self, bp) self:DestroyShield() self:SetMaintenanceConsumptionInactive() @@ -92,7 +92,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancements unused + ---@param bp UnitBlueprintEnhancement unused ProcessEnhancementShieldHeavy = function(self, bp) WaitTicks(1) self:CreateShield(bp) @@ -101,7 +101,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancements unused + ---@param bp UnitBlueprintEnhancement unused ProcessEnhancementShieldHeavyRemove = function(self, bp) self:DestroyShield() self:SetMaintenanceConsumptionInactive() @@ -109,7 +109,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancements + ---@param bp UnitBlueprintEnhancement ProcessEnhancementResourceAllocation = function(self, bp) local bpEcon = self.Blueprint.Economy self:SetProductionPerSecondEnergy((bp.ProductionPerSecondEnergy + bpEcon.ProductionPerSecondEnergy) or 0) @@ -117,7 +117,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancements unused + ---@param bp UnitBlueprintEnhancement unused ProcessEnhancementResourceAllocationRemove = function(self, bp) local bpEcon = self.Blueprint.Economy self:SetProductionPerSecondEnergy(bpEcon.ProductionPerSecondEnergy or 0) @@ -125,7 +125,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancements unused + ---@param bp UnitBlueprintEnhancement unused ProcessEnhancementEngineeringFocusModule = function(self, bp) if not Buffs['AeonSCUBuildRate'] then BuffBlueprint { @@ -146,7 +146,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancements unused + ---@param bp UnitBlueprintEnhancement unused ProcessEnhancementEngineeringFocusModuleRemove = function(self, bp) if Buff.HasBuff(self, 'AeonSCUBuildRate') then Buff.RemoveBuff(self, 'AeonSCUBuildRate') @@ -154,7 +154,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancements unused + ---@param bp UnitBlueprintEnhancement unused ProcessEnhancementSystemIntegrityCompensator = function(self, bp) if not Buffs['AeonSCURegenRate'] then BuffBlueprint { @@ -175,7 +175,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancements unused + ---@param bp UnitBlueprintEnhancement unused ProcessEnhancementSystemIntegrityCompensatorRemove = function(self, bp) if Buff.HasBuff(self, 'AeonSCURegenRate') then Buff.RemoveBuff(self, 'AeonSCURegenRate') @@ -183,19 +183,19 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancements unused + ---@param bp UnitBlueprintEnhancement unused ProcessEnhancementSacrifice = function(self, bp) self:AddCommandCap('RULEUCC_Sacrifice') end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancements unused + ---@param bp UnitBlueprintEnhancement unused ProcessEnhancementSacrificeRemove = function(self, bp) self:RemoveCommandCap('RULEUCC_Sacrifice') end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancements unused + ---@param bp UnitBlueprintEnhancement unused ProcessEnhancementStabilitySuppressant = function(self, bp) local wep = self:GetWeaponByLabel('RightReactonCannon') wep:AddDamageMod(bp.NewDamageMod or 0) @@ -204,7 +204,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancements unused + ---@param bp UnitBlueprintEnhancement unused ProcessEnhancementStabilitySuppressantRemove = function(self, bp) local wep = self:GetWeaponByLabel('RightReactonCannon') wep:AddDamageMod(-self.Blueprint.Enhancements['RightReactonCannon'].NewDamageMod) From 32032b373d27eb3c69afa914207e9b8fefe802b5 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:31:32 -0800 Subject: [PATCH 5/9] Use `Enhancement` type --- units/UAL0301/UAL0301_script.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/units/UAL0301/UAL0301_script.lua b/units/UAL0301/UAL0301_script.lua index 6d5ce7cbb1..1f072d8ae8 100644 --- a/units/UAL0301/UAL0301_script.lua +++ b/units/UAL0301/UAL0301_script.lua @@ -213,7 +213,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param enh string + ---@param enh Enhancement CreateEnhancement = function(self, enh) CommandUnit.CreateEnhancement(self, enh) local bp = self.Blueprint.Enhancements[enh] From 126f52b078e33c3281fb07f5efc96a42c56f3420 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:32:50 -0800 Subject: [PATCH 6/9] Remove `unused` where it is used --- units/UAL0301/UAL0301_script.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/units/UAL0301/UAL0301_script.lua b/units/UAL0301/UAL0301_script.lua index 1f072d8ae8..f2af8e2f66 100644 --- a/units/UAL0301/UAL0301_script.lua +++ b/units/UAL0301/UAL0301_script.lua @@ -75,7 +75,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancement unused + ---@param bp UnitBlueprintEnhancement ProcessEnhancementShield = function(self, bp) self:AddToggleCap('RULEUTC_ShieldToggle') self:SetEnergyMaintenanceConsumptionOverride(bp.MaintenanceConsumptionPerSecondEnergy or 0) @@ -92,7 +92,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancement unused + ---@param bp UnitBlueprintEnhancement ProcessEnhancementShieldHeavy = function(self, bp) WaitTicks(1) self:CreateShield(bp) @@ -109,7 +109,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancement + ---@param bp UnitBlueprintEnhancement ProcessEnhancementResourceAllocation = function(self, bp) local bpEcon = self.Blueprint.Economy self:SetProductionPerSecondEnergy((bp.ProductionPerSecondEnergy + bpEcon.ProductionPerSecondEnergy) or 0) @@ -125,7 +125,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancement unused + ---@param bp UnitBlueprintEnhancement ProcessEnhancementEngineeringFocusModule = function(self, bp) if not Buffs['AeonSCUBuildRate'] then BuffBlueprint { @@ -154,7 +154,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancement unused + ---@param bp UnitBlueprintEnhancement ProcessEnhancementSystemIntegrityCompensator = function(self, bp) if not Buffs['AeonSCURegenRate'] then BuffBlueprint { @@ -195,7 +195,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancement unused + ---@param bp UnitBlueprintEnhancement ProcessEnhancementStabilitySuppressant = function(self, bp) local wep = self:GetWeaponByLabel('RightReactonCannon') wep:AddDamageMod(bp.NewDamageMod or 0) @@ -204,7 +204,7 @@ UAL0301 = ClassUnit(CommandUnit) { end, ---@param self UAL0301 - ---@param bp UnitBlueprintEnhancement unused + ---@param bp UnitBlueprintEnhancement ProcessEnhancementStabilitySuppressantRemove = function(self, bp) local wep = self:GetWeaponByLabel('RightReactonCannon') wep:AddDamageMod(-self.Blueprint.Enhancements['RightReactonCannon'].NewDamageMod) From 121c0d5bccd007cf8e64246de0c007d4e99f9d97 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:33:46 -0800 Subject: [PATCH 7/9] Fix whitespace error --- units/UAL0301/UAL0301_script.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/units/UAL0301/UAL0301_script.lua b/units/UAL0301/UAL0301_script.lua index f2af8e2f66..5e0a380c50 100644 --- a/units/UAL0301/UAL0301_script.lua +++ b/units/UAL0301/UAL0301_script.lua @@ -64,7 +64,7 @@ UAL0301 = ClassUnit(CommandUnit) { ---@param self UAL0301 ---@param bp UnitBlueprintEnhancement unused - ProcessEnhancementTeleporter = function (self, bp) + ProcessEnhancementTeleporter = function(self, bp) self:AddCommandCap('RULEUCC_Teleport') end, From 881bc0c248c17593cc9cbe0c292e504c123f6d45 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:35:09 -0800 Subject: [PATCH 8/9] Use a `#region` --- units/UAL0301/UAL0301_script.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/units/UAL0301/UAL0301_script.lua b/units/UAL0301/UAL0301_script.lua index 5e0a380c50..da056e0fd1 100644 --- a/units/UAL0301/UAL0301_script.lua +++ b/units/UAL0301/UAL0301_script.lua @@ -59,8 +59,8 @@ UAL0301 = ClassUnit(CommandUnit) { EffectUtil.CreateAeonCommanderBuildingEffects(self, unitBeingBuilt, self.BuildEffectBones, self.BuildEffectsBag) end, - -- ============================================================================================================================================ - -- ENHANCEMENTS + --------------------------------------------------------------------------- + --#region Enhancements ---@param self UAL0301 ---@param bp UnitBlueprintEnhancement unused @@ -228,6 +228,7 @@ UAL0301 = ClassUnit(CommandUnit) { end end, + --#endregion } TypeClass = UAL0301 From a62a10a85ff6d51b8b1cd12689168504f00fbd2a Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:36:07 -0800 Subject: [PATCH 9/9] Fix typo in engineering enhancement name --- units/UAL0301/UAL0301_script.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/units/UAL0301/UAL0301_script.lua b/units/UAL0301/UAL0301_script.lua index da056e0fd1..3ec963c1ad 100644 --- a/units/UAL0301/UAL0301_script.lua +++ b/units/UAL0301/UAL0301_script.lua @@ -126,7 +126,7 @@ UAL0301 = ClassUnit(CommandUnit) { ---@param self UAL0301 ---@param bp UnitBlueprintEnhancement - ProcessEnhancementEngineeringFocusModule = function(self, bp) + ProcessEnhancementEngineeringFocusingModule = function(self, bp) if not Buffs['AeonSCUBuildRate'] then BuffBlueprint { Name = 'AeonSCUBuildRate', @@ -147,7 +147,7 @@ UAL0301 = ClassUnit(CommandUnit) { ---@param self UAL0301 ---@param bp UnitBlueprintEnhancement unused - ProcessEnhancementEngineeringFocusModuleRemove = function(self, bp) + ProcessEnhancementEngineeringFocusingModuleRemove = function(self, bp) if Buff.HasBuff(self, 'AeonSCUBuildRate') then Buff.RemoveBuff(self, 'AeonSCUBuildRate') end