Content update for NetEntities (#18935)

This commit is contained in:
metalgearsloth
2023-09-11 09:42:41 +10:00
committed by GitHub
parent 389c8d1a2c
commit 5a0fc68be2
526 changed files with 3058 additions and 2215 deletions

View File

@@ -63,34 +63,37 @@ namespace Content.Server.Interaction
private void HandleDragDropRequestEvent(DragDropRequestEvent msg, EntitySessionEventArgs args)
{
if (Deleted(msg.Dragged) || Deleted(msg.Target))
var dragged = GetEntity(msg.Dragged);
var target = GetEntity(msg.Target);
if (Deleted(dragged) || Deleted(target))
return;
var user = args.SenderSession.AttachedEntity;
if (user == null || !_actionBlockerSystem.CanInteract(user.Value, msg.Target))
if (user == null || !_actionBlockerSystem.CanInteract(user.Value, target))
return;
// must be in range of both the target and the object they are drag / dropping
// Client also does this check but ya know we gotta validate it.
if (!InRangeUnobstructed(user.Value, msg.Dragged, popup: true)
|| !InRangeUnobstructed(user.Value, msg.Target, popup: true))
if (!InRangeUnobstructed(user.Value, dragged, popup: true)
|| !InRangeUnobstructed(user.Value, target, popup: true))
{
return;
}
var dragArgs = new DragDropDraggedEvent(user.Value, msg.Target);
var dragArgs = new DragDropDraggedEvent(user.Value, target);
// trigger dragdrops on the dropped entity
RaiseLocalEvent(msg.Dragged, ref dragArgs);
RaiseLocalEvent(dragged, ref dragArgs);
if (dragArgs.Handled)
return;
var dropArgs = new DragDropTargetEvent(user.Value, msg.Dragged);
var dropArgs = new DragDropTargetEvent(user.Value, dragged);
// trigger dragdrops on the target entity (what you are dropping onto)
RaiseLocalEvent(msg.Target, ref dropArgs);
RaiseLocalEvent(GetEntity(msg.Target), ref dropArgs);
}
#endregion