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>
82 lines
3.1 KiB
C#
82 lines
3.1 KiB
C#
using Content.Shared.Construction.EntitySystems;
|
|
using Content.Shared.Database;
|
|
using Content.Shared.Disposal.Components;
|
|
|
|
namespace Content.Shared.Disposal.Unit;
|
|
|
|
public abstract partial class SharedDisposalUnitSystem
|
|
{
|
|
private void OnUiButtonPressed(Entity<DisposalUnitComponent> ent, ref DisposalUnitUiButtonPressedMessage args)
|
|
{
|
|
if (args.Actor is not { Valid: true } player)
|
|
return;
|
|
|
|
switch (args.Button)
|
|
{
|
|
case DisposalUnitUiButton.Eject:
|
|
EjectContents(ent);
|
|
_adminLog.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(player):player} hit eject button on {ToPrettyString(ent)}");
|
|
break;
|
|
case DisposalUnitUiButton.Engage:
|
|
ToggleEngage(ent);
|
|
_adminLog.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(player):player} hit flush button on {ToPrettyString(ent)}, it's now {(ent.Comp.Engaged ? "on" : "off")}");
|
|
break;
|
|
case DisposalUnitUiButton.Power:
|
|
_power.TogglePower(ent.Owner, user: args.Actor);
|
|
break;
|
|
default:
|
|
throw new ArgumentOutOfRangeException($"{ToPrettyString(player):player} attempted to hit a nonexistant button on {ToPrettyString(ent)}");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns the estimated time when the disposal unit will be back to full pressure.
|
|
/// </summary>
|
|
/// <param name="ent">The disposal unit.</param>
|
|
/// <returns>The estimated time.</returns>
|
|
public TimeSpan EstimatedFullPressure(Entity<DisposalUnitComponent> ent)
|
|
{
|
|
if (ent.Comp.NextPressurized < _timing.CurTime)
|
|
return TimeSpan.Zero;
|
|
|
|
return ent.Comp.NextPressurized;
|
|
}
|
|
|
|
protected void UpdateUI(Entity<DisposalUnitComponent> entity)
|
|
{
|
|
if (_timing.ApplyingState)
|
|
return;
|
|
|
|
if (_ui.TryGetOpenUi(entity.Owner, DisposalUnitUiKey.Key, out var bui))
|
|
{
|
|
bui.Update<DisposalUnitBoundUserInterfaceState>();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Updates the appearance data of a disposal unit.
|
|
/// </summary>
|
|
/// <param name="ent">The disposal unit.</param>
|
|
protected void UpdateVisualState(Entity<DisposalUnitComponent> ent)
|
|
{
|
|
if (!TryComp(ent, out AppearanceComponent? appearance))
|
|
return;
|
|
|
|
var isAnchored = Transform(ent).Anchored;
|
|
_appearance.SetData(ent, AnchorVisuals.Anchored, isAnchored, appearance);
|
|
|
|
if (!isAnchored)
|
|
return;
|
|
|
|
var state = GetState(ent);
|
|
_appearance.SetData(ent, DisposalUnitVisuals.IsReady, state == DisposalsPressureState.Ready, appearance);
|
|
_appearance.SetData(ent, DisposalUnitVisuals.IsFlushing, state == DisposalsPressureState.Flushed, appearance);
|
|
_appearance.SetData(ent, DisposalUnitVisuals.IsEngaged, ent.Comp.Engaged, appearance);
|
|
|
|
if (!_power.IsPowered(ent.Owner))
|
|
return;
|
|
|
|
_appearance.SetData(ent, DisposalUnitVisuals.IsFull, GetContainedEntityCount(ent) > 0, appearance);
|
|
_appearance.SetData(ent, DisposalUnitVisuals.IsCharging, state != DisposalsPressureState.Ready, appearance);
|
|
}
|
|
}
|