Refactor slip dropping to use throwing (#5476)

* Refactor slip dropping to use throwing

* Update Content.Server/Fluids/EntitySystems/SpillableSystem.cs

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* Uncringe

* Update Content.Server/Fluids/EntitySystems/SpillableSystem.cs

Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
This commit is contained in:
Clyybber
2021-11-24 00:38:39 +01:00
committed by GitHub
parent ee27c75224
commit 0e98c1c524
10 changed files with 113 additions and 121 deletions

View File

@@ -658,11 +658,11 @@ namespace Content.Shared.Interaction
/// Activates the Dropped behavior of an object
/// Verifies that the user is capable of doing the drop interaction first
/// </summary>
public bool TryDroppedInteraction(IEntity user, IEntity item, bool intentional)
public bool TryDroppedInteraction(IEntity user, IEntity item)
{
if (user == null || item == null || !_actionBlockerSystem.CanDrop(user.Uid)) return false;
DroppedInteraction(user, item, intentional);
DroppedInteraction(user, item);
return true;
}
@@ -670,21 +670,21 @@ namespace Content.Shared.Interaction
/// Calls Dropped on all components that implement the IDropped interface
/// on an entity that has been dropped.
/// </summary>
public void DroppedInteraction(IEntity user, IEntity item, bool intentional)
public void DroppedInteraction(IEntity user, IEntity item)
{
var dropMsg = new DroppedEvent(user.Uid, item.Uid, intentional);
var dropMsg = new DroppedEvent(user.Uid, item.Uid);
RaiseLocalEvent(item.Uid, dropMsg);
if (dropMsg.Handled)
return;
item.Transform.LocalRotation = intentional ? Angle.Zero : (_random.Next(0, 100) / 100f) * MathHelper.TwoPi;
item.Transform.LocalRotation = Angle.Zero;
var comps = item.GetAllComponents<IDropped>().ToList();
// Call Land on all components that implement the interface
foreach (var comp in comps)
{
comp.Dropped(new DroppedEventArgs(user, intentional));
comp.Dropped(new DroppedEventArgs(user));
}
}
#endregion