* Engine namespace changes.
* Automated remove redundant using statements.
* Simplified Graphics namespace.
* Apparently the container system stores full type names in the map file.😞 This updates those names.
* API Changes to LocalizationManager.LoadCulture.
* Update submodule to v0.3.2
48 lines
1.5 KiB
C#
48 lines
1.5 KiB
C#
using Content.Server.GameObjects.Components.Mobs;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Serialization;
|
|
|
|
namespace Content.Server.GameObjects.Components.Projectiles
|
|
{
|
|
/// <summary>
|
|
/// Adds stun when it collides with an entity
|
|
/// </summary>
|
|
[RegisterComponent]
|
|
public sealed class StunnableProjectileComponent : Component, ICollideBehavior
|
|
{
|
|
public override string Name => "StunnableProjectile";
|
|
|
|
// See stunnable for what these do
|
|
private int _stunAmount;
|
|
private int _knockdownAmount;
|
|
private int _slowdownAmount;
|
|
|
|
public override void ExposeData(ObjectSerializer serializer)
|
|
{
|
|
base.ExposeData(serializer);
|
|
serializer.DataField(ref _stunAmount, "stunAmount", 0);
|
|
serializer.DataField(ref _knockdownAmount, "knockdownAmount", 0);
|
|
serializer.DataField(ref _slowdownAmount, "slowdownAmount", 0);
|
|
}
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
Owner.EnsureComponentWarn(out ProjectileComponent _);
|
|
}
|
|
|
|
void ICollideBehavior.CollideWith(IEntity entity)
|
|
{
|
|
if (entity.TryGetComponent(out StunnableComponent stunnableComponent))
|
|
{
|
|
stunnableComponent.Stun(_stunAmount);
|
|
stunnableComponent.Knockdown(_knockdownAmount);
|
|
stunnableComponent.Slowdown(_slowdownAmount);
|
|
}
|
|
}
|
|
|
|
void ICollideBehavior.PostCollide(int collidedCount) {}
|
|
}
|
|
}
|