Fixes Esword not changing hit sound and sharpComp. (#9005)

Co-authored-by: Kara <lunarautomaton6@gmail.com>
This commit is contained in:
Júlio César Ueti
2022-06-21 21:54:28 -03:00
committed by GitHub
parent d958ababb9
commit a8f8426eed
3 changed files with 20 additions and 2 deletions

View File

@@ -24,6 +24,12 @@ namespace Content.Server.Weapon.Melee.EnergySword
[DataField("deActivateSound")]
public SoundSpecifier DeActivateSound { get; set; } = new SoundPathSpecifier("/Audio/Weapons/ebladeoff.ogg");
[DataField("onHitOn")]
public SoundSpecifier OnHitOn { get; set; } = new SoundPathSpecifier("/Audio/Weapons/eblade1.ogg");
[DataField("onHitOff")]
public SoundSpecifier OnHitOff { get; set; } = new SoundPathSpecifier("/Audio/Weapons/genhit1.ogg");
[DataField("colorOptions")]
public List<Color> ColorOptions = new()
{

View File

@@ -6,6 +6,9 @@ using Content.Shared.Light.Component;
using Content.Shared.Toggleable;
using Content.Shared.Tools.Components;
using Content.Server.CombatMode.Disarm;
using Content.Server.Kitchen.Components;
using Content.Server.Weapon.Melee.Components;
using Content.Shared.Sound;
using Robust.Shared.Audio;
using Robust.Shared.Player;
using Robust.Shared.Random;
@@ -74,6 +77,11 @@ namespace Content.Server.Weapon.Melee.EnergySword
malus.Malus -= comp.litDisarmMalus;
}
if(TryComp<MeleeWeaponComponent>(comp.Owner, out var weaponComp))
weaponComp.HitSound = comp.OnHitOff;
RemComp<SharpComponent>(comp.Owner);
SoundSystem.Play(comp.DeActivateSound.GetSound(), Filter.Pvs(comp.Owner, entityManager: EntityManager), comp.Owner);
comp.Activated = false;
@@ -89,6 +97,11 @@ namespace Content.Server.Weapon.Melee.EnergySword
item.Size = 9999;
}
EnsureComp<SharpComponent>(comp.Owner);
if(TryComp<MeleeWeaponComponent>(comp.Owner, out var weaponComp))
weaponComp.HitSound = comp.OnHitOn;
SoundSystem.Play(comp.ActivateSound.GetSound(), Filter.Pvs(comp.Owner, entityManager: EntityManager), comp.Owner);
if (TryComp<DisarmMalusComponent>(comp.Owner, out var malus))

View File

@@ -11,7 +11,6 @@
Heat: 12.5
Blunt: -7
litDisarmMalus: 0.6
- type: Sharp
- type: Sprite
sprite: Objects/Weapons/Melee/e_sword.rsi
layers:
@@ -23,7 +22,7 @@
map: [ "blade" ]
- type: MeleeWeapon
hitSound:
path: /Audio/Weapons/eblade1.ogg
path: /Audio/Weapons/genhit1.ogg
damage:
types:
Blunt: 7