-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathworld_gen.py
44 lines (30 loc) · 1.1 KB
/
world_gen.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!usr/bin/env python
from lxml import etree as ET
from wizard import worldSettings
def worldGenerator(w):
sdf = ET.Element("sdf",version="1.4")
world = ET.SubElement(sdf,"world",name="AutoGen Terrain World")
#setting up the scene
scene = ET.SubElement(world,"scene")
ambient = ET.SubElement(scene,"ambient")
ambient.text = w.ambient
#Day: 120 120 120 255
#Night: 20 40 50 255
#Dawm/Dusk: 120 80 60 255
#AfterDawn/BeforeDusk: 120 70 80 255
sky = ET.SubElement(scene,"sky")
clouds = ET.SubElement(sky,"clouds")
speed = ET.SubElement(clouds,"speed")
speed.text = "12"
time = ET.SubElement(sky,"time")
time.text = w.time
#including models
include = ET.SubElement(world,"include")
uri = ET.SubElement(include,"uri")
uri.text = "model://autogen_terrain"
include = ET.SubElement(world,"include")
uri = ET.SubElement(include,"uri")
uri.text = "model://sun"
#print ET.tostring(sdf,pretty_print=True,xml_declaration=True)
tree = ET.ElementTree(sdf)
tree.write('terrain.world', pretty_print=True, xml_declaration=True)