#4219 some small project tweaks
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using Content.Server.Sound;
|
using Content.Server.Sound.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
|
||||||
namespace Content.Server.Interaction.Components
|
namespace Content.Server.Interaction.Components
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using Content.Server.Clothing.Components;
|
using Content.Server.Clothing.Components;
|
||||||
using Content.Server.Items;
|
using Content.Server.Items;
|
||||||
using Content.Server.Sound;
|
using Content.Server.Sound.Components;
|
||||||
using Content.Shared.ActionBlocker;
|
using Content.Shared.ActionBlocker;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Server.Sound
|
namespace Content.Server.Sound.Components
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Base sound emitter which defines most of the data fields.
|
/// Base sound emitter which defines most of the data fields.
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
|
||||||
namespace Content.Server.Sound
|
namespace Content.Server.Sound.Components
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Simple sound emitter that emits sound on ActivateInWorld
|
/// Simple sound emitter that emits sound on ActivateInWorld
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
|
||||||
namespace Content.Server.Sound
|
namespace Content.Server.Sound.Components
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Simple sound emitter that emits sound on LandEvent
|
/// Simple sound emitter that emits sound on LandEvent
|
||||||
@@ -3,7 +3,7 @@ using Robust.Shared.Audio;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
|
|
||||||
namespace Content.Server.Sound
|
namespace Content.Server.Sound.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class LoopingLoopingSoundComponent : SharedLoopingSoundComponent
|
public class LoopingLoopingSoundComponent : SharedLoopingSoundComponent
|
||||||
@@ -2,6 +2,7 @@ using Content.Shared.Audio;
|
|||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Throwing;
|
using Content.Shared.Throwing;
|
||||||
using Content.Server.Interaction.Components;
|
using Content.Server.Interaction.Components;
|
||||||
|
using Content.Server.Sound.Components;
|
||||||
using Content.Server.Throwing;
|
using Content.Server.Throwing;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Content.Server.Sound;
|
using Content.Server.Sound.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
|
||||||
namespace Content.Server.Throwing
|
namespace Content.Server.Throwing
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
using Content.Shared.Audio;
|
|
||||||
using Content.Shared.Interaction;
|
|
||||||
using Content.Shared.Throwing;
|
|
||||||
using Robust.Shared.Audio;
|
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Player;
|
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
using Robust.Shared.Random;
|
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
|
|
||||||
namespace Content.Server.Toys
|
|
||||||
{
|
|
||||||
[RegisterComponent]
|
|
||||||
public class ToysComponent : Component, IActivate, IUse, ILand
|
|
||||||
{
|
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
|
||||||
|
|
||||||
public override string Name => "Toys";
|
|
||||||
|
|
||||||
[ViewVariables]
|
|
||||||
[DataField("toySqueak")]
|
|
||||||
public string _soundCollectionName = "ToySqueak";
|
|
||||||
|
|
||||||
public void Squeak()
|
|
||||||
{
|
|
||||||
PlaySqueakEffect();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PlaySqueakEffect()
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrWhiteSpace(_soundCollectionName))
|
|
||||||
{
|
|
||||||
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(_soundCollectionName);
|
|
||||||
var file = _random.Pick(soundCollection.PickFiles);
|
|
||||||
SoundSystem.Play(Filter.Pvs(Owner), file, Owner, AudioParams.Default);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
|
||||||
{
|
|
||||||
Squeak();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IUse.UseEntity(UseEntityEventArgs eventArgs)
|
|
||||||
{
|
|
||||||
Squeak();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ILand.Land(LandEventArgs eventArgs)
|
|
||||||
{
|
|
||||||
Squeak();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user