mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-10 02:41: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>
96 lines
3.2 KiB
C#
96 lines
3.2 KiB
C#
using Content.Shared.Disposal.Components;
|
|
using Content.Shared.Disposal.Unit;
|
|
using Robust.Client.Animations;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Shared.Audio.Systems;
|
|
|
|
namespace Content.Client.Disposal.Unit;
|
|
|
|
/// <inheritdoc/>
|
|
public sealed partial class DisposalUnitSystem : SharedDisposalUnitSystem
|
|
{
|
|
[Dependency] private AppearanceSystem _appearanceSystem = default!;
|
|
[Dependency] private AnimationPlayerSystem _animationSystem = default!;
|
|
[Dependency] private SharedAudioSystem _audioSystem = default!;
|
|
|
|
private const string AnimationKey = "disposal_unit_animation";
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<DisposalUnitComponent, AfterAutoHandleStateEvent>(OnHandleState);
|
|
SubscribeLocalEvent<DisposalUnitComponent, AppearanceChangeEvent>(OnAppearanceChange);
|
|
}
|
|
|
|
protected override void OnComponentInit(Entity<DisposalUnitComponent> ent, ref ComponentInit args)
|
|
{
|
|
base.OnComponentInit(ent, ref args);
|
|
|
|
// Create and store flushing animation.
|
|
var anim = new Animation
|
|
{
|
|
Length = ent.Comp.FlushDelay,
|
|
AnimationTracks =
|
|
{
|
|
new AnimationTrackSpriteFlick()
|
|
{
|
|
LayerKey = DisposalUnitVisualLayers.OverlayFlushing,
|
|
KeyFrames = { new AnimationTrackSpriteFlick.KeyFrame(ent.Comp.FlushingState, 0f) },
|
|
},
|
|
}
|
|
};
|
|
|
|
// Try to add flushing sound
|
|
if (ent.Comp.FlushSound != null)
|
|
{
|
|
anim.AnimationTracks.Add(
|
|
new AnimationTrackPlaySound
|
|
{
|
|
KeyFrames = { new AnimationTrackPlaySound.KeyFrame(_audioSystem.ResolveSound(ent.Comp.FlushSound), 0) }
|
|
}
|
|
);
|
|
}
|
|
|
|
ent.Comp.FlushingAnimation = anim;
|
|
}
|
|
|
|
private void OnHandleState(EntityUid uid, DisposalUnitComponent component, ref AfterAutoHandleStateEvent args)
|
|
{
|
|
UpdateUI((uid, component));
|
|
}
|
|
|
|
private void OnAppearanceChange(Entity<DisposalUnitComponent> ent, ref AppearanceChangeEvent args)
|
|
{
|
|
if (args.Sprite == null)
|
|
return;
|
|
|
|
UpdateState(ent, args.Sprite, args.Component);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Updates the animation of a disposal unit.
|
|
/// </summary>
|
|
/// <param name="ent">The disposal unit.</param>
|
|
/// <param name="sprite">The disposal unit's sprite.</param>
|
|
/// <param name="appearance">The disposal unit's appearance.</param>
|
|
private void UpdateState(Entity<DisposalUnitComponent> ent, SpriteComponent sprite, AppearanceComponent appearance)
|
|
{
|
|
if (!_appearanceSystem.TryGetData<bool>(ent, DisposalUnitVisuals.IsFlushing, out var isFlushing, appearance))
|
|
return;
|
|
|
|
// This is a transient state so not too worried about replaying in range.
|
|
if (isFlushing)
|
|
{
|
|
if (!_animationSystem.HasRunningAnimation(ent, AnimationKey))
|
|
{
|
|
_animationSystem.Play(ent, (Animation)ent.Comp.FlushingAnimation, AnimationKey);
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
_animationSystem.Stop(ent.Owner, AnimationKey);
|
|
}
|
|
}
|
|
|