Fix welder making unwanted sounds (#1536)
* Fix Welding making sounds if not actually welded something * Fix Sound Error * -Hardcode bad -Removed duplicate sound on suicide
This commit is contained in:
@@ -17,6 +17,7 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Interactable
|
||||
{
|
||||
@@ -49,6 +50,8 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
private SolutionComponent? _solutionComponent;
|
||||
private PointLightComponent? _pointLightComponent;
|
||||
|
||||
public string? WeldSoundCollection { get; set; }
|
||||
|
||||
[ViewVariables]
|
||||
public float Fuel => _solutionComponent?.Solution.GetReagentQuantity("chem.WeldingFuel").Float() ?? 0f;
|
||||
|
||||
@@ -82,6 +85,11 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
Owner.TryGetComponent(out _pointLightComponent);
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, collection => WeldSoundCollection, "weldSoundCollection", string.Empty);
|
||||
}
|
||||
|
||||
public override ComponentState GetComponentState()
|
||||
{
|
||||
return new WelderComponentState(FuelCapacity, Fuel, WelderLit);
|
||||
@@ -116,7 +124,13 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
if (_solutionComponent == null)
|
||||
return false;
|
||||
|
||||
return _solutionComponent.TryRemoveReagent("chem.WeldingFuel", ReagentUnit.New(value));
|
||||
bool succeeded = _solutionComponent.TryRemoveReagent("chem.WeldingFuel", ReagentUnit.New(value));
|
||||
|
||||
if (succeeded && !silent)
|
||||
{
|
||||
PlaySoundCollection(WeldSoundCollection);
|
||||
}
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
private bool CanWeld(float value)
|
||||
@@ -206,7 +220,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
{
|
||||
if (TryWeld(5, victim, silent: true))
|
||||
{
|
||||
PlaySoundCollection("Welder", -5);
|
||||
PlaySoundCollection(WeldSoundCollection);
|
||||
chat.EntityMe(victim, Loc.GetString("welds {0:their} every orifice closed! It looks like {0:theyre} trying to commit suicide!", victim)); //TODO: theyre macro
|
||||
return SuicideKind.Heat;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user