mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* Initial commit * Added pods * Transit tubes should no longer connect with disposal pipes * Updated the transit tube sprites * Revisited how the transit tubes work * Fixing merge conflict * Updated sprites * Simplified disposal component collections and updated yaml * Moved the majority of the disposals code to Shared * Move disposed ents via physics * Disposal unit now use generic visualizers * Followers of disposed entities have predicted movement * Made BeingDisposedSystem shared * Added documentation for some components * Code clean up * Removed unneeded container entries, tubes use directions instead of angles * Many EntityUid/Comp -> Entity<Comp> changes * Updated DisposableSystem * Review of DisposalTubeSystem * Review of DisposalUnitSystem * Review of DisposalSignalRouterSystem * Unit updates * Fixing merge conflict * Merge conflict resolved * Re-organization of systems and components * Allow trapped entities to escape endless loops * Fix for item ejection * UI updates * Minor tweak * Fixes for transit tubes * Removed placeholder sprite * Removed transit tubes (for now) * Moved exit stun time to DisposalHolderComponent * Added a limit on the amount of damage that can sustained from disposals travel * Fix for PVS-related sound issues * Added a limit on the number of entities that can be inserted into units * Clean up * Undid file scoping * Fixed test fail * Fixed test fail * Increased min default capacity of disposal units * Fixed audio spam occurring when dumping multiple items into a disposal unit * Tile prying now occurs whenever exiting an open pipe * Prevent attacking and interactions while traveling through disposals * Added generic verbs for entering/exiting disposal units * Fixed UI prediction bug * Bug fixes * Small improvements * Moved the disposal holder prototype from the disposal entry to the unit * Minor clean up * Added support for a disposal holder despawn effect * Added prediction guard * Test fail fix * Re-added new escape behavior * Removed outdated PVS code * Clean up * More escape behavior changes * More clean up * Updated exit selection logic * Bug fix * More clean up * Split up disposal unit code * Cleaned up disposal units some more * Adjusted exit throw distance * Capitalized disposal and mailing unit window titles * Bug fixes * Taggers and routers show existing tags when the UI opens * Fixed test fail * test fail fix * Minor performance improvement * Minor improvement in pathing * merge conflicts * Fix heisentest * Fixed mispredict * Updated system referencing conventions * Updated to account for changes made to the code * Attempting to fix submodule issue * Addressing test fails * Additional fixes for tests * Addressing reviewer comments * Cleaned up exit randomization * T-ray can see disposal pipes when in 'pipe' mode * Fix for flush animation flickering * mild thing * fix both --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
277 lines
7.6 KiB
C#
277 lines
7.6 KiB
C#
using Content.Shared.Atmos;
|
|
using Content.Shared.DoAfter;
|
|
using Content.Shared.Whitelist;
|
|
using Robust.Shared.Audio;
|
|
using Robust.Shared.Containers;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Serialization;
|
|
|
|
namespace Content.Shared.Disposal.Components;
|
|
|
|
/// <summary>
|
|
/// Takes in entities and flushes them out to attached disposals tubes after a timer.
|
|
/// </summary>
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true), AutoGenerateComponentPause]
|
|
public sealed partial class DisposalUnitComponent : Component
|
|
{
|
|
/// <summary>
|
|
/// Air contained in the disposal unit.
|
|
/// </summary>
|
|
[DataField]
|
|
public GasMixture Air = new(Atmospherics.CellVolume);
|
|
|
|
/// <summary>
|
|
/// Name of the flushing animation state.
|
|
/// </summary>
|
|
[DataField]
|
|
public string FlushingState = "disposal-flush";
|
|
|
|
/// <summary>
|
|
/// The animation used when unit flushes.
|
|
/// </summary>
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
public object FlushingAnimation = default!;
|
|
|
|
/// <summary>
|
|
/// Sounds played upon the unit flushing.
|
|
/// </summary>
|
|
[DataField("soundFlush"), AutoNetworkedField]
|
|
public SoundSpecifier? FlushSound = new SoundPathSpecifier("/Audio/Machines/disposalflush.ogg");
|
|
|
|
/// <summary>
|
|
/// Blacklists (prevents) entities listed from being placed inside.
|
|
/// </summary>
|
|
[DataField]
|
|
public EntityWhitelist? Blacklist;
|
|
|
|
/// <summary>
|
|
/// Whitelists (allows) entities listed from being placed inside.
|
|
/// </summary>
|
|
[DataField]
|
|
public EntityWhitelist? Whitelist;
|
|
|
|
/// <summary>
|
|
/// Sound played when an object is inserted into the disposal unit.
|
|
/// </summary>
|
|
[ViewVariables(VVAccess.ReadWrite), DataField("soundInsert")]
|
|
public SoundSpecifier? InsertSound = new SoundPathSpecifier("/Audio/Effects/trashbag1.ogg");
|
|
|
|
/// <summary>
|
|
/// The next time that the insertion sound is allowed to be played.
|
|
/// Used to reduce audio spam when dumping multiple items into the unit.
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField, AutoPausedField]
|
|
public TimeSpan NextAllowedInsertSound = TimeSpan.Zero;
|
|
|
|
/// <summary>
|
|
/// Delay in seconds before the insertion audio can be played again.
|
|
/// </summary>
|
|
[DataField]
|
|
public TimeSpan InsertSoundDelay = TimeSpan.FromSeconds(0.1);
|
|
|
|
/// <summary>
|
|
/// State for this disposals unit.
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField]
|
|
public DisposalsPressureState State;
|
|
|
|
/// <summary>
|
|
/// Next time the disposal unit will be pressurized.
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField, AutoPausedField]
|
|
public TimeSpan NextPressurized = TimeSpan.Zero;
|
|
|
|
/// <summary>
|
|
/// The percentage of pressure gained per second by the unit.
|
|
/// </summary>
|
|
[DataField]
|
|
public float PressurePerSecond = 0.05f;
|
|
|
|
/// <summary>
|
|
/// How long it takes to flush a disposals unit manually.
|
|
/// </summary>
|
|
[DataField("flushTime")]
|
|
public TimeSpan ManualFlushTime = TimeSpan.FromSeconds(2);
|
|
|
|
/// <summary>
|
|
/// How long it takes from the start of a flush animation to return the sprite to normal.
|
|
/// </summary>
|
|
[DataField]
|
|
public TimeSpan FlushDelay = TimeSpan.FromSeconds(3);
|
|
|
|
/// <summary>
|
|
/// Removes the pressure requirement for flushing.
|
|
/// </summary>
|
|
[DataField]
|
|
public bool DisablePressure;
|
|
|
|
/// <summary>
|
|
/// Last time that an entity tried to exit this disposal unit.
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField, AutoPausedField]
|
|
public TimeSpan LastExitAttempt;
|
|
|
|
/// <summary>
|
|
/// Delay in seconds before entities are allowed another
|
|
/// attempt to exit the disposal unit again.
|
|
/// </summary>
|
|
[DataField]
|
|
public TimeSpan ExitAttemptDelay = TimeSpan.FromSeconds(0.5);
|
|
|
|
/// <summary>
|
|
/// Sets whether the unit should automatically flush
|
|
/// after something is inserted into it.
|
|
/// </summary>
|
|
[DataField]
|
|
public bool AutomaticEngage = true;
|
|
|
|
/// <summary>
|
|
/// Delay for automatic flushing of the disposal unit.
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField]
|
|
public TimeSpan AutomaticEngageTime = TimeSpan.FromSeconds(30);
|
|
|
|
/// <summary>
|
|
/// Delay for entities trying to enter disposals themselves.
|
|
/// </summary>
|
|
[DataField]
|
|
public float EntryDelay = 0.5f;
|
|
|
|
/// <summary>
|
|
/// Delay from trying to shove someone else into disposals.
|
|
/// </summary>
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
public float DraggedEntryDelay = 2.0f;
|
|
|
|
/// <summary>
|
|
/// Container of entities inside this disposal unit.
|
|
/// </summary>
|
|
[DataField]
|
|
public Container? Container;
|
|
|
|
/// <summary>
|
|
/// Was the disposals unit engaged for a manual flush.
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField]
|
|
public bool Engaged;
|
|
|
|
/// <summary>
|
|
/// Next time this unit will flush. Is the lesser of <see cref="FlushDelay"/> and <see cref="AutomaticEngageTime"/>
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField, AutoPausedField]
|
|
public TimeSpan? NextFlush;
|
|
|
|
/// <summary>
|
|
/// The max number of entities that can be inserted in the unit before it needs to be flushed.
|
|
/// </summary>
|
|
[DataField]
|
|
public int MaxCapacity = 30;
|
|
|
|
/// <summary>
|
|
/// Proto ID of the holder spawned to contain entities that
|
|
/// are inserted into the disposals system.
|
|
/// </summary>
|
|
[DataField]
|
|
public EntProtoId HolderPrototypeId = "DisposalHolder";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Event raised on entities that are entering or exiting disposals.
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public record DisposalSystemTransitionEvent;
|
|
|
|
/// <summary>
|
|
/// Do after raised when attempting to insert an entity into a disposal unit.
|
|
/// </summary>
|
|
[Serializable, NetSerializable]
|
|
public sealed partial class DisposalDoAfterEvent : SimpleDoAfterEvent;
|
|
|
|
/// <summary>
|
|
/// Message sent from the server to the client to update the UI of disposal units.
|
|
/// </summary>
|
|
[Serializable, NetSerializable]
|
|
public sealed class DisposalUnitBoundUserInterfaceState : BoundUserInterfaceState;
|
|
|
|
/// <summary>
|
|
/// Disposal unit pressure states.
|
|
/// </summary>
|
|
[Serializable, NetSerializable]
|
|
public enum DisposalsPressureState : byte
|
|
{
|
|
/// <summary>
|
|
/// The disposal unit is fully pressurized and ready to flush.
|
|
/// </summary>
|
|
Ready,
|
|
|
|
/// <summary>
|
|
/// Has been flushed recently within FlushDelay.
|
|
/// </summary>
|
|
Flushed,
|
|
|
|
/// <summary>
|
|
/// FlushDelay has elapsed and now we're transitioning back to Ready.
|
|
/// </summary>
|
|
Pressurizing
|
|
}
|
|
|
|
/// <summary>
|
|
/// Visual keys for disposal units.
|
|
/// </summary>
|
|
[Serializable, NetSerializable]
|
|
public enum DisposalUnitVisuals : byte
|
|
{
|
|
IsReady,
|
|
IsEngaged,
|
|
IsFlushing,
|
|
IsCharging,
|
|
IsFull,
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sprite layers for disposal units.
|
|
/// </summary>
|
|
[Serializable, NetSerializable]
|
|
public enum DisposalUnitVisualLayers : byte
|
|
{
|
|
Base,
|
|
OverlayFlushing,
|
|
OverlayEngaged,
|
|
OverlayCharging,
|
|
OverlayFull,
|
|
}
|
|
|
|
/// <summary>
|
|
/// UI button types for disposal units.
|
|
/// </summary>
|
|
[Serializable, NetSerializable]
|
|
public enum DisposalUnitUiButton : byte
|
|
{
|
|
Eject,
|
|
Engage,
|
|
Power,
|
|
}
|
|
|
|
/// <summary>
|
|
/// Message data sent from client to server when a disposal unit ui button is pressed.
|
|
/// </summary>
|
|
[Serializable, NetSerializable]
|
|
public sealed class DisposalUnitUiButtonPressedMessage : BoundUserInterfaceMessage
|
|
{
|
|
public readonly DisposalUnitUiButton Button;
|
|
|
|
public DisposalUnitUiButtonPressedMessage(DisposalUnitUiButton button)
|
|
{
|
|
Button = button;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Key for the disposal unit UI.
|
|
/// </summary>
|
|
[Serializable, NetSerializable]
|
|
public enum DisposalUnitUiKey : byte
|
|
{
|
|
Key
|
|
}
|