Files
OldThink/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs
Remuchi 5e74f6ae53 Merge branch 'master' of https://github.com/space-wizards/space-station-14 into upstream
# Conflicts:
#	Content.Client/Administration/Managers/ClientAdminManager.cs
#	Content.Client/Administration/Systems/BwoinkSystem.cs
#	Content.Client/Alerts/ClientAlertsSystem.cs
#	Content.Client/Audio/BackgroundAudioSystem.cs
#	Content.Client/CardboardBox/CardboardBoxSystem.cs
#	Content.Client/Chemistry/UI/InjectorStatusControl.cs
#	Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml
#	Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml.cs
#	Content.Client/Clothing/ClientClothingSystem.cs
#	Content.Client/CriminalRecords/CriminalRecordsConsoleBoundUserInterface.cs
#	Content.Client/CriminalRecords/CriminalRecordsConsoleWindow.xaml.cs
#	Content.Client/Decals/Overlays/DecalOverlay.cs
#	Content.Client/DoAfter/DoAfterOverlay.cs
#	Content.Client/Doors/AirlockSystem.cs
#	Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml
#	Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml.cs
#	Content.Client/Launcher/LauncherConnectingGui.xaml
#	Content.Client/Launcher/LauncherConnectingGui.xaml.cs
#	Content.Client/Lobby/LobbyState.cs
#	Content.Client/Lobby/UI/LobbyGui.xaml.cs
#	Content.Client/MainMenu/UI/MainMenuControl.xaml
#	Content.Client/MassMedia/Ui/MiniArticleCardControl.xaml
#	Content.Client/MassMedia/Ui/MiniArticleCardControl.xaml.cs
#	Content.Client/MassMedia/Ui/NewsWriteMenu.xaml
#	Content.Client/MassMedia/Ui/NewsWriteMenu.xaml.cs
#	Content.Client/Options/UI/Tabs/MiscTab.xaml
#	Content.Client/Options/UI/Tabs/MiscTab.xaml.cs
#	Content.Client/Outline/InteractionOutlineSystem.cs
#	Content.Client/Overlays/ShowSecurityIconsSystem.cs
#	Content.Client/Players/PlayTimeTracking/JobRequirementsManager.cs
#	Content.Client/Popups/PopupOverlay.cs
#	Content.Client/Popups/PopupSystem.cs
#	Content.Client/Preferences/ClientPreferencesManager.cs
#	Content.Client/Preferences/UI/HumanoidProfileEditor.xaml
#	Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs
#	Content.Client/StatusIcon/StatusIconOverlay.cs
#	Content.Client/Stylesheets/StyleNano.cs
#	Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs
#	Content.Client/UserInterface/Systems/Chat/ChatUIController.cs
#	Content.Server/Access/Systems/IdCardConsoleSystem.cs
#	Content.Server/Administration/Commands/BanCommand.cs
#	Content.Server/Administration/Notes/AdminMessageEui.cs
#	Content.Server/Administration/Notes/AdminNotesSystem.cs
#	Content.Server/Administration/Notes/IAdminNotesManager.cs
#	Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs
#	Content.Server/Administration/Systems/BwoinkSystem.cs
#	Content.Server/Administration/UI/PermissionsEui.cs
#	Content.Server/Antag/AntagSelectionSystem.cs
#	Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs
#	Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs
#	Content.Server/Chat/Systems/ChatSystem.cs
#	Content.Server/Chemistry/EntitySystems/InjectorSystem.cs
#	Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs
#	Content.Server/Connection/ConnectionManager.cs
#	Content.Server/CriminalRecords/Systems/CriminalRecordsConsoleSystem.cs
#	Content.Server/Database/DatabaseRecords.cs
#	Content.Server/Database/ServerDbBase.cs
#	Content.Server/Database/ServerDbManager.cs
#	Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs
#	Content.Server/Doors/Systems/DoorSystem.cs
#	Content.Server/Execution/ExecutionSystem.cs
#	Content.Server/Explosion/EntitySystems/ExplosionSystem.cs
#	Content.Server/Fax/FaxSystem.cs
#	Content.Server/Fluids/EntitySystems/PuddleSystem.Evaporation.cs
#	Content.Server/GameTicking/GameTicker.Replays.cs
#	Content.Server/GameTicking/GameTicker.RoundFlow.cs
#	Content.Server/GameTicking/Rules/Components/ThiefRuleComponent.cs
#	Content.Server/GameTicking/Rules/GameRuleSystem.Utility.cs
#	Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs
#	Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs
#	Content.Server/GameTicking/Rules/ThiefRuleSystem.cs
#	Content.Server/GameTicking/Rules/TraitorRuleSystem.cs
#	Content.Server/GameTicking/Rules/ZombieRuleSystem.cs
#	Content.Server/Hands/Systems/HandsSystem.cs
#	Content.Server/Holosign/HolosignSystem.cs
#	Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.cs
#	Content.Server/Info/InfoSystem.cs
#	Content.Server/Kitchen/EntitySystems/SharpSystem.cs
#	Content.Server/Magic/MagicSystem.cs
#	Content.Server/MagicMirror/MagicMirrorSystem.cs
#	Content.Server/Mapping/MappingSystem.cs
#	Content.Server/MassMedia/Systems/NewsSystem.cs
#	Content.Server/Medical/Components/HealthAnalyzerComponent.cs
#	Content.Server/Medical/CrewMonitoring/CrewMonitoringServerSystem.cs
#	Content.Server/Medical/CryoPodSystem.cs
#	Content.Server/Medical/HealthAnalyzerSystem.cs
#	Content.Server/Nutrition/EntitySystems/OpenableSystem.cs
#	Content.Server/Preferences/Managers/ServerPreferencesManager.cs
#	Content.Server/Remotes/DoorRemoteSystem.cs
#	Content.Server/Resist/EscapeInventorySystem.cs
#	Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs
#	Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs
#	Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs
#	Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs
#	Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs
#	Content.Server/Species/Systems/NymphSystem.cs
#	Content.Server/StationEvents/Components/GasLeakRuleComponent.cs
#	Content.Server/StationEvents/EventManagerSystem.cs
#	Content.Server/Store/Systems/StoreSystem.Ui.cs
#	Content.Server/Strip/StrippableSystem.cs
#	Content.Server/VendingMachines/VendingMachineSystem.cs
#	Content.Server/Weapons/Ranged/Systems/GunSystem.cs
#	Content.Shared.Database/LogType.cs
#	Content.Shared/Actions/SharedActionsSystem.cs
#	Content.Shared/Administration/AdminFlags.cs
#	Content.Shared/Administration/SharedBwoinkSystem.cs
#	Content.Shared/Anomaly/SharedAnomalySystem.cs
#	Content.Shared/Bed/Sleep/SharedSleepingSystem.cs
#	Content.Shared/Buckle/SharedBuckleSystem.Strap.cs
#	Content.Shared/Chat/ChatChannel.cs
#	Content.Shared/Chemistry/Components/InjectorComponent.cs
#	Content.Shared/Chemistry/EntitySystems/SharedInjectorSystem.cs
#	Content.Shared/Chemistry/SharedReagentDispenser.cs
#	Content.Shared/Containers/ItemSlot/ItemSlotsComponent.cs
#	Content.Shared/CriminalRecords/Systems/SharedCriminalRecordsConsoleSystem.cs
#	Content.Shared/Cuffs/SharedCuffableSystem.cs
#	Content.Shared/Doors/Systems/SharedDoorSystem.cs
#	Content.Shared/Friction/TileFrictionController.cs
#	Content.Shared/Humanoid/Prototypes/SpeciesPrototype.cs
#	Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs
#	Content.Shared/Implants/SharedImplanterSystem.cs
#	Content.Shared/Lock/LockSystem.cs
#	Content.Shared/MedicalScanner/HealthAnalyzerScannedUserMessage.cs
#	Content.Shared/Nutrition/Components/OpenableComponent.cs
#	Content.Shared/Nutrition/EntitySystems/SharedOpenableSystem.cs
#	Content.Shared/Nutrition/EntitySystems/ThirstSystem.cs
#	Content.Shared/Preferences/HumanoidCharacterProfile.cs
#	Content.Shared/Preferences/ICharacterProfile.cs
#	Content.Shared/Projectiles/SharedProjectileSystem.cs
#	Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs
#	Content.Shared/Security/SecurityStatus.cs
#	Content.Shared/Security/Systems/DeployableBarrierSystem.cs
#	Content.Shared/Slippery/SlipperySystem.cs
#	Content.Shared/Species/Systems/ReformSystem.cs
#	Content.Shared/Standing/StandingStateSystem.cs
#	Content.Shared/StatusIcon/StatusIconPrototype.cs
#	Content.Shared/Store/ListingPrototype.cs
#	Content.Shared/VendingMachines/SharedVendingMachineSystem.cs
#	Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs
#	README.md
#	Resources/Audio/Ambience/Antag/pirate_start.ogg
#	Resources/Changelog/Changelog.yml
#	Resources/Credits/GitHub.txt
#	Resources/Locale/en-US/criminal-records/criminal-records.ftl
#	Resources/Locale/en-US/escape-menu/ui/options-menu.ftl
#	Resources/Locale/en-US/medical/components/health-analyzer-component.ftl
#	Resources/Locale/en-US/reagents/meta/biological.ftl
#	Resources/Locale/en-US/reagents/meta/fun.ftl
#	Resources/Locale/en-US/reagents/meta/physical-desc.ftl
#	Resources/Locale/en-US/seeds/seeds.ftl
#	Resources/Locale/en-US/wires/wire-names.ftl
#	Resources/Maps/Shuttles/cargo_fland.yml
#	Resources/Maps/core.yml
#	Resources/Maps/europa.yml
#	Resources/Maps/fland.yml
#	Resources/Maps/origin.yml
#	Resources/Maps/saltern.yml
#	Resources/Maps/train.yml
#	Resources/Prototypes/Actions/diona.yml
#	Resources/Prototypes/Atmospherics/gases.yml
#	Resources/Prototypes/Catalog/Cargo/cargo_emergency.yml
#	Resources/Prototypes/Catalog/Cargo/cargo_engines.yml
#	Resources/Prototypes/Catalog/Cargo/cargo_fun.yml
#	Resources/Prototypes/Catalog/Cargo/cargo_security.yml
#	Resources/Prototypes/Catalog/Cargo/cargo_service.yml
#	Resources/Prototypes/Catalog/Cargo/cargo_vending.yml
#	Resources/Prototypes/Catalog/Fills/Boxes/general.yml
#	Resources/Prototypes/Catalog/Fills/Boxes/syndicate.yml
#	Resources/Prototypes/Catalog/Fills/Crates/engines.yml
#	Resources/Prototypes/Catalog/Fills/Items/briefcases.yml
#	Resources/Prototypes/Catalog/Fills/Items/toolboxes.yml
#	Resources/Prototypes/Catalog/Fills/Lockers/dressers.yml
#	Resources/Prototypes/Catalog/Fills/Lockers/heads.yml
#	Resources/Prototypes/Catalog/Fills/Lockers/security.yml
#	Resources/Prototypes/Catalog/VendingMachines/Inventories/bardrobe.yml
#	Resources/Prototypes/Catalog/VendingMachines/Inventories/clothesmate.yml
#	Resources/Prototypes/Catalog/VendingMachines/Inventories/lawdrobe.yml
#	Resources/Prototypes/Catalog/VendingMachines/Inventories/medical.yml
#	Resources/Prototypes/Catalog/VendingMachines/Inventories/medidrobe.yml
#	Resources/Prototypes/Catalog/VendingMachines/Inventories/robotics.yml
#	Resources/Prototypes/Catalog/VendingMachines/Inventories/sec.yml
#	Resources/Prototypes/Catalog/uplink_catalog.yml
#	Resources/Prototypes/Datasets/Names/first_male.yml
#	Resources/Prototypes/Datasets/tips.yml
#	Resources/Prototypes/Entities/Clothing/Hands/colored.yml
#	Resources/Prototypes/Entities/Clothing/Head/base_clothinghead.yml
#	Resources/Prototypes/Entities/Clothing/Head/hats.yml
#	Resources/Prototypes/Entities/Clothing/OuterClothing/coats.yml
#	Resources/Prototypes/Entities/Clothing/Uniforms/jumpsuits.yml
#	Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
#	Resources/Prototypes/Entities/Mobs/Player/silicon.yml
#	Resources/Prototypes/Entities/Mobs/Species/base.yml
#	Resources/Prototypes/Entities/Mobs/Species/slime.yml
#	Resources/Prototypes/Entities/Mobs/Species/vox.yml
#	Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks.yml
#	Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_bottles.yml
#	Resources/Prototypes/Entities/Objects/Consumable/Food/produce.yml
#	Resources/Prototypes/Entities/Objects/Devices/Electronics/signaller.yml
#	Resources/Prototypes/Entities/Objects/Devices/nuke.yml
#	Resources/Prototypes/Entities/Objects/Devices/pda.yml
#	Resources/Prototypes/Entities/Objects/Fun/toys.yml
#	Resources/Prototypes/Entities/Objects/Materials/Sheets/glass.yml
#	Resources/Prototypes/Entities/Objects/Materials/parts.yml
#	Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml
#	Resources/Prototypes/Entities/Objects/Misc/implanters.yml
#	Resources/Prototypes/Entities/Objects/Misc/kudzu.yml
#	Resources/Prototypes/Entities/Objects/Misc/rubber_stamp.yml
#	Resources/Prototypes/Entities/Objects/Shields/shields.yml
#	Resources/Prototypes/Entities/Objects/Specific/Hydroponics/tools.yml
#	Resources/Prototypes/Entities/Objects/Specific/Medical/handheld_crew_monitor.yml
#	Resources/Prototypes/Entities/Objects/Specific/Medical/healthanalyzer.yml
#	Resources/Prototypes/Entities/Objects/Specific/Robotics/borg_modules.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Bombs/firebomb.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/shotgun.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/shotgun.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Melee/e_sword.yml
#	Resources/Prototypes/Entities/Structures/Decoration/curtains.yml
#	Resources/Prototypes/Entities/Structures/Doors/Airlocks/access.yml
#	Resources/Prototypes/Entities/Structures/Doors/MaterialDoors/material_doors.yml
#	Resources/Prototypes/Entities/Structures/Doors/Windoors/base_structurewindoors.yml
#	Resources/Prototypes/Entities/Structures/Lighting/base_lighting.yml
#	Resources/Prototypes/Entities/Structures/Machines/lathe.yml
#	Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml
#	Resources/Prototypes/Entities/Structures/Specific/Anomaly/anomalies.yml
#	Resources/Prototypes/Entities/Structures/Storage/glass_box.yml
#	Resources/Prototypes/Entities/Structures/Wallmounts/fireaxe_cabinet.yml
#	Resources/Prototypes/Entities/Structures/Wallmounts/switch.yml
#	Resources/Prototypes/Entities/Structures/Walls/asteroid.yml
#	Resources/Prototypes/Entities/Structures/Walls/grille.yml
#	Resources/Prototypes/Entities/Structures/Walls/walls.yml
#	Resources/Prototypes/Entities/Structures/Windows/window.yml
#	Resources/Prototypes/Entities/Structures/stairs.yml
#	Resources/Prototypes/GameRules/events.yml
#	Resources/Prototypes/Hydroponics/seeds.yml
#	Resources/Prototypes/Maps/saltern.yml
#	Resources/Prototypes/Reagents/biological.yml
#	Resources/Prototypes/Reagents/fun.yml
#	Resources/Prototypes/Recipes/Construction/Graphs/utilities/solarpanel.yml
#	Resources/Prototypes/Recipes/Construction/weapons.yml
#	Resources/Prototypes/Recipes/Crafting/improvised.yml
#	Resources/Prototypes/Recipes/Lathes/clothing.yml
#	Resources/Prototypes/Recipes/Reactions/fun.yml
#	Resources/Prototypes/Research/arsenal.yml
#	Resources/Prototypes/Roles/Jobs/Engineering/technical_assistant.yml
#	Resources/Prototypes/Roles/Jobs/Fun/emergencyresponseteam.yml
#	Resources/Prototypes/Roles/Jobs/Medical/medical_intern.yml
#	Resources/Prototypes/Roles/Jobs/Medical/paramedic.yml
#	Resources/Prototypes/Roles/Jobs/Science/research_assistant.yml
#	Resources/Prototypes/Roles/Jobs/Security/detective.yml
#	Resources/Prototypes/Roles/Jobs/Security/security_cadet.yml
#	Resources/Prototypes/Roles/Jobs/departments.yml
#	Resources/Prototypes/Species/human.yml
#	Resources/Prototypes/Species/vox.yml
#	Resources/Prototypes/Stacks/Materials/materials.yml
#	Resources/Prototypes/StatusEffects/health.yml
#	Resources/Prototypes/Tiles/plating.yml
#	Resources/Prototypes/Voice/speech_emote_sounds.yml
#	Resources/Prototypes/Voice/speech_emotes.yml
#	Resources/Prototypes/explosion.yml
#	Resources/Prototypes/game_presets.yml
#	Resources/Prototypes/lobbyscreens.yml
#	Resources/Prototypes/secret_weights.yml
#	Resources/Prototypes/tags.yml
#	Resources/ServerInfo/Guidebook/Jobs.xml
#	Resources/ServerInfo/Guidebook/Science/ArtifactReports.xml
#	Resources/Textures/Clothing/Belt/emt.rsi/meta.json
#	Resources/Textures/Clothing/Head/Hats/beret_medic.rsi/meta.json
#	Resources/Textures/Clothing/Head/Hats/beret_qm.rsi/meta.json
#	Resources/Textures/Clothing/Head/Soft/bluesoft_flipped.rsi/meta.json
#	Resources/Textures/Clothing/Head/Soft/corpsoft_flipped.rsi/meta.json
#	Resources/Textures/Clothing/Head/Soft/greensoft_flipped.rsi/meta.json
#	Resources/Textures/Clothing/Head/Soft/greysoft_flipped.rsi/meta.json
#	Resources/Textures/Clothing/Head/Soft/paramedicsoft_flipped.rsi/meta.json
#	Resources/Textures/Clothing/Mask/neckgaiterred.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Hardsuits/slayer.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Hardsuits/syndicate.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Suits/syndicate.rsi/meta.json
#	Resources/Textures/Clothing/Uniforms/Jumpsuit/qmformal.rsi/meta.json
#	Resources/Textures/Decals/Overlays/greyscale.rsi/checkerNESW.png
#	Resources/Textures/Decals/Overlays/greyscale.rsi/checkerNWSE.png
#	Resources/Textures/Decals/Overlays/greyscale.rsi/fulltile_overlay.png
#	Resources/Textures/Decals/Overlays/greyscale.rsi/halftile_overlay.png
#	Resources/Textures/Decals/Overlays/greyscale.rsi/halftile_overlay_180.png
#	Resources/Textures/Decals/Overlays/greyscale.rsi/halftile_overlay_270.png
#	Resources/Textures/Decals/Overlays/greyscale.rsi/halftile_overlay_90.png
#	Resources/Textures/Decals/Overlays/greyscale.rsi/quartertile_overlay.png
#	Resources/Textures/Decals/Overlays/greyscale.rsi/quartertile_overlay_180.png
#	Resources/Textures/Decals/Overlays/greyscale.rsi/quartertile_overlay_270.png
#	Resources/Textures/Decals/Overlays/greyscale.rsi/quartertile_overlay_90.png
#	Resources/Textures/Decals/Overlays/greyscale.rsi/threequartertile_overlay.png
#	Resources/Textures/Decals/Overlays/greyscale.rsi/threequartertile_overlay_180.png
#	Resources/Textures/Decals/Overlays/greyscale.rsi/threequartertile_overlay_270.png
#	Resources/Textures/Decals/Overlays/greyscale.rsi/threequartertile_overlay_90.png
#	Resources/Textures/Interface/Misc/job_icons.rsi/meta.json
#	Resources/Textures/Interface/emotions.svg.192dpi.png.yml
#	Resources/Textures/LobbyScreens/dead-in-space.png.yml
#	Resources/Textures/LobbyScreens/doomed.webp.yml
#	Resources/Textures/LobbyScreens/pharmacy.png.yml
#	Resources/Textures/LobbyScreens/pharmacy.webp.yml
#	Resources/Textures/LobbyScreens/robotics.webp.yml
#	Resources/Textures/LobbyScreens/supermatter.png.yml
#	Resources/Textures/LobbyScreens/susstation.png.yml
#	Resources/Textures/LobbyScreens/warden.png.yml
#	Resources/Textures/LobbyScreens/warden.webp.yml
#	Resources/Textures/Mobs/Customization/human_hair.rsi/meta.json
#	Resources/Textures/Mobs/Effects/brute_damage.rsi/LLeg_Brute_40.png
#	Resources/Textures/Mobs/Effects/brute_damage.rsi/RLeg_Brute_40.png
#	Resources/Textures/Objects/Devices/nuke.rsi/meta.json
#	Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_deployed.png
#	Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_exploding.png
#	Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_timing.png
#	Resources/Textures/Objects/Misc/books.rsi/meta.json
#	Resources/Textures/Objects/Misc/bureaucracy.rsi/paper_stamp-lawyer.png
#	Resources/Textures/Objects/Storage/boxes.rsi/meta.json
#	Resources/Textures/Objects/Tools/t-ray.rsi/tray-off.png
#	Resources/Textures/Objects/Tools/t-ray.rsi/tray-on.png
#	Resources/Textures/Objects/Weapons/Guns/Battery/mini-ebow.rsi/bolt.png
#	Resources/Textures/Structures/Doors/Airlocks/Standard/external.rsi/emergency_open_unlit.png
#	Resources/Textures/Structures/Doors/Airlocks/Standard/shuttle_syndicate.rsi/emergency_open_unlit.png
#	Resources/Textures/Structures/Doors/Windoors/plasma.rsi/emergency_unlit.png
#	Resources/Textures/Structures/Doors/Windoors/uranium.rsi/emergency_unlit.png
#	Resources/Textures/Structures/Power/Generation/Singularity/emitter.rsi/locked.png
#	Resources/Textures/Tiles/attributions.yml
#	Resources/Textures/Tiles/shuttleblue.png
#	Resources/Textures/Tiles/shuttleorange.png
#	Resources/Textures/Tiles/shuttlepurple.png
#	Resources/Textures/Tiles/shuttlered.png
#	Resources/Textures/Tiles/shuttlewhite.png
#	Resources/Textures/White/Fluff/DOOMMAX/cap_cap.rsi/meta.json
#	Resources/Textures/White/Fluff/HSKveez/hardsuit.rsi/meta.json
#	Resources/Textures/White/Fluff/Vtergot/strictgloves.rsi/meta.json
#	Resources/clientCommandPerms.yml
#	Resources/migration.yml
2024-03-26 15:52:23 +07:00

832 lines
31 KiB
C#

using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Server.Administration.Logs;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Disposal.Tube;
using Content.Server.Carrying;
using Content.Server.Disposal.Tube.Components;
using Content.Server.Disposal.Unit.Components;
using Content.Server.Popups;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Shared.ActionBlocker;
using Content.Shared.Atmos;
using Content.Shared.Database;
using Content.Shared.Destructible;
using Content.Shared.Disposal;
using Content.Shared.Disposal.Components;
using Content.Shared.DoAfter;
using Content.Shared.DragDrop;
using Content.Shared.Emag.Systems;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Item;
using Content.Shared.Movement.Events;
using Content.Shared.Popups;
using Content.Shared.Throwing;
using Content.Shared.Verbs;
using Robust.Server.Audio;
using Robust.Server.GameObjects;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Events;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Robust.Shared.Utility;
namespace Content.Server.Disposal.Unit.EntitySystems;
public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
{
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
[Dependency] private readonly AppearanceSystem _appearance = default!;
[Dependency] private readonly AtmosphereSystem _atmosSystem = default!;
[Dependency] private readonly AudioSystem _audioSystem = default!;
[Dependency] private readonly DisposalTubeSystem _disposalTubeSystem = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly PowerReceiverSystem _power = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly TransformSystem _transformSystem = default!;
[Dependency] private readonly UserInterfaceSystem _ui = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<DisposalUnitComponent, ComponentGetState>(OnGetState);
SubscribeLocalEvent<DisposalUnitComponent, PreventCollideEvent>(OnPreventCollide);
SubscribeLocalEvent<DisposalUnitComponent, CanDropTargetEvent>(OnCanDragDropOn);
SubscribeLocalEvent<DisposalUnitComponent, GotEmaggedEvent>(OnEmagged);
// Shouldn't need re-anchoring.
SubscribeLocalEvent<DisposalUnitComponent, AnchorStateChangedEvent>(OnAnchorChanged);
// TODO: Predict me when hands predicted
SubscribeLocalEvent<DisposalUnitComponent, ContainerRelayMovementEntityEvent>(OnMovement);
SubscribeLocalEvent<DisposalUnitComponent, PowerChangedEvent>(OnPowerChange);
SubscribeLocalEvent<DisposalUnitComponent, ComponentInit>(OnDisposalInit);
SubscribeLocalEvent<DisposalUnitComponent, ThrowHitByEvent>(OnThrowCollide);
SubscribeLocalEvent<DisposalUnitComponent, ActivateInWorldEvent>(OnActivate);
SubscribeLocalEvent<DisposalUnitComponent, AfterInteractUsingEvent>(OnAfterInteractUsing);
SubscribeLocalEvent<DisposalUnitComponent, DragDropTargetEvent>(OnDragDropOn);
SubscribeLocalEvent<DisposalUnitComponent, DestructionEventArgs>(OnDestruction);
SubscribeLocalEvent<DisposalUnitComponent, GetVerbsEvent<InteractionVerb>>(AddInsertVerb);
SubscribeLocalEvent<DisposalUnitComponent, GetVerbsEvent<AlternativeVerb>>(AddDisposalAltVerbs);
SubscribeLocalEvent<DisposalUnitComponent, GetVerbsEvent<Verb>>(AddClimbInsideVerb);
SubscribeLocalEvent<DisposalUnitComponent, DisposalDoAfterEvent>(OnDoAfter);
SubscribeLocalEvent<DisposalUnitComponent, SharedDisposalUnitComponent.UiButtonPressedMessage>(OnUiButtonPressed);
}
private void OnGetState(EntityUid uid, DisposalUnitComponent component, ref ComponentGetState args)
{
args.State = new DisposalUnitComponentState(
component.FlushSound,
component.State,
component.NextPressurized,
component.AutomaticEngageTime,
component.NextFlush,
component.Powered,
component.Engaged,
GetNetEntityList(component.RecentlyEjected));
}
private void AddDisposalAltVerbs(EntityUid uid, SharedDisposalUnitComponent component, GetVerbsEvent<AlternativeVerb> args)
{
if (!args.CanAccess || !args.CanInteract)
return;
// Behavior for if the disposals bin has items in it
if (component.Container.ContainedEntities.Count > 0)
{
// Verbs to flush the unit
AlternativeVerb flushVerb = new()
{
Act = () => ManualEngage(uid, component),
Text = Loc.GetString("disposal-flush-verb-get-data-text"),
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/delete_transparent.svg.192dpi.png")),
Priority = 1,
};
args.Verbs.Add(flushVerb);
// Verb to eject the contents
AlternativeVerb ejectVerb = new()
{
Act = () => TryEjectContents(uid, component),
Category = VerbCategory.Eject,
Text = Loc.GetString("disposal-eject-verb-get-data-text")
};
args.Verbs.Add(ejectVerb);
}
}
private void AddClimbInsideVerb(EntityUid uid, SharedDisposalUnitComponent component, GetVerbsEvent<Verb> args)
{
// This is not an interaction, activation, or alternative verb type because unfortunately most users are
// unwilling to accept that this is where they belong and don't want to accidentally climb inside.
if (!component.MobsCanEnter ||
!args.CanAccess ||
!args.CanInteract ||
component.Container.ContainedEntities.Contains(args.User) ||
!_actionBlockerSystem.CanMove(args.User))
{
return;
}
// Add verb to climb inside of the unit,
Verb verb = new()
{
Act = () => TryInsert(uid, args.User, args.User),
DoContactInteraction = true,
Text = Loc.GetString("disposal-self-insert-verb-get-data-text")
};
// TODO VERB ICON
// TODO VERB CATEGORY
// create a verb category for "enter"?
// See also, medical scanner. Also maybe add verbs for entering lockers/body bags?
args.Verbs.Add(verb);
}
private void AddInsertVerb(EntityUid uid, SharedDisposalUnitComponent component, GetVerbsEvent<InteractionVerb> args)
{
if (!args.CanAccess || !args.CanInteract || args.Hands == null || args.Using == null)
return;
if (!_actionBlockerSystem.CanDrop(args.User))
return;
if (!CanInsert(uid, component, args.Using.Value))
return;
InteractionVerb insertVerb = new()
{
Text = Name(args.Using.Value),
Category = VerbCategory.Insert,
Act = () =>
{
_handsSystem.TryDropIntoContainer(args.User, args.Using.Value, component.Container, checkActionBlocker: false, args.Hands);
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(args.User):player} inserted {ToPrettyString(args.Using.Value)} into {ToPrettyString(uid)}");
AfterInsert(uid, component, args.Using.Value, args.User);
}
};
args.Verbs.Add(insertVerb);
}
private void OnDoAfter(EntityUid uid, SharedDisposalUnitComponent component, DoAfterEvent args)
{
if (args.Handled || args.Cancelled || args.Args.Target == null || args.Args.Used == null)
return;
AfterInsert(uid, component, args.Args.Target.Value, args.Args.User, doInsert: true);
args.Handled = true;
}
public override void DoInsertDisposalUnit(EntityUid uid, EntityUid toInsert, EntityUid user, SharedDisposalUnitComponent? disposal = null)
{
if (!ResolveDisposals(uid, ref disposal))
return;
if (!_containerSystem.Insert(toInsert, disposal.Container))
return;
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(user):player} inserted {ToPrettyString(toInsert)} into {ToPrettyString(uid)}");
AfterInsert(uid, disposal, toInsert, user);
}
public override void Update(float frameTime)
{
base.Update(frameTime);
var query = EntityQueryEnumerator<DisposalUnitComponent, MetaDataComponent>();
while (query.MoveNext(out var uid, out var unit, out var metadata))
{
Update(uid, unit, metadata, frameTime);
}
}
#region UI Handlers
private void OnUiButtonPressed(EntityUid uid, SharedDisposalUnitComponent component, SharedDisposalUnitComponent.UiButtonPressedMessage args)
{
if (args.Session.AttachedEntity is not { Valid: true } player)
{
return;
}
switch (args.Button)
{
case SharedDisposalUnitComponent.UiButton.Eject:
TryEjectContents(uid, component);
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(player):player} hit eject button on {ToPrettyString(uid)}");
break;
case SharedDisposalUnitComponent.UiButton.Engage:
ToggleEngage(uid, component);
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(player):player} hit flush button on {ToPrettyString(uid)}, it's now {(component.Engaged ? "on" : "off")}");
break;
case SharedDisposalUnitComponent.UiButton.Power:
_power.TogglePower(uid, user: args.Session.AttachedEntity);
break;
default:
throw new ArgumentOutOfRangeException($"{ToPrettyString(player):player} attempted to hit a nonexistant button on {ToPrettyString(uid)}");
}
}
public void ToggleEngage(EntityUid uid, SharedDisposalUnitComponent component)
{
component.Engaged ^= true;
if (component.Engaged)
{
ManualEngage(uid, component);
}
else
{
Disengage(uid, component);
}
}
#endregion
#region Eventbus Handlers
private void OnActivate(EntityUid uid, SharedDisposalUnitComponent component, ActivateInWorldEvent args)
{
if (!TryComp(args.User, out ActorComponent? actor))
{
return;
}
args.Handled = true;
_ui.TryOpen(uid, SharedDisposalUnitComponent.DisposalUnitUiKey.Key, actor.PlayerSession);
}
private void OnAfterInteractUsing(EntityUid uid, SharedDisposalUnitComponent component, AfterInteractUsingEvent args)
{
if (args.Handled || !args.CanReach)
return;
if (!HasComp<HandsComponent>(args.User))
{
return;
}
if (!CanInsert(uid, component, args.Used) || !_handsSystem.TryDropIntoContainer(args.User, args.Used, component.Container))
{
return;
}
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(args.User):player} inserted {ToPrettyString(args.Used)} into {ToPrettyString(uid)}");
AfterInsert(uid, component, args.Used, args.User);
args.Handled = true;
}
/// <summary>
/// Thrown items have a chance of bouncing off the unit and not going in.
/// </summary>
private void OnThrowCollide(EntityUid uid, SharedDisposalUnitComponent component, ThrowHitByEvent args)
{
var canInsert = CanInsert(uid, component, args.Thrown);
if (!canInsert) // WD edit
return;
var inserted = _containerSystem.Insert(args.Thrown, component.Container);
if (!inserted)
{
throw new InvalidOperationException("Container insertion failed but CanInsert returned true");
}
if (args.Component.Thrower != null)
_adminLogger.Add(LogType.Landed, LogImpact.Low, $"{ToPrettyString(args.Thrown)} thrown by {ToPrettyString(args.Component.Thrower.Value):player} landed in {ToPrettyString(uid)}");
AfterInsert(uid, component, args.Thrown);
}
private void OnDisposalInit(EntityUid uid, SharedDisposalUnitComponent component, ComponentInit args)
{
component.Container = _containerSystem.EnsureContainer<Container>(uid, SharedDisposalUnitComponent.ContainerId);
UpdateInterface(uid, component, component.Powered);
}
private void OnPowerChange(EntityUid uid, SharedDisposalUnitComponent component, ref PowerChangedEvent args)
{
if (!component.Running || args.Powered == component.Powered)
return;
component.Powered = args.Powered;
UpdateVisualState(uid, component);
UpdateInterface(uid, component, args.Powered);
if (!args.Powered)
{
component.NextFlush = null;
Dirty(uid, component);
return;
}
if (component.Engaged && !TryFlush(uid, component))
{
QueueAutomaticEngage(uid, component);
}
}
// TODO: This should just use the same thing as entity storage?
private void OnMovement(EntityUid uid, SharedDisposalUnitComponent component, ref ContainerRelayMovementEntityEvent args)
{
var currentTime = GameTiming.CurTime;
if (!TryComp(args.Entity, out HandsComponent? hands) ||
hands.Count == 0 ||
currentTime < component.LastExitAttempt + ExitAttemptDelay)
{
return;
}
component.LastExitAttempt = currentTime;
Remove(uid, component, args.Entity);
}
private void OnAnchorChanged(EntityUid uid, SharedDisposalUnitComponent component, ref AnchorStateChangedEvent args)
{
if (Terminating(uid))
return;
UpdateVisualState(uid, component);
if (!args.Anchored)
TryEjectContents(uid, component);
}
private void OnDestruction(EntityUid uid, SharedDisposalUnitComponent component, DestructionEventArgs args)
{
TryEjectContents(uid, component);
}
private void OnDragDropOn(EntityUid uid, SharedDisposalUnitComponent component, ref DragDropTargetEvent args)
{
args.Handled = TryInsert(uid, args.Dragged, args.User);
}
#endregion
private void UpdateState(EntityUid uid, DisposalsPressureState state, SharedDisposalUnitComponent component, MetaDataComponent metadata)
{
if (component.State == state)
return;
component.State = state;
UpdateVisualState(uid, component);
UpdateInterface(uid, component, component.Powered);
Dirty(uid, component, metadata);
if (state == DisposalsPressureState.Ready)
{
component.NextPressurized = TimeSpan.Zero;
// Manually engaged
if (component.Engaged)
{
component.NextFlush = GameTiming.CurTime + component.ManualFlushTime;
}
else if (component.Container.ContainedEntities.Count > 0)
{
component.NextFlush = GameTiming.CurTime + component.AutomaticEngageTime;
}
else
{
component.NextFlush = null;
}
}
}
/// <summary>
/// Work out if we can stop updating this disposals component i.e. full pressure and nothing colliding.
/// </summary>
private void Update(EntityUid uid, SharedDisposalUnitComponent component, MetaDataComponent metadata, float frameTime)
{
var state = GetState(uid, component, metadata);
// Pressurizing, just check if we need a state update.
if (component.NextPressurized > GameTiming.CurTime)
{
UpdateState(uid, state, component, metadata);
return;
}
if (component.NextFlush != null)
{
if (component.NextFlush.Value < GameTiming.CurTime)
{
TryFlush(uid, component);
}
}
UpdateState(uid, state, component, metadata);
Box2? disposalsBounds = null;
var count = component.RecentlyEjected.Count;
if (count > 0)
{
if (!HasComp<PhysicsComponent>(uid))
{
component.RecentlyEjected.Clear();
}
else
{
disposalsBounds = _lookup.GetWorldAABB(uid);
}
}
for (var i = 0; i < component.RecentlyEjected.Count; i++)
{
var ejectedId = component.RecentlyEjected[i];
if (HasComp<PhysicsComponent>(ejectedId))
{
// TODO: We need to use a specific collision method (which sloth hasn't coded yet) for actual bounds overlaps.
// TODO: Come do this sloth :^)
// Check for itemcomp as we won't just block the disposal unit "sleeping" for something it can't collide with anyway.
if (!HasComp<ItemComponent>(ejectedId)
&& _lookup.GetWorldAABB(ejectedId).Intersects(disposalsBounds!.Value))
{
continue;
}
component.RecentlyEjected.RemoveAt(i);
i--;
}
}
if (count != component.RecentlyEjected.Count)
Dirty(uid, component, metadata);
}
public bool TryInsert(EntityUid unitId, EntityUid toInsertId, EntityUid? userId, DisposalUnitComponent? unit = null)
{
if (!Resolve(unitId, ref unit))
return false;
if (userId.HasValue && !HasComp<HandsComponent>(userId) && toInsertId != userId) // Mobs like mouse can Jump inside even with no hands
{
_popupSystem.PopupEntity(Loc.GetString("disposal-unit-no-hands"), userId.Value, userId.Value, PopupType.SmallCaution);
return false;
}
if (!CanInsert(unitId, unit, toInsertId))
return false;
if (HasComp<CarryingComponent>(toInsertId))
return false;
bool insertingSelf = userId == toInsertId;
var delay = insertingSelf ? unit.EntryDelay : unit.DraggedEntryDelay;
if (userId != null && !insertingSelf)
_popupSystem.PopupEntity(Loc.GetString("disposal-unit-being-inserted", ("user", Identity.Entity((EntityUid) userId, EntityManager))), toInsertId, toInsertId, PopupType.Large);
if (delay <= 0 || userId == null)
{
AfterInsert(unitId, unit, toInsertId, userId, doInsert: true);
return true;
}
// Can't check if our target AND disposals moves currently so we'll just check target.
// if you really want to check if disposals moves then add a predicate.
var doAfterArgs = new DoAfterArgs(EntityManager, userId.Value, delay, new DisposalDoAfterEvent(), unitId, target: toInsertId, used: unitId)
{
BreakOnDamage = true,
BreakOnMove = true,
NeedHand = false
};
_doAfterSystem.TryStartDoAfter(doAfterArgs);
return true;
}
public bool TryFlush(EntityUid uid, SharedDisposalUnitComponent component)
{
if (!CanFlush(uid, component))
{
return false;
}
if (component.NextFlush != null)
component.NextFlush = component.NextFlush.Value + component.AutomaticEngageTime;
var beforeFlushArgs = new BeforeDisposalFlushEvent();
RaiseLocalEvent(uid, beforeFlushArgs);
if (beforeFlushArgs.Cancelled)
{
Disengage(uid, component);
return false;
}
var xform = Transform(uid);
if (!TryComp(xform.GridUid, out MapGridComponent? grid))
return false;
var coords = xform.Coordinates;
var entry = grid.GetLocal(coords)
.FirstOrDefault(HasComp<DisposalEntryComponent>);
if (entry == default || component is not DisposalUnitComponent sDisposals)
{
component.Engaged = false;
Dirty(uid, component);
return false;
}
HandleAir(uid, sDisposals, xform);
_disposalTubeSystem.TryInsert(entry, sDisposals, beforeFlushArgs.Tags);
component.NextPressurized = GameTiming.CurTime;
if (!component.DisablePressure)
component.NextPressurized += TimeSpan.FromSeconds(1f / PressurePerSecond);
component.Engaged = false;
// stop queuing NOW
component.NextFlush = null;
UpdateVisualState(uid, component, true);
UpdateInterface(uid, component, component.Powered);
Dirty(uid, component);
return true;
}
private void HandleAir(EntityUid uid, DisposalUnitComponent component, TransformComponent xform)
{
var air = component.Air;
var indices = _transformSystem.GetGridTilePositionOrDefault((uid, xform));
if (_atmosSystem.GetTileMixture(xform.GridUid, xform.MapUid, indices, true) is { Temperature: > 0f } environment)
{
var transferMoles = 0.1f * (0.25f * Atmospherics.OneAtmosphere * 1.01f - air.Pressure) * air.Volume / (environment.Temperature * Atmospherics.R);
component.Air = environment.Remove(transferMoles);
}
}
public void UpdateInterface(EntityUid uid, SharedDisposalUnitComponent component, bool powered)
{
var compState = GetState(uid, component);
var stateString = Loc.GetString($"disposal-unit-state-{compState}");
var state = new SharedDisposalUnitComponent.DisposalUnitBoundUserInterfaceState(Name(uid), stateString, EstimatedFullPressure(uid, component), powered, component.Engaged);
_ui.TrySetUiState(uid, SharedDisposalUnitComponent.DisposalUnitUiKey.Key, state);
var stateUpdatedEvent = new DisposalUnitUIStateUpdatedEvent(state);
RaiseLocalEvent(uid, stateUpdatedEvent);
}
/// <summary>
/// Returns the estimated time when the disposal unit will be back to full pressure.
/// </summary>
private TimeSpan EstimatedFullPressure(EntityUid uid, SharedDisposalUnitComponent component)
{
if (component.NextPressurized < GameTiming.CurTime)
return TimeSpan.Zero;
return component.NextPressurized;
}
public void UpdateVisualState(EntityUid uid, SharedDisposalUnitComponent component, bool flush = false)
{
if (!TryComp(uid, out AppearanceComponent? appearance))
{
return;
}
if (!Transform(uid).Anchored)
{
_appearance.SetData(uid, SharedDisposalUnitComponent.Visuals.VisualState, SharedDisposalUnitComponent.VisualState.UnAnchored, appearance);
_appearance.SetData(uid, SharedDisposalUnitComponent.Visuals.Handle, SharedDisposalUnitComponent.HandleState.Normal, appearance);
_appearance.SetData(uid, SharedDisposalUnitComponent.Visuals.Light, SharedDisposalUnitComponent.LightStates.Off, appearance);
return;
}
var state = GetState(uid, component);
switch (state)
{
case DisposalsPressureState.Flushed:
_appearance.SetData(uid, SharedDisposalUnitComponent.Visuals.VisualState, SharedDisposalUnitComponent.VisualState.Flushing, appearance);
break;
case DisposalsPressureState.Pressurizing:
_appearance.SetData(uid, SharedDisposalUnitComponent.Visuals.VisualState, SharedDisposalUnitComponent.VisualState.Charging, appearance);
break;
case DisposalsPressureState.Ready:
_appearance.SetData(uid, SharedDisposalUnitComponent.Visuals.VisualState, SharedDisposalUnitComponent.VisualState.Anchored, appearance);
break;
}
_appearance.SetData(uid, SharedDisposalUnitComponent.Visuals.Handle, component.Engaged
? SharedDisposalUnitComponent.HandleState.Engaged
: SharedDisposalUnitComponent.HandleState.Normal, appearance);
if (!component.Powered)
{
_appearance.SetData(uid, SharedDisposalUnitComponent.Visuals.Light, SharedDisposalUnitComponent.LightStates.Off, appearance);
return;
}
var lightState = SharedDisposalUnitComponent.LightStates.Off;
if (component.Container.ContainedEntities.Count > 0)
{
lightState |= SharedDisposalUnitComponent.LightStates.Full;
}
if (state is DisposalsPressureState.Pressurizing or DisposalsPressureState.Flushed)
{
lightState |= SharedDisposalUnitComponent.LightStates.Charging;
}
else
{
lightState |= SharedDisposalUnitComponent.LightStates.Ready;
}
_appearance.SetData(uid, SharedDisposalUnitComponent.Visuals.Light, lightState, appearance);
}
public void Remove(EntityUid uid, SharedDisposalUnitComponent component, EntityUid toRemove)
{
_containerSystem.Remove(toRemove, component.Container);
if (component.Container.ContainedEntities.Count == 0)
{
// If not manually engaged then reset the flushing entirely.
if (!component.Engaged)
{
component.NextFlush = null;
}
}
if (!component.RecentlyEjected.Contains(toRemove))
component.RecentlyEjected.Add(toRemove);
UpdateVisualState(uid, component);
Dirty(uid, component);
}
public bool CanFlush(EntityUid unit, SharedDisposalUnitComponent component)
{
return GetState(unit, component) == DisposalsPressureState.Ready
&& component.Powered
&& Comp<TransformComponent>(unit).Anchored;
}
public void ManualEngage(EntityUid uid, SharedDisposalUnitComponent component, MetaDataComponent? metadata = null)
{
component.Engaged = true;
UpdateVisualState(uid, component);
UpdateInterface(uid, component, component.Powered);
Dirty(uid, component);
if (!CanFlush(uid, component))
return;
if (!Resolve(uid, ref metadata))
return;
var pauseTime = Metadata.GetPauseTime(uid, metadata);
var nextEngage = GameTiming.CurTime - pauseTime + component.ManualFlushTime;
component.NextFlush = TimeSpan.FromSeconds(Math.Min((component.NextFlush ?? TimeSpan.MaxValue).TotalSeconds, nextEngage.TotalSeconds));
}
public void Disengage(EntityUid uid, SharedDisposalUnitComponent component)
{
component.Engaged = false;
if (component.Container.ContainedEntities.Count == 0)
{
component.NextFlush = null;
}
UpdateVisualState(uid, component);
UpdateInterface(uid, component, component.Powered);
Dirty(uid, component);
}
/// <summary>
/// Remove all entities currently in the disposal unit.
/// </summary>
public void TryEjectContents(EntityUid uid, SharedDisposalUnitComponent component)
{
foreach (var entity in component.Container.ContainedEntities.ToArray())
{
Remove(uid, component, entity);
}
if (!component.Engaged)
{
component.NextFlush = null;
Dirty(uid, component);
}
}
public override bool HasDisposals(EntityUid? uid)
{
return HasComp<DisposalUnitComponent>(uid);
}
public override bool ResolveDisposals(EntityUid uid, [NotNullWhen(true)] ref SharedDisposalUnitComponent? component)
{
if (component != null)
return true;
TryComp<DisposalUnitComponent>(uid, out var storage);
component = storage;
return component != null;
}
public override bool CanInsert(EntityUid uid, SharedDisposalUnitComponent component, EntityUid entity)
{
if (!base.CanInsert(uid, component, entity))
return false;
return _containerSystem.CanInsert(entity, component.Container);
}
/// <summary>
/// If something is inserted (or the likes) then we'll queue up an automatic flush in the future.
/// </summary>
public void QueueAutomaticEngage(EntityUid uid, SharedDisposalUnitComponent component, MetaDataComponent? metadata = null)
{
if (component.Deleted || !component.AutomaticEngage || !component.Powered && component.Container.ContainedEntities.Count == 0)
{
return;
}
var pauseTime = Metadata.GetPauseTime(uid, metadata);
var automaticTime = GameTiming.CurTime + component.AutomaticEngageTime - pauseTime;
var flushTime = TimeSpan.FromSeconds(Math.Min((component.NextFlush ?? TimeSpan.MaxValue).TotalSeconds, automaticTime.TotalSeconds));
component.NextFlush = flushTime;
Dirty(uid, component);
}
public void AfterInsert(EntityUid uid, SharedDisposalUnitComponent component, EntityUid inserted, EntityUid? user = null, bool doInsert = false)
{
_audioSystem.PlayPvs(component.InsertSound, uid);
if (doInsert && !_containerSystem.Insert(inserted, component.Container))
return;
if (user != inserted && user != null)
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(user.Value):player} inserted {ToPrettyString(inserted)} into {ToPrettyString(uid)}");
QueueAutomaticEngage(uid, component);
if (TryComp(inserted, out ActorComponent? actor))
{
_ui.TryClose(uid, SharedDisposalUnitComponent.DisposalUnitUiKey.Key, actor.PlayerSession);
}
// Maybe do pullable instead? Eh still fine.
Joints.RecursiveClearJoints(inserted);
UpdateVisualState(uid, component);
}
}
/// <summary>
/// Sent before the disposal unit flushes it's contents.
/// Allows adding tags for sorting and preventing the disposal unit from flushing.
/// </summary>
public sealed class DisposalUnitUIStateUpdatedEvent : EntityEventArgs
{
public SharedDisposalUnitComponent.DisposalUnitBoundUserInterfaceState State;
public DisposalUnitUIStateUpdatedEvent(SharedDisposalUnitComponent.DisposalUnitBoundUserInterfaceState state)
{
State = state;
}
}
/// <summary>
/// Sent before the disposal unit flushes it's contents.
/// Allows adding tags for sorting and preventing the disposal unit from flushing.
/// </summary>
public sealed class BeforeDisposalFlushEvent : CancellableEntityEventArgs
{
public readonly List<string> Tags = new();
}