From be23e80d5185245fbe067ac2d09f7cd5ab199837 Mon Sep 17 00:00:00 2001 From: _nebula <41904486+misternebula@users.noreply.github.com> Date: Mon, 31 Jul 2023 22:49:32 +0100 Subject: [PATCH] fix api test mod --- APITestMod/APITestMod.cs | 6 +++--- APITestMod/IQSBAPI.cs | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/APITestMod/APITestMod.cs b/APITestMod/APITestMod.cs index 96a637f4..50c26fc2 100644 --- a/APITestMod/APITestMod.cs +++ b/APITestMod/APITestMod.cs @@ -43,15 +43,15 @@ public class APITestMod : ModBehaviour ModHelper.Console.WriteLine("Sending string message test..."); qsbAPI.RegisterHandler("apitest-string", MessageHandler); - qsbAPI.SendMessage("apitest-string", "STRING MESSAGE", true); + qsbAPI.SendMessage("apitest-string", "STRING MESSAGE", receiveLocally: true); ModHelper.Console.WriteLine("Sending int message test..."); qsbAPI.RegisterHandler("apitest-int", MessageHandler); - qsbAPI.SendMessage("apitest-int", 123, true); + qsbAPI.SendMessage("apitest-int", 123, receiveLocally: true); ModHelper.Console.WriteLine("Sending float message test..."); qsbAPI.RegisterHandler("apitest-float", MessageHandler); - qsbAPI.SendMessage("apitest-float", 3.14f, true); + qsbAPI.SendMessage("apitest-float", 3.14f, receiveLocally: true); }); }; } diff --git a/APITestMod/IQSBAPI.cs b/APITestMod/IQSBAPI.cs index 7e4e9f20..385bf865 100644 --- a/APITestMod/IQSBAPI.cs +++ b/APITestMod/IQSBAPI.cs @@ -1,4 +1,5 @@ -using OWML.Common; +using System; +using OWML.Common; using UnityEngine.Events; public interface IQSBAPI @@ -58,8 +59,9 @@ public interface IQSBAPI /// The type of the data being sent. This type must be serializable. /// The unique key of the message. /// The data to send. + /// The player to send this message to. (0 is the host, uint.MaxValue means every player) /// If true, the action given to will also be called on the same client that is sending the message. - void SendMessage(string messageType, T data, bool receiveLocally = false); + void SendMessage(string messageType, T data, uint to = uint.MaxValue, bool receiveLocally = false); /// /// Registers an action to be called when a message is received.