Fix errors

This commit is contained in:
DrSmugleaf
2021-12-05 21:02:04 +01:00
parent 2a3b7d809d
commit ab9d0cc6d8
94 changed files with 568 additions and 591 deletions

View File

@@ -41,7 +41,7 @@ namespace Content.Shared.Verbs
// call ActionBlocker checks, just cache it for the verb request.
var canInteract = force || _actionBlockerSystem.CanInteract(user);
EntityUid? @using = null;
EntityUid @using = default;
if (EntityManager.TryGetComponent(user, out SharedHandsComponent? hands) && (force || _actionBlockerSystem.CanUse(user)))
{
hands.TryGetActiveHeldEntity(out @using);
@@ -49,9 +49,9 @@ namespace Content.Shared.Verbs
// Check whether the "Held" entity is a virtual pull entity. If yes, set that as the entity being "Used".
// This allows you to do things like buckle a dragged person onto a surgery table, without click-dragging
// their sprite.
if (@using != null && EntityManager.TryGetComponent<HandVirtualItemComponent?>(@using.Value, out var pull))
if (@using != default && EntityManager.TryGetComponent<HandVirtualItemComponent?>(@using, out var pull))
{
@using = pull.BlockingEntity
@using = pull.BlockingEntity;
}
}
@@ -110,25 +110,25 @@ namespace Content.Shared.Verbs
}
}
public void LogVerb(Verb verb, EntityUid userUid, EntityUid targetUid, bool forced)
public void LogVerb(Verb verb, EntityUid user, EntityUid target, bool forced)
{
// first get the held item. again.
EntityUid usedUid = default;
if (EntityManager.TryGetComponent(userUid, out SharedHandsComponent? hands) &&
if (EntityManager.TryGetComponent(user, out SharedHandsComponent? hands) &&
hands.TryGetActiveHeldEntity(out var heldEntity))
{
usedUid = heldEntity;
if (usedUid != null && EntityManager.TryGetComponent(usedUid.Value, out HandVirtualItemComponent? pull))
if (usedUid != default && EntityManager.TryGetComponent(usedUid, out HandVirtualItemComponent? pull))
usedUid = pull.BlockingEntity;
}
// get all the entities
if (!userUid.IsValid() || !targetUid.IsValid())
if (!user.IsValid() || !target.IsValid())
return;
EntityUid? used = null;
if (usedUid != null)
EntityManager.EntityExists(usedUid.Value);
if (usedUid != default)
EntityManager.EntityExists(usedUid);
// then prepare the basic log message body
var verbText = $"{verb.Category?.Text} {verb.Text}".Trim();
@@ -137,7 +137,7 @@ namespace Content.Shared.Verbs
: $"executed '{verbText}' verb targeting ";
// then log with entity information
if (usedUidused != null)
if (used != null)
_logSystem.Add(LogType.Verb, verb.Impact,
$"{user} {logText} {target} while holding {used}");
else