removed TryGetSound + made some SoundSpecifier datafields required
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Content.Server.Stunnable.Components
|
||||
|
||||
protected override void OnKnockdownEnd()
|
||||
{
|
||||
if(Owner.TryGetComponent(out IMobStateComponent? mobState) && !mobState.IsIncapacitated())
|
||||
if (Owner.TryGetComponent(out IMobStateComponent? mobState) && !mobState.IsIncapacitated())
|
||||
EntitySystem.Get<StandingStateSystem>().Stand(Owner);
|
||||
}
|
||||
|
||||
@@ -57,8 +57,7 @@ namespace Content.Server.Stunnable.Components
|
||||
|
||||
protected override void OnInteractHand()
|
||||
{
|
||||
if(_stunAttemptSound.TryGetSound(out var sound))
|
||||
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner, AudioHelpers.WithVariation(0.05f));
|
||||
SoundSystem.Play(Filter.Pvs(Owner), _stunAttemptSound.GetSound(), Owner, AudioHelpers.WithVariation(0.05f));
|
||||
}
|
||||
|
||||
bool IDisarmedAct.Disarmed(DisarmedActEventArgs eventArgs)
|
||||
@@ -73,12 +72,11 @@ namespace Content.Server.Stunnable.Components
|
||||
|
||||
if (source != null)
|
||||
{
|
||||
if (_stunAttemptSound.TryGetSound(out var sound))
|
||||
SoundSystem.Play(Filter.Pvs(source), sound, source, AudioHelpers.WithVariation(0.025f));
|
||||
SoundSystem.Play(Filter.Pvs(source), _stunAttemptSound.GetSound(), source, AudioHelpers.WithVariation(0.025f));
|
||||
if (target != null)
|
||||
{
|
||||
source.PopupMessageOtherClients(Loc.GetString("stunnable-component-disarm-success-others", ("source", source.Name),("target", target.Name)));
|
||||
source.PopupMessageCursor(Loc.GetString("stunnable-component-disarm-success",("target", target.Name)));
|
||||
source.PopupMessageOtherClients(Loc.GetString("stunnable-component-disarm-success-others", ("source", source.Name), ("target", target.Name)));
|
||||
source.PopupMessageCursor(Loc.GetString("stunnable-component-disarm-success", ("target", target.Name)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,18 +119,17 @@ namespace Content.Server.Stunnable
|
||||
{
|
||||
if (!entity.TryGetComponent(out StunnableComponent? stunnable) || !comp.Activated) return;
|
||||
|
||||
if(comp.StunSound.TryGetSound(out var stunSound))
|
||||
SoundSystem.Play(Filter.Pvs(comp.Owner), stunSound, comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
if(!stunnable.SlowedDown)
|
||||
SoundSystem.Play(Filter.Pvs(comp.Owner), comp.StunSound.GetSound(), comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
if (!stunnable.SlowedDown)
|
||||
{
|
||||
if(_robustRandom.Prob(comp.ParalyzeChanceNoSlowdown))
|
||||
if (_robustRandom.Prob(comp.ParalyzeChanceNoSlowdown))
|
||||
stunnable.Paralyze(comp.ParalyzeTime);
|
||||
else
|
||||
stunnable.Slowdown(comp.SlowdownTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_robustRandom.Prob(comp.ParalyzeChanceWithSlowdown))
|
||||
if (_robustRandom.Prob(comp.ParalyzeChanceWithSlowdown))
|
||||
stunnable.Paralyze(comp.ParalyzeTime);
|
||||
else
|
||||
stunnable.Slowdown(comp.SlowdownTime);
|
||||
@@ -140,8 +139,7 @@ namespace Content.Server.Stunnable
|
||||
if (!comp.Owner.TryGetComponent<PowerCellSlotComponent>(out var slot) || slot.Cell == null || !(slot.Cell.CurrentCharge < comp.EnergyPerUse))
|
||||
return;
|
||||
|
||||
if(comp.SparksSound.TryGetSound(out var sparksSound))
|
||||
SoundSystem.Play(Filter.Pvs(comp.Owner), sparksSound, comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
SoundSystem.Play(Filter.Pvs(comp.Owner), comp.SparksSound.GetSound(), comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
TurnOff(comp);
|
||||
}
|
||||
|
||||
@@ -155,8 +153,7 @@ namespace Content.Server.Stunnable
|
||||
if (!comp.Owner.TryGetComponent<SpriteComponent>(out var sprite) ||
|
||||
!comp.Owner.TryGetComponent<ItemComponent>(out var item)) return;
|
||||
|
||||
if(comp.SparksSound.TryGetSound(out var sparksSound))
|
||||
SoundSystem.Play(Filter.Pvs(comp.Owner), sparksSound, comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
SoundSystem.Play(Filter.Pvs(comp.Owner), comp.SparksSound.GetSound(), comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
item.EquippedPrefix = "off";
|
||||
// TODO stunbaton visualizer
|
||||
sprite.LayerSetState(0, "stunbaton_off");
|
||||
@@ -180,22 +177,19 @@ namespace Content.Server.Stunnable
|
||||
|
||||
if (slot.Cell == null)
|
||||
{
|
||||
if(comp.TurnOnFailSound.TryGetSound(out var turnOnFailSound))
|
||||
SoundSystem.Play(playerFilter, turnOnFailSound, comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
SoundSystem.Play(playerFilter, comp.TurnOnFailSound.GetSound(), comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
user.PopupMessage(Loc.GetString("comp-stunbaton-activated-missing-cell"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (slot.Cell != null && slot.Cell.CurrentCharge < comp.EnergyPerUse)
|
||||
{
|
||||
if(comp.TurnOnFailSound.TryGetSound(out var turnOnFailSound))
|
||||
SoundSystem.Play(playerFilter, turnOnFailSound, comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
SoundSystem.Play(playerFilter, comp.TurnOnFailSound.GetSound(), comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
user.PopupMessage(Loc.GetString("comp-stunbaton-activated-dead-cell"));
|
||||
return;
|
||||
}
|
||||
|
||||
if(comp.SparksSound.TryGetSound(out var sparksSound))
|
||||
SoundSystem.Play(playerFilter, sparksSound, comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
SoundSystem.Play(playerFilter, comp.SparksSound.GetSound(), comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
|
||||
item.EquippedPrefix = "on";
|
||||
sprite.LayerSetState(0, "stunbaton_on");
|
||||
|
||||
Reference in New Issue
Block a user