1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-12-22 23:58:48 -05:00
minetest/genmap.py
Perttu Ahola c18af6e728 - added map generating script
- dropped support for versions older than 2 because of lighting support
2010-11-29 12:16:17 +02:00

39 lines
531 B
Python
Executable File

#!/usr/bin/python
import struct
import random
def getrand():
i = random.randrange(0,2)
if i==0:
return 0
return 254
"""
Map format:
map/sectors/XXXXZZZZ/YYYY
XXXX,YYYY,ZZZZ = coordinates in hexadecimal
fffe = -2
ffff = -1
0000 = 0
0001 = 1
"""
f = open("map/sectors/00000000/ffff", "wb")
# version
f.write(struct.pack('B', 2))
# is_underground
f.write(struct.pack('B', 0))
for i in range(0,16*16*16):
# Material content
f.write(struct.pack('B', getrand()))
# Brightness
f.write(struct.pack('B', 15))
f.close()