Add Modular grenades (chemnades). (#7138)
This commit is contained in:
32
Content.Server/Construction/Completions/AdminLog.cs
Normal file
32
Content.Server/Construction/Completions/AdminLog.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Database;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.Construction.Completions;
|
||||
|
||||
/// <summary>
|
||||
/// Generate an admin log upon reaching this node. Useful for dangerous construction (e.g., modular grenades)
|
||||
/// </summary>
|
||||
[UsedImplicitly]
|
||||
public sealed class AdminLog : IGraphAction
|
||||
{
|
||||
[DataField("logType", required: true)]
|
||||
public LogType LogType = LogType.Construction;
|
||||
|
||||
[DataField("impact")]
|
||||
public LogImpact Impact = LogImpact.Medium;
|
||||
|
||||
[DataField("message", required: true)]
|
||||
public string Message = string.Empty;
|
||||
|
||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||
{
|
||||
var logSys = entityManager.EntitySysManager.GetEntitySystem<AdminLogSystem>();
|
||||
|
||||
if (userUid.HasValue)
|
||||
logSys.Add(LogType, Impact, $"{Message} - Entity: {entityManager.ToPrettyString(uid):entity}, User: {entityManager.ToPrettyString(userUid.Value):user}");
|
||||
else
|
||||
logSys.Add(LogType, Impact, $"{Message} - Entity: {entityManager.ToPrettyString(uid):entity}");
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,9 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Sound;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Construction.Completions
|
||||
{
|
||||
@@ -16,9 +13,17 @@ namespace Content.Server.Construction.Completions
|
||||
{
|
||||
[DataField("sound", required: true)] public SoundSpecifier Sound { get; private set; } = default!;
|
||||
|
||||
[DataField("AudioParams")]
|
||||
public AudioParams AudioParams = AudioParams.Default;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("variation")]
|
||||
public float Variation = 0.125f;
|
||||
|
||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||
{
|
||||
SoundSystem.Play(Filter.Pvs(uid), Sound.GetSound(), uid, AudioHelpers.WithVariation(0.125f));
|
||||
var scale = (float) IoCManager.Resolve<IRobustRandom>().NextGaussian(1, Variation);
|
||||
SoundSystem.Play(Filter.Pvs(uid, entityManager: entityManager), Sound.GetSound(), uid, AudioParams.WithPitchScale(scale));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user