CatStation/Content.Server/Ghost/Components/SpookySpeakerComponent.cs
Whatstone 7c7544e014
Add the ability for ghosts to extinguish candles. (#44810)
* SpookyExtinguish, oooooo

* comments, intensity

* Use allowedIntensity in GhostSystem

* commento-stuffed

* GhostComponent: return to BooCount for sanity

* unindento

* fix ghost component, dependency order (holy shit)

* More cleanup than feature at this point

* Add partial to PoweredLightSystem

* event field order, ghost system comments

* Separate spooky, consistency w.r.t. DoGhostEvent

* BooActionEvent handler to GhostSystem.Boo, fix ext

* featuring kenny blankenship and vic romano

* fix maximum value

* Fix BooIntensity comment

* remove whitespace

* comments, RevenantSystem: set handled

* "for a typical ghost"

* Address PR suggestions

* Use Handled, SpookyLight: BooIntensity->Intensity

* Use Handled in BooActionEvent handler, update name

* remove query

* address beck-thompson's requested changes + Handled

* ResponseIntensity setter, private Handled setter

* Check Handled, not !Handled

* there is a third

* the hell was this using placement

* Obsolete Extinguish, Try with Entity<T>

* why wasn't this using TimeOffsetSerializer

---------

Co-authored-by: iaada <iaada@users.noreply.github.com>
2026-08-04 05:15:17 +00:00

45 lines
1.5 KiB
C#

using Content.Shared.Dataset;
using Content.Shared.Ghost.Components;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Ghost.Components;
/// <summary>
/// Causes this entity to react to ghost player using the "Boo!" action by speaking
/// a randomly chosen message from a specified set.
/// </summary>
[RegisterComponent, AutoGenerateComponentPause]
public sealed partial class SpookySpeakerComponent : Component
{
/// <summary>
/// ProtoId of the LocalizedDataset to use for messages.
/// </summary>
[DataField(required: true)]
public ProtoId<LocalizedDatasetPrototype> MessageSet;
/// <summary>
/// Probability that this entity will speak if activated by a Boo action.
/// This is so whole banks of entities don't trigger at the same time.
/// </summary>
[DataField]
public float SpeakChance = 0.5f;
/// <summary>
/// Minimum time that must pass after speaking before this entity can speak again.
/// </summary>
[DataField]
public TimeSpan Cooldown = TimeSpan.FromSeconds(30);
/// <summary>
/// Time when the cooldown will have elapsed and the entity can speak again.
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField]
public TimeSpan NextSpeakTime;
/// <summary>
/// The intensity of this response.
/// </summary>
[DataField]
public GhostBooIntensity Intensity = GhostBooIntensity.Normal;
}