* 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
54 lines
1.9 KiB
C#
54 lines
1.9 KiB
C#
using System;
|
|
using SS14.Shared.GameObjects;
|
|
using Content.Server.GameObjects.EntitySystems;
|
|
using SS14.Shared.Interfaces.GameObjects;
|
|
using SS14.Shared.Map;
|
|
using SS14.Shared.IoC;
|
|
using SS14.Server.GameObjects;
|
|
using SS14.Shared.Maths;
|
|
using SS14.Server.Interfaces.GameObjects;
|
|
using SS14.Shared.Interfaces.Timing;
|
|
using SS14.Shared.GameObjects.EntitySystemMessages;
|
|
using SS14.Shared.Serialization;
|
|
using SS14.Shared.Interfaces.GameObjects.Components;
|
|
using Content.Shared.GameObjects;
|
|
|
|
namespace Content.Server.GameObjects.Components.Weapon.Melee
|
|
{
|
|
public class MeleeWeaponComponent : Component, IAfterAttack
|
|
{
|
|
public override string Name => "MeleeWeapon";
|
|
|
|
public int Damage = 1;
|
|
public float Range = 1;
|
|
public float ArcWidth = 90;
|
|
|
|
public override void ExposeData(ObjectSerializer serializer)
|
|
{
|
|
base.ExposeData(serializer);
|
|
|
|
serializer.DataField(ref Damage, "damage", 5);
|
|
serializer.DataField(ref Range, "range", 1);
|
|
serializer.DataField(ref ArcWidth, "arcwidth", 90);
|
|
}
|
|
|
|
void IAfterAttack.Afterattack(IEntity user, GridLocalCoordinates clicklocation, IEntity attacked)
|
|
{
|
|
var location = user.GetComponent<ITransformComponent>().LocalPosition;
|
|
var angle = new Angle(clicklocation.ToWorld().Position - location.ToWorld().Position);
|
|
var entities = IoCManager.Resolve<IServerEntityManager>().GetEntitiesInArc(user.GetComponent<ITransformComponent>().LocalPosition, Range, angle, ArcWidth);
|
|
|
|
foreach (var entity in entities)
|
|
{
|
|
if (!entity.GetComponent<ITransformComponent>().IsMapTransform || entity == user)
|
|
continue;
|
|
|
|
if (entity.TryGetComponent(out DamageableComponent damagecomponent))
|
|
{
|
|
damagecomponent.TakeDamage(DamageType.Brute, Damage);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|