Skip to content

Instantly share code, notes, and snippets.

@Brianetta
Created December 19, 2011 21:57
Show Gist options
  • Save Brianetta/1499081 to your computer and use it in GitHub Desktop.
Save Brianetta/1499081 to your computer and use it in GitHub Desktop.
Sample star system grid generator
-- Define some desired system types
local systypes = {
{'STAR_A_GIANT','STAR_F_GIANT'},
{'STAR_M_SUPER_GIANT','STAR_K_SUPER_GIANT'},
{'STAR_G_HYPER_GIANT','STAR_B_HYPER_GIANT'},
{'STAR_S_BH','WHITE_DWARF'},
{'STAR_IM_BH'},
{'STAR_SM_BH'},
{'STAR_O','STAR_O','STAR_O','STAR_O',},
}
--Make some systems, and grid them up
local x,y,sect = 0,0,0
for counter,systype in ipairs(systypes) do
if x == 1 then
x = 0
if y == 1 then
y = 0
sect = sect + 1
else
y = y + 0.2
end
else
x = x + 0.2
end
CustomSystem:new(("t%s").format(counter),systype):add_to_sector(0,sect,0,v(x,y,0.200))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment