From 74df2d22dabcd7ed0bd3a2313de688ce2b713d31 Mon Sep 17 00:00:00 2001 From: Pavel Penev Date: Fri, 6 Oct 2023 11:53:15 +0300 Subject: [PATCH] Fixed initTable warnings about missing properties The Lua extension would report missing/uninitialized fields on actor creation because it thought they were required. This makes them all optional, except for OwnerInit, which is special. --- OpenRA.Mods.Common/UtilityCommands/ExtractEmmyLuaAPI.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractEmmyLuaAPI.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractEmmyLuaAPI.cs index 7f4a703c51..4772cbea79 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractEmmyLuaAPI.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractEmmyLuaAPI.cs @@ -149,7 +149,13 @@ namespace OpenRA.Mods.Common.UtilityCommands .Distinct()); if (!string.IsNullOrEmpty(parameterString)) + { + // OwnerInit is special as it is the only "required" init. All others are optional. + if (init.Name != nameof(OwnerInit)) + parameterString += '?'; + Console.WriteLine($"---@field {name} {parameterString}"); + } } usedEnums = localEnums.Distinct();