From 186887d5b2efcc7c3f9e9c424c9a852e77fd874b Mon Sep 17 00:00:00 2001 From: Vish-hands Date: Tue, 20 Jan 2026 09:24:06 +0000 Subject: [PATCH] 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 --- cfg/mapcycle.txt | 5 ++++- install.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ scripts/start.sh | 2 +- 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/cfg/mapcycle.txt b/cfg/mapcycle.txt index eaafb52..cf556d9 100644 --- a/cfg/mapcycle.txt +++ b/cfg/mapcycle.txt @@ -1,12 +1,15 @@ // PropHunt Map Cycle // Add your PropHunt maps here +// PropHunt Maps +ph_office + // Default GMod maps (some work for PropHunt) gm_construct gm_flatgrass // Classic PropHunt Maps (require workshop downloads) -// ph_office +// ph_office (already included above - Workshop ID: 188818807) // ph_restaurant // ph_restaurant_v2 // ph_hotel diff --git a/install.sh b/install.sh index 15b6e0a..89bcf2c 100755 --- a/install.sh +++ b/install.sh @@ -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 diff --git a/scripts/start.sh b/scripts/start.sh index 62c135c..da576a9 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -9,7 +9,7 @@ SERVER_DIR="${INSTALL_DIR}/serverfiles" # Configuration (can be overridden with environment variables) SRCDS_TOKEN="${SRCDS_TOKEN:-}" SERVER_NAME="${SERVER_NAME:-PropHunt Server}" -MAP="${MAP:-gm_construct}" +MAP="${MAP:-ph_office}" MAX_PLAYERS="${MAX_PLAYERS:-24}" PORT="${PORT:-27015}" GAMEMODE="${GAMEMODE:-prop_hunt}"