From d323f629247555e45dd9251b73bf1749570f1f4a Mon Sep 17 00:00:00 2001
From: Kittenji <41535779+ChrisFeline@users.noreply.github.com>
Date: Thu, 21 May 2026 09:05:21 -0400
Subject: [PATCH] ToN_PlayerCount parameter
---
CHANGELOG.md | 2 ++
Docs/OSC/OSC_Parameters.md | 5 +++++
Utils/LilOSC.cs | 11 ++++++++++-
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a07d4ea..09d67af 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,4 +4,6 @@
- Updated Terror ID database for new and modified terrors.
* These changes won't be reflected on the Discord Rich presence for now.
- Updated 繁體中文 localization (ty @XoF-eLtTiL).
+- New OSC parameter: ToN_PlayerCount
+ * This parameter indicates the lobby size, not the participating players or alive.
- Removed YoBro
\ No newline at end of file
diff --git a/Docs/OSC/OSC_Parameters.md b/Docs/OSC/OSC_Parameters.md
index 809dc77..c846127 100644
--- a/Docs/OSC/OSC_Parameters.md
+++ b/Docs/OSC/OSC_Parameters.md
@@ -19,6 +19,11 @@ Parameter | Type | Description
`ToN_Damaged` | `INT`
`FLOAT` | Value set for a few frames when the player takes damage. The number represents the amount of damage taken on that hit. If the player dies the base damage number will be `255`
`ToN_DeathID` | `INT` | You can use this parameter to track when your friends die in the game.
+# Other
+Parameter | Type | Description
+-----------------|---------|--------------------------
+`ToN_PlayerCount`| `INT` | Number of players in the lobby.
+
### ToN_Damaged
> You can customize the output value for the `ToN_Damaged` parameter using [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript).
> Just click on **Settings > Send Damage Event > (Set Output)** and here you can specify the code that will be evaluated before sending the damage value as a float.
diff --git a/Utils/LilOSC.cs b/Utils/LilOSC.cs
index 49f705e..f464d1b 100644
--- a/Utils/LilOSC.cs
+++ b/Utils/LilOSC.cs
@@ -200,12 +200,15 @@ internal static class LilOSC {
const string ParamItemStatus = "ToN_ItemStatus";
const string ParamMaster = "ToN_MasterChange";
+ const string ParamPlayerCount = "ToN_PlayerCount";
+
static readonly string[] ParamAll = [
ParamRoundType, ParamTerror1, ParamTerror2, ParamTerror3, ParamTPhase1, ParamTPhase2, ParamTPhase3,
ParamOptedIn, ParamSaboteur, ParamMap, ParamEncounter,
ParamTerrorColorH, ParamTerrorColorS, ParamTerrorColorV, ParamTerrorColorL,
ParamTerrorColorR, ParamTerrorColorG, ParamTerrorColorB,
- ParamAlive, ParamReborn, ParamDamaged, ParamMaster, ParamDeath, ParamPages, ParamItemStatus
+ ParamAlive, ParamReborn, ParamDamaged, ParamMaster, ParamDeath, ParamPages, ParamItemStatus,
+ ParamPlayerCount
];
const string ParameterFileName = "osc_parameters.txt";
internal static void Initialize() {
@@ -237,6 +240,8 @@ internal static void Initialize() {
static int LastPageCount = 0;
+ static int LastPlayerCount = 0;
+
static string[]? m_EncounterKeys { get; set; }
static string[] EncounterKeys {
get {
@@ -267,6 +272,8 @@ static string[] EncounterKeys {
static bool IsRoundActive => ToNGameState.IsRoundActive;
static bool IsReborn => ToNGameState.IsReborn;
+ static int PlayerCount => ToNGameState.PlayerCount;
+
static string ChatboxMessage = string.Empty;
static bool ChatboxClear = false;
@@ -535,6 +542,8 @@ internal static void SendData(bool force = false) {
if (LastAlive != IsAlive || force) SendParam(ParamAlive, LastAlive = IsAlive);
if (LastReborn != IsReborn || force) SendParam(ParamReborn, LastReborn = IsReborn);
if (LastStarted != IsRoundActive || force) SendParam(ParamStarted, LastStarted = IsRoundActive);
+
+ if (LastPlayerCount != PlayerCount || force) SendParam(ParamPlayerCount, LastPlayerCount = PlayerCount);
}
if (ChatboxClear || (ToNLogContext.CanSendChatbox && MainWindow.Started && !force && !string.IsNullOrEmpty(ChatboxMessage))) {