Fix verbs in-hand.

Properly this time.
This commit is contained in:
Pieter-Jan Briers
2020-08-20 21:45:28 +02:00
parent e9d302f6e5
commit fc2ee61f75
6 changed files with 63 additions and 64 deletions

View File

@@ -51,12 +51,7 @@ namespace Content.Server.GameObjects.EntitySystems
continue;
}
if (verb.RequireInteractionRange && !VerbUtility.InVerbUseRange(userEntity, entity))
{
break;
}
if (verb.BlockedByContainers && !userEntity.IsInSameOrNoContainer(entity))
if (!VerbUtility.VerbAccessChecks(userEntity, entity, verb))
{
break;
}
@@ -72,13 +67,7 @@ namespace Content.Server.GameObjects.EntitySystems
continue;
}
if (globalVerb.RequireInteractionRange &&
!VerbUtility.InVerbUseRange(userEntity, entity))
{
break;
}
if (globalVerb.BlockedByContainers && !userEntity.IsInSameOrNoContainer(entity))
if (!VerbUtility.VerbAccessChecks(userEntity, entity, globalVerb))
{
break;
}
@@ -110,19 +99,9 @@ namespace Content.Server.GameObjects.EntitySystems
//Get verbs, component dependent.
foreach (var (component, verb) in VerbUtility.GetVerbs(entity))
{
if (verb.RequireInteractionRange && !VerbUtility.InVerbUseRange(userEntity, entity))
continue;
if (verb.BlockedByContainers)
if (!VerbUtility.VerbAccessChecks(userEntity, entity, verb))
{
if (!userEntity.IsInSameOrNoContainer(entity))
{
if (!ContainerHelpers.TryGetContainer(entity, out var container) ||
container.Owner != userEntity)
{
continue;
}
}
continue;
}
var verbData = verb.GetData(userEntity, component);
@@ -136,11 +115,10 @@ namespace Content.Server.GameObjects.EntitySystems
//Get global verbs. Visible for all entities regardless of their components.
foreach (var globalVerb in VerbUtility.GetGlobalVerbs(Assembly.GetExecutingAssembly()))
{
if (globalVerb.RequireInteractionRange && !VerbUtility.InVerbUseRange(userEntity, entity))
continue;
if (globalVerb.BlockedByContainers && !userEntity.IsInSameOrNoContainer(entity))
if (!VerbUtility.VerbAccessChecks(userEntity, entity, globalVerb))
{
continue;
}
var verbData = globalVerb.GetData(userEntity, entity);
if (verbData.IsInvisible)