CatStation/Content.Shared/CardboardBox/Components/CardboardBoxComponent.cs
AndrewFenriz 887835018c
Vehicle system: Mech & CardboardBox Integration (#43532)
* Part one of Vehicles

* Also we need this

* Part 1

* Part 1.1

* And we need this

* Part 2

* Part 2.1

* We REALLY need this

* Part 1 of integration

* Little fix

* Just fixes

* fixes (i'm tired)

* fix

* fix

* Apply suggestions from code review

Co-authored-by: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>

* update

* fixed

* just for cleaner diff

* just in case

* I think this might be cleaner

* fix

* fix

* upd

* upd

* fix update

* small fix

* upd

* fix test?

* fix?

* remove initialize

* move attack to vehicle

---------

Co-authored-by: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>
2026-07-21 00:14:11 +00:00

61 lines
1.8 KiB
C#

using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.CardboardBox.Components;
/// <summary>
/// Allows a user to control an EntityStorage entity while inside of it.
/// Used for big cardboard box entities.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause]
public sealed partial class CardboardBoxComponent : Component
{
/// <summary>
/// The entity used for the box opening effect
/// </summary>
[DataField]
public EntProtoId Effect = "Exclamation";
/// <summary>
/// Sound played upon effect creation
/// </summary>
[DataField]
public SoundSpecifier? EffectSound;
/// <summary>
/// Whether to prevent the box from making the sound and effect
/// </summary>
[DataField]
public bool Quiet;
/// <summary>
/// How far should the box opening effect go?
/// </summary>
[DataField]
public float Distance = 6f;
/// <summary>
/// Time at which the sound effect can next be played.
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField, AutoPausedField]
public TimeSpan EffectCooldown;
/// <summary>
/// Time between sound effects. Prevents effect spam
/// </summary>
[DataField]
public TimeSpan CooldownDuration = TimeSpan.FromSeconds(5f);
}
/// <summary>
/// Message to play the box effect.
/// </summary>
[Serializable, NetSerializable]
public sealed class PlayBoxEffectMessage(NetEntity source, NetEntity mover) : EntityEventArgs
{
public NetEntity Source = source;
public NetEntity Mover = mover;
}