forked from HaloSpaceStation/HaloSpaceStation13
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.sh
executable file
·72 lines (51 loc) · 1.58 KB
/
compile.sh
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
function compile_map {
mapname=$1
#delete the old environment file if it exists
if [ -f $mapname.dme ]
then
rm $mapname.dme
fi
#copy a new one as template
cp baystation12.dme $mapname.dme
#prep it... these sed calls are ripped from scripts\dm.sh
#add the MAP_OVERRIDE define to stop dreammaker complaining
sed -i '1s!^!#define 'MAP_OVERRIDE'\n!' $mapname.dme
#not sure what this does exactly, HACK HACK
#sed -i 's!// BEGIN_INCLUDE!// BEGIN_INCLUDE\n#include "'$arg'"!' $dmepath.dme
#actual map file include
sed -i 's!#include "maps\\_map_include.dm"!#include "maps\\'$mapname'\\'$mapname'.dm"!' $mapname.dme
#compile the dmb
"$DM" "$mapname.dme"
#write it out so that dreamseeker can access the list
echo $mapname >> switchable_maps
rm $mapname.dme
}
source "$( dirname "${BASH_SOURCE[0]}" )/scripts/sourcedm.sh"
if [[ $DM == "" ]]; then
echo "Couldn't find the DreamMaker executable, aborting."
exit 3
fi
#compile the initial dmb
"$DM" "baystation12.dme"
#wipe the existing list of precompiled maps
if [ -f switchable_maps ]
then
rm switchable_maps
fi
# depends on # of spaces, which isn't the best, but hopefully that doesn't change much
grep -P "\s{10}- " .github/workflows/tests.yml | while read -r line ; do
#make sure this line isnt commented out
hashpos=`expr index "$line" \#`
if [ $hashpos -eq 0 ]
then
#this is a nasty hack
linepos=`expr index "$line" H`
linepos=`expr $linepos + 1`
#we've extracted the mapname
mapname=${line:linepos}
# now compile it
compile_map $mapname
fi
done
sleep 10 #Sleep for 10 seconds