mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-25 15:35:22 +00:00
29 lines
788 B
C#
29 lines
788 B
C#
using QSB.TransformSync;
|
|
using QSB.Utility;
|
|
|
|
namespace QSB.Events
|
|
{
|
|
class PlayerJoinEvent : QSBEvent
|
|
{
|
|
public override EventType Type => EventType.PlayerJoin;
|
|
|
|
public override void SetupListener()
|
|
{
|
|
GlobalMessenger<string>.AddListener("QSBPlayerJoin", var => EventSender.SendEvent(this, PlayerTransformSync.LocalInstance.netId.Value, var));
|
|
}
|
|
|
|
public override void OnReceive(uint sender, object[] data)
|
|
{
|
|
var player = PlayerRegistry.CreatePlayer(sender);
|
|
player.Name = (string)data[0];
|
|
player.IsReady = true;
|
|
DebugLog.ToAll($"{player.Name} joined!");
|
|
}
|
|
|
|
public override void OnReceiveLocal(object[] data)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
}
|