|
| 1 | +-------------------------------------------------------------------------------- |
| 2 | +-- Supreme Commander mod automatic unit wiki generation script for Github wikis |
| 3 | +-- Copyright 2021-2022 Sean 'Balthazar' Wheeldon Lua 5.4.2 |
| 4 | +-------------------------------------------------------------------------------- |
| 5 | + |
| 6 | +--[{ ---------------------------------------------------------------------- ]]-- |
| 7 | +--[[ Inputs -- NOTE: Mod input files must be valid lua ]]-- |
| 8 | +--[[ ---------------------------------------------------------------------- ]]-- |
| 9 | +local OutputDirectory = "D:/faf-development/fa.wiki/" |
| 10 | +local WikiGeneratorDirectory = "D:/faf-development/BrewWikiGen/" |
| 11 | +local FADirectory = "D:/faf-development/fa/" |
| 12 | + |
| 13 | +--#region This section deals with overriding the OutputDirectory and WikiGeneratorDirectory if required by command-line arguments |
| 14 | + |
| 15 | +local function parse_args(arg) |
| 16 | + local args = {} |
| 17 | + for i = 1, #arg do |
| 18 | + local key, value = arg[i]:match("--([^=]+)=(.*)") |
| 19 | + if key and value then |
| 20 | + key = key:gsub("^%-+", "") -- Remove leading '-' characters |
| 21 | + args[key] = value |
| 22 | + end |
| 23 | + end |
| 24 | + return args |
| 25 | +end |
| 26 | + |
| 27 | +local args = parse_args(arg) |
| 28 | + |
| 29 | +-- Overwrite default values if provided as command-line arguments |
| 30 | +if args["OutputDirectory"] then |
| 31 | + OutputDirectory = args["OutputDirectory"] |
| 32 | +end |
| 33 | +if args["WikiGeneratorDirectory"] then |
| 34 | + WikiGeneratorDirectory = args["WikiGeneratorDirectory"] |
| 35 | +end |
| 36 | +if args["FADirectory"] then |
| 37 | + FADirectory = args["FADirectory"] |
| 38 | +end |
| 39 | + |
| 40 | +print("Directories set") |
| 41 | +print("Output Directory: " ..OutputDirectory) |
| 42 | +print("Wiki Generator Directory: " ..WikiGeneratorDirectory) |
| 43 | +print("FA Directory: " ..FADirectory) |
| 44 | +--#endregion |
| 45 | + |
| 46 | +EnvironmentData = { |
| 47 | + name = 'Forged Alliance', |
| 48 | + author = 'Gas Powered Games', |
| 49 | + version = '1.6.6', |
| 50 | + icon = false, |
| 51 | + location = FADirectory, |
| 52 | + |
| 53 | + GenerateWikiPages = false, |
| 54 | + RebuildBlueprints = true, |
| 55 | + RunSanityChecks = false, |
| 56 | + |
| 57 | + base64 = { |
| 58 | + UnitIcons = false, |
| 59 | + }, |
| 60 | + |
| 61 | + Lua = FADirectory, |
| 62 | + LOC = FADirectory, |
| 63 | + |
| 64 | + PreModBlueprints = {}, |
| 65 | + PostModBlueprints = { |
| 66 | + "BakePropBlueprints" |
| 67 | + }, |
| 68 | + |
| 69 | + LoadExtraBlueprints = { |
| 70 | + Beam = false, |
| 71 | + Mesh = false, |
| 72 | + Prop = true, |
| 73 | + Emitter = false, |
| 74 | + TrailEmitter = false, |
| 75 | + }, |
| 76 | +} |
| 77 | + |
| 78 | +WikiOptions = { |
| 79 | + Language = 'US', -- These are not ISO_639-1. As an Englishman I am offended. |
| 80 | + |
| 81 | + GenerateHomePage = false, |
| 82 | + GenerateSidebar = false, |
| 83 | + GenerateModPages = false, |
| 84 | + GenerateUnitPages = false, |
| 85 | + GenerateProjectilesPage = false, |
| 86 | + GenerateCategoryPages = false, |
| 87 | + |
| 88 | + -- Unit page options |
| 89 | + IncludeStrategicIcon = false, |
| 90 | + AbilityDescriptions = false, |
| 91 | + BalanceNote = '<LOC wiki_balance_stats_steam>Displayed stats are from when launched on the steam/retail version of the game.', |
| 92 | + ConstructionNote = '<LOC wiki_builders_note_steam>Build times from the Steam/retail version of the game:', |
| 93 | + BuildListSaysModUnits = false, |
| 94 | + |
| 95 | + OnlineRepoUnitPageBlueprintLink = 'https://github.com/The-Balthazar/BrewLAN/tree/master/', |
| 96 | + LocalRepuUnitPageBlueprintLink = FADirectory, |
| 97 | +} |
| 98 | + |
| 99 | +RebuildBlueprintOptions = { |
| 100 | + RebuildBpFiles = { |
| 101 | + Unit = false, |
| 102 | + Beam = false, |
| 103 | + Mesh = false, |
| 104 | + Prop = true, |
| 105 | + Emitter = false, |
| 106 | + Projectile = false, |
| 107 | + TrailEmitter = false, |
| 108 | + }, |
| 109 | + RemoveUnusedValues = false, |
| 110 | + CleanupBuildOnLayerCaps = false, |
| 111 | + CleanupGeneralBackgroundIcon = false, |
| 112 | + CleanupWreckageLayers = false, |
| 113 | + CleanupCommandCaps = false, |
| 114 | + CleanupIntelOverlayCategories = false, |
| 115 | + RemoveMilitaryOverlayCategories = false, |
| 116 | + RemoveProductCategories = false, |
| 117 | + RecalculateThreat = false, |
| 118 | +} |
| 119 | + |
| 120 | +CleanupOptions = { |
| 121 | + CleanUnitBpFiles = false, |
| 122 | + CleanUnitBpGeneral = false, |
| 123 | + CleanUnitBpDisplay = false, |
| 124 | + CleanUnitBpInterface = false, |
| 125 | + CleanUnitBpUseOOBTestZoom = false, |
| 126 | + CleanUnitBpThreat = false, |
| 127 | +} |
| 128 | + |
| 129 | +ModDirectories = { -- In order |
| 130 | + -- 'C:/BrewLAN/mods/BrewLAN/', |
| 131 | + -- 'C:/BrewLAN/mods/BrewLAN_Units/BrewAir/', |
| 132 | + -- 'C:/BrewLAN/mods/BrewLAN_Units/BrewIntel/', |
| 133 | + -- 'C:/BrewLAN/mods/BrewLAN_Units/BrewMonsters/', |
| 134 | + -- 'C:/BrewLAN/mods/BrewLAN_Units/BrewResearch/', |
| 135 | + -- 'C:/BrewLAN/mods/BrewLAN_Units/BrewShields/', |
| 136 | + -- 'C:/BrewLAN/mods/BrewLAN_Units/BrewTeaParty/', |
| 137 | + -- 'C:/BrewLAN/mods/BrewLAN_Units/BrewTurrets/', |
| 138 | +} |
| 139 | + |
| 140 | +BlueprintExclusions = { |
| 141 | + '/op[ec][^/]*_unit%.bp', --bp files like OPE2001 |
| 142 | + '/[ux][arse]c[^/]*_unit%.bp', --Exclude civilian units. |
| 143 | +} |
| 144 | + |
| 145 | +BlueprintIdExclusions = { -- Excludes blueprints with any of these IDs (case insensitive) |
| 146 | + "zxa0001", -- Dummy unit |
| 147 | + "zxa0002", -- Dummy unit for external/mobile factory units |
| 148 | + "zxa0003", -- Dummy unit |
| 149 | + "ura0001O", -- Cybran build drone |
| 150 | + "ura0002O", -- Cybran build drone |
| 151 | + "ura0003O", -- Cybran build drone |
| 152 | + "XRO4001", -- Remains of Dostya |
| 153 | +} |
| 154 | + |
| 155 | +FooterCategories = { -- In order |
| 156 | + 'UEF', 'AEON', 'CYBRAN', 'SERAPHIM', |
| 157 | + 'TECH1', 'TECH2', 'TECH3', 'EXPERIMENTAL', |
| 158 | + 'MOBILE', |
| 159 | + 'ANTIAIR', 'ANTINAVY', 'DIRECTFIRE', |
| 160 | + 'AIR', 'LAND', 'NAVAL', |
| 161 | + 'HOVER', |
| 162 | + 'ECONOMIC', |
| 163 | + 'SHIELD', 'PERSONALSHIELD', |
| 164 | + 'BOMBER', 'TORPEDOBOMBER', |
| 165 | + 'MINE', |
| 166 | + 'COMMAND', 'SUBCOMMANDER', 'ENGINEER', 'FIELDENGINEER', |
| 167 | + 'TRANSPORTATION', 'AIRSTAGINGPLATFORM', |
| 168 | + 'SILO', |
| 169 | + 'FACTORY', |
| 170 | + 'ARTILLERY', |
| 171 | + 'STRUCTURE', |
| 172 | +} |
| 173 | + |
| 174 | +Logging = { -- Functional logs |
| 175 | + LogEmojiSupported = false, |
| 176 | + |
| 177 | + LocalisationLoaded = false, |
| 178 | + HelpStringsLoaded = false, |
| 179 | + BuffsLoaded = false, |
| 180 | + SCMLoadIssues = false, |
| 181 | + SandboxedFileLogs = { |
| 182 | + Debug = false, -- SPEW |
| 183 | + Log = true, -- LOG, _ALERT, print |
| 184 | + Warn = true, -- WARN |
| 185 | + }, |
| 186 | + |
| 187 | + ExcludedBlueprints = false, |
| 188 | + BlueprintTotals = true, |
| 189 | + MissingUnitImage = true, |
| 190 | + |
| 191 | + ChangeDiscarded = true, |
| 192 | + NewFileWrites = true, |
| 193 | + FileAppendWrites = true, |
| 194 | + FileUpdateWrites = false, |
| 195 | + FileAssetCopies = true, |
| 196 | + |
| 197 | +ThreatCalculationWarnings = false, |
| 198 | +} |
| 199 | +Sanity = { -- Advice logs |
| 200 | + BlueprintChecks = false, |
| 201 | + BlueprintPedanticChecks = false, |
| 202 | + BlueprintStrategicIconChecks = false, |
| 203 | +} |
| 204 | +Info = { -- Misc data logs |
| 205 | + UnitLODCounts = false, |
| 206 | + ProjectileBlueprintCounts = false, |
| 207 | +} |
| 208 | + |
| 209 | +dofile(WikiGeneratorDirectory.."Main.lua") |
| 210 | +GeneratorMain(OutputDirectory) |
| 211 | + |
0 commit comments