diff --git a/ObservatoryExplorer/CustomCriteriaManager.cs b/ObservatoryExplorer/CustomCriteriaManager.cs index 82c8842..d40900d 100644 --- a/ObservatoryExplorer/CustomCriteriaManager.cs +++ b/ObservatoryExplorer/CustomCriteriaManager.cs @@ -100,24 +100,12 @@ namespace Observatory.Explorer return _ringsFiltered(ring_list, 'Ring') end"); - //Rings - has > 0 proper rings - LuaState.DoString(@" - function hasRings (ring_list) - return _hasRingsFiltered(ring_list, 'Ring') - end"); - //Rings - iterate belts only LuaState.DoString(@" function beltsOnly (ring_list) return _ringsFiltered(ring_list, 'Belt') end"); - //Rings - has > 0 belts - LuaState.DoString(@" - function hasBelts (ring_list) - return _hasRingsFiltered(ring_list, 'Belt') - end"); - //Bodies in system LuaState.DoString(@" function bodies (system_list) @@ -155,6 +143,42 @@ namespace Observatory.Explorer #endregion + #region Convenience Functions + + //Rings - has > 0 belts + LuaState.DoString(@" + function hasBelts (ring_list) + return _hasRingsFiltered(ring_list, 'Belt') + end"); + + //Rings - has > 0 proper rings + LuaState.DoString(@" + function hasRings (ring_list) + return _hasRingsFiltered(ring_list, 'Ring') + end"); + + LuaState.DoString(@" + function isStar (scan) + return scan.StarType and scan.StarType ~= '' + end"); + + LuaState.DoString(@" + function isPlanet (scan) + return scan.PlanetClass ~= nil + end"); + + LuaState.DoString(@" + function hasAtmosphere (scan) + return scan.AtmosphereComposition ~= nil + end"); + + LuaState.DoString(@" + function hasLandableAtmosphere (scan) + return scan.Landable and scan.AtmosphereComposition ~= nil + end"); + + #endregion + CriteriaFunctions.Clear(); var criteria = File.Exists(criteriaPath) ? File.ReadAllLines(criteriaPath) : Array.Empty(); StringBuilder script = new();