mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +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>
78 lines
2.5 KiB
C#
78 lines
2.5 KiB
C#
using Content.Shared.Disposal.Components;
|
|
using Content.Shared.Disposal.Holder;
|
|
using Content.Shared.Disposal.Tube;
|
|
using Content.Shared.Disposal.Unit;
|
|
using Robust.Shared.Audio;
|
|
using Robust.Shared.Audio.Systems;
|
|
using System.Linq;
|
|
|
|
namespace Content.Shared.Disposal.Router;
|
|
|
|
/// <summary>
|
|
/// This system handles the routing of entities in disposals
|
|
/// based on what tags they possess.
|
|
/// </summary>
|
|
public sealed partial class DisposalRouterSystem : EntitySystem
|
|
{
|
|
[Dependency] private SharedDisposalHolderSystem _disposalHolder = default!;
|
|
[Dependency] private DisposalTubeSystem _disposalTube = default!;
|
|
[Dependency] private SharedAudioSystem _audio = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<DisposalRouterComponent, GetDisposalsNextDirectionEvent>(OnGetRouterNextDirection, before: new[] { typeof(DisposalTubeSystem) });
|
|
|
|
Subs.BuiEvents<DisposalRouterComponent>(DisposalRouterUiKey.Key, subs =>
|
|
{
|
|
subs.Event<DisposalRouterUiActionMessage>(OnUiAction);
|
|
});
|
|
}
|
|
|
|
private void OnGetRouterNextDirection(Entity<DisposalRouterComponent> ent, ref GetDisposalsNextDirectionEvent args)
|
|
{
|
|
if (args.Handled)
|
|
return;
|
|
|
|
if (!TryComp<DisposalTubeComponent>(ent, out var disposalTube))
|
|
return;
|
|
|
|
var exits = _disposalTube.GetTubeConnectableDirections((ent, disposalTube));
|
|
|
|
if (exits.Length < 3 || _disposalHolder.TagsOverlap(args.Holder, ent.Comp.Tags))
|
|
{
|
|
_disposalTube.SelectNextDirection((ent, disposalTube), exits, ref args);
|
|
return;
|
|
}
|
|
|
|
_disposalTube.SelectNextDirection((ent, disposalTube), exits.Skip(1).ToArray(), ref args);
|
|
args.Handled = true;
|
|
}
|
|
|
|
private void OnUiAction(Entity<DisposalRouterComponent> ent, ref DisposalRouterUiActionMessage msg)
|
|
{
|
|
if (!Exists(msg.Actor))
|
|
return;
|
|
|
|
// Check for correct message and ignore maleformed strings
|
|
if (SharedDisposalHolderSystem.TagRegex.IsMatch(msg.Tags))
|
|
{
|
|
ent.Comp.Tags.Clear();
|
|
|
|
foreach (var tag in msg.Tags.Split(',', StringSplitOptions.RemoveEmptyEntries))
|
|
{
|
|
var trimmed = tag.Trim();
|
|
|
|
if (string.IsNullOrEmpty(trimmed))
|
|
continue;
|
|
|
|
ent.Comp.Tags.Add(trimmed);
|
|
}
|
|
|
|
Dirty(ent);
|
|
|
|
_audio.PlayPredicted(ent.Comp.ClickSound, ent, msg.Actor, AudioParams.Default.WithVolume(-2f));
|
|
}
|
|
}
|
|
}
|