VocationLife/Source/VocationLife/Public/VocationServerSettings.h
pixachux 932157eda5 Add Steam/LAN multiplayer menu with map and IP:Port connect, plus headless web admin.
Players can host or join via Steam or LAN, pick maps, and connect by address; dedicated servers expose an HTTP panel for port and game rules.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-22 19:06:28 +02:00

88 lines
2.5 KiB
C++

// Copyright VocationLife Project. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/Object.h"
#include "VocationServerSettings.generated.h"
USTRUCT(BlueprintType)
struct FVocationMapOption
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Map")
FString DisplayName;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Map")
FString MapPath;
};
USTRUCT(BlueprintType)
struct FVocationGameRules
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Rules")
bool bFriendlyFire = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Rules")
float DayLengthMinutes = 20.f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Rules")
bool bAllowVocationSwitch = true;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Rules")
int32 StartingOre = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Rules")
float MiningRespawnSeconds = 30.f;
};
/**
* Runtime + config-backed dedicated server settings.
* Loaded from Config/ServerConfig.ini and mutable via the web admin.
*/
UCLASS(Config = ServerConfig, DefaultConfig)
class VOCATIONLIFE_API UVocationServerSettings : public UObject
{
GENERATED_BODY()
public:
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "Server")
FString ServerName = TEXT("VocationLife Dedicated Server");
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "Server")
int32 MaxPlayers = 4;
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "Server")
int32 GamePort = 7777;
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "Server")
int32 AdminHttpPort = 8080;
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "Server")
bool bLANOnly = false;
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "Server")
bool bUseSteam = true;
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "Server")
FString AdminPassword = TEXT("vocation");
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "Server")
FString DefaultMapPath = TEXT("/Engine/Maps/Entry");
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "Server")
FVocationGameRules GameRules;
UFUNCTION(BlueprintCallable, Category = "VocationLife|Server")
void LoadFromDisk();
UFUNCTION(BlueprintCallable, Category = "VocationLife|Server")
void SaveToDisk();
UFUNCTION(BlueprintCallable, Category = "VocationLife|Server")
static TArray<FVocationMapOption> GetAvailableMaps();
};