* Add test that puts all components on an entity and checks for no exceptions Also fix all the exceptions that happened because of this * Add comments to the test * Fix nullable errors * Fix more nullable errors * More nullable error fixes * Unignore basic actor component * Fix more nullable errors * NULLABLE ERROR * Add string interpolation * Merge if checks * Remove redundant pragma warning disable 649 * Address reviews * Remove null wrappers around TryGetComponent * Merge conflict fixes * APC battery component error fix * Fix power test * Fix atmos mapgrid usages
37 lines
977 B
C#
37 lines
977 B
C#
using System;
|
|
using Content.Server.GameObjects.Components.Explosion;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.GameObjects.Components;
|
|
using Robust.Shared.Interfaces.GameObjects;
|
|
using Robust.Shared.Log;
|
|
|
|
namespace Content.Server.GameObjects.Components.Projectiles
|
|
{
|
|
[RegisterComponent]
|
|
public class ExplosiveProjectileComponent : Component, ICollideBehavior
|
|
{
|
|
public override string Name => "ExplosiveProjectile";
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
Owner.EnsureComponent<ExplosiveComponent>();
|
|
}
|
|
|
|
void ICollideBehavior.CollideWith(IEntity entity)
|
|
{
|
|
if (Owner.TryGetComponent(out ExplosiveComponent explosive))
|
|
{
|
|
explosive.Explosion();
|
|
}
|
|
}
|
|
|
|
// Projectile should handle the deleting
|
|
void ICollideBehavior.PostCollide(int collisionCount)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
}
|