Expose exoplanet creation settings to user as module properties (#1499)

* Expose exoplanet creation settings to user as module properties

* Set default textures from asset to avoid explicit paths to sync folder
This commit is contained in:
Emma Broman
2021-02-12 14:32:37 +01:00
committed by GitHub
parent afd484044d
commit e21edaa13e
6 changed files with 302 additions and 58 deletions
@@ -4,6 +4,14 @@ local DataPath = asset.syncedResource({
Identifier = "exoplanets_data",
Version = 2
})
asset.onInitialize(function ()
local p = "Modules.Exoplanets.DataFolder";
if(openspace.getPropertyValue(p) == "") then
openspace.setPropertyValueSingle(p, DataPath)
end
end)
asset.export("DataPath", DataPath)
asset.meta = {
@@ -1,4 +1,5 @@
asset.require('./../habitable_zones/habitable_zone_textures')
local habitableZoneTextures =
asset.require('./../habitable_zones/habitable_zone_textures').TexturesPath
local TexturesPath = asset.syncedResource({
Name = "Exoplanet Textures",
@@ -6,6 +7,37 @@ local TexturesPath = asset.syncedResource({
Identifier = "exoplanets_textures",
Version = 2
})
asset.onInitialize(function ()
local starTexture = TexturesPath .. "/sun.jpg"
local noDataTexture = TexturesPath .. "/grid-32.png"
local discTexture = TexturesPath .. "/disc_bw_texture.png"
local hzTexture = habitableZoneTextures .. "/hot_to_cold_faded.png"
-- Set the default textures used for the exoplanet system creation
-- (Check if already set, to not override value in config file)
local p = "Modules.Exoplanets.StarTexture";
if(openspace.getPropertyValue(p) == "") then
openspace.setPropertyValueSingle(p, starTexture)
end
p = "Modules.Exoplanets.NoDataTexture";
if(openspace.getPropertyValue(p) == "") then
openspace.setPropertyValueSingle(p, noDataTexture)
end
p = "Modules.Exoplanets.OrbitDiscTexture";
if(openspace.getPropertyValue(p) == "") then
openspace.setPropertyValueSingle(p, discTexture)
end
p = "Modules.Exoplanets.HabitableZoneTexture";
if(openspace.getPropertyValue(p) == "") then
openspace.setPropertyValueSingle(p, hzTexture)
end
end)
asset.export("TexturesPath", TexturesPath)
asset.meta = {