File: many-galaxy.gravitspawn

package info (click to toggle)
gravit 0.5.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,420 kB
  • ctags: 942
  • sloc: ansic: 6,841; makefile: 63; sh: 43
file content (28 lines) | stat: -rw-r--r-- 863 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
-- vim:syntax=lua tabstop=4

load("functions.lua")

function describe()
    log("Many elliptical and spiral galaxies with initial velocities")
end

function spawn()
	-- work out a number of galaxies based on spawnparticles
	local galaxysize = randomint(200,1000)
	local galaxies = math.floor(spawnparticles / galaxysize) + 1
	for i=0,galaxies-1 do
		local pos = randomrange(galaxies * 2000)
		local vel = randomrange(100)
		local rad = randomfloat(50, 1000)
		local massmin = randomfloat(10,1000)
		local massmax = randomfloat(10,1000)
		local particlestart = math.floor(spawnparticles/galaxies)*i
		local particlecount = math.floor(spawnparticles/galaxies)
		if (i == galaxies-1) then 
		      particlecount = spawnparticles - particlestart
		end

		makegalaxy(pos, vel, rad, massmin, massmax, particlestart, particlecount)
	end
end