Remove IDropped (#7075)

This commit is contained in:
Leon Friedrich
2022-03-13 21:47:28 +13:00
committed by GitHub
parent 4444d099d1
commit e3ead6a3ba
10 changed files with 42 additions and 117 deletions

View File

@@ -14,7 +14,7 @@ namespace Content.Server.Atmos.Components
{
[RegisterComponent]
[ComponentReference(typeof(SharedGasAnalyzerComponent))]
public sealed class GasAnalyzerComponent : SharedGasAnalyzerComponent, IAfterInteract, IDropped
public sealed class GasAnalyzerComponent : SharedGasAnalyzerComponent, IAfterInteract
{
[Dependency] private readonly IEntityManager _entities = default!;
@@ -256,13 +256,5 @@ namespace Content.Server.Atmos.Components
return true;
}
void IDropped.Dropped(DroppedEventArgs eventArgs)
{
if (_entities.TryGetComponent(eventArgs.User, out ActorComponent? actor))
{
CloseInterface(actor.PlayerSession);
}
}
}
}

View File

@@ -21,7 +21,7 @@ namespace Content.Server.Atmos.Components
{
[RegisterComponent]
#pragma warning disable 618
public sealed class GasTankComponent : Component, IExamine, IGasMixtureHolder, IDropped
public sealed class GasTankComponent : Component, IExamine, IGasMixtureHolder
#pragma warning restore 618
{
[Dependency] private readonly IEntityManager _entMan = default!;
@@ -31,8 +31,6 @@ namespace Content.Server.Atmos.Components
private int _integrity = 3;
[Dependency] private readonly IEntityManager _entityManager = default!;
[ViewVariables] private BoundUserInterface? _userInterface;
[DataField("ruptureSound")] private SoundSpecifier _ruptureSound = new SoundPathSpecifier("Audio/Effects/spray.ogg");
@@ -289,10 +287,5 @@ namespace Content.Server.Atmos.Components
if (_integrity < 3)
_integrity++;
}
void IDropped.Dropped(DroppedEventArgs eventArgs)
{
DisconnectFromInternals(eventArgs.User);
}
}
}

View File

@@ -1,5 +1,6 @@
using Content.Server.Atmos.Components;
using Content.Shared.Actions;
using Content.Shared.Interaction.Events;
using Content.Shared.Toggleable;
using Content.Shared.Verbs;
using JetBrains.Annotations;
@@ -21,6 +22,12 @@ namespace Content.Server.Atmos.EntitySystems
SubscribeLocalEvent<GasTankComponent, GetVerbsEvent<ActivationVerb>>(AddOpenUIVerb);
SubscribeLocalEvent<GasTankComponent, GetActionsEvent>(OnGetActions);
SubscribeLocalEvent<GasTankComponent, ToggleActionEvent>(OnActionToggle);
SubscribeLocalEvent<GasTankComponent, DroppedEvent>(OnDropped);
}
private void OnDropped(EntityUid uid, GasTankComponent component, DroppedEvent args)
{
component.DisconnectFromInternals(args.User);
}
private void OnGetActions(EntityUid uid, GasTankComponent component, GetActionsEvent args)

View File

@@ -116,7 +116,7 @@ public sealed class CrayonSystem : EntitySystem
private void OnCrayonDropped(EntityUid uid, CrayonComponent component, DroppedEvent args)
{
if (TryComp<ActorComponent>(args.UserUid, out var actor))
if (TryComp<ActorComponent>(args.User, out var actor))
component.UserInterface?.Close(actor.PlayerSession);
}
}

View File

@@ -1,19 +1,14 @@
using Content.Server.Chemistry.Components;
using Content.Server.Chemistry.Components;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Fluids.EntitySystems;
using Content.Server.Popups;
using Content.Shared.ActionBlocker;
using Content.Shared.Audio;
using Content.Shared.CharacterAppearance.Systems;
using Content.Shared.Extinguisher;
using Content.Shared.FixedPoint;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Verbs;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Player;
namespace Content.Server.Extinguisher;
@@ -28,7 +23,6 @@ public sealed class FireExtinguisherSystem : EntitySystem
base.Initialize();
SubscribeLocalEvent<FireExtinguisherComponent, ComponentInit>(OnFireExtinguisherInit);
SubscribeLocalEvent<FireExtinguisherComponent, DroppedEvent>(OnDropped);
SubscribeLocalEvent<FireExtinguisherComponent, UseInHandEvent>(OnUseInHand);
SubscribeLocalEvent<FireExtinguisherComponent, AfterInteractEvent>(OnAfterInteract);
SubscribeLocalEvent<FireExtinguisherComponent, GetVerbsEvent<InteractionVerb>>(OnGetInteractionVerbs);
@@ -43,12 +37,6 @@ public sealed class FireExtinguisherSystem : EntitySystem
}
}
private void OnDropped(EntityUid uid, FireExtinguisherComponent component, DroppedEvent args)
{
// idk why this has to be done??????????
UpdateAppearance(uid, component);
}
private void OnUseInHand(EntityUid uid, FireExtinguisherComponent component, UseInHandEvent args)
{
if (args.Handled)

View File

@@ -8,6 +8,7 @@ using Content.Server.UserInterface;
using Content.Shared.ActionBlocker;
using Content.Shared.DragDrop;
using Content.Shared.Hands.Components;
using Content.Shared.Interaction.Events;
using Content.Shared.Inventory;
using Content.Shared.Popups;
using Content.Shared.Strip.Components;
@@ -247,6 +248,8 @@ namespace Content.Server.Strip
if (invSystem.TryGetSlotEntity(Owner, slot, out var item) && invSystem.TryUnequip(user, Owner, slot))
{
// Raise a dropped event, so that things like gas tank internals properly deactivate when stripping
_entities.EventBus.RaiseLocalEvent(item.Value, new DroppedEvent(user));
userHands.PutInHandOrDrop(item.Value);
}