Files
QuartZ-dump/GlobalShared/Util/NexusUtils.cs
2024-12-29 21:15:58 +01:00

43 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using Nexus.API;
using Nexus.Utilities;
using Sandbox.Engine.Multiplayer;
using Sandbox.ModAPI;
using ServerNetwork.Sync;
using VRageMath;
namespace Global.Shared.Util
{
public class NexusUtils
{
public static NexusServerSideAPI nexusServerAPI = new NexusServerSideAPI(1234);
public static NexusAPI nexusAPI = new NexusAPI((ushort)nexusServerAPI.CrossServerModID);
public void BroadCastMessage(string author, string message, Color color)
{
var scriptedChatMsg1 = new ScriptedChatMsg
{
Author = author,
Text = message,
Font = "White",
Color = color,
Target = 0
};
var msg = new ScriptedMessage
{
Author = scriptedChatMsg1.Author,
ChatColor = scriptedChatMsg1.Color.GetDrawingColor().ToArgb(),
Target = scriptedChatMsg1.Target,
Text = scriptedChatMsg1.Text
};
NexusServerSideAPI.SendMessageToAllServers(ref nexusAPI,
MyAPIGateway.Utilities.SerializeToBinary(msg));
}
}
}