Skip to main content

A library to open, read, modify and write goldsrc .map files

Project description

goldsrcmap


Python library to manipulate goldsrc engine .map files

work in progress...

Usage

https://github.com/G2Pavon/goldsrcmap/wiki

Load map:

#../Mapping/Scripting/example1.py
import goldsrcmap as gsm

# Load .map file
m = gsm.load_map('Mapping/maps/file.map')

for entity in m.entities:
  if entity.classname == 'func_door': # classname @property
    for brush in entity.brushes:
      brush.rotate_z(45)
  if entity.properties['classname'] == 'func_wall': # using properties attribute
    for brush in entity: # alternative syntax without using brushes @property
      brush.move_by(256, 256, 64)
  if entity['classname'] == 'func_plat': # without using properties attribute
    for brush in entity:
      brush.move_to(32,32,256, centroid=True)
            
  # more logic here

# Save the edited map in /Scripting/ folder
gsm.save_map(m, 'edited.map')

Create from scratch:

#../Mapping/Scripting/example2.py
import goldsrcmap as gsm

m = gsm.new_map()

# Edit worldspawn properties
m.worldspawn.properties['wad'] = 'path/to/zhlt.wad; path/to/other.wad' # get worldspawn entity directly with @property
m.worldspawn['skyname'] = 'nebula' # alternative way to add entity property without using properties attribute

# Create brushes
skybox_room = gsm.BrushGenerator.room(2048, 2048, 2048, 16, [0,0,0], center=True)
floor = gsm.BrushGenerator.cuboid(512, 512, 32, [0,0,-128], texture="grass")

# Create entities
player = gsm.EntityGenerator.info_player_start([0,0,0])
light = gsm.EntityGenerator.light_environment([0,0,1024], angle=180, pitch=-70)

# append brush and entities in map
m.add_brush(skybox_room, floor) # adding individually or as a list also works add_brush([skybox_room, floor])
m.add_entity(player, light) # same here

button = Entity()
button.add_brush(gsm.BrushGenerator.cuboid(16, 16, 48, [82,82,0], texture="black"))
button.properties = {
                    "classname":"func_button",
                    "spawnflags":"1",
                    "speed":"5",
                    "lip":"0",
                    "wait":"2",
                    "delay":"0",
                    "target":"counter_off",
                    "master":"stopsource",
                    "targetname":"counter_stop_button"
                    }
m.add_entity(button)

# Save the new map in cstrike
gsm.save_map(m, 'cstrike/maps/generated.map')

Project details


Release history Release notifications | RSS feed

This version

1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

goldsrcmap-1.tar.gz (31.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

goldsrcmap-1-py3-none-any.whl (37.1 kB view details)

Uploaded Python 3

File details

Details for the file goldsrcmap-1.tar.gz.

File metadata

  • Download URL: goldsrcmap-1.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for goldsrcmap-1.tar.gz
Algorithm Hash digest
SHA256 5dc6988b7a77f78a07bb2613cef8e8465e68c497b56735b33cfbbc701ca19602
MD5 0dea138a79d5ba52d5639bf89c3aabde
BLAKE2b-256 aebe9c7cb94bf1dfddbec3f6a349e208a435ae4215c0b08d7245d2fb48c0615a

See more details on using hashes here.

File details

Details for the file goldsrcmap-1-py3-none-any.whl.

File metadata

  • Download URL: goldsrcmap-1-py3-none-any.whl
  • Upload date:
  • Size: 37.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for goldsrcmap-1-py3-none-any.whl
Algorithm Hash digest
SHA256 9c95f720c7b3a9f7eab42169cbf81147e707592aaa8a7a5ad99735d649fd7bf9
MD5 c4705724744890b22f081e033219f9a8
BLAKE2b-256 a9f9b521edbbdd8638a5fe5bb40dfa903a7c4b5a6337227b4b3efe7dfb69ad91

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page