-
Notifications
You must be signed in to change notification settings - Fork 0
/
planetGeneration.lua
28 lines (27 loc) · 1020 Bytes
/
planetGeneration.lua
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
planetGeneration = {}
function planetGeneration.generatePlanetTypes()
local planetTypesFile= love.filesystem.read("data/planetTypes.json")
local planetTypes = lunajson.decode(planetTypesFile)
for planetName,planetTypes in pairs(planetTypes) do
global.planetTypes[planetName] = {}
local newPlanet = {}
for var,val in pairs(planetTypes) do
newPlanet[var] = val
end
global.planetTypes[planetName] = newPlanet
end
end
function planetGeneration.generateBiomes()
local biomesFile = love.filesystem.read("data/biomes.json")
local biomes = lunajson.decode(biomesFile)
for biomeName,biome in pairs(biomes) do
global.biomes[biomeName] = {}
local newBiome = {}
for var,val in pairs(biome) do
newBiome[var] = val
end
global.biomeAmount = global.biomeAmount + 1
global.biomesIndexed[#global.biomesIndexed+1] = biomeName
global.biomes[biomeName] = newBiome
end
end