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

Update UEF SACU Enhancement Script #6515

Merged
merged 7 commits into from
Nov 18, 2024

Conversation

MrRowey
Copy link
Member

@MrRowey MrRowey commented Nov 7, 2024

Following on the changes of #6498

Checklist

  • Changes are annotated, including comments where useful
  • Changes are documented in the changelog for the next game version

@MrRowey MrRowey changed the title Update Cybran Enhancement Script Update UEF SACU Enhancement Script Nov 7, 2024
end
end,

---@param self UEL0301
---@param intel IntelType
OnIntelEnabled = function(self, intel)
CommandUnit.OnIntelEnabled(self, intel)
if self.RadarJammerEnh and self:IsIntelEnabled('Jammer') then
if self.ProcessEnhancementRadarJammer and self:IsIntelEnabled('Jammer') then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an unintentional change - it would always be true. See also the RadarJammerEnh field that is set to true/false depending on whether the enhancement exists.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After looking at this can't this just be a part of the 2 Functions for the enhancements now?

Copy link
Member Author

@MrRowey MrRowey Nov 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So something like

    ---@param self UEL0301
    ---@param bp UnitBlueprintEnhancement
    ProcessEnhancementRadarJammer = function(self, bp)
        self:SetIntelRadius('Jammer', bp.NewJammerRadius or 26)
        self:EnableUnitIntel('Enhancement', 'Jammer')
        self:AddToggleCap('RULEUTC_JammingToggle')
        self:SetEnergyMaintenanceConsumptionOverride(bp.MaintenanceConsumptionPerSecondEnergy or 0)
        self:SetMaintenanceConsumptionActive()

        if self.IntelEffects then
            self.IntelEffectsBag = {}
            self:CreateTerrainTypeEffects(self.IntelEffects, 'FXIdle',  self.Layer, nil, self.IntelEffectsBag)
        end

    end,
    ```

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but then do you even need the self.RadarJammerEnh = true if the part its setting ti for can now be apart of the same function as it wasn't before ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't inline OnIntelEnabled because that function is called when the jamming toggle is pressed (or whenever else the jammer is enabled), while the enhancement function is called only once when the enhancement is built. Same for OnIntelDisabled.

If you did inline it, then the jammer's FX and and energy consumption would remain permanently on until the enhancement is removed.

units/UEL0301/UEL0301_script.lua Show resolved Hide resolved
@MrRowey MrRowey marked this pull request as ready for review November 11, 2024 20:50
@MrRowey MrRowey requested a review from Garanas November 11, 2024 20:51
@MrRowey MrRowey marked this pull request as draft November 11, 2024 21:00
@MrRowey MrRowey marked this pull request as ready for review November 13, 2024 16:48
@MrRowey MrRowey requested a review from lL1l1 November 13, 2024 16:53
@lL1l1 lL1l1 merged commit e2f24fb into FAForever:develop Nov 18, 2024
5 checks passed
@lL1l1 lL1l1 added the area: code style code refactoring label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: code style code refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants