Add priority sorting to InteractUsing
This commit is contained in:
@@ -446,7 +446,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var attackBys = attacked.GetAllComponents<IInteractUsing>().ToList();
|
var attackBys = attacked.GetAllComponents<IInteractUsing>().OrderByDescending(x => x.Priority);
|
||||||
var attackByEventArgs = new InteractUsingEventArgs
|
var attackByEventArgs = new InteractUsingEventArgs
|
||||||
{
|
{
|
||||||
User = user, ClickLocation = clickLocation, Using = weapon, Target = attacked
|
User = user, ClickLocation = clickLocation, Using = weapon, Target = attacked
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
@@ -12,6 +13,12 @@ namespace Content.Shared.Interfaces.GameObjects.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IInteractUsing
|
public interface IInteractUsing
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The interaction Priority. Higher numbers get called first.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>Prority defaults to 0</value>
|
||||||
|
int Priority { get => 0; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when using one object on another when user is in range of the target entity.
|
/// Called when using one object on another when user is in range of the target entity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user