Fix thrown throwing (#2723)
Technically some stuff could be dependent upon the entity regardless if it's deleted but this is how ICollideBehavior does it (not by my design) so I figured we'd make it consistent. If someone really needs the functionality even if it's deleted then they can refactor it. Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -52,7 +52,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
|||||||
|
|
||||||
public void HitBy(ThrowCollideEventArgs eventArgs)
|
public void HitBy(ThrowCollideEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (!eventArgs.Thrown.TryGetComponent(out CreamPieComponent creamPie) || CreamPied) return;
|
if (!eventArgs.Thrown.HasComponent<CreamPieComponent>() || CreamPied) return;
|
||||||
|
|
||||||
CreamPied = true;
|
CreamPied = true;
|
||||||
Owner.PopupMessage(Loc.GetString("You have been creamed by {0:theName}!", eventArgs.Thrown));
|
Owner.PopupMessage(Loc.GetString("You have been creamed by {0:theName}!", eventArgs.Thrown));
|
||||||
|
|||||||
@@ -624,11 +624,13 @@ namespace Content.Server.GameObjects.EntitySystems.Click
|
|||||||
|
|
||||||
foreach (var comp in thrown.GetAllComponents<IThrowCollide>().ToArray())
|
foreach (var comp in thrown.GetAllComponents<IThrowCollide>().ToArray())
|
||||||
{
|
{
|
||||||
|
if (thrown.Deleted) break;
|
||||||
comp.DoHit(eventArgs);
|
comp.DoHit(eventArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var comp in target.GetAllComponents<IThrowCollide>().ToArray())
|
foreach (var comp in target.GetAllComponents<IThrowCollide>().ToArray())
|
||||||
{
|
{
|
||||||
|
if (target.Deleted) break;
|
||||||
comp.HitBy(eventArgs);
|
comp.HitBy(eventArgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user