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

Restore lost fields during formatting #5236

Merged
merged 15 commits into from
Jul 18, 2023

Conversation

Garanas
Copy link
Member

@Garanas Garanas commented Jul 17, 2023

We formatted the blueprints in #5169 to prepare for using the WikiGenerator written by @The-Balthazar. But while doing so I was naive and it turned out we removed quite a few fields that FAF does use. This is my attempt to restore those fields.

Specifically, this function is essentially no longer applied:

function RemoveRedundantBlueprintValues(bp)
    -- Just straight up kill these, always. They do nothing
    if RebuildBlueprintOptions.RemoveUnusedValues then
        bp.General.Category = nil
        bp.General.Classification = nil
        bp.General.TechLevel = nil
        bp.General.UnitWeight = nil
        bp.Display.PlaceholderMeshName = nil
        bp.Display.SpawnRandomRotation = nil
        bp.UseOOBTestZoom = nil
        bp.Interface = nil
    end

    -- Build on layer caps
    if RebuildBlueprintOptions.CleanupBuildOnLayerCaps then
        if bp.Physics.MotionType ~= 'RULEUMT_None' -- Only structures use BuildOnLayerCaps
        or BuildOnLayerBitwiseValue(bp.Physics.BuildOnLayerCaps) == 1 then -- This is the undefined default
            bp.Physics.BuildOnLayerCaps = nil
        else
            NilFalseValuesInFlagList(bp.Physics.BuildOnLayerCaps)
        end
    end

    if RebuildBlueprintOptions.CleanupWreckageLayers then
        NilFalseValuesInFlagList(bp.Wreckage.WreckageLayers)
    end

    -- Command caps
    if RebuildBlueprintOptions.CleanupCommandCaps then
        if not NilFalseValuesInFlagList(bp.General.CommandCaps) then -- Clear false values
            bp.General.CommandCaps = nil -- Remove if nothing is true
        end
    end

    if RebuildBlueprintOptions.RemoveMilitaryOverlayCategories and bp.Categories then
        table.removeByValue(bp.Categories, 'OVERLAYANTIAIR')
        table.removeByValue(bp.Categories, 'OVERLAYANTINAVY')
        table.removeByValue(bp.Categories, 'OVERLAYDEFENSE')
        table.removeByValue(bp.Categories, 'OVERLAYDIRECTFIRE')
        table.removeByValue(bp.Categories, 'OVERLAYINDIRECTFIRE')
    end

    if RebuildBlueprintOptions.RemoveProductCategories and bp.Categories then
        table.removeByValue(bp.Categories, arrayFindSub(bp.Categories, 1, 7, 'PRODUCT') )
    end

    --if not bp.Display.MovementEffects.Land.Treads.ScrollTreads then LODs[1].Scrolling = nil end
end

Hdt80bro and others added 2 commits July 17, 2023 20:28
* Polish enhancements

* Localize enhancement descriptions

* Add last missing keys possible to add

* Fix two SACU typos
@Garanas Garanas merged commit 1fe3d05 into deploy/fafdevelop Jul 18, 2023
2 checks passed
@Garanas Garanas deleted the fix/restore-lost-fields branch July 18, 2023 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants