Add utility verbs (#6473)

This commit is contained in:
Leon Friedrich
2022-02-24 23:48:53 +13:00
committed by GitHub
parent 8ae2ba9fa5
commit 53c9ecbf6a
7 changed files with 156 additions and 10 deletions

View File

@@ -47,16 +47,16 @@ namespace Content.Shared.Verbs
/// Raises a number of events in order to get all verbs of the given type(s) defined in local systems. This
/// does not request verbs from the server.
/// </summary>
public SortedSet<Verb> GetLocalVerbs(EntityUid target, EntityUid user, Type type, bool force = false, bool all = false)
public SortedSet<Verb> GetLocalVerbs(EntityUid target, EntityUid user, Type type, bool force = false)
{
return GetLocalVerbs(target, user, new List<Type>() { type }, force, all);
return GetLocalVerbs(target, user, new List<Type>() { type }, force);
}
/// <summary>
/// Raises a number of events in order to get all verbs of the given type(s) defined in local systems. This
/// does not request verbs from the server.
/// </summary>
public SortedSet<Verb> GetLocalVerbs(EntityUid target, EntityUid user, List<Type> types, bool force = false, bool all = false)
public SortedSet<Verb> GetLocalVerbs(EntityUid target, EntityUid user, List<Type> types, bool force = false)
{
SortedSet<Verb> verbs = new();
@@ -99,6 +99,15 @@ namespace Content.Shared.Verbs
verbs.UnionWith(verbEvent.Verbs);
}
if (types.Contains(typeof(UtilityVerb))
&& @using != null
&& @using != target)
{
var verbEvent = new GetVerbsEvent<UtilityVerb>(user, target, @using, hands, canInteract, canAccess);
RaiseLocalEvent(@using.Value, verbEvent); // directed at used, not at target
verbs.UnionWith(verbEvent.Verbs);
}
if (types.Contains(typeof(AlternativeVerb)))
{
var verbEvent = new GetVerbsEvent<AlternativeVerb>(user, target, @using, hands, canInteract, canAccess);