CatStation/Content.Server/RuntimeFun/SpeakOnExceptionComponent.cs
beck-thompson b9607e39b0
Exception now meows when an error occurs on the server (#39734)
* Exception now meows when an error occurs

* tweaks

* Add to real mouse

* 1984 😔

* Sussy entity effect

* Comment

* More errors

* Other fixes

* opps

* fixes

* cleanup

* Cleanup

* Remove saving last message

* runtime as well!

* Make logger private, clean up error has occured to boolean instead of string

* Add auto pause and time offset serializer

* Properly block accent when speaking (sometimes)

* Add package

* Fix

* Review

* fix
2026-08-16 09:07:42 +00:00

41 lines
1.3 KiB
C#

using Content.Shared.Dataset;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.RuntimeFun;
/// <summary>
/// Entities with this component will speak from a dataset everytime an error occurs in an interval.
/// </summary>
[RegisterComponent, AutoGenerateComponentPause]
public sealed partial class SpeakOnExceptionComponent : Component
{
/// <summary>
/// Minimum time between error speech events.
/// </summary>
[DataField]
public TimeSpan SpeechCooldown = TimeSpan.FromMinutes(1);
/// <summary>
/// The chance to speak without an accent.
/// </summary>
[DataField]
public float ChanceSpeakNoAccent = 0.005f;
/// <summary>
/// Localized dataset used when speaking.
/// </summary>
[DataField]
public ProtoId<LocalizedDatasetPrototype> Dataset = "ExceptionSpeechDataset";
/// <summary>
/// The next time the entity can say another error.
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField]
public TimeSpan? NextTimeCanSpeak;
/// <summary>
/// If this component is currently trying to block accents from working.
/// </summary>
public bool BlockAccent;
}