1 Commits

Author SHA1 Message Date
Vish-hands
186887d5b2 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>
2026-01-20 09:24:06 +00:00
3 changed files with 56 additions and 2 deletions

View File

@@ -1,12 +1,15 @@
// PropHunt Map Cycle // PropHunt Map Cycle
// Add your PropHunt maps here // Add your PropHunt maps here
// PropHunt Maps
ph_office
// Default GMod maps (some work for PropHunt) // Default GMod maps (some work for PropHunt)
gm_construct gm_construct
gm_flatgrass gm_flatgrass
// Classic PropHunt Maps (require workshop downloads) // Classic PropHunt Maps (require workshop downloads)
// ph_office // ph_office (already included above - Workshop ID: 188818807)
// ph_restaurant // ph_restaurant
// ph_restaurant_v2 // ph_restaurant_v2
// ph_hotel // ph_hotel

View File

@@ -279,6 +279,56 @@ apply_configs() {
log_success "Configurations applied." 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() { create_server_config() {
log_info "Creating server configuration..." log_info "Creating server configuration..."
@@ -608,6 +658,7 @@ main() {
create_start_script create_start_script
create_update_script create_update_script
apply_configs apply_configs
download_prophunt_maps
if [[ $EUID -eq 0 ]]; then if [[ $EUID -eq 0 ]]; then
create_systemd_service create_systemd_service

View File

@@ -9,7 +9,7 @@ SERVER_DIR="${INSTALL_DIR}/serverfiles"
# Configuration (can be overridden with environment variables) # Configuration (can be overridden with environment variables)
SRCDS_TOKEN="${SRCDS_TOKEN:-}" SRCDS_TOKEN="${SRCDS_TOKEN:-}"
SERVER_NAME="${SERVER_NAME:-PropHunt Server}" SERVER_NAME="${SERVER_NAME:-PropHunt Server}"
MAP="${MAP:-gm_construct}" MAP="${MAP:-ph_office}"
MAX_PLAYERS="${MAX_PLAYERS:-24}" MAX_PLAYERS="${MAX_PLAYERS:-24}"
PORT="${PORT:-27015}" PORT="${PORT:-27015}"
GAMEMODE="${GAMEMODE:-prop_hunt}" GAMEMODE="${GAMEMODE:-prop_hunt}"