6 Commits
Author SHA1 Message Date
Justin Oros 126a5ab548 Add downloads and latest version badges 2026-09-28 12:42:31 -07:00
Justin Oros 891d315f77 Fix truncated Install.ps1 2026-09-23 17:25:46 -07:00
Justin Oros 01cb41b551 Add -Remove option to Install.ps1 2026-09-22 21:02:35 -07:00
Justin Oros b551a3c98a Fix README formatting 2026-09-22 20:44:30 -07:00
Justin Oros d20ebcfadc Remove screenshot from README 2026-09-22 20:43:10 -07:00
Justin Oros f8dddb466b Add README and one-line installer 2026-09-22 20:41:15 -07:00
2 changed files with 253 additions and 0 deletions
+157
View File
@@ -0,0 +1,157 @@
[CmdletBinding()]
param(
[string]$GameDir,
[switch]$Remove
)
$ErrorActionPreference = 'Stop'
function Write-Step {
param([string]$Text)
Write-Host ''
Write-Host $Text -ForegroundColor Cyan
}
function Find-GameDir {
$steam = (Get-ItemProperty 'HKCU:\Software\Valve\Steam' -ErrorAction SilentlyContinue).SteamPath
if (-not $steam) { return $null }
$libs = @($steam)
$vdf = Join-Path $steam 'steamapps\libraryfolders.vdf'
if (Test-Path $vdf) {
Select-String -Path $vdf -Pattern '"path"\s+"(.+?)"' -AllMatches |
ForEach-Object { $_.Matches } |
ForEach-Object { $libs += $_.Groups[1].Value.Replace('\\','\') }
}
foreach ($lib in $libs) {
$candidate = Join-Path $lib 'steamapps\common\Sons Of The Forest'
if (Test-Path (Join-Path $candidate 'SonsOfTheForest.exe')) { return $candidate }
}
return $null
}
function Get-ReleaseZip {
param([string]$Repo, [string]$Pattern, [string]$OutFile)
$release = Invoke-RestMethod "https://api.github.com/repos/$Repo/releases/latest" -Headers @{ 'User-Agent' = 'ps' }
$asset = $release.assets | Where-Object { $_.name -match $Pattern } | Select-Object -First 1
if (-not $asset) { throw "Could not find a download matching $Pattern in the latest $Repo release" }
Write-Host " version $($release.tag_name)"
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $OutFile -UseBasicParsing
return $asset.name
}
try {
Write-Host ''
Write-Host '====================================' -ForegroundColor Green
Write-Host ' PlayerList installer' -ForegroundColor Green
Write-Host '====================================' -ForegroundColor Green
if (Get-Process -Name 'SonsOfTheForest' -ErrorAction SilentlyContinue) {
throw 'Sons of the Forest is running. Close the game and run the installer again.'
}
Write-Step 'Looking for Sons of the Forest'
if (-not $GameDir) { $GameDir = Find-GameDir }
if (-not $GameDir -or -not (Test-Path (Join-Path $GameDir 'SonsOfTheForest.exe'))) {
Write-Host ' Could not find the game automatically.' -ForegroundColor Yellow
Write-Host ' In Steam, right-click Sons Of The Forest, then Manage, then Browse local files.'
Write-Host ' Copy the folder path from the address bar and paste it below.'
$GameDir = (Read-Host ' Game folder').Trim('"')
if (-not (Test-Path (Join-Path $GameDir 'SonsOfTheForest.exe'))) {
throw "SonsOfTheForest.exe was not found in $GameDir"
}
}
Write-Host " found: $GameDir" -ForegroundColor Green
if ($Remove) {
Write-Step 'Removing PlayerList'
$modsDir = Join-Path $GameDir 'Mods'
$dll = Join-Path $modsDir 'PlayerList.dll'
$dataDir = Join-Path $modsDir 'PlayerList'
$config = Join-Path $GameDir 'UserData\PlayerList.txt'
$removed = $false
foreach ($item in @($dll, $dataDir, $config)) {
if (Test-Path $item) {
Remove-Item $item -Recurse -Force
Write-Host " removed $item"
$removed = $true
}
}
if ($removed) {
Write-Host ' PlayerList removed. RedLoader and your other mods were left alone.' -ForegroundColor Green
}
else {
Write-Host ' PlayerList was not installed' -ForegroundColor Yellow
}
Write-Host ''
return
}
$needsFirstLaunch = $false
Write-Step 'Checking for RedLoader'
if (Test-Path (Join-Path $GameDir '_RedLoader\net6\SonsSdk.dll')) {
Write-Host ' already installed' -ForegroundColor Green
}
else {
Write-Host ' not installed, downloading it now'
$rlZip = Join-Path $env:TEMP 'RedLoader.zip'
Get-ReleaseZip -Repo 'ToniMacaroni/RedLoader' -Pattern '^RedLoader.*\.zip$' -OutFile $rlZip | Out-Null
$rlStage = Join-Path $env:TEMP 'redloader-stage'
if (Test-Path $rlStage) { Remove-Item $rlStage -Recurse -Force }
Expand-Archive -Path $rlZip -DestinationPath $rlStage -Force
Copy-Item -Path (Join-Path $rlStage '*') -Destination $GameDir -Recurse -Force
Remove-Item $rlZip -Force -ErrorAction SilentlyContinue
Remove-Item $rlStage -Recurse -Force -ErrorAction SilentlyContinue
Write-Host ' installed' -ForegroundColor Green
$needsFirstLaunch = $true
}
Write-Step 'Downloading PlayerList'
$modZip = Join-Path $env:TEMP 'PlayerList.zip'
Get-ReleaseZip -Repo 'JustinOros/sotf-playerlist' -Pattern '^PlayerList\.zip$' -OutFile $modZip | Out-Null
Write-Step 'Installing PlayerList'
$modsDir = Join-Path $GameDir 'Mods'
New-Item -ItemType Directory -Force -Path $modsDir | Out-Null
Remove-Item (Join-Path $modsDir 'PlayerList.dll') -Force -ErrorAction SilentlyContinue
Remove-Item (Join-Path $modsDir 'PlayerList') -Recurse -Force -ErrorAction SilentlyContinue
Expand-Archive -Path $modZip -DestinationPath $modsDir -Force
Remove-Item $modZip -Force -ErrorAction SilentlyContinue
if (-not (Test-Path (Join-Path $modsDir 'PlayerList.dll'))) {
throw 'Something went wrong, PlayerList.dll is not in the Mods folder'
}
if (-not (Test-Path (Join-Path $modsDir 'PlayerList\manifest.json'))) {
throw 'Something went wrong, manifest.json is not in the Mods\PlayerList folder'
}
Write-Host ' installed' -ForegroundColor Green
Write-Host ''
Write-Host '====================================' -ForegroundColor Green
Write-Host ' Done' -ForegroundColor Green
Write-Host '====================================' -ForegroundColor Green
Write-Host ''
if ($needsFirstLaunch) {
Write-Host 'RedLoader was installed for the first time, so the next time you start'
Write-Host 'the game it will take a few extra minutes to get ready. That is normal.'
Write-Host ''
}
Write-Host 'Start Sons of the Forest, then:'
Write-Host ' 1. Check that MODS appears on the main menu and lists PlayerList'
Write-Host ' 2. Join or host a multiplayer game'
Write-Host ' 3. Hold TAB to see the connected players'
Write-Host ''
Write-Host 'To uninstall, run this script again with -Remove'
Write-Host ''
}
catch {
Write-Host ''
Write-Host "Install failed: $($_.Exception.Message)" -ForegroundColor Red
if ($_.Exception.Message -match 'denied') {
Write-Host 'Try again from PowerShell opened with Run as administrator.' -ForegroundColor Yellow
}
Write-Host ''
}
+96
View File
@@ -0,0 +1,96 @@
# PlayerList
[![Downloads](https://img.shields.io/github/downloads/JustinOros/sotf-playerlist/total?label=downloads)](https://github.com/JustinOros/sotf-playerlist/releases) [![Latest](https://img.shields.io/github/v/release/JustinOros/sotf-playerlist?label=latest)](https://github.com/JustinOros/sotf-playerlist/releases/latest)
Hold TAB to see a list of the players connected to your Sons of the Forest game.
## Multiplayer
Client side only. Nothing gets installed on a dedicated server, and other
players do not need the mod. Works on dedicated servers and on games hosted by
a player.
## Installation
### Easy install
Close the game, open PowerShell and paste:
```powershell
irm https://raw.githubusercontent.com/JustinOros/sotf-playerlist/main/Install.ps1 | iex
```
It finds your game, installs RedLoader if needed, and installs the latest
PlayerList. Run it again any time to update.
### Manual install
#### Step 1: Install RedLoader
[RedLoader](https://github.com/ToniMacaroni/RedLoader/releases/latest) is the mod
loader for Sons of the Forest. The game cannot load any mod without it, so
install it first. You only have to do this once.
1. Download `RedLoader.zip` from the
[latest RedLoader release](https://github.com/ToniMacaroni/RedLoader/releases/latest)
2. Extract it into your Sons of the Forest folder, the one containing
`SonsOfTheForest.exe`, usually
`C:\Program Files (x86)\Steam\steamapps\common\Sons Of The Forest`
3. Launch the game once and wait until you reach the main menu. The first launch
takes a few minutes while RedLoader processes the game files
4. Check that `MODS` appears on the main menu, then quit
#### Step 2: Install PlayerList
1. Download `PlayerList.zip` from the
[latest release](https://github.com/JustinOros/sotf-playerlist/releases/latest)
2. Extract it into the `Mods` folder inside your game folder
3. You should end up with:
```
Mods\PlayerList.dll
Mods\PlayerList\manifest.json
```
## Usage
In a multiplayer game, hold TAB. The list shows every connected player with
your own name marked `(you)`. Release TAB to hide it.
Press F1 to open the console, then use these commands:
| Command | Action |
| --- | --- |
| `playerlist` | Show the player list on screen and write it to `_RedLoader\Latest.log` |
| `playerlist key F2` | Change the key that shows the list |
The key is saved to `UserData\PlayerList.txt` in your game folder.
## Uninstall
Close the game, open PowerShell and paste:
```powershell
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/JustinOros/sotf-playerlist/main/Install.ps1))) -Remove
```
Or from a clone of this repo, run `.\Install.ps1 -Remove`. This removes only
PlayerList and its settings. RedLoader and your other mods are left alone.
## Building from source
Requires the .NET 8 SDK and RedLoader installed with its game assemblies
generated.
```powershell
.\build.ps1 -Install
```
Use `-Package` to build `PlayerList.zip` for a release. Pass `-GameDir "path"` if
the game is not found automatically.
## Troubleshooting
Check `_RedLoader\Latest.log` in your game folder. PlayerList logs a line when
it loads. Running `playerlist` in the console also logs every tracked player
entity, which helps if a name is missing or wrong.