Better click attack effect

This commit is contained in:
Víctor Aguilera Puerto
2020-08-31 19:32:06 +02:00
parent 69bd44c94c
commit b927fddf4c
4 changed files with 17 additions and 55 deletions

View File

@@ -36,6 +36,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
public float ArcCooldownTime { get; private set; } = 1f;
public float CooldownTime { get; private set; } = 0.5f;
[ViewVariables(VVAccess.ReadWrite)]
public string ClickArc { get; set; }
[ViewVariables(VVAccess.ReadWrite)]
public string Arc { get; set; }
@@ -59,6 +62,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
serializer.DataField(this, x => x.Range, "range", 1);
serializer.DataField(this, x => x.ArcWidth, "arcwidth", 90);
serializer.DataField(this, x => x.Arc, "arc", "default");
serializer.DataField(this, x => x.ClickArc, "clickArc", "punch");
serializer.DataField(this, x => x._hitSound, "hitSound", "/Audio/Weapons/genhit1.ogg");
serializer.DataField(this, x => x._missSound, "hitSound", "/Audio/Weapons/punchmiss.ogg");
serializer.DataField(this, x => x.ArcCooldownTime, "arcCooldownTime", 1f);
@@ -159,11 +163,16 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
damageComponent.ChangeDamage(DamageType, Damage, false, Owner);
}
if (!OnHitEntities(new[] {target}, eventArgs))
var targets = new[] {target};
if (!OnHitEntities(targets, eventArgs))
return true;
var sys = _entitySystemManager.GetEntitySystem<MeleeWeaponSystem>();
sys.SendAnimation(angle, eventArgs.User, target);
if (ClickArc != null)
{
var sys = _entitySystemManager.GetEntitySystem<MeleeWeaponSystem>();
sys.SendAnimation(ClickArc, angle, eventArgs.User, targets);
}
_lastAttackTime = curTime;
_cooldownEnd = _lastAttackTime + TimeSpan.FromSeconds(CooldownTime);