/usr/share/gravit/spawn/one-galaxy.gravitspawn is in gravit-data 0.5.1+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | -- vim:syntax=lua tabstop=4
load("functions.lua")
function describe()
log("One spiral galaxy")
end
function spawn()
particlemassmin = randomfloat(1,1000)
particlemassmax = randomfloat(1,1000)
estmass = (particlemassmin + particlemassmax) / 2 * spawnparticles
galaxyradius = randomfloat(10,1000)
speedbase = .0000001
thickness = randomfloat(0.001, 10)
verticalvelocity = randomfloat(0, 1)
for i=0,spawnparticles-1 do
radius = randomfloat(0,galaxyradius)
speed = speedbase * radius * math.sqrt(estmass)
angle = randomfloat(0,2*math.pi)
pos = v(math.cos(angle)*radius, math.sin(angle)*radius, randomfloat(-thickness,thickness))
vel = v(math.cos(angle+math.pi/2)*speed*radius, math.sin(angle+math.pi/2)*speed*radius, randomfloat(-verticalvelocity, verticalvelocity))
mass = randomfloat(particlemassmin,particlemassmax)
particle(i, pos, vel, mass)
end
end
|