Equipment verbs & admin inventory access. (#14315)
This commit is contained in:
@@ -93,6 +93,7 @@ namespace Content.Shared.Verbs
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: fix this garbage and use proper generics or reflection or something else, not this.
|
||||
if (types.Contains(typeof(InteractionVerb)))
|
||||
{
|
||||
var verbEvent = new GetVerbsEvent<InteractionVerb>(user, target, @using, hands, canInteract, canAccess);
|
||||
@@ -145,6 +146,14 @@ namespace Content.Shared.Verbs
|
||||
verbs.UnionWith(verbEvent.Verbs);
|
||||
}
|
||||
|
||||
if (types.Contains(typeof(EquipmentVerb)))
|
||||
{
|
||||
var access = canAccess || _interactionSystem.CanAccessEquipment(user, target);
|
||||
var verbEvent = new GetVerbsEvent<EquipmentVerb>(user, target, @using, hands, canInteract, access);
|
||||
RaiseLocalEvent(target, verbEvent);
|
||||
verbs.UnionWith(verbEvent.Verbs);
|
||||
}
|
||||
|
||||
return verbs;
|
||||
}
|
||||
|
||||
|
||||
@@ -202,8 +202,9 @@ namespace Content.Shared.Verbs
|
||||
return string.Compare(Icon?.ToString(), otherVerb.Icon?.ToString(), StringComparison.CurrentCulture);
|
||||
}
|
||||
|
||||
// I hate this. Please somebody allow generics to be networked.
|
||||
/// <summary>
|
||||
/// Collection of all verb types, along with string keys.
|
||||
/// Collection of all verb types,
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Useful when iterating over verb types, though maybe this should be obtained and stored via reflection or
|
||||
@@ -212,13 +213,14 @@ namespace Content.Shared.Verbs
|
||||
/// </remarks>
|
||||
public static List<Type> VerbTypes = new()
|
||||
{
|
||||
{ typeof(Verb) },
|
||||
{ typeof(InteractionVerb) },
|
||||
{ typeof(UtilityVerb) },
|
||||
{ typeof(InnateVerb)},
|
||||
{ typeof(AlternativeVerb) },
|
||||
{ typeof(ActivationVerb) },
|
||||
{ typeof(ExamineVerb) }
|
||||
typeof(Verb),
|
||||
typeof(InteractionVerb),
|
||||
typeof(UtilityVerb),
|
||||
typeof(InnateVerb),
|
||||
typeof(AlternativeVerb),
|
||||
typeof(ActivationVerb),
|
||||
typeof(ExamineVerb),
|
||||
typeof(EquipmentVerb)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -333,4 +335,15 @@ namespace Content.Shared.Verbs
|
||||
|
||||
public bool ShowOnExamineTooltip = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verbs specifically for interactions that occur with equipped entities. These verbs should be accessible via
|
||||
/// the stripping UI, and may optionally also be accessible via a verb on the equipee if the via inventory relay
|
||||
/// events.get-verbs event.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class EquipmentVerb : Verb
|
||||
{
|
||||
public override int TypePriority => 5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Content.Shared.Verbs
|
||||
|
||||
public readonly bool AdminRequest;
|
||||
|
||||
public RequestServerVerbsEvent(EntityUid entityUid, List<Type> verbTypes, EntityUid? slotOwner = null, bool adminRequest = false)
|
||||
public RequestServerVerbsEvent(EntityUid entityUid, IEnumerable<Type> verbTypes, EntityUid? slotOwner = null, bool adminRequest = false)
|
||||
{
|
||||
EntityUid = entityUid;
|
||||
SlotOwner = slotOwner;
|
||||
|
||||
Reference in New Issue
Block a user