Skip to content

Commit b120db0

Browse files
committed
Add an awful meta specific trigger stripping non-generic hack
fix navmeshes misc changes
1 parent 45ccb77 commit b120db0

File tree

4 files changed

+99
-24
lines changed

4 files changed

+99
-24
lines changed

LAUNCH compile.cmd

+66-18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
@rem ==== DONT MIND ME ====
2+
@set NLM=^
3+
4+
5+
@set NL=^^^%NLM%%NLM%^%NLM%%NLM%
6+
@rem ======================
7+
8+
19
@set VRADHDR=-softsun 25 -bounce 24
210
@set VBSPEXTRAS=-notjunc
311
@rem -StaticPropSampleScale 0.25 -StaticPropLighting
@@ -22,15 +30,16 @@
2230
@cd /d "%CMD_LC_ROOT%"
2331
@call common.cmd
2432
@cd /d "%CMD_LC_ROOT%"
25-
@echo Version to build: %BUILD_VERSION%
26-
@echo In: %mapfile%.vmf
27-
@echo Out: %mapname%.bsp
33+
@echo %NL% # Version to build: %BUILD_VERSION%
34+
@echo %NL% # In: %mapfile%.vmf
35+
@echo %NL% # Out: %mapname%.bsp
36+
2837
@call build_version.cmd -1
2938
@cd /d "%CMD_LC_ROOT%"
3039
@call common.cmd
3140
@cd /d "%CMD_LC_ROOT%"
3241

33-
@del /S /Q "%CMD_LC_ROOT%\bspzip_out.log"
42+
@del /S /Q "%CMD_LC_ROOT%\bspzip_out.log" 2>nul >nul
3443

3544
@if "%1"=="b" @goto buildnext
3645
@if "%1"=="B" @goto buildnext
@@ -94,8 +103,7 @@ set TESTBUILD=1
94103

95104

96105

97-
@echo Compiling version '%BUILD_VERSION%' target bsp: "%mapfolder%\%mapname%.bsp"
98-
106+
@echo %NL% # Compiling version '%BUILD_VERSION%' target bsp: "%mapfolder%\%mapname%.bsp"
99107

100108

101109
:docopy
@@ -113,13 +121,48 @@ set TESTBUILD=1
113121

114122

115123
:vmfii
116-
@echo ================= VMF Merging =================
117-
extras\vmfii "%targetvmf%" "%targetvmf%" --fgd "%FGDS%"
124+
125+
@echo %NL% # VMF Merging 
126+
127+
extras\vmfii "%targetvmf%" "%targetvmf%" --fgd "%FGDS%" >> %mapfolder%\%mapname%.log
118128
@if ERRORLEVEL 1 goto failed
119129

120130

121131

122132

133+
@if %TRIGGER_STRIPPING_HACK_ENABLE%==1 goto hack_triggerstrip
134+
@goto hack_triggerstrip_skip
135+
136+
:hack_triggerstrip
137+
@set mapname_trigger=%mapname%_trigger
138+
@echo %NL% # lua_trigger hack stripping from vmf 
139+
copy "%targetvmf%" "%mapfolder%\%mapname_trigger%.vmf"
140+
@if ERRORLEVEL 1 goto failed
141+
python removetriggers.py "%mapfolder%\%mapname_trigger%.vmf" "%targetvmf%"
142+
@if ERRORLEVEL 1 goto failed
143+
"%compilers_dir%\vbsp.exe" -allowdynamicpropsasstatic %VBSPEXTRAS% -leaktest -low "%mapfolder%\%mapname_trigger%"
144+
@if ERRORLEVEL 1 goto failed
145+
146+
@echo %NL% # Generating trigger files in data folder
147+
COPY "%mapfolder%\%mapname_trigger%.bsp" "%GameDir%\maps\%mapname_trigger%.bsp"
148+
@if ERRORLEVEL 1 goto trigger_fail
149+
@cd /d "%CMD_LC_ROOT%"
150+
call extras\gmodcommander.cmd trigger_extract "%mapname_trigger%"
151+
@if ERRORLEVEL 1 goto trigger_fail
152+
@goto trigger_ok
153+
:trigger_fail
154+
@cd /d "%CMD_LC_ROOT%"
155+
@echo trigger extraction failed :(
156+
:trigger_ok
157+
@cd /d "%CMD_LC_ROOT%"
158+
159+
160+
161+
:hack_triggerstrip_skip
162+
163+
164+
165+
123166

124167

125168

@@ -128,8 +171,8 @@ extras\vmfii "%targetvmf%" "%targetvmf%" --fgd "%FGDS%"
128171

129172

130173
:vbsp
131-
@echo ================= VBSP ====================================================
132174

175+
@echo %NL% # VBSP 
133176

134177
@echo VProject %VProject%
135178
"%compilers_dir%\vbsp.exe" -allowdynamicpropsasstatic %VBSPEXTRAS% -leaktest -low "%mapfolder%\%mapname%"
@@ -139,8 +182,8 @@ extras\vmfii "%targetvmf%" "%targetvmf%" --fgd "%FGDS%"
139182

140183

141184
:vvis
142-
@echo ================= VVIS ====================================================
143185

186+
@echo %NL% # VVIS
144187
if not %TESTBUILD%==1 "%compilers_dir%\vvis.exe" -low "%mapfolder%\%mapname%"
145188
@if ERRORLEVEL 1 goto failed
146189

@@ -150,13 +193,15 @@ if not %TESTBUILD%==1 "%compilers_dir%\vvis.exe" -low "%mapfolder%\%mapname%"
150193
@if %NOLDR%==1 goto vradhdr
151194

152195
:vradldr
153-
@echo ================= VRAD LDR ================================================
196+
197+
@echo %NL% # VRAD LDR
154198
if not %TESTBUILD%==1 "%compilers_dir%\vrad.exe" -low %VRADLDR% -noskyboxrecurse -ldr "%mapfolder%\%mapname%"
155199
@if ERRORLEVEL 1 goto failed
156200

157201

158202
:vradhdr
159-
@echo ================= VRAD HDR ================================================
203+
204+
@echo %NL% # VRAD HDR
160205
if not %TESTBUILD%==1 "%compilers_dir%\vrad.exe" -low %VRADHDR% -noskyboxrecurse -hdr "%mapfolder%\%mapname%"
161206
@if ERRORLEVEL 1 goto failed
162207

@@ -168,7 +213,8 @@ if not %TESTBUILD%==1 "%compilers_dir%\vrad.exe" -low %VRADHDR% -noskyboxrecurse
168213
:reprocess
169214

170215
:copy
171-
@echo ================= Copying to game =========================================
216+
217+
@echo %NL% # Copying to game
172218
COPY "%mapfolder%\%mapname%.bsp" "%GameDir%\maps\%mapname%.bsp"
173219
@if ERRORLEVEL 1 goto failed
174220

@@ -285,6 +331,8 @@ goto hdrok
285331
:navmesh
286332
@echo ================= Generating navmesh =================
287333

334+
@set targetnav=%GameDir%\maps\%mapname%.nav
335+
288336
@if not exist "%mapfolder%\%mapfile%.lm.txt" @goto navmesh_noseeds
289337

290338
@cd /d "%CMD_LC_ROOT%"
@@ -293,7 +341,7 @@ goto hdrok
293341
@if ERRORLEVEL 1 goto failed
294342
@cd /d "%CMD_LC_ROOT%"
295343

296-
goto navmesh_end
344+
@goto navmesh_end
297345
:navmesh_noseeds
298346
@echo SKIPPING: Seed file missing "%mapfolder%\%mapfile%.lm.txt"
299347
:navmesh_end
@@ -303,11 +351,11 @@ goto navmesh_end
303351
@start /low /min extras\bzip2.exe -kf -9 "%GameDir%\maps\%mapname%.bsp"
304352
@start /low /min extras\bzip2.exe -kf -9 "%GameDir%\maps\graphs\%mapname%.ain"
305353

306-
@set "filename=%GameDir%\maps\%mapname%.nav"
354+
@rem Check navmesh existing and warn if not
307355
@set size=0
308-
@for /f %%A in (%filename%) do set size=%%~zA
309-
@if %size% GTR 1 @goto navok
310-
@echo "NAVMESH GENERATION FAILED. Size=%size%"
356+
@for /f %%i in ("%targetnav%") do set size=%%~zi
357+
@if %size% gtr 0 @goto navok
358+
@echo NAVMESH GENERATION FAILED (%targetnav%). Size=%size%
311359
@goto navcskip
312360
:navok
313361
@start /low /min extras\bzip2.exe -kf -9 "%GameDir%\maps\%mapname%.nav"

extras/gmodcommander.cmd

+12-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
@copy /Y build_cubemaps.lua "%GameDir%"\lua\autorun\client\build_cubemaps.lua > nul
1111
@if ERRORLEVEL 1 goto fail
1212

13+
@copy /Y trigger_extract.lua "%GameDir%"\lua\autorun\server\trigger_extract.lua > nul
14+
@if ERRORLEVEL 1 goto fail
15+
1316
@copy /Y gmodcommander.cfg "%GameDir%"\cfg\gmodcommander.cfg > nul
1417
@if ERRORLEVEL 1 goto fail
1518

@@ -26,27 +29,30 @@
2629
@If "%1"=="missing" @goto missing
2730
@If "%1"=="cubemaps_ldr" @goto cubemaps_ldr
2831
@If "%1"=="navmesh" @goto navmesh
32+
@If "%1"=="trigger_extract" @goto trigger_extract
2933
@If "%1"=="cubemaps_hdr" @goto cubemaps_hdr
3034

3135
@echo "ERROR: Unknown task: %1"
3236
@goto out
3337

3438
:missing
35-
start "AUTOMATION" /D "%GameExeDir%" /wait /min "%GAME_EXE%" -game "%GameDir%" -multirun -disableluarefresh -noworkshop -windowed %GCNOADDONS% -insecure -nohltv -condebug -textmode -toconsole +map %2 +exec gmodcommander +con_nprint_bgalpha writemissing
39+
start "MAP TOOLKIT: VMT" /D "%GameExeDir%" /wait /min "%GAME_EXE%" -game "%GameDir%" -multirun -disableluarefresh -noworkshop -windowed %GCNOADDONS% -insecure -nohltv -condebug -textmode -toconsole +map %2 +exec gmodcommander +con_nprint_bgalpha writemissing
40+
@goto win
41+
42+
:trigger_extract
43+
start "MAP TOOLKIT: TRIGGERS" /D "%GameExeDir%" /wait /min "%GAME_EXE%" -game "%GameDir%" -multirun -console -noworkshop %GCNOADDONS% -windowed -disableluarefresh -insecure -nohltv -condebug -textmode -toconsole +map %2 +exec gmodcommander +con_nprint_bgalpha trigger_extract
3644
@goto win
3745

3846
:cubemaps_ldr
39-
@rem start "AUTOMATION" /D "%GameExeDir%" /wait /min "%GAME_EXE%" -game "%GameDir%" -multirun -w 1024 -h 768 -windowed -console -disableluarefresh -insecure -nohltv -condebug -toconsole +map %2 +sv_cheats 1 +mat_hdr_level 0 +mat_specular 0 -buildcubemaps
40-
start "AUTOMATION" /D "%GameExeDir%" /wait /min "%GAME_EXE%" -game "%GameDir%" -multirun -w 1024 -h 1024 -noworkshop %GCNOADDONS% -windowed -console -disableluarefresh -insecure -nohltv -condebug -toconsole +map %2 +sv_cheats 1 +mat_hdr_level 0 +mat_specular 0 +exec gmodcommander +con_nprint_bgalpha cubemaps
47+
start "MAP TOOLKIT: LDR" /D "%GameExeDir%" /wait /min "%GAME_EXE%" -game "%GameDir%" -multirun -w 1024 -h 1024 -noworkshop %GCNOADDONS% -windowed -console -disableluarefresh -insecure -nohltv -condebug -toconsole +map %2 +sv_cheats 1 +mat_hdr_level 0 +mat_specular 0 +exec gmodcommander +con_nprint_bgalpha cubemaps
4148
@goto win
4249

4350
:cubemaps_hdr
44-
@rem start "AUTOMATION" /D "%GameExeDir%" /wait /min "%GAME_EXE%" -game "%GameDir%" -multirun -w 1024 -h 768 -windowed -console -disableluarefresh -insecure -nohltv -condebug -toconsole +map %2 +sv_cheats 1 +mat_hdr_level 2 +mat_specular 0 -buildcubemaps
45-
start "AUTOMATION" /D "%GameExeDir%" /wait /min "%GAME_EXE%" -game "%GameDir%" -multirun -w 1024 -h 1024 -noworkshop %GCNOADDONS% -windowed -console -disableluarefresh -insecure -nohltv -condebug -toconsole +map %2 +sv_cheats 1 +mat_hdr_level 2 +mat_specular 0 +exec gmodcommander +con_nprint_bgalpha cubemaps
51+
start "MAP TOOLKIT: HDR" /D "%GameExeDir%" /wait /min "%GAME_EXE%" -game "%GameDir%" -multirun -w 1024 -h 1024 -noworkshop %GCNOADDONS% -windowed -console -disableluarefresh -insecure -nohltv -condebug -toconsole +map %2 +sv_cheats 1 +mat_hdr_level 2 +mat_specular 0 +exec gmodcommander +con_nprint_bgalpha cubemaps
4652
@goto win
4753

4854
:navmesh
49-
start "AUTOMATION" /D "%GameExeDir%" /wait /min "%GAME_EXE%" -game "%GameDir%" -multirun -console -noworkshop %GCNOADDONS% -windowed -disableluarefresh -insecure -nohltv -condebug -textmode -toconsole +map %2 +exec gmodcommander +con_nprint_bgalpha navmesh
55+
start "MAP TOOLKIT: NAV" /D "%GameExeDir%" /wait /min "%GAME_EXE%" -game "%GameDir%" -multirun -console -noworkshop %GCNOADDONS% -windowed -disableluarefresh -insecure -nohltv -condebug -textmode -toconsole +map %2 +exec gmodcommander +con_nprint_bgalpha navmesh
5056
@goto win
5157

5258
@goto win

publish_map.cmd

+3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ copy "%GameDir%\maps\%mapname%.bsp" "%mapfolder%\%mapfile%\maps\"
3131
copy "%GameDir%\maps\graphs\%mapname%.ain" "%mapfolder%\%mapfile%\maps\graphs"
3232
)
3333

34+
35+
@if %DONT_PUBLISH_NAV%==1 @goto nocopynav
3436
@if exist "%GameDir%\maps\%mapname%.nav" copy "%GameDir%\maps\%mapname%.nav" "%mapfolder%\%mapfile%\maps\"
37+
:nocopynav
3538

3639
@if exist "%mapfolder%\%mapfile%.gma" @del "%mapfolder%\%mapfile%.gma"
3740

removetriggers.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import vmf_tool
2+
import sys,os
3+
4+
v = vmf_tool.Vmf(sys.argv[1])
5+
outf=sys.argv[2]
6+
#import code
7+
#code.interact(local=locals())
8+
removed=0
9+
entities=v.raw_namespace.entities
10+
for ent in entities:
11+
if ent.classname=="lua_trigger":
12+
#print(ent,ent.classname,ent.place)
13+
removed+=1
14+
entities.remove(ent)
15+
16+
print("Removed",removed,"triggers")
17+
18+
v.save_to_file(outf)

0 commit comments

Comments
 (0)