Initial commit

This commit is contained in:
Eagle517
2025-02-09 03:28:25 -06:00
commit f3f758c163
6 changed files with 223 additions and 0 deletions

17
bin/install-bl Normal file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -e
cd /data
echo "Installing Blockland..."
curl -fsSL -A "blocklandWIN/2.0" -o /tmp/latest-manifest.dat http://update.blockland.us/latestVersion.php
download_url=$(head -n 1 /tmp/latest-manifest.dat | cut -f 2)
tail -n +2 /tmp/latest-manifest.dat | tr '\r\n\t' '\0' | xargs -0 -n 2 -P $BL_INST_NUM_PROC sh -c \
'file="./$2"; if [ "$BL_INST_OVERWRITE" -eq 1 ]; then zflag="-z $'$file'"; else zflag=; fi; curl -fsSL -A "blocklandWIN/2.0" --create-dirs $zflag -o "$file" $1/$3' _ $download_url
if [[ "$BL_PATCH_ENABLE" -eq 1 ]]; then
source patch-bl
fi

10
bin/patch-bl Normal file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
set -e
cd /data
echo "Patching Blockland..."
curl -fsSLJ --clobber -o Blockland.exe $BL_PATCH_EXE_URL
curl -fsSLJ --clobber -o RedBlocklandLoader.dll $BL_PATCH_LOADER_URL
curl -fsSLJ --clobber --output-dir ./modules/ --create-dirs -o WineFix.dll $BL_PATCH_WINEFIX_URL

60
bin/run-bl Normal file
View File

@@ -0,0 +1,60 @@
#!/bin/bash
set -e
cd /data
if [[ "$BL_INST_FORCE" -eq 1 ]] || [ ! -f "Blockland.exe" ]; then
source "install-bl"
fi
if [ -z "$BL_PORT" ]; then
echo "Please provide a port by setting BL_PORT"
exit -1
fi
if [ -z "$BL_GAMEMODE" ]; then
echo "Please provide a gamemode by setting BL_GAMEMODE"
exit -1
fi
if [ -z "$BL_SERVER_NAME" ]; then
echo "Please provide a server name by setting BL_SERVER_NAME"
exit -1
fi
if [[ "$BL_MAX_PLAYERS" -lt 1 ]]; then
echo "BL_MAX_PLAYERS must be greater than 0"
exit -1
fi
if [[ "$BL_DEDI_LAN" -eq 0 ]]; then
if [ -z "$BL_DTOKEN" ]; then
echo "Please provide a dtoken by setting BL_DTOKEN"
exit -1
fi
dedi=dedicated
else
dedi=dedicatedLAN
fi
unset DISPLAY
# If the wine prefix doesn't exist, create it using wineboot
# rather than having it be created by launching Blockland,
# as Blockland will hang otherwise.
if [ ! -d "$HOME/.wine" ]; then
echo "Creating wine prefix..."
wineboot -i
# Annoyingly, if Blockland is launched too quickly after wineboot,
# CreateWindowExA fails which means winsockWindow in winNet.cc@184
# in TGE is set to NULL. This causes all networking in Blockland
# to not function correctly, as WinsockProc will not be called.
echo "Waiting for wine to fully init..."
sleep 3
fi
echo "Launching Blockland..."
xvfb-run -a wine "Blockland.exe" ptlaaxobimwroe -${dedi} -port $BL_PORT -dtoken $BL_DTOKEN -gamemode $BL_GAMEMODE -serverName $BL_SERVER_NAME -maxPlayers $BL_MAX_PLAYERS $BL_EXTRA_ARGS