mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 00:25:19 +02:00
- added map generating script
- dropped support for versions older than 2 because of lighting support
This commit is contained in:
38
genmap.py
Executable file
38
genmap.py
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/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()
|
||||
|
Reference in New Issue
Block a user