Fix nullable errors with AfterInteract in UtensilComponent.
This commit is contained in:
@@ -112,9 +112,9 @@ namespace Content.Server.GameObjects.Components.Culinary
|
||||
TryUseUtensil(eventArgs.User, eventArgs.Target);
|
||||
}
|
||||
|
||||
private void TryUseUtensil(IEntity user, IEntity target)
|
||||
private void TryUseUtensil(IEntity user, IEntity? target)
|
||||
{
|
||||
if (!target.TryGetComponent(out FoodComponent? food))
|
||||
if (target == null || !target.TryGetComponent(out FoodComponent? food))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
|
||||
}
|
||||
|
||||
var afterInteracts = weapon.GetAllComponents<IAfterInteract>().ToList();
|
||||
var afterInteractEventArgs = new AfterInteractEventArgs { User = user, ClickLocation = clickLocation, CanReach = canReach };
|
||||
var afterInteractEventArgs = new AfterInteractEventArgs(user, clickLocation, null, canReach);
|
||||
|
||||
foreach (var afterInteract in afterInteracts)
|
||||
{
|
||||
@@ -460,10 +460,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
|
||||
|
||||
// If we aren't directly attacking the nearby object, lets see if our item has an after attack we can do
|
||||
var afterAttacks = weapon.GetAllComponents<IAfterInteract>().ToList();
|
||||
var afterAttackEventArgs = new AfterInteractEventArgs
|
||||
{
|
||||
User = user, ClickLocation = clickLocation, Target = attacked, CanReach = true
|
||||
};
|
||||
var afterAttackEventArgs = new AfterInteractEventArgs(user, clickLocation, attacked, canReach: true);
|
||||
|
||||
foreach (var afterAttack in afterAttacks)
|
||||
{
|
||||
@@ -833,10 +830,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
|
||||
return;
|
||||
|
||||
var afterAttacks = weapon.GetAllComponents<IAfterInteract>().ToList();
|
||||
var afterAttackEventArgs = new AfterInteractEventArgs
|
||||
{
|
||||
User = user, ClickLocation = clickLocation, Target = attacked, CanReach = false
|
||||
};
|
||||
var afterAttackEventArgs = new AfterInteractEventArgs(user, clickLocation, attacked, canReach: false);
|
||||
|
||||
//See if we have a ranged attack interaction
|
||||
foreach (var afterAttack in afterAttacks)
|
||||
|
||||
Reference in New Issue
Block a user