Fix: Set ph_office as default map and add map download

- Changed default map from gm_construct to ph_office in start.sh
- Added ph_office to mapcycle.txt as first map
- Added download_prophunt_maps function to install.sh to automatically
  download and extract the ph_office map (Workshop ID: 188818807)
- Maps are extracted using gmad_linux for immediate use

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
Vish-hands
2026-01-20 09:24:06 +00:00
parent e713c9734e
commit 186887d5b2
3 changed files with 56 additions and 2 deletions

View File

@@ -279,6 +279,56 @@ apply_configs() {
log_success "Configurations applied."
}
download_prophunt_maps() {
log_info "Downloading PropHunt maps from Steam Workshop..."
# Workshop IDs for PropHunt maps
local PH_OFFICE_ID="188818807"
# Create maps directory if it doesn't exist
mkdir -p "$SERVER_DIR/garrysmod/maps"
mkdir -p "$SERVER_DIR/garrysmod/cache/srcds"
# Download ph_office using SteamCMD
log_info "Downloading ph_office map (Workshop ID: $PH_OFFICE_ID)..."
cd "$STEAMCMD_DIR"
./steamcmd.sh +login anonymous \
+workshop_download_item 4000 $PH_OFFICE_ID \
+quit 2>/dev/null || {
log_warning "SteamCMD workshop download failed, trying alternative method..."
}
# Check if GMA file was downloaded
local GMA_FILE=""
if [[ -f "$STEAMCMD_DIR/steamapps/workshop/content/4000/$PH_OFFICE_ID/*.gma" ]]; then
GMA_FILE=$(ls "$STEAMCMD_DIR/steamapps/workshop/content/4000/$PH_OFFICE_ID/"*.gma 2>/dev/null | head -1)
fi
# If we have a GMA file, extract it
if [[ -n "$GMA_FILE" ]] && [[ -f "$GMA_FILE" ]]; then
log_info "Extracting map from GMA file..."
cp "$GMA_FILE" "$SERVER_DIR/garrysmod/cache/srcds/${PH_OFFICE_ID}.gma"
cd "$SERVER_DIR"
if [[ -f "bin/gmad_linux" ]]; then
./bin/gmad_linux extract -file "garrysmod/cache/srcds/${PH_OFFICE_ID}.gma" -out garrysmod/
log_success "ph_office map extracted successfully!"
else
log_warning "gmad_linux not found. Map will be extracted on first server start."
fi
else
# Alternative: Download directly from Steam CDN if available
log_warning "Workshop download failed. The ph_office map will be downloaded when the server first uses +host_workshop_map"
log_info "You can also manually download it using: +host_workshop_map $PH_OFFICE_ID"
fi
# Check if ph_office.bsp exists
if [[ -f "$SERVER_DIR/garrysmod/maps/ph_office.bsp" ]]; then
log_success "ph_office.bsp is ready!"
else
log_warning "ph_office.bsp not found. It will be downloaded on first server start with workshop."
fi
}
create_server_config() {
log_info "Creating server configuration..."
@@ -608,6 +658,7 @@ main() {
create_start_script
create_update_script
apply_configs
download_prophunt_maps
if [[ $EUID -eq 0 ]]; then
create_systemd_service