Files
tbd-station-14/Content.Server/GameObjects/Components/Projectiles/ThrownItemComponent.cs
clusterfack 37df61113e Species Component (#130)
* Fix this
fug
oksure
Creates the initial species component, damage states, and threshold templates and hooks them into the damageable component

* More rebase fixes

* test

* Pre future rebase

* Please

* Lol

* Lol2

* SHADERS

* Update Engine

* yml file

* Fix an initialization issue, injects dependencies

* Fix error in loading shaders

* Makes a master character ui controller component added upon client attachment to entity and remove upon client detachment from entity

* Fixes just about everytrhing

* Address PJB's comments

* geeze

* Make overlays work in worldspace instead of screen space and not cover user interfaces

* update submodule
2018-12-13 14:47:18 +01:00

38 lines
1.4 KiB
C#

using System.Collections.Generic;
using Content.Server.GameObjects.Components.Projectiles;
using Content.Shared.GameObjects;
using Content.Shared.Physics;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components;
namespace Content.Server.GameObjects.Components
{
class ThrownItemComponent : ProjectileComponent, ICollideBehavior
{
public override string Name => "ThrownItem";
void ICollideBehavior.CollideWith(List<IEntity> collidedwith)
{
foreach (var entity in collidedwith)
{
if (entity.TryGetComponent(out DamageableComponent damage))
{
damage.TakeDamage(DamageType.Brute, 10);
}
}
// Stop colliding with mobs, this mimics not having enough velocity to do damage
// after impacting the first object.
// For realism this should actually be changed when the velocity of the object is less than a threshold.
// This would allow ricochets off walls, and weird gravity effects from slowing the object.
if (collidedwith.Count > 0 && Owner.TryGetComponent(out ICollidableComponent body))
{
body.CollisionMask &= (int) ~CollisionGroup.Mob;
// KYS, your job is finished.
Owner.RemoveComponent<ThrownItemComponent>();
}
}
}
}