Welders now play sounds when toggled.
This commit is contained in:
@@ -1,9 +1,16 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Shared.Audio;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
using Robust.Shared.Interfaces.Random;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
@@ -18,6 +25,12 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools
|
|||||||
{
|
{
|
||||||
SpriteComponent spriteComponent;
|
SpriteComponent spriteComponent;
|
||||||
|
|
||||||
|
#pragma warning disable 649
|
||||||
|
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||||
|
[Dependency] private readonly IRobustRandom _robustRandom;
|
||||||
|
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||||
|
#pragma warning restore 649
|
||||||
|
|
||||||
public override string Name => "Welder";
|
public override string Name => "Welder";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -133,12 +146,14 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools
|
|||||||
Activated = false;
|
Activated = false;
|
||||||
// Layer 1 is the flame.
|
// Layer 1 is the flame.
|
||||||
spriteComponent.LayerSetVisible(1, false);
|
spriteComponent.LayerSetVisible(1, false);
|
||||||
|
PlaySoundCollection("welder_off", -5);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (CanActivate())
|
else if (CanActivate())
|
||||||
{
|
{
|
||||||
Activated = true;
|
Activated = true;
|
||||||
spriteComponent.LayerSetVisible(1, true);
|
spriteComponent.LayerSetVisible(1, true);
|
||||||
|
PlaySoundCollection("welder_on", -5);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -162,5 +177,13 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools
|
|||||||
message.AddMarkup(loc.GetString("Fuel: [color={0}]{1}/{2}[/color].",
|
message.AddMarkup(loc.GetString("Fuel: [color={0}]{1}/{2}[/color].",
|
||||||
Fuel < FuelCapacity / 4f ? "darkorange" : "orange", Math.Round(Fuel), FuelCapacity));
|
Fuel < FuelCapacity / 4f ? "darkorange" : "orange", Math.Round(Fuel), FuelCapacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PlaySoundCollection(string name, float volume)
|
||||||
|
{
|
||||||
|
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(name);
|
||||||
|
var file = _robustRandom.Pick(soundCollection.PickFiles);
|
||||||
|
_entitySystemManager.GetEntitySystem<AudioSystem>()
|
||||||
|
.Play(file, AudioParams.Default.WithVolume(volume));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
Resources/Audio/effects/zzzt.ogg
Normal file
BIN
Resources/Audio/effects/zzzt.ogg
Normal file
Binary file not shown.
BIN
Resources/Audio/items/lighter1.ogg
Normal file
BIN
Resources/Audio/items/lighter1.ogg
Normal file
Binary file not shown.
BIN
Resources/Audio/items/lighter2.ogg
Normal file
BIN
Resources/Audio/items/lighter2.ogg
Normal file
Binary file not shown.
@@ -61,6 +61,17 @@
|
|||||||
- type: ItemCooldown
|
- type: ItemCooldown
|
||||||
- type: MeleeWeapon
|
- type: MeleeWeapon
|
||||||
|
|
||||||
|
- type: sound_collection
|
||||||
|
id: welder_on
|
||||||
|
files:
|
||||||
|
- /Audio/items/lighter1.ogg
|
||||||
|
- /Audio/items/lighter2.ogg
|
||||||
|
|
||||||
|
- type: sound_collection
|
||||||
|
id: welder_off
|
||||||
|
files:
|
||||||
|
- /Audio/effects/zzzt.ogg
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: Crowbar
|
name: Crowbar
|
||||||
parent: BaseItem
|
parent: BaseItem
|
||||||
|
|||||||
Reference in New Issue
Block a user