Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions Docs/OSC/OSC_Parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ Parameter | Type | Description
`ToN_Damaged` | `INT`<br>`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).<br>
> 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.
Expand Down
11 changes: 10 additions & 1 deletion Utils/LilOSC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
}
#pragma warning restore CS8600,CS8602 // Converting null literal or possible null value to non-nullable type.

static OSCQueryService OscQuery;

Check warning on line 40 in Utils/LilOSC.cs

View workflow job for this annotation

GitHub Actions / build (Release)

The field 'OSCLib.OscQuery' is never used

static OSCLib() {

Check warning on line 42 in Utils/LilOSC.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Non-nullable field 'OscQuery' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
PortTCP = GetAvailableTcpPort();
PortUDP = GetAvailableUdpPort();

Expand Down Expand Up @@ -115,7 +115,7 @@

internal static void SetAvatar(string id) => Send("/avatar/change", id);

private static Action<string, object?[]>? MonitorCallback;

Check warning on line 118 in Utils/LilOSC.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Field 'OSCLib.MonitorCallback' is never assigned to, and will always have its default value null

internal static void StartOSCMonitor(Action<string, object?[]>? callback) {
/*
Expand Down Expand Up @@ -200,12 +200,15 @@
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() {
Expand Down Expand Up @@ -237,6 +240,8 @@

static int LastPageCount = 0;

static int LastPlayerCount = 0;

static string[]? m_EncounterKeys { get; set; }
static string[] EncounterKeys {
get {
Expand Down Expand Up @@ -267,6 +272,8 @@
static bool IsRoundActive => ToNGameState.IsRoundActive;
static bool IsReborn => ToNGameState.IsReborn;

static int PlayerCount => ToNGameState.PlayerCount;

static string ChatboxMessage = string.Empty;
static bool ChatboxClear = false;

Expand Down Expand Up @@ -535,6 +542,8 @@
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))) {
Expand Down
Loading