2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-04-05 17:39:39 -04:00

Additional custom criteria convenience functions.

This commit is contained in:
Xjph 2022-09-04 19:20:49 -02:30
parent 796819617b
commit 95db12de72

View File

@ -100,24 +100,12 @@ namespace Observatory.Explorer
return _ringsFiltered(ring_list, 'Ring') return _ringsFiltered(ring_list, 'Ring')
end"); end");
//Rings - has > 0 proper rings
LuaState.DoString(@"
function hasRings (ring_list)
return _hasRingsFiltered(ring_list, 'Ring')
end");
//Rings - iterate belts only //Rings - iterate belts only
LuaState.DoString(@" LuaState.DoString(@"
function beltsOnly (ring_list) function beltsOnly (ring_list)
return _ringsFiltered(ring_list, 'Belt') return _ringsFiltered(ring_list, 'Belt')
end"); end");
//Rings - has > 0 belts
LuaState.DoString(@"
function hasBelts (ring_list)
return _hasRingsFiltered(ring_list, 'Belt')
end");
//Bodies in system //Bodies in system
LuaState.DoString(@" LuaState.DoString(@"
function bodies (system_list) function bodies (system_list)
@ -155,6 +143,42 @@ namespace Observatory.Explorer
#endregion #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(); CriteriaFunctions.Clear();
var criteria = File.Exists(criteriaPath) ? File.ReadAllLines(criteriaPath) : Array.Empty<string>(); var criteria = File.Exists(criteriaPath) ? File.ReadAllLines(criteriaPath) : Array.Empty<string>();
StringBuilder script = new(); StringBuilder script = new();