Code: Select all
-- Title: Mark stars by spectral type
-- Mark all stars in a sphere centered on the current selection.
-- Original script by Vincent Gian, modified by Chris Laurel
starcolors = {
S = "#ff0000";
M = "#ff4400";
K = "#ffaa22";
G = "#cccc33";
F = "#ffffaa";
A = "#dddddd";
B = "#88aaff";
O = "#4444ff";
D = "#ff00ff";
L = "#00ff00";
T = "#00ff00";
W = "#0000ff";
}
function mark_star_dist(obj, radius)
for star in celestia:stars() do
if star:getposition():distanceto(obj:getposition()) <= radius then
local size = 10.0 - star:absmag()
local color = starcolors[string.sub(star:spectraltype(), 1, 1)]
if color == nil then
star:mark("#404040", "square", size, 0.5)
else
star:mark(color, "circle", size, 0.5)
end
end
end
end
celestia:unmarkall()
objname = ""
obj = celestia:getselection()
-- Radius of the sphere (in km):
radius = 1e15
while true do
obj = celestia:getselection()
if obj and objname ~= obj:name() then
objname = obj:name()
celestia:unmarkall()
mark_star_dist(obj, radius)
end
wait(0)
end
--Chris