diff --git a/Yafc.Parser/FactorioDataSource.cs b/Yafc.Parser/FactorioDataSource.cs index 512afbb9..a92cb74b 100644 --- a/Yafc.Parser/FactorioDataSource.cs +++ b/Yafc.Parser/FactorioDataSource.cs @@ -382,6 +382,14 @@ internal partial class ModInfo : IDisposable { private readonly List<(string mod, bool optional)> parsedDependencies = []; private readonly List incompatibilities = []; + public bool quality_required { get; set; } + public bool rail_bridges_required { get; set; } + public bool space_travel_required { get; set; } + public bool spoiling_required { get; set; } + public bool freezing_required { get; set; } + public bool segmented_units_required { get; set; } + public bool expansion_shaders_required { get; set; } + public ZipArchive? zipArchive; public string folder; diff --git a/Yafc.Parser/LuaContext.cs b/Yafc.Parser/LuaContext.cs index 3d5b24af..ffd867db 100644 --- a/Yafc.Parser/LuaContext.cs +++ b/Yafc.Parser/LuaContext.cs @@ -156,6 +156,17 @@ public LuaContext() { SetGlobal("mods", mods); + var featureFlags = NewTable(); + featureFlags["quality"] = FactorioDataSource.allMods.Any(x => x.Value.quality_required); + featureFlags["rail_bridges"] = FactorioDataSource.allMods.Any(x => x.Value.rail_bridges_required); + featureFlags["space_travel"] = FactorioDataSource.allMods.Any(x => x.Value.space_travel_required); + featureFlags["spoiling"] = FactorioDataSource.allMods.Any(x => x.Value.spoiling_required); + featureFlags["freezing"] = FactorioDataSource.allMods.Any(x => x.Value.freezing_required); + featureFlags["segmented_units"] = FactorioDataSource.allMods.Any(x => x.Value.segmented_units_required); + featureFlags["expansion_shaders"] = FactorioDataSource.allMods.Any(x => x.Value.expansion_shaders_required); + + SetGlobal("feature_flags", featureFlags); + LuaCFunction traceback = CreateErrorTraceback; neverCollect.Add(traceback); lua_pushcclosure(L, Marshal.GetFunctionPointerForDelegate(traceback), 0);