Commit 3cb5eb83 authored by dylan grafmyre's avatar dylan grafmyre
Browse files

snapshot

parents
*.log
*.prt
*.bsp
*.vmx
*.swp
*.prof
env
*.egg-info
*.bundle
*.pyc
*.lint
lint
*.blend1
*.dmx
*.pyc
#
PYTHON_BIN?=./env/scripts/python
GARYSMOD_DIR?=D:\\Steam\\steamapps\\common\\GarrysMod\\
VBIN_DIR?=$(GARYSMOD_DIR)bin\\
MOD_DIR?=$(GARYSMOD_DIR)garrysmod\\
VBIN_FLAGS?=-game $(MOD_DIR)
BSP_BIN?=$(VBIN_DIR)vbsp.exe
BSP_FLAGS?=$(VBIN_FLAGS)
VIS_BIN?=$(VBIN_DIR)vvis.exe
VIS_FLAGS?=$(VBIN_FLAGS) -fast
RAD_BIN?=$(VBIN_DIR)vrad.exe
RAD_FLAGS?=$(VBIN_FLAGS) -StaticPropLighting -bounce 2 -noextra
# -StaticPropSampleScale 0.25
BSPZIP_BIN?=$(VBIN_DIR)bspzip.exe
BSPZIP_FLAGS?=
%.bsp: %.vmf
$(BSP_BIN) $(BSP_FLAGS) $(basename $^) # writes bsp
$(VIS_BIN) $(VIS_FLAGS) $(basename $^) # depends on .prt, r/w bsp
$(RAD_BIN) $(RAD_FLAGS) $(basename $^) # reads lights.rad, r/w bsp
cp $@ $(MOD_DIR)maps\\$(notdir $@)
%.prt: %.bsp
@test -f $@ || rm -f $(basename $@).bsp
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $(basename $@).bsp
%.log: %.bsp
@test -f $@ || rm -f $(basename $@).bsp
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $(basename $@).bsp
%_p.bsp: %.bsp
$(BSPZIP_BIN) $(BSPZIP_FLAGS) -addlist $^ $(basename $^).bspzip-addlist $@
game: install ttt_terrorcon_v2_p.bsp
$(GARYSMOD_DIR)hl2.exe -allowdebug $(VBIN_FLAGS) +map $(notdir $(basename $(word 2,$^))) +gamemode terrortown +ttt_debug_preventwin 1 +ttt_preptime_seconds 10 +ttt_minimum_players 1
install: ttt_terrorcon_v2_p.bsp
cp -v $^ $(MOD_DIR)maps\\
%.lint: %.bspzip-addlist
$(PYTHON_BIN) ./contrib/bsppack-lint $^ 2> $@
.PHONY: lint
lint: ttt_terrorcon_v2.lint
$(PYTHON_BIN) ./contrib/vmt-lint 2> $@
custom content in hammer
------------------------
option 1 - edit mount.cfg, add path to this repo
# Garrys Mod\garrysmod\cfg\mount.cfg
"mountcfg"
{
"ttt_terrorcon" "c:\path-to\ttt_terrorcon"
}
option 2 - copy resources into garrysmod
cp -var \
models
materials
./path-to/Garrys Mod/garrysmod/
option 3 - build release
make ttt_terrorcon_v2_p.bsp
cp ttt_terrorcon_v2_p.bsp 'Garrys Mod/garrysmod/maps/'
modeling notes
--------------
one blender unit == 1 meter:
# *.qc
$scale = 19.680119
#!/usr/bin/env python3
import argparse
import collections
import logging
import os
HAS_PYVMF = False
try:
import pyvmf
HAS_PYVMF = True
except ImportError as err:
logging.error(err)
ARGP = argparse.ArgumentParser()
ARGP.add_argument('input', type=argparse.FileType())
class WormDict(collections.UserDict):
def __setitem__(self, key, value):
if key in self:
raise KeyError('key {!r} already exists in dat'.format(key))
super().__setitem__(key, value)
class BsppackAddlist(collections.UserDict):
@classmethod
def new_from_file(cls, file_):
dat = WormDict()
while True:
local = file_.readline().rstrip('\n')
remote = file_.readline().rstrip('\n')
logging.debug('%r -> %r', local, remote)
if not local:
break
if not remote:
raise RuntimeWarning('uneven line count')
dat[local] = remote
return cls(dat)
def lint_local(self):
for key in self:
if not os.path.isfile(key):
logging.error('local file is not file: %r', key)
def main_vmflint(argp, bsppack_addlist):
path = '{}.vmf'.format(os.path.splitext(argp.input.name)[0])
logging.info('parsing vmf %r ...', path)
with open(path) as fh:
vmf = pyvmf.Vmf.load(fh)
logging.info('parsing vmf %r ... done %r ', path, vmf)
models = set([i.attributes['model'] for i in vmf.iter_props()])
bsppack_addlist_values = bsppack_addlist.values()
bsppack_addlist_values_lower = [i.lower() for i in bsppack_addlist_values]
for model in models:
prop_is_zipped = model in bsppack_addlist_values
if not prop_is_zipped:
logging.error('using unpacked file: %r', model)
continue
materials = set()
for leaf, material in vmf.iter_materials():
material_lower = material.lower()
if material_lower in materials:
continue
materials.add(material_lower)
material_is_zipped = material_lower in bsppack_addlist_values_lower
if not material_is_zipped:
logging.error('%r %r: using unpacked file: %r', leaf.name, leaf.attributes['id'], material)
def main(argp=None, argv=None):
if argp is None:
argp = ARGP.parse_args(argv)
logging.basicConfig(level=logging.INFO)
bsppack_addlist = BsppackAddlist.new_from_file(argp.input)
bsppack_addlist.lint_local()
if HAS_PYVMF:
main_vmflint(argp, bsppack_addlist)
if __name__ == '__main__':
main()
import itertools
import logging
import random
import sys
import argparse
ARGP = argparse.ArgumentParser()
ARGP.add_argument('scale', type=int)
ARGP.add_argument('-w', action='store_true')
ARGP.add_argument('weapons', type=int)
ARGP.add_argument('ammo', type=int)
wfmt = """
versioninfo
{{
"editorversion" "400"
"editorbuild" "8538"
"mapversion" "0"
"formatversion" "100"
"prefab" "0"
}}
visgroups
{{
}}
viewsettings
{{
"bSnapToGrid" "1"
"bShowGrid" "1"
"bShowLogicalGrid" "0"
"nGridSpacing" "64"
"bShow3DGrid" "0"
}}
world
{{
"id" "0"
"mapversion" "0"
"classname" "worldspawn"
"skyname" "sky_day01_01"
"maxpropscreenwidth" "-1"
"detailvbsp" "detail.vbsp"
"detailmaterial" "detail/detailsprites"
{groupheader}
}}
"""
gfmt = """
group
{{
"id" "{uid}"
editor
{{
"color" "113 194 0"
"visgroupshown" "1"
"visgroupautoshown" "1"
}}
}}
"""
fmt = ("""
entity
{{
"id" "{uid.gen}"
"classname" "prop_dynamic"
"angles" "0 {angles} 0"
"DisableBoneFollowers" "0"
"disablereceiveshadows" "0"
"disableshadows" "0"
"ExplodeDamage" "0"
"ExplodeRadius" "0"
"fademaxdist" "0"
"fademindist" "-1"
"fadescale" "1"
"gmod_allowphysgun" "1"
"HoldAnimation" "0"
"MaxAnimTime" "10"
"maxdxlevel" "0"
"MinAnimTime" "5"
"mindxlevel" "0"
"model" "{model}"
"modelscale" "1.0"
"parentname" "{cargo_uid}"
"PerformanceMode" "0"
"pressuredelay" "0"
"RandomAnimation" "0"
"renderamt" "255"
"rendercolor" "255 255 255"
"renderfx" "0"
"rendermode" "0"
"SetBodyGroup" "0"
"skin" "0"
"solid" "6"
"spawnflags" "256"
"StartDisabled" "0"
"origin" "{originx[128]} {originy[128]} 0"
editor
{{
"color" "113 194 0"
"groupid" "{group_id}"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[0 0]"
}}
}}
entity
{{
"id" "{uid.gen}"
"classname" "func_physbox"
"damagetoenablemotion" "0"
"Damagetype" "0"
"disablereceiveshadows" "0"
"disableshadows" "0"
"ExplodeDamage" "40"
"explodemagnitude" "1"
"ExplodeRadius" "1"
"explosion" "0"
"forcetoenablemotion" "0"
"gibdir" "0 0 0"
"gmod_allowphysgun" "1"
"health" "1"
"massScale" "0"
"material" "1"
"modelscale" "1.0"
"nodamageforces" "0"
"notsolid" "0"
"origin" "{originx[128]} {originy[128]} 32.2"
"PerformanceMode" "0"
"preferredcarryangles" "0 0 0"
"pressuredelay" "0"
"propdata" "0"
"renderamt" "255"
"rendercolor" "255 255 255"
"renderfx" "0"
"rendermode" "0"
"spawnflags" "524288"
"spawnobject" "0"
"targetname" "{cargo_uid}"
solid
{{
"id" "{uid.gen}"
side
{{
"id" "{uid.gen}"
"plane" "({originx[96]} {originy[96]} 64) ({originx[96]} {originy[160]} 64) ({originx[160]} {originy[160]} 64)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[1 0 0 0] 0.125"
"vaxis" "[0 -1 0 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[96]} {originy[160]} 56) ({originx[96]} {originy[160]} 64) ({originx[96]} {originy[96]} 64)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[0 1 0 0] 0.125"
"vaxis" "[0 0 -1 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[160]} {originy[96]} 56) ({originx[160]} {originy[96]} 64) ({originx[160]} {originy[160]} 64)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[0 1 0 0] 0.125"
"vaxis" "[0 0 -1 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[160]} {originy[160]} 56) ({originx[160]} {originy[160]} 64) ({originx[96]} {originy[160]} 64)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[1 0 0 0] 0.125"
"vaxis" "[0 0 -1 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[96]} {originy[96]} 56) ({originx[96]} {originy[96]} 64) ({originx[160]} {originy[96]} 64)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[1 0 0 0] 0.125"
"vaxis" "[0 0 -1 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[96]} {originy[160]} 56) ({originx[96]} {originy[96]} 56) ({originx[160]} {originy[96]} 56)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[1 0 0 0] 0.125"
"vaxis" "[0 -1 0 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
editor
{{
"color" "113 194 0"
"visgroupshown" "1"
"visgroupautoshown" "1"
}}
}}
solid
{{
"id" "{uid.gen}"
side
{{
"id" "{uid.gen}"
"plane" "({originx[96]} {originy[160]} 0) ({originx[96]} {originy[96]} 0) ({originx[160]} {originy[96]} 0)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[0 1 0 0] 0.125"
"vaxis" "[0 0 -1 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[96]} {originy[96]} 8) ({originx[96]} {originy[96]} 0) ({originx[96]} {originy[160]} 0)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[1 0 0 0] 0.125"
"vaxis" "[0 0 -1 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[160]} {originy[160]} 8) ({originx[160]} {originy[160]} 0) ({originx[160]} {originy[96]} 0)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[1 0 0 0] 0.125"
"vaxis" "[0 0 -1 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[96]} {originy[160]} 8) ({originx[96]} {originy[160]} 0) ({originx[160]} {originy[160]} 0)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[1 0 0 0] 0.125"
"vaxis" "[0 -1 0 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[160]} {originy[96]} 8) ({originx[160]} {originy[96]} 0) ({originx[96]} {originy[96]} 0)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[1 0 0 0] 0.125"
"vaxis" "[0 -1 0 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[96]} {originy[96]} 8) ({originx[96]} {originy[160]} 8) ({originx[160]} {originy[160]} 8)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[0 1 0 0] 0.125"
"vaxis" "[0 0 -1 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
editor
{{
"color" "113 194 0"
"visgroupshown" "1"
"visgroupautoshown" "1"
}}
}}
solid
{{
"id" "{uid.gen}"
side
{{
"id" "{uid.gen}"
"plane" "({originx[96]} {originy[96]} 56) ({originx[96]} {originy[96]} 8) ({originx[96]} {originy[160]} 8)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[1 0 0 0] 0.125"
"vaxis" "[0 -1 0 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[96]} {originy[160]} 56) ({originx[96]} {originy[160]} 8) ({originx[104]} {originy[160]} 8)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[0 1 0 0] 0.125"
"vaxis" "[0 0 -1 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[104]} {originy[96]} 8) ({originx[96]} {originy[96]} 8) ({originx[96]} {originy[96]} 56)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[0 1 0 0] 0.125"
"vaxis" "[0 0 -1 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[96]} {originy[96]} 56) ({originx[96]} {originy[160]} 56) ({originx[104]} {originy[160]} 56)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[1 0 0 0] 0.125"
"vaxis" "[0 0 -1 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[96]} {originy[160]} 8) ({originx[96]} {originy[96]} 8) ({originx[104]} {originy[96]} 8)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[1 0 0 0] 0.125"
"vaxis" "[0 0 -1 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[104]} {originy[160]} 56) ({originx[104]} {originy[160]} 8) ({originx[104]} {originy[96]} 8)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[1 0 0 0] 0.125"
"vaxis" "[0 -1 0 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
editor
{{
"color" "113 194 0"
"visgroupshown" "1"
"visgroupautoshown" "1"
}}
}}
solid
{{
"id" "{uid.gen}"
side
{{
"id" "{uid.gen}"
"plane" "({originx[160]} {originy[160]} 56) ({originx[160]} {originy[160]} 8) ({originx[160]} {originy[96]} 8)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[0 1 0 0] 0.125"
"vaxis" "[0 0 -1 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[152]} {originy[160]} 8) ({originx[160]} {originy[160]} 8) ({originx[160]} {originy[160]} 56)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[1 0 0 0] 0.125"
"vaxis" "[0 0 -1 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[160]} {originy[96]} 56) ({originx[160]} {originy[96]} 8) ({originx[152]} {originy[96]} 8)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[1 0 0 0] 0.125"
"vaxis" "[0 0 -1 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[152]} {originy[160]} 56) ({originx[160]} {originy[160]} 56) ({originx[160]} {originy[96]} 56)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 -1 0 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[152]} {originy[96]} 8) ({originx[160]} {originy[96]} 8) ({originx[160]} {originy[160]} 8)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 -1 0 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[152]} {originy[96]} 56) ({originx[152]} {originy[96]} 8) ({originx[152]} {originy[160]} 8)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[0 1 0 0] 0.25"
"vaxis" "[0 0 -1 0] 0.25"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
editor
{{
"color" "113 194 0"
"visgroupshown" "1"
"visgroupautoshown" "1"
}}
}}
solid
{{
"id" "{uid.gen}"
side
{{
"id" "{uid.gen}"
"plane" "({originx[104]} {originy[160]} 8) ({originx[152]} {originy[160]} 8) ({originx[152]} {originy[160]} 56)"
"material" "PHOENIX_STORMS/METALFENCE004A"
"uaxis" "[1 0 0 0] 0.125"
"vaxis" "[0 0 -1 0] 0.125"
"rotation" "0"
"lightmapscale" "16"
"smoothing_groups" "0"
}}
side
{{
"id" "{uid.gen}"
"plane" "({originx[104]} {originy[152]} 56) ({originx[104]} {originy[160]} 56) ({originx[152]} {originy[160]} 56)"
"material" "PHOENIX_STORMS/METALFENCE004A"