-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathwoodbox_block.py
executable file
·48 lines (33 loc) · 1.17 KB
/
woodbox_block.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
45
46
47
48
#! /usr/bin/env python3
"""Example map generator: Woodbox (Block)
This script demonstrates vmflib by generating a map (consisting of a large
empty room) and writing it to "woodbox_block.vmf". You can open the resulting
file using the Valve Hammer Editor and compile it for use in-game.
This example shows off the tools.Block class, which allows for the easy
creation of 3D block brushes. It's pretty awesome.
"""
from vmflib import *
from vmflib.types import Vertex
from vmflib.tools import Block
m = vmf.ValveMap()
walls = []
# Floor
walls.append(Block(Vertex(0, 0, -512), (1024, 1024, 64)))
# Ceiling
walls.append(Block(Vertex(0, 0, 512), (1024, 1024, 64)))
# Left wall
walls.append(Block(Vertex(-512, 0, 0), (64, 1024, 1024)))
# Right wall
walls.append(Block(Vertex(512, 0, 0), (64, 1024, 1024)))
# Forward wall
walls.append(Block(Vertex(0, 512, 0), (1024, 64, 1024)))
# Rear wall
walls.append(Block(Vertex(0, -512, 0), (1024, 64, 1024)))
# Set each wall's material
for wall in walls:
wall.set_material('wood/woodwall009a')
# Add walls to world geometry
m.world.children.extend(walls)
# TODO: Define a playerspawn entity
# Write the map to a file
m.write_vmf('woodbox_block.vmf')