forked from TeamSpen210/HammerAddons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.bat
50 lines (44 loc) · 1.39 KB
/
build.bat
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
49
50
@echo off
setlocal EnableDelayedExpansion
SET games=p2 p1 hl2 ep1 ep2 gmod csgo tf2 asw l4d l4d2 infra mesa
:: If set, override the FGD filename generated.
SET filename.p2=portal2
SET filename.p1=portal
SET filename.ep1=episodic
SET filename.tf2=tf
SET filename.l4d=left4dead
SET filename.l4d2=left4dead2
SET filename.mesa=blackmesa
SET game=%1
:: Make sure game isn't empty
:while
IF [%game%]==[] (echo Games: %games% & echo Enter game to build. Use ALL to build every game. & SET /P game= & GOTO :while)
IF /I %game%==ALL (
CALL :copy_hammer_files
(FOR %%i in (%games%) do (
CALL :build_game %%i
))
EXIT
) ELSE (
(FOR %%i in (%games%) do (
IF /I %game%==%%i (
CALL :copy_hammer_files
CALL :build_game %game%
EXIT
)
))
echo Unknown game. Exitting. & EXIT /B 1
)
:build_game
SET tag=%1
IF DEFINED filename.%tag% (SET fname=!filename.%tag%!) ELSE (SET fname=%tag%)
echo Building FGD for %1 as "%fname%.fgd"...
python src/hammeraddons/unify_fgd.py exp "%tag%" srctools -o "build/%fname%.fgd"
IF %ERRORLEVEL% NEQ 0 (echo Building FGD for %tag% has failed. Exitting. & EXIT)
EXIT /B
:copy_hammer_files
echo Copying Hammer files...
IF %ERRORLEVEL% LSS 8 robocopy hammer build/hammer /S /PURGE
IF %ERRORLEVEL% LSS 8 robocopy instances build/instances /XF *.vmx /S /PURGE
IF %ERRORLEVEL% LSS 8 EXIT /B 0
echo Failed copying Hammer files. Exitting. & EXIT