Remove IDropped (#7075)

This commit is contained in:
Leon Friedrich
2022-03-13 21:47:28 +13:00
committed by GitHub
parent 4444d099d1
commit e3ead6a3ba
10 changed files with 42 additions and 117 deletions

View File

@@ -836,46 +836,15 @@ namespace Content.Shared.Interaction
}
#endregion
#region Drop
/// <summary>
/// Activates the Dropped behavior of an object
/// Verifies that the user is capable of doing the drop interaction first
/// </summary>
public bool TryDroppedInteraction(EntityUid user, EntityUid item)
{
if (!_actionBlockerSystem.CanDrop(user)) return false;
DroppedInteraction(user, item);
return true;
}
/// <summary>
/// Calls Dropped on all components that implement the IDropped interface
/// on an entity that has been dropped.
/// </summary>
public void DroppedInteraction(EntityUid user, EntityUid item)
{
var dropMsg = new DroppedEvent(user, item);
var dropMsg = new DroppedEvent(user);
RaiseLocalEvent(item, dropMsg);
if (dropMsg.Handled)
{
_adminLogSystem.Add(LogType.Drop, LogImpact.Low, $"{ToPrettyString(user):user} dropped {ToPrettyString(item):entity}");
return;
}
Transform(item).LocalRotation = Angle.Zero;
var comps = AllComps<IDropped>(item).ToList();
// Call Land on all components that implement the interface
foreach (var comp in comps)
{
comp.Dropped(new DroppedEventArgs(user));
}
_adminLogSystem.Add(LogType.Drop, LogImpact.Low, $"{ToPrettyString(user):user} dropped {ToPrettyString(item):entity}");
}
#endregion
#endregion
/// <summary>
/// If a target is in range, but not in the same container as the user, it may be inside of a backpack. This