Fix popupmessage appearing behind the player when moving (#1401)

This commit is contained in:
DrSmugleaf
2020-07-24 14:26:39 +02:00
committed by GitHub
parent 5e2109a2d6
commit 1eac63e5bb
3 changed files with 106 additions and 31 deletions

View File

@@ -25,10 +25,27 @@ namespace Content.Server
{
DebugTools.Assert(!_initialized);
_netManager.RegisterNetMessage<MsgDoNotify>(nameof(MsgDoNotify));
_netManager.RegisterNetMessage<MsgDoNotifyCursor>(nameof(MsgDoNotifyCursor));
_netManager.RegisterNetMessage<MsgDoNotifyCoordinates>(nameof(MsgDoNotifyCoordinates));
_netManager.RegisterNetMessage<MsgDoNotifyEntity>(nameof(MsgDoNotifyEntity));
_initialized = true;
}
public override void PopupMessage(IEntity source, IEntity viewer, string message)
{
if (!viewer.TryGetComponent(out IActorComponent actor))
{
return;
}
var netMessage = _netManager.CreateNetMessage<MsgDoNotifyEntity>();
netMessage.Entity = source.Uid;
netMessage.Message = message;
_netManager.ServerSendMessage(netMessage, actor.playerSession.ConnectedClient);
}
public override void PopupMessage(GridCoordinates coordinates, IEntity viewer, string message)
{
if (!viewer.TryGetComponent(out IActorComponent actor))
@@ -36,9 +53,10 @@ namespace Content.Server
return;
}
var netMessage = _netManager.CreateNetMessage<MsgDoNotify>();
var netMessage = _netManager.CreateNetMessage<MsgDoNotifyCoordinates>();
netMessage.Coordinates = coordinates;
netMessage.Message = message;
_netManager.ServerSendMessage(netMessage, actor.playerSession.ConnectedClient);
}
@@ -49,9 +67,9 @@ namespace Content.Server
return;
}
var netMessage = _netManager.CreateNetMessage<MsgDoNotify>();
var netMessage = _netManager.CreateNetMessage<MsgDoNotifyCursor>();
netMessage.Message = message;
netMessage.AtCursor = true;
_netManager.ServerSendMessage(netMessage, actor.playerSession.ConnectedClient);
}