diff --git a/Content.Client/EscapeMenuOwner.cs b/Content.Client/EscapeMenuOwner.cs index 5cbd33c1d8..93acf5b298 100644 --- a/Content.Client/EscapeMenuOwner.cs +++ b/Content.Client/EscapeMenuOwner.cs @@ -6,6 +6,7 @@ using Robust.Client.Interfaces.Placement; using Robust.Client.Interfaces.ResourceManagement; using Robust.Client.Interfaces.State; using Robust.Shared.Input; +using Robust.Shared.Input.Binding; using Robust.Shared.Interfaces.Configuration; using Robust.Shared.Interfaces.Map; using Robust.Shared.IoC; diff --git a/Content.Client/GameObjects/Components/Items/ItemComponent.cs b/Content.Client/GameObjects/Components/Items/ItemComponent.cs index 4c6a1d0402..b3efb0fa16 100644 --- a/Content.Client/GameObjects/Components/Items/ItemComponent.cs +++ b/Content.Client/GameObjects/Components/Items/ItemComponent.cs @@ -1,4 +1,6 @@ -using Content.Shared.GameObjects; +using Content.Client.GameObjects.Components.Storage; +using Content.Client.Interfaces.GameObjects.Components.Interaction; +using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Items; using Robust.Client.Graphics; using Robust.Client.Interfaces.ResourceManagement; diff --git a/Content.Client/GameObjects/Components/PlaceableSurfaceComponent.cs b/Content.Client/GameObjects/Components/PlaceableSurfaceComponent.cs new file mode 100644 index 0000000000..88c12cad83 --- /dev/null +++ b/Content.Client/GameObjects/Components/PlaceableSurfaceComponent.cs @@ -0,0 +1,11 @@ +using Content.Shared.GameObjects.Components; +using Robust.Shared.GameObjects; + +namespace Content.Client.GameObjects.Components +{ + [RegisterComponent] + public class PlaceableSurfaceComponent : SharedPlaceableSurfaceComponent + { + + } +} diff --git a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs index 0a0b948237..4fc955ede6 100644 --- a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs +++ b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using Content.Shared.GameObjects.Components.Storage; using Content.Client.Interfaces.GameObjects; +using Content.Client.Interfaces.GameObjects.Components.Interaction; using Robust.Client.Graphics.Drawing; using Robust.Client.Interfaces.GameObjects.Components; using Robust.Client.UserInterface; @@ -21,7 +22,7 @@ namespace Content.Client.GameObjects.Components.Storage /// Client version of item storage containers, contains a UI which displays stored entities and their size /// [RegisterComponent] - public class ClientStorageComponent : SharedStorageComponent + public class ClientStorageComponent : SharedStorageComponent, IClientDraggable { private Dictionary StoredEntities { get; set; } = new Dictionary(); private int StorageSizeUsed; @@ -316,5 +317,17 @@ namespace Content.Client.GameObjects.Components.Storage AddChild(hBoxContainer); } } + + public bool ClientCanDropOn(CanDropEventArgs eventArgs) + { + //can only drop on placeable surfaces to empty out contents + return eventArgs.Target.HasComponent(); + } + + public bool ClientCanDrag(CanDragEventArgs eventArgs) + { + //always draggable, at least for now + return true; + } } } diff --git a/Content.Client/GameObjects/EntitySystems/DragDropSystem.cs b/Content.Client/GameObjects/EntitySystems/DragDropSystem.cs new file mode 100644 index 0000000000..feb97342a2 --- /dev/null +++ b/Content.Client/GameObjects/EntitySystems/DragDropSystem.cs @@ -0,0 +1,397 @@ +using System.Collections.Generic; +using Content.Client.Interfaces.GameObjects.Components.Interaction; +using Content.Client.State; +using Content.Shared.GameObjects; +using Content.Shared.GameObjects.EntitySystemMessages; +using Content.Shared.GameObjects.EntitySystems; +using JetBrains.Annotations; +using Robust.Client.GameObjects; +using Robust.Client.GameObjects.EntitySystems; +using Robust.Client.Graphics.Shaders; +using Robust.Client.Interfaces.Graphics.ClientEye; +using Robust.Client.Interfaces.Input; +using Robust.Client.Interfaces.State; +using Robust.Shared.GameObjects.Systems; +using Robust.Shared.Input; +using Robust.Shared.Input.Binding; +using Robust.Shared.Interfaces.GameObjects; +using Robust.Shared.Interfaces.Map; +using Robust.Shared.IoC; +using Robust.Shared.Log; +using Robust.Shared.Maths; +using Robust.Shared.Prototypes; + +namespace Content.Client.GameObjects.EntitySystems +{ + /// + /// Handles clientside drag and drop logic + /// + [UsedImplicitly] + public class DragDropSystem : EntitySystem + { + // drag will be triggered when mouse leaves this deadzone around the click position. + private const float DragDeadzone = 2f; + // how often to recheck possible targets (prevents calling expensive + // check logic each update) + private const float TargetRecheckInterval = 0.25f; + + // if a drag ends up being cancelled and it has been under this + // amount of time since the mousedown, we will "replay" the original + // mousedown event so it can be treated like a regular click + private const float MaxMouseDownTimeForReplayingClick = 0.85f; + + private const string ShaderDropTargetInRange = "SelectionOutlineInrange"; + private const string ShaderDropTargetOutOfRange = "SelectionOutline"; + +#pragma warning disable 649 + [Dependency] private readonly IStateManager _stateManager; + [Dependency] private readonly IEntityManager _entityManager; + [Dependency] private readonly IInputManager _inputManager; + [Dependency] private readonly IEyeManager _eyeManager; + [Dependency] private readonly IPrototypeManager _prototypeManager; + [Dependency] private readonly IMapManager _mapManager; +#pragma warning restore 649 + + // entity performing the drag action + private IEntity _dragger; + private IEntity _draggedEntity; + private IClientDraggable _draggable; + private IEntity _dragShadow; + private DragState _state; + // time since mouse down over the dragged entity + private float _mouseDownTime; + // screen pos where the mouse down began + private Vector2 _mouseDownScreenPos; + // how much time since last recheck of all possible targets + private float _targetRecheckTime; + // reserved initial mousedown event so we can replay it if no drag ends up being performed + private PointerInputCmdHandler.PointerInputCmdArgs? _savedMouseDown; + // whether we are currently replaying the original mouse down, so we + // can ignore any events sent to this system + private bool _isReplaying; + + private ShaderInstance _dropTargetInRangeShader; + private ShaderInstance _dropTargetOutOfRangeShader; + private SharedInteractionSystem _interactionSystem; + private InputSystem _inputSystem; + + private List highlightedSprites = new List(); + + private enum DragState + { + NotDragging, + // not dragging yet, waiting to see + // if they hold for long enough + MouseDown, + // currently dragging something + Dragging, + } + + + public override void Initialize() + { + _state = DragState.NotDragging; + + _dropTargetInRangeShader = _prototypeManager.Index(ShaderDropTargetInRange).Instance(); + _dropTargetOutOfRangeShader = _prototypeManager.Index(ShaderDropTargetOutOfRange).Instance(); + _interactionSystem = EntitySystem.Get(); + _inputSystem = EntitySystem.Get(); + // needs to fire on mouseup and mousedown so we can detect a drag / drop + CommandBinds.Builder + .Bind(EngineKeyFunctions.Use, new PointerInputCmdHandler(OnUse, false)) + .Register(); + + } + + public override void Shutdown() + { + CancelDrag(false, null); + CommandBinds.Unregister(); + base.Shutdown(); + } + + private bool OnUse(in PointerInputCmdHandler.PointerInputCmdArgs args) + { + // not currently predicted + if (_inputSystem.Predicted) return false; + + // currently replaying a saved click, don't handle this because + // we already decided this click doesn't represent an actual drag attempt + if (_isReplaying) return false; + + if (args.State == BoundKeyState.Down) + { + return OnUseMouseDown(args); + } + else if (args.State == BoundKeyState.Up) + { + return OnUseMouseUp(args); + } + + return false; + } + + private bool OnUseMouseDown(in PointerInputCmdHandler.PointerInputCmdArgs args) + { + var dragger = args.Session.AttachedEntity; + // cancel any current dragging if there is one (shouldn't be because they would've had to have lifted + // the mouse, canceling the drag, but just being cautious) + CancelDrag(false, null); + + // possibly initiating a drag + // check if the clicked entity is draggable + if (_entityManager.TryGetEntity(args.EntityUid, out var entity)) + { + // check if the entity is reachable + if (_interactionSystem.InRangeUnobstructed(dragger.Transform.MapPosition, + entity.Transform.MapPosition, ignoredEnt: dragger) == false) + { + { + return false; + } + } + foreach (var draggable in entity.GetAllComponents()) + { + var dragEventArgs = new CanDragEventArgs(args.Session.AttachedEntity, entity); + if (draggable.ClientCanDrag(dragEventArgs)) + { + // wait to initiate a drag + _dragger = dragger; + _draggedEntity = entity; + _draggable = draggable; + _mouseDownTime = 0; + _state = DragState.MouseDown; + _mouseDownScreenPos = _inputManager.MouseScreenPosition; + // don't want anything else to process the click, + // but we will save the event so we can "re-play" it if this drag does + // not turn into an actual drag so the click can be handled normally + _savedMouseDown = args; + return true; + } + } + } + + return false; + } + + private bool OnUseMouseUp(in PointerInputCmdHandler.PointerInputCmdArgs args) + { + if (_state == DragState.MouseDown) + { + // quick mouseup, definitely treat it as a normal click by + // replaying the original + CancelDrag(true, args.OriginalMessage); + return false; + } + if (_state != DragState.Dragging) return false; + + // remaining CancelDrag calls will not replay the click because + // by this time we've determined the input was actually a drag attempt + + + // tell the server we are dropping if we are over a valid drop target in range. + // We don't use args.EntityUid here because drag interactions generally should + // work even if there's something "on top" of the drop target + if (_interactionSystem.InRangeUnobstructed(_dragger.Transform.MapPosition, + args.Coordinates.ToMap(_mapManager), ignoredEnt: _dragger) == false) + { + { + CancelDrag(false, null); + return false; + } + } + + var entities = GameScreenBase.GetEntitiesUnderPosition(_stateManager, args.Coordinates); + foreach (var entity in entities) + { + // check if it's able to be dropped on by current dragged entity + if (_draggable.ClientCanDropOn(new CanDropEventArgs(_dragger, _draggedEntity, entity))) + { + // tell the server about the drop attempt + RaiseNetworkEvent(new DragDropMessage(args.Coordinates, _draggedEntity.Uid, + entity.Uid)); + + CancelDrag(false, null); + return true; + } + } + CancelDrag(false, null); + return false; + } + + private void StartDragging() + { + // this is checked elsewhere but adding this as a failsafe + if (_draggedEntity == null || _draggedEntity.Deleted) + { + Logger.Error("Programming error. Cannot initiate drag, no dragged entity or entity" + + " was deleted."); + return; + } + + if (_draggedEntity.TryGetComponent(out var draggedSprite)) + { + _state = DragState.Dragging; + // pop up drag shadow under mouse + var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition); + _dragShadow = _entityManager.SpawnEntity("dragshadow", mousePos); + var dragSprite = _dragShadow.GetComponent(); + dragSprite.CopyFrom(draggedSprite); + dragSprite.RenderOrder = EntityManager.CurrentTick.Value; + dragSprite.Color = dragSprite.Color.WithAlpha(0.7f); + // keep it on top of everything + dragSprite.DrawDepth = (int) DrawDepth.Overlays; + + HighlightTargets(); + } + else + { + Logger.Warning("Unable to display drag shadow for {0} because it" + + " has no sprite component.", _draggedEntity.Name); + } + } + + private void HighlightTargets() + { + if (_state != DragState.Dragging || _draggedEntity == null || + _draggedEntity.Deleted || _dragShadow == null || _dragShadow.Deleted) + { + Logger.Warning("Programming error. Can't highlight drag and drop targets, not currently " + + "dragging anything or dragged entity / shadow was deleted."); + return; + } + + // highlights the possible targets which are visible + // and able to be dropped on by the current dragged entity + + // remove current highlights + RemoveHighlights(); + + // find possible targets on screen even if not reachable + // TODO: Duplicated in SpriteSystem + var pvsBounds = _eyeManager.GetWorldViewport().Enlarged(5); + var pvsEntities = EntityManager.GetEntitiesIntersecting(_eyeManager.CurrentMap, pvsBounds, true); + foreach (var pvsEntity in pvsEntities) + { + if (pvsEntity.TryGetComponent(out var inRangeSprite)) + { + // can't highlight if there's no sprite or it's not visible + if (inRangeSprite.Visible == false) continue; + + // check if it's able to be dropped on by current dragged entity + if (_draggable.ClientCanDropOn(new CanDropEventArgs(_dragger, _draggedEntity, pvsEntity))) + { + // highlight depending on whether its in or out of range + var inRange = _interactionSystem.InRangeUnobstructed(_dragger.Transform.MapPosition, + pvsEntity.Transform.MapPosition, ignoredEnt: _dragger); + inRangeSprite.PostShader = inRange ? _dropTargetInRangeShader : _dropTargetOutOfRangeShader; + inRangeSprite.RenderOrder = EntityManager.CurrentTick.Value; + highlightedSprites.Add(inRangeSprite); + } + } + } + } + + private void RemoveHighlights() + { + foreach (var highlightedSprite in highlightedSprites) + { + highlightedSprite.PostShader = null; + highlightedSprite.RenderOrder = 0; + } + highlightedSprites.Clear(); + } + + /// + /// Cancels the drag, firing our saved drag event if instructed to do so and + /// we are within the threshold for replaying the click + /// (essentially reverting the drag attempt and allowing the original click + /// to proceed as if no drag was performed) + /// + /// if fireSavedCmd is true, this should be passed with the value of + /// the pointer cmd that caused the drag to be cancelled + private void CancelDrag(bool fireSavedCmd, FullInputCmdMessage cause) + { + RemoveHighlights(); + if (_dragShadow != null) + { + _entityManager.DeleteEntity(_dragShadow); + } + + _dragShadow = null; + _draggedEntity = null; + _draggable = null; + _dragger = null; + _state = DragState.NotDragging; + + _mouseDownTime = 0; + + if (fireSavedCmd && _savedMouseDown.HasValue && _mouseDownTime < MaxMouseDownTimeForReplayingClick) + { + var savedValue = _savedMouseDown.Value; + _isReplaying = true; + // adjust the timing info based on the current tick so it appears as if it happened now + var replayMsg = savedValue.OriginalMessage; + var adjustedInputMsg = new FullInputCmdMessage(cause.Tick, cause.SubTick, replayMsg.InputFunctionId, replayMsg.State, replayMsg.Coordinates, replayMsg.ScreenCoordinates, replayMsg.Uid); + + _inputSystem.HandleInputCommand(savedValue.Session, EngineKeyFunctions.Use, + adjustedInputMsg, true); + _isReplaying = false; + } + + _savedMouseDown = null; + + } + + public override void Update(float frameTime) + { + base.Update(frameTime); + if (_state == DragState.MouseDown) + { + var screenPos = _inputManager.MouseScreenPosition; + if (_draggedEntity == null || _draggedEntity.Deleted) + { + // something happened to the clicked entity or we moved the mouse off the target so + // we shouldn't replay the original click + CancelDrag(false, null); + return; + } + else if ((_mouseDownScreenPos - screenPos).Length > DragDeadzone) + { + // initiate actual drag + StartDragging(); + _mouseDownTime = 0; + } + } + else if (_state == DragState.Dragging) + { + if (_draggedEntity == null || _draggedEntity.Deleted) + { + CancelDrag(false, null); + return; + } + // still in range of the thing we are dragging? + if (_interactionSystem.InRangeUnobstructed(_dragger.Transform.MapPosition, + _draggedEntity.Transform.MapPosition, ignoredEnt: _dragger) == false) + { + CancelDrag(false, null); + return; + } + + // keep dragged entity under mouse + var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition); + // TODO: would use MapPosition instead if it had a setter, but it has no setter. + // is that intentional, or should we add a setter for Transform.MapPosition? + _dragShadow.Transform.WorldPosition = mousePos.Position; + + _targetRecheckTime += frameTime; + if (_targetRecheckTime > TargetRecheckInterval) + { + HighlightTargets(); + _targetRecheckTime = 0; + } + + } + } + } +} diff --git a/Content.Client/IgnoredComponents.cs b/Content.Client/IgnoredComponents.cs index 838d82a380..961e34eae8 100644 --- a/Content.Client/IgnoredComponents.cs +++ b/Content.Client/IgnoredComponents.cs @@ -25,7 +25,6 @@ "ItemTeleporter", "Portal", "EntityStorage", - "PlaceableSurface", "Wirecutter", "Screwdriver", "Multitool", diff --git a/Content.Client/Interfaces/GameObjects/Components/Interaction/IClientDraggable.cs b/Content.Client/Interfaces/GameObjects/Components/Interaction/IClientDraggable.cs new file mode 100644 index 0000000000..26c36d878c --- /dev/null +++ b/Content.Client/Interfaces/GameObjects/Components/Interaction/IClientDraggable.cs @@ -0,0 +1,59 @@ +using System; +using Robust.Shared.Interfaces.GameObjects; + +namespace Content.Client.Interfaces.GameObjects.Components.Interaction +{ + /// + /// This interface allows a local client to initiate dragging of the component's entity by mouse, for drag and + /// drop interactions. The actual logic of what happens on drop + /// is handled by IDragDrop + /// + public interface IClientDraggable + { + + /// + /// Invoked on entities visible to the user to check if this component's entity + /// can be dropped on the indicated target entity. No need to check range / reachability in here. + /// + /// true iff target is a valid target to be dropped on by this + /// component's entity. Returning true will cause the target entity to be highlighted as a potential + /// target and allow dropping when in range. + bool ClientCanDropOn(CanDropEventArgs eventArgs); + + /// + /// Invoked clientside when user is attempting to initiate a drag with this component's entity + /// in range. Return true if the drag should be initiated. It's fine to + /// return true even if there wouldn't be any valid targets - just return true + /// if this entity is in a "draggable" state. + /// + /// + /// true iff drag should be initiated + bool ClientCanDrag(CanDragEventArgs eventArgs); + } + + public class CanDropEventArgs : EventArgs + { + public CanDropEventArgs(IEntity user, IEntity dragged, IEntity target) + { + User = user; + Dragged = dragged; + Target = target; + } + + public IEntity User { get; } + public IEntity Dragged { get; } + public IEntity Target { get; } + } + + public class CanDragEventArgs : EventArgs + { + public CanDragEventArgs(IEntity user, IEntity dragged) + { + User = user; + Dragged = dragged; + } + + public IEntity User { get; } + public IEntity Dragged { get; } + } +} diff --git a/Content.Client/Sandbox/SandboxManager.cs b/Content.Client/Sandbox/SandboxManager.cs index e20931fd58..9a83f2b29e 100644 --- a/Content.Client/Sandbox/SandboxManager.cs +++ b/Content.Client/Sandbox/SandboxManager.cs @@ -8,6 +8,7 @@ using Robust.Client.Interfaces.ResourceManagement; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; using Robust.Shared.Input; +using Robust.Shared.Input.Binding; using Robust.Shared.Interfaces.Map; using Robust.Shared.Interfaces.Network; using Robust.Shared.IoC; diff --git a/Content.Client/ScreenshotHook.cs b/Content.Client/ScreenshotHook.cs index 529a469b72..f3a7565bed 100644 --- a/Content.Client/ScreenshotHook.cs +++ b/Content.Client/ScreenshotHook.cs @@ -5,6 +5,7 @@ using Content.Shared.Input; using Robust.Client.Interfaces.Graphics; using Robust.Client.Interfaces.Input; using Robust.Shared.Input; +using Robust.Shared.Input.Binding; using Robust.Shared.Interfaces.Resources; using Robust.Shared.IoC; using Robust.Shared.Log; diff --git a/Content.Client/State/GameScreen.cs b/Content.Client/State/GameScreen.cs index 5d5ff40f04..a0d947c4e8 100644 --- a/Content.Client/State/GameScreen.cs +++ b/Content.Client/State/GameScreen.cs @@ -1,13 +1,19 @@ +using System.Collections.Generic; +using System.Collections.Immutable; using Content.Client.Chat; using Content.Client.Interfaces.Chat; using Content.Client.UserInterface; using Content.Shared.Input; using Robust.Client.Interfaces.Input; +using Robust.Client.Interfaces.State; using Robust.Client.Interfaces.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Shared.Input; +using Robust.Shared.Input.Binding; +using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Map; using Robust.Shared.ViewVariables; namespace Content.Client.State diff --git a/Content.Client/State/GameScreenBase.cs b/Content.Client/State/GameScreenBase.cs index b11201eca3..f7d7742540 100644 --- a/Content.Client/State/GameScreenBase.cs +++ b/Content.Client/State/GameScreenBase.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using Content.Client.GameObjects.Components; -using Content.Shared.GameObjects; using Content.Shared.GameObjects.EntitySystems; using Robust.Client.GameObjects.EntitySystems; using Robust.Client.Interfaces.GameObjects; @@ -9,6 +9,7 @@ using Robust.Client.Interfaces.GameObjects.Components; using Robust.Client.Interfaces.Graphics.ClientEye; using Robust.Client.Interfaces.Input; using Robust.Client.Interfaces.UserInterface; +using Robust.Client.Interfaces.State; using Robust.Client.Player; using Robust.Shared.GameObjects; using Robust.Shared.Input; @@ -71,7 +72,7 @@ namespace Content.Client.State .InRangeUnobstructed(playerPos, entityPos, predicate: entity => entity == _playerManager.LocalPlayer.ControlledEntity || entity == entityToClick, - insideBlockerValid: true); + ignoreInsideBlocker: true); } InteractionOutlineComponent outline; @@ -146,6 +147,25 @@ namespace Content.Client.State return foundEntities.Select(a => a.clicked).ToList(); } + /// + /// Gets all entities intersecting the given position. + /// + /// Static alternative to GetEntitiesUnderPosition to cut out + /// some of the boilerplate needed to get state manager and check the current state. + /// + /// state manager to use to get the current game screen + /// coordinates to check + /// the entities under the position, empty list if none found + public static IList GetEntitiesUnderPosition(IStateManager stateManager, GridCoordinates coordinates) + { + if (stateManager.CurrentState is GameScreenBase gameScreenBase) + { + return gameScreenBase.GetEntitiesUnderPosition(coordinates); + } + + return ImmutableList.Empty; + } + internal class ClickableEntityComparer : IComparer<(IEntity clicked, int depth, uint renderOrder)> { public int Compare((IEntity clicked, int depth, uint renderOrder) x, diff --git a/Content.Client/State/LobbyState.cs b/Content.Client/State/LobbyState.cs index 3209e1d01b..440509796c 100644 --- a/Content.Client/State/LobbyState.cs +++ b/Content.Client/State/LobbyState.cs @@ -12,6 +12,7 @@ using Robust.Client.Interfaces.UserInterface; using Robust.Client.Player; using Robust.Client.UserInterface.Controls; using Robust.Shared.Input; +using Robust.Shared.Input.Binding; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; diff --git a/Content.Client/UserInterface/GameHud.cs b/Content.Client/UserInterface/GameHud.cs index fdfd3e624c..587dbe4304 100644 --- a/Content.Client/UserInterface/GameHud.cs +++ b/Content.Client/UserInterface/GameHud.cs @@ -9,6 +9,7 @@ using Robust.Client.Interfaces.ResourceManagement; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Shared.Input; +using Robust.Shared.Input.Binding; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Maths; diff --git a/Content.Server/AI/Operators/Combat/Melee/SwingMeleeWeaponOperator.cs b/Content.Server/AI/Operators/Combat/Melee/SwingMeleeWeaponOperator.cs index 38065d5973..207710d94b 100644 --- a/Content.Server/AI/Operators/Combat/Melee/SwingMeleeWeaponOperator.cs +++ b/Content.Server/AI/Operators/Combat/Melee/SwingMeleeWeaponOperator.cs @@ -2,6 +2,7 @@ using Content.Server.GameObjects; using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Weapon.Melee; using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.EntitySystems.Click; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.IoC; @@ -28,7 +29,7 @@ namespace Content.Server.AI.Operators.Combat.Melee { return true; } - + if (!_owner.TryGetComponent(out CombatModeComponent combatModeComponent)) { return false; @@ -41,7 +42,7 @@ namespace Content.Server.AI.Operators.Combat.Melee return true; } - + public override void Shutdown(Outcome outcome) { base.Shutdown(outcome); diff --git a/Content.Server/AI/Operators/Combat/Melee/UnarmedCombatOperator.cs b/Content.Server/AI/Operators/Combat/Melee/UnarmedCombatOperator.cs index 5fc0332351..a0bade8ae3 100644 --- a/Content.Server/AI/Operators/Combat/Melee/UnarmedCombatOperator.cs +++ b/Content.Server/AI/Operators/Combat/Melee/UnarmedCombatOperator.cs @@ -2,6 +2,7 @@ using Content.Server.GameObjects; using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Weapon.Melee; using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.EntitySystems.Click; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.IoC; @@ -29,7 +30,7 @@ namespace Content.Server.AI.Operators.Combat.Melee { return true; } - + if (!_owner.TryGetComponent(out CombatModeComponent combatModeComponent)) { return false; @@ -39,7 +40,7 @@ namespace Content.Server.AI.Operators.Combat.Melee { combatModeComponent.IsInCombatMode = true; } - + if (_owner.TryGetComponent(out UnarmedCombatComponent unarmedCombatComponent)) { _unarmedCombat = unarmedCombatComponent; @@ -85,4 +86,4 @@ namespace Content.Server.AI.Operators.Combat.Melee return Outcome.Continuing; } } -} \ No newline at end of file +} diff --git a/Content.Server/AI/Operators/Inventory/CloseStorageOperator.cs b/Content.Server/AI/Operators/Inventory/CloseStorageOperator.cs index 193b45077e..d70300e4a4 100644 --- a/Content.Server/AI/Operators/Inventory/CloseStorageOperator.cs +++ b/Content.Server/AI/Operators/Inventory/CloseStorageOperator.cs @@ -1,7 +1,7 @@ using Content.Server.AI.Utility; using Content.Server.AI.WorldState.States.Inventory; using Content.Server.GameObjects.Components; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Robust.Shared.Interfaces.GameObjects; @@ -27,7 +27,7 @@ namespace Content.Server.AI.Operators.Inventory { return true; } - + var blackboard = UtilityAiHelpers.GetBlackboard(_owner); if (blackboard == null) @@ -36,7 +36,7 @@ namespace Content.Server.AI.Operators.Inventory } _target = blackboard.GetState().GetValue(); - + return _target != null; } @@ -55,12 +55,12 @@ namespace Content.Server.AI.Operators.Inventory return Outcome.Failed; } - if (!_target.TryGetComponent(out EntityStorageComponent storageComponent) || + if (!_target.TryGetComponent(out EntityStorageComponent storageComponent) || storageComponent.IsWeldedShut) { return Outcome.Failed; } - + if (storageComponent.Open) { var activateArgs = new ActivateEventArgs {User = _owner, Target = _target}; @@ -70,4 +70,4 @@ namespace Content.Server.AI.Operators.Inventory return Outcome.Success; } } -} \ No newline at end of file +} diff --git a/Content.Server/AI/Operators/Inventory/InteractWithEntityOperator.cs b/Content.Server/AI/Operators/Inventory/InteractWithEntityOperator.cs index dc2412a335..8e49c9587c 100644 --- a/Content.Server/AI/Operators/Inventory/InteractWithEntityOperator.cs +++ b/Content.Server/AI/Operators/Inventory/InteractWithEntityOperator.cs @@ -1,5 +1,5 @@ using Content.Server.GameObjects.Components.Mobs; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.EntitySystems.Click; using Content.Server.Utility; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.IoC; diff --git a/Content.Server/AI/Operators/Inventory/OpenStorageOperator.cs b/Content.Server/AI/Operators/Inventory/OpenStorageOperator.cs index c7c21ae3f2..54190e6e0b 100644 --- a/Content.Server/AI/Operators/Inventory/OpenStorageOperator.cs +++ b/Content.Server/AI/Operators/Inventory/OpenStorageOperator.cs @@ -1,7 +1,7 @@ using Content.Server.AI.Utility; using Content.Server.AI.WorldState.States.Inventory; using Content.Server.GameObjects.Components; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Content.Shared.GameObjects.EntitySystems; using Robust.Shared.Containers; @@ -16,13 +16,13 @@ namespace Content.Server.AI.Operators.Inventory { private readonly IEntity _owner; private readonly IEntity _target; - + public OpenStorageOperator(IEntity owner, IEntity target) { _owner = owner; _target = target; } - + public override Outcome Execute(float frameTime) { if (!ContainerHelpers.TryGetContainer(_target, out var container)) @@ -35,22 +35,22 @@ namespace Content.Server.AI.Operators.Inventory return Outcome.Failed; } - if (!container.Owner.TryGetComponent(out EntityStorageComponent storageComponent) || + if (!container.Owner.TryGetComponent(out EntityStorageComponent storageComponent) || storageComponent.IsWeldedShut) { return Outcome.Failed; } - + if (!storageComponent.Open) { var activateArgs = new ActivateEventArgs {User = _owner, Target = _target}; storageComponent.Activate(activateArgs); } - + var blackboard = UtilityAiHelpers.GetBlackboard(_owner); blackboard?.GetState().SetValue(container.Owner); - + return Outcome.Success; } } -} \ No newline at end of file +} diff --git a/Content.Server/AI/Operators/Inventory/PickupEntityOperator.cs b/Content.Server/AI/Operators/Inventory/PickupEntityOperator.cs index ba0f40f78f..01255d9470 100644 --- a/Content.Server/AI/Operators/Inventory/PickupEntityOperator.cs +++ b/Content.Server/AI/Operators/Inventory/PickupEntityOperator.cs @@ -1,5 +1,5 @@ using Content.Server.GameObjects; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.EntitySystems.Click; using Content.Server.Utility; using Robust.Shared.Containers; using Robust.Shared.Interfaces.GameObjects; diff --git a/Content.Server/AI/Utility/Considerations/ActionBlocker/CanMoveCon.cs b/Content.Server/AI/Utility/Considerations/ActionBlocker/CanMoveCon.cs index 5d9949508e..0a1828d495 100644 --- a/Content.Server/AI/Utility/Considerations/ActionBlocker/CanMoveCon.cs +++ b/Content.Server/AI/Utility/Considerations/ActionBlocker/CanMoveCon.cs @@ -1,6 +1,8 @@ using Content.Server.AI.Utility.Curves; using Content.Server.AI.WorldState; using Content.Server.AI.WorldState.States; +using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects.EntitySystems; namespace Content.Server.AI.Utility.Considerations.ActionBlocker diff --git a/Content.Server/Chat/ChatManager.cs b/Content.Server/Chat/ChatManager.cs index f36474ba1e..60c6eb4a64 100644 --- a/Content.Server/Chat/ChatManager.cs +++ b/Content.Server/Chat/ChatManager.cs @@ -1,6 +1,6 @@ using System.Linq; using Content.Server.GameObjects.Components.Observer; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces; using Content.Server.Interfaces.Chat; using Content.Server.Observer; diff --git a/Content.Server/Explosions/ExplosionHelper.cs b/Content.Server/Explosions/ExplosionHelper.cs index a7a61a6396..44b8926b71 100644 --- a/Content.Server/Explosions/ExplosionHelper.cs +++ b/Content.Server/Explosions/ExplosionHelper.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using Content.Server.GameObjects.Components.Mobs; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.Maps; using Robust.Server.GameObjects; using Robust.Server.GameObjects.EntitySystems; diff --git a/Content.Server/GameObjects/Components/Access/IdCardConsoleComponent.cs b/Content.Server/GameObjects/Components/Access/IdCardConsoleComponent.cs index cad078d673..98ca521b45 100644 --- a/Content.Server/GameObjects/Components/Access/IdCardConsoleComponent.cs +++ b/Content.Server/GameObjects/Components/Access/IdCardConsoleComponent.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces; using Content.Server.Interfaces.GameObjects; using Content.Server.Utility; diff --git a/Content.Server/GameObjects/Components/AnchorableComponent.cs b/Content.Server/GameObjects/Components/AnchorableComponent.cs index ef98de532a..ef8e0b4a27 100644 --- a/Content.Server/GameObjects/Components/AnchorableComponent.cs +++ b/Content.Server/GameObjects/Components/AnchorableComponent.cs @@ -1,5 +1,5 @@ -using Content.Server.GameObjects.Components.Interactable; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.Components.Interactable; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects.Components.Interactable; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Components; diff --git a/Content.Server/GameObjects/Components/Cargo/CargoConsoleComponent.cs b/Content.Server/GameObjects/Components/Cargo/CargoConsoleComponent.cs index b8be1cda01..cd5effccc2 100644 --- a/Content.Server/GameObjects/Components/Cargo/CargoConsoleComponent.cs +++ b/Content.Server/GameObjects/Components/Cargo/CargoConsoleComponent.cs @@ -1,6 +1,7 @@ using Content.Server.Cargo; using Content.Server.GameObjects.Components.Power.ApcNetComponents; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects.Components.Cargo; using Content.Shared.Prototypes.Cargo; using JetBrains.Annotations; diff --git a/Content.Server/GameObjects/Components/Chemistry/InjectorComponent.cs b/Content.Server/GameObjects/Components/Chemistry/InjectorComponent.cs index aa3fa3ea7b..189a7c3808 100644 --- a/Content.Server/GameObjects/Components/Chemistry/InjectorComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/InjectorComponent.cs @@ -1,6 +1,6 @@ using System; using Content.Server.GameObjects.Components.Metabolism; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces; using Content.Server.Utility; using Content.Shared.Chemistry; diff --git a/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs b/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs index 3d14e1c481..c23f727381 100644 --- a/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; using Content.Server.GameObjects.Components.Nutrition; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces; using Content.Server.Utility; using Content.Shared.Chemistry; diff --git a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs index 099d8b20eb..6a7a855713 100644 --- a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs @@ -1,7 +1,7 @@ using System; using System.Linq; using Content.Server.GameObjects.Components.Sound; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.GameObjects.Components.Power; using Content.Server.Interfaces; using Content.Server.Interfaces.GameObjects; diff --git a/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs b/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs index 96b2dec4d7..c72c05f10c 100644 --- a/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs @@ -1,5 +1,5 @@ using Content.Server.Chemistry; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.Chemistry; using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Chemistry; @@ -19,6 +19,7 @@ using System.Collections.Generic; using System.Linq; using Content.Shared.GameObjects.EntitySystems; using Robust.Shared.GameObjects.Systems; +using Content.Server.GameObjects.EntitySystems.Click; namespace Content.Server.GameObjects.Components.Chemistry { diff --git a/Content.Server/GameObjects/Components/Chemistry/TransformableContainerComponent.cs b/Content.Server/GameObjects/Components/Chemistry/TransformableContainerComponent.cs index 94d18c734e..048eb685a1 100644 --- a/Content.Server/GameObjects/Components/Chemistry/TransformableContainerComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/TransformableContainerComponent.cs @@ -1,4 +1,4 @@ -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.Chemistry; using Robust.Server.GameObjects; using Robust.Shared.GameObjects; diff --git a/Content.Server/GameObjects/Components/Command/CommunicationsConsoleComponent.cs b/Content.Server/GameObjects/Components/Command/CommunicationsConsoleComponent.cs index 50db5f1ba3..38e54736b5 100644 --- a/Content.Server/GameObjects/Components/Command/CommunicationsConsoleComponent.cs +++ b/Content.Server/GameObjects/Components/Command/CommunicationsConsoleComponent.cs @@ -1,6 +1,6 @@ using Content.Server.GameObjects.Components.Power.ApcNetComponents; using Content.Server.GameObjects.Components.Power; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces.GameTicking; using Content.Server.Utility; using Content.Shared.GameObjects.Components.Command; diff --git a/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs b/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs index 1eb9cad50e..5005046472 100644 --- a/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs +++ b/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs @@ -1,4 +1,11 @@ -using Content.Shared.Construction; +using System; +using System.Collections.Generic; +using Content.Server.GameObjects.Components.Interactable; +using Content.Server.GameObjects.Components.Stack; +using Content.Server.Interfaces.GameObjects.Components.Interaction; +using Content.Server.Interfaces; +using Content.Server.Utility; +using Content.Shared.Construction; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; diff --git a/Content.Server/GameObjects/Components/Damage/BreakableComponent.cs b/Content.Server/GameObjects/Components/Damage/BreakableComponent.cs index de784838c5..226abbc3ab 100644 --- a/Content.Server/GameObjects/Components/Damage/BreakableComponent.cs +++ b/Content.Server/GameObjects/Components/Damage/BreakableComponent.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces; using Content.Shared.GameObjects; using Robust.Shared.GameObjects; diff --git a/Content.Server/GameObjects/Components/Damage/DamageOnToolInteractComponent.cs b/Content.Server/GameObjects/Components/Damage/DamageOnToolInteractComponent.cs index 4f66b92807..8a50cd06c5 100644 --- a/Content.Server/GameObjects/Components/Damage/DamageOnToolInteractComponent.cs +++ b/Content.Server/GameObjects/Components/Damage/DamageOnToolInteractComponent.cs @@ -4,6 +4,7 @@ using Content.Shared.GameObjects.Components.Interactable; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; using System.Collections.Generic; +using Content.Server.Interfaces.GameObjects.Components.Interaction; namespace Content.Server.GameObjects.Components.Damage { @@ -43,7 +44,7 @@ namespace Content.Server.GameObjects.Components.Damage { if (welder.WelderLit) return CallDamage(eventArgs, tool); } - break; //If the tool quality is welding and its not lit or its not actually a welder that can be lit then its pointless to continue. + break; //If the tool quality is welding and its not lit or its not actually a welder that can be lit then its pointless to continue. } if (tool.HasQuality(toolQuality)) return CallDamage(eventArgs, tool); diff --git a/Content.Server/GameObjects/Components/Damage/DestructibleComponent.cs b/Content.Server/GameObjects/Components/Damage/DestructibleComponent.cs index ed72c17540..ae3fc6dcb2 100644 --- a/Content.Server/GameObjects/Components/Damage/DestructibleComponent.cs +++ b/Content.Server/GameObjects/Components/Damage/DestructibleComponent.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces; using Content.Shared.GameObjects; using Robust.Server.GameObjects.EntitySystems; diff --git a/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs b/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs index e5755e3c5b..339e235790 100644 --- a/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs +++ b/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs @@ -3,7 +3,7 @@ using System.Threading; using Content.Server.GameObjects.Components.Interactable; using Content.Server.GameObjects.Components.Power.ApcNetComponents; using Content.Server.GameObjects.Components.VendingMachines; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces; using Content.Shared.GameObjects.Components.Doors; using Content.Shared.GameObjects.Components.Interactable; diff --git a/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs b/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs index 29076c4501..50ea455972 100644 --- a/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs +++ b/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs @@ -1,6 +1,8 @@ using System; using Content.Server.GameObjects.Components.Access; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; +using Content.Server.Utility; using Content.Shared.GameObjects.Components.Doors; using Content.Shared.GameObjects.Components.Movement; using Robust.Server.GameObjects; diff --git a/Content.Server/GameObjects/Components/Explosion/ExplosiveComponent.cs b/Content.Server/GameObjects/Components/Explosion/ExplosiveComponent.cs index f23c611e24..96b7f19202 100644 --- a/Content.Server/GameObjects/Components/Explosion/ExplosiveComponent.cs +++ b/Content.Server/GameObjects/Components/Explosion/ExplosiveComponent.cs @@ -1,5 +1,5 @@ using Content.Server.Explosions; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Server/GameObjects/Components/Explosion/FlashExplosiveComponent.cs b/Content.Server/GameObjects/Components/Explosion/FlashExplosiveComponent.cs index 02789749bf..024ea93f4c 100644 --- a/Content.Server/GameObjects/Components/Explosion/FlashExplosiveComponent.cs +++ b/Content.Server/GameObjects/Components/Explosion/FlashExplosiveComponent.cs @@ -1,5 +1,6 @@ using Content.Server.GameObjects.Components.Weapon; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Robust.Server.GameObjects.EntitySystems; using Robust.Shared.Containers; using Robust.Shared.GameObjects; @@ -51,7 +52,7 @@ namespace Content.Server.GameObjects.Components.Explosion { Owner.Delete(); } - + return true; } diff --git a/Content.Server/GameObjects/Components/Fluids/BucketComponent.cs b/Content.Server/GameObjects/Components/Fluids/BucketComponent.cs index 9eb7c71ad0..b35dd8d7b7 100644 --- a/Content.Server/GameObjects/Components/Fluids/BucketComponent.cs +++ b/Content.Server/GameObjects/Components/Fluids/BucketComponent.cs @@ -1,7 +1,7 @@ using System; using Content.Server.GameObjects.Components.Chemistry; using Content.Server.GameObjects.Components.Sound; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Content.Shared.Chemistry; using Content.Shared.Interfaces; diff --git a/Content.Server/GameObjects/Components/Fluids/MopComponent.cs b/Content.Server/GameObjects/Components/Fluids/MopComponent.cs index 3cab561acb..22fc46878a 100644 --- a/Content.Server/GameObjects/Components/Fluids/MopComponent.cs +++ b/Content.Server/GameObjects/Components/Fluids/MopComponent.cs @@ -1,7 +1,7 @@ using System; using Content.Server.GameObjects.Components.Chemistry; using Content.Server.GameObjects.Components.Sound; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Content.Shared.Chemistry; using Content.Shared.Interfaces; diff --git a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs index fb9227697a..6091c504dc 100644 --- a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs @@ -2,7 +2,8 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks.Dataflow; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.EntitySystems.Click; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces; using Content.Shared.GameObjects; using Content.Shared.GameObjects.EntitySystems; diff --git a/Content.Server/GameObjects/Components/GUI/ServerHandsComponent.cs b/Content.Server/GameObjects/Components/GUI/ServerHandsComponent.cs index 0b8a492592..df383f54fd 100644 --- a/Content.Server/GameObjects/Components/GUI/ServerHandsComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/ServerHandsComponent.cs @@ -5,6 +5,8 @@ using System; using System.Collections.Generic; using System.Linq; using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.EntitySystems.Click; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces.GameObjects; using Content.Shared.GameObjects; using Robust.Server.GameObjects; diff --git a/Content.Server/GameObjects/Components/Gravity/GravityGeneratorComponent.cs b/Content.Server/GameObjects/Components/Gravity/GravityGeneratorComponent.cs index a553c3e4bf..52f8a99fd5 100644 --- a/Content.Server/GameObjects/Components/Gravity/GravityGeneratorComponent.cs +++ b/Content.Server/GameObjects/Components/Gravity/GravityGeneratorComponent.cs @@ -2,7 +2,7 @@ using Content.Server.GameObjects.Components.Interactable; using Content.Server.GameObjects.Components.Power.ApcNetComponents; using Content.Server.GameObjects.Components.Power; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces; using Content.Server.Utility; using Content.Shared.GameObjects.Components.Gravity; diff --git a/Content.Server/GameObjects/Components/Healing/HealingComponent.cs b/Content.Server/GameObjects/Components/Healing/HealingComponent.cs index bfebc2d3ab..b0d0b9e2c0 100644 --- a/Content.Server/GameObjects/Components/Healing/HealingComponent.cs +++ b/Content.Server/GameObjects/Components/Healing/HealingComponent.cs @@ -1,5 +1,5 @@ using Content.Server.GameObjects.Components.Stack; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Content.Shared.GameObjects; using Robust.Shared.GameObjects; diff --git a/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs b/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs index 868a74465e..d0017971e5 100644 --- a/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs +++ b/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs @@ -1,7 +1,7 @@ using System; using System.Linq; using Content.Server.GameObjects.Components.Mobs; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces; using Content.Server.Mobs; using Content.Shared.GameObjects.Components.Instruments; diff --git a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs index 3348ab0593..42086c3cb0 100644 --- a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs @@ -1,4 +1,7 @@ using Content.Server.GameObjects.Components.Power; +using Content.Server.GameObjects.Components.Sound; +using Content.Server.GameObjects.EntitySystems.Click; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.GameObjects.EntitySystems; using Content.Server.Interfaces.GameObjects; using Content.Shared.GameObjects; diff --git a/Content.Server/GameObjects/Components/Interactable/MultitoolComponent.cs b/Content.Server/GameObjects/Components/Interactable/MultitoolComponent.cs index e548f6e957..95973aa1d4 100644 --- a/Content.Server/GameObjects/Components/Interactable/MultitoolComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/MultitoolComponent.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Interactable; using Robust.Server.GameObjects; diff --git a/Content.Server/GameObjects/Components/Interactable/TilePryingComponent.cs b/Content.Server/GameObjects/Components/Interactable/TilePryingComponent.cs index be625da60f..12f95f4371 100644 --- a/Content.Server/GameObjects/Components/Interactable/TilePryingComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/TilePryingComponent.cs @@ -1,4 +1,5 @@ -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.EntitySystems.Click; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects.Components.Interactable; using Content.Shared.Maps; using Robust.Shared.GameObjects; diff --git a/Content.Server/GameObjects/Components/Interactable/ToolComponent.cs b/Content.Server/GameObjects/Components/Interactable/ToolComponent.cs index bfa1ac94ee..495fc008b5 100644 --- a/Content.Server/GameObjects/Components/Interactable/ToolComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/ToolComponent.cs @@ -3,6 +3,11 @@ using System; using System.Collections.Generic; +using System.Linq; +using System.Reflection.Metadata.Ecma335; +using Content.Server.GameObjects.Components.Chemistry; +using Content.Server.GameObjects.EntitySystems.Click; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.Audio; using Content.Shared.GameObjects.Components.Interactable; using Content.Shared.GameObjects.EntitySystems; diff --git a/Content.Server/GameObjects/Components/Interactable/WelderComponent.cs b/Content.Server/GameObjects/Components/Interactable/WelderComponent.cs index 03d2b85479..bf55f988fa 100644 --- a/Content.Server/GameObjects/Components/Interactable/WelderComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/WelderComponent.cs @@ -1,7 +1,8 @@ using System; using System.Runtime.Remoting; using Content.Server.GameObjects.Components.Chemistry; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.EntitySystems.Click; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces; using Content.Server.Interfaces.Chat; using Content.Server.Interfaces.GameObjects; diff --git a/Content.Server/GameObjects/Components/Items/Clothing/ClothingComponent.cs b/Content.Server/GameObjects/Components/Items/Clothing/ClothingComponent.cs index 1d5c187da4..6bf0ae5822 100644 --- a/Content.Server/GameObjects/Components/Items/Clothing/ClothingComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Clothing/ClothingComponent.cs @@ -3,7 +3,7 @@ using Robust.Shared.Utility; using System; using System.Collections.Generic; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces; using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Items; diff --git a/Content.Server/GameObjects/Components/Items/DiceComponent.cs b/Content.Server/GameObjects/Components/Items/DiceComponent.cs index 9620c8bbd5..90f5ab03ce 100644 --- a/Content.Server/GameObjects/Components/Items/DiceComponent.cs +++ b/Content.Server/GameObjects/Components/Items/DiceComponent.cs @@ -1,5 +1,6 @@ -using Content.Server.GameObjects.Components.Sound; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.Components.Sound; +using Content.Server.GameObjects.EntitySystems.Click; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Content.Shared.Audio; using Robust.Server.GameObjects; diff --git a/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs b/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs index cc1ce34725..3ebd014501 100644 --- a/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs +++ b/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs @@ -1,5 +1,5 @@ using Content.Server.GameObjects.Components.Stack; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Content.Shared.Maps; using Robust.Server.GameObjects.EntitySystems; diff --git a/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs index 6eae6bf66f..2792be485a 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs @@ -3,7 +3,7 @@ using System.Linq; using Content.Server.GameObjects.Components.Interactable; using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.Components.Sound; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Interactable; using Content.Shared.GameObjects.Components.Storage; diff --git a/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs index 054a557938..d999794391 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs @@ -1,4 +1,8 @@ -using Content.Server.GameObjects.EntitySystems; +using System; +using Content.Server.GameObjects.Components; +using Content.Server.GameObjects.Components.Destructible; +using Content.Server.Interfaces.GameObjects.Components.Interaction; +using Content.Server.GameObjects.EntitySystems; using Content.Server.Interfaces.GameObjects; using Content.Server.Throw; using Content.Server.Utility; @@ -89,7 +93,7 @@ namespace Content.Server.GameObjects var userPos = user.Transform.MapPosition; var itemPos = Owner.Transform.MapPosition; - return InteractionChecks.InRangeUnobstructed(user, itemPos, ignoredEnt: Owner, insideBlockerValid:true); + return InteractionChecks.InRangeUnobstructed(user, itemPos, ignoredEnt: Owner, ignoreInsideBlocker:true); } public bool InteractHand(InteractHandEventArgs eventArgs) diff --git a/Content.Server/GameObjects/Components/Items/Storage/SecureEntityStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/SecureEntityStorageComponent.cs index 9f583e5a09..dbdb37c09e 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/SecureEntityStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/SecureEntityStorageComponent.cs @@ -1,5 +1,5 @@ using Content.Server.GameObjects.Components.Access; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces; using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Storage; diff --git a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs index 6878efd0b0..5ab57cdc29 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs @@ -3,7 +3,8 @@ using System.Collections.Generic; using System.Linq; using Content.Server.GameObjects.Components; using Content.Server.GameObjects.Components.Items.Storage; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.EntitySystems.Click; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces.GameObjects; using Content.Server.Utility; using Content.Shared.GameObjects.Components.Storage; @@ -21,6 +22,7 @@ using Robust.Shared.Interfaces.Map; using Robust.Shared.Interfaces.Network; using Robust.Shared.IoC; using Robust.Shared.Log; +using Robust.Shared.Maths; using Robust.Shared.Players; using Robust.Shared.Serialization; @@ -32,7 +34,8 @@ namespace Content.Server.GameObjects [RegisterComponent] [ComponentReference(typeof(IActivate))] [ComponentReference(typeof(IStorageComponent))] - public class ServerStorageComponent : SharedStorageComponent, IInteractUsing, IUse, IActivate, IStorageComponent, IDestroyAct, IExAct + public class ServerStorageComponent : SharedStorageComponent, IInteractUsing, IUse, IActivate, IStorageComponent, IDestroyAct, IExAct, + IDragDrop { #pragma warning disable 649 [Dependency] private readonly IMapManager _mapManager; @@ -409,5 +412,26 @@ namespace Content.Server.GameObjects Owner.PopupMessage(player, "Can't insert."); return false; } + + public bool DragDrop(DragDropEventArgs eventArgs) + { + if (eventArgs.Target.TryGetComponent(out var placeableSurface)) + { + if (!placeableSurface.IsPlaceable) return false; + + // empty everything out + foreach (var storedEntity in StoredEntities.ToList()) + { + if (Remove(storedEntity)) + { + storedEntity.Transform.WorldPosition = eventArgs.DropLocation.Position; + } + } + + return true; + } + + return false; + } } } diff --git a/Content.Server/GameObjects/Components/Items/ToysComponent.cs b/Content.Server/GameObjects/Components/Items/ToysComponent.cs index fdbf4d3347..d6ad2a8ae8 100644 --- a/Content.Server/GameObjects/Components/Items/ToysComponent.cs +++ b/Content.Server/GameObjects/Components/Items/ToysComponent.cs @@ -1,5 +1,6 @@ using Content.Server.GameObjects.Components.Sound; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Content.Shared.Audio; using Robust.Server.GameObjects; diff --git a/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs b/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs index 8b83174754..e7af82550d 100644 --- a/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs +++ b/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Linq; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.ViewVariables; diff --git a/Content.Server/GameObjects/Components/MagicMirrorComponent.cs b/Content.Server/GameObjects/Components/MagicMirrorComponent.cs index 76017269c8..eec3bea3d3 100644 --- a/Content.Server/GameObjects/Components/MagicMirrorComponent.cs +++ b/Content.Server/GameObjects/Components/MagicMirrorComponent.cs @@ -1,5 +1,5 @@ using Content.Server.GameObjects.Components.Mobs; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Content.Shared.GameObjects.Components; using Content.Shared.Interfaces; diff --git a/Content.Server/GameObjects/Components/Markers/WarpPointComponent.cs b/Content.Server/GameObjects/Components/Markers/WarpPointComponent.cs index 05ed281f67..232ba77ccf 100644 --- a/Content.Server/GameObjects/Components/Markers/WarpPointComponent.cs +++ b/Content.Server/GameObjects/Components/Markers/WarpPointComponent.cs @@ -1,4 +1,5 @@ -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.EntitySystems.Click; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Robust.Shared.GameObjects; using Robust.Shared.Localization; using Robust.Shared.Serialization; diff --git a/Content.Server/GameObjects/Components/Medical/MedicalScannerComponent.cs b/Content.Server/GameObjects/Components/Medical/MedicalScannerComponent.cs index f8bbdaa168..84bd1b53ba 100644 --- a/Content.Server/GameObjects/Components/Medical/MedicalScannerComponent.cs +++ b/Content.Server/GameObjects/Components/Medical/MedicalScannerComponent.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Medical; using Content.Server.GameObjects.Components.Power; diff --git a/Content.Server/GameObjects/Components/Metabolism/BloodstreamComponent.cs b/Content.Server/GameObjects/Components/Metabolism/BloodstreamComponent.cs index e428c72f17..f1f9656f4f 100644 --- a/Content.Server/GameObjects/Components/Metabolism/BloodstreamComponent.cs +++ b/Content.Server/GameObjects/Components/Metabolism/BloodstreamComponent.cs @@ -1,6 +1,6 @@ using System.Linq; using Content.Server.GameObjects.Components.Chemistry; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.Chemistry; using Robust.Shared.GameObjects; using Robust.Shared.IoC; diff --git a/Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs b/Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs index ef85c5eb4b..d6df7cca1d 100644 --- a/Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs +++ b/Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs @@ -1,6 +1,6 @@ using Content.Server.GameObjects.Components.Sound; using Content.Server.GameObjects.Components.Weapon.Melee; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Content.Shared.GameObjects; using Robust.Server.GameObjects; diff --git a/Content.Server/GameObjects/Components/Mobs/BuckleComponent.cs b/Content.Server/GameObjects/Components/Mobs/BuckleComponent.cs index 493a21e320..747737cea4 100644 --- a/Content.Server/GameObjects/Components/Mobs/BuckleComponent.cs +++ b/Content.Server/GameObjects/Components/Mobs/BuckleComponent.cs @@ -1,6 +1,7 @@ using Content.Server.GameObjects.Components.Strap; using Content.Server.GameObjects.EntitySystems; using Content.Server.Interfaces; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Mobs; using Content.Server.Utility; using Content.Shared.GameObjects; diff --git a/Content.Server/GameObjects/Components/Mobs/DamageStates.cs b/Content.Server/GameObjects/Components/Mobs/DamageStates.cs index abfdcb52f0..ad79a7a106 100644 --- a/Content.Server/GameObjects/Components/Mobs/DamageStates.cs +++ b/Content.Server/GameObjects/Components/Mobs/DamageStates.cs @@ -1,5 +1,5 @@ using Content.Server.GameObjects.Components.Mobs; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Mobs; using Content.Shared.Audio; using Content.Shared.GameObjects.Components.Mobs; diff --git a/Content.Server/GameObjects/Components/Mobs/MindComponent.cs b/Content.Server/GameObjects/Components/Mobs/MindComponent.cs index 6272bc8464..3e15cdceaf 100644 --- a/Content.Server/GameObjects/Components/Mobs/MindComponent.cs +++ b/Content.Server/GameObjects/Components/Mobs/MindComponent.cs @@ -1,5 +1,6 @@ using Content.Server.GameObjects.Components.Observer; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.EntitySystems.Click; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces.GameTicking; using Content.Server.Mobs; using Robust.Shared.GameObjects; diff --git a/Content.Server/GameObjects/Components/Mobs/SpeciesComponent.cs b/Content.Server/GameObjects/Components/Mobs/SpeciesComponent.cs index 380f93d667..23342f3a15 100644 --- a/Content.Server/GameObjects/Components/Mobs/SpeciesComponent.cs +++ b/Content.Server/GameObjects/Components/Mobs/SpeciesComponent.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using Content.Server.GameObjects.Components.Mobs; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces; using Content.Server.Observer; using Content.Shared.GameObjects; diff --git a/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs b/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs index 3098310a57..0b72696503 100644 --- a/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs +++ b/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs @@ -1,5 +1,8 @@ using System; using System.Threading; +using Content.Server.GameObjects.Components.Movement; +using Content.Server.Interfaces.GameObjects.Components.Interaction; +using Content.Server.Interfaces.GameObjects; using Content.Server.GameObjects.EntitySystems; using Content.Server.Mobs; using Content.Shared.Audio; diff --git a/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs b/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs index f6aaaf46da..12e55c9576 100644 --- a/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs +++ b/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs @@ -1,6 +1,6 @@ using System; using System.Linq; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects.Components.Movement; using Robust.Server.GameObjects; using Robust.Server.GameObjects.EntitySystems; diff --git a/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs b/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs index 712f01130b..38d6e1fffe 100644 --- a/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs @@ -1,6 +1,7 @@ using System; using Content.Server.GameObjects.Components.Chemistry; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.EntitySystems.Click; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.Audio; using Content.Shared.Chemistry; using Content.Shared.GameObjects.Components.Nutrition; diff --git a/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs b/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs index ef13d79fb9..e38af09497 100644 --- a/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs @@ -4,6 +4,8 @@ using Content.Server.GameObjects.Components.Chemistry; using Content.Server.GameObjects.Components.Utensil; using Content.Server.GameObjects.EntitySystems; using Content.Server.Utility; +using Content.Server.GameObjects.Components.Sound; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.Chemistry; using Content.Shared.GameObjects.Components.Utensil; using Content.Shared.Interfaces; diff --git a/Content.Server/GameObjects/Components/Nutrition/FoodContainerComponent.cs b/Content.Server/GameObjects/Components/Nutrition/FoodContainerComponent.cs index efddfcc04b..572f1963c5 100644 --- a/Content.Server/GameObjects/Components/Nutrition/FoodContainerComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/FoodContainerComponent.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects.Components.Nutrition; using Robust.Server.GameObjects; using Robust.Shared.GameObjects; diff --git a/Content.Server/GameObjects/Components/Observer/GhostComponent.cs b/Content.Server/GameObjects/Components/Observer/GhostComponent.cs index 9caca4a53c..ba906a1b78 100644 --- a/Content.Server/GameObjects/Components/Observer/GhostComponent.cs +++ b/Content.Server/GameObjects/Components/Observer/GhostComponent.cs @@ -1,4 +1,4 @@ -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Players; using Content.Shared.GameObjects.Components.Observer; using Content.Shared.GameObjects.EntitySystems; diff --git a/Content.Server/GameObjects/Components/PDA/PDAComponent.cs b/Content.Server/GameObjects/Components/PDA/PDAComponent.cs index 78328c9c94..eb7f1d1b68 100644 --- a/Content.Server/GameObjects/Components/PDA/PDAComponent.cs +++ b/Content.Server/GameObjects/Components/PDA/PDAComponent.cs @@ -3,7 +3,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; using Content.Server.GameObjects.Components.Access; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces; using Content.Server.Interfaces.PDA; using Content.Shared.GameObjects; diff --git a/Content.Server/GameObjects/Components/Paper/PaperComponent.cs b/Content.Server/GameObjects/Components/Paper/PaperComponent.cs index 1cb46cece3..d8d391b483 100644 --- a/Content.Server/GameObjects/Components/Paper/PaperComponent.cs +++ b/Content.Server/GameObjects/Components/Paper/PaperComponent.cs @@ -1,4 +1,5 @@ -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.EntitySystems.Click; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Content.Shared.GameObjects.Components; using Robust.Server.GameObjects; diff --git a/Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs b/Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs index 1f8789d579..1f193bf5bd 100644 --- a/Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs +++ b/Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs @@ -1,15 +1,14 @@ -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; +using Content.Shared.GameObjects.Components; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; namespace Content.Server.GameObjects.Components { [RegisterComponent] - public class PlaceableSurfaceComponent : Component, IInteractUsing + public class PlaceableSurfaceComponent : SharedPlaceableSurfaceComponent, IInteractUsing { - public override string Name => "PlaceableSurface"; - private bool _isPlaceable; public bool IsPlaceable { get => _isPlaceable; set => _isPlaceable = value; } diff --git a/Content.Server/GameObjects/Components/PottedPlantHideComponent.cs b/Content.Server/GameObjects/Components/PottedPlantHideComponent.cs index 5093ac5b01..5de2091e62 100644 --- a/Content.Server/GameObjects/Components/PottedPlantHideComponent.cs +++ b/Content.Server/GameObjects/Components/PottedPlantHideComponent.cs @@ -1,4 +1,4 @@ -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces.GameObjects; using Content.Shared.Audio; using Content.Shared.Interfaces; diff --git a/Content.Server/GameObjects/Components/Power/ApcNetComponents/ApcComponent.cs b/Content.Server/GameObjects/Components/Power/ApcNetComponents/ApcComponent.cs index 9d7cebc0fb..5b5c62b12a 100644 --- a/Content.Server/GameObjects/Components/Power/ApcNetComponents/ApcComponent.cs +++ b/Content.Server/GameObjects/Components/Power/ApcNetComponents/ApcComponent.cs @@ -11,6 +11,7 @@ using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; using Robust.Shared.ViewVariables; using System; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Robust.Shared.IoC; using Robust.Shared.Interfaces.Timing; diff --git a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/BaseCharger.cs b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/BaseCharger.cs index 7645f43d8d..543c14b698 100644 --- a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/BaseCharger.cs +++ b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/BaseCharger.cs @@ -2,6 +2,7 @@ using Content.Server.GameObjects.Components.Power.ApcNetComponents; using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Power; using Content.Shared.GameObjects.EntitySystems; @@ -104,7 +105,7 @@ namespace Content.Server.GameObjects.Components.Power.Chargers { batteryBarrelComponent.UpdateAppearance(); } - + UpdateStatus(); } diff --git a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/LightBulbComponent.cs b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/LightBulbComponent.cs index 62742bb113..07aafe6459 100644 --- a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/LightBulbComponent.cs +++ b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/LightBulbComponent.cs @@ -1,5 +1,5 @@ using System; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.Audio; using Robust.Server.GameObjects; using Robust.Server.GameObjects.EntitySystems; diff --git a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PowerCellChargerComponent.cs b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PowerCellChargerComponent.cs index ba066745d3..8e4adfced8 100644 --- a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PowerCellChargerComponent.cs +++ b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PowerCellChargerComponent.cs @@ -1,4 +1,5 @@ using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; diff --git a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PoweredLightComponent.cs b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PoweredLightComponent.cs index 4cc6ecebd9..a391b27a6f 100644 --- a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PoweredLightComponent.cs +++ b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PoweredLightComponent.cs @@ -1,6 +1,7 @@ using System; using Content.Server.GameObjects.Components.Power.ApcNetComponents; using Content.Server.GameObjects.Components.Sound; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.GameObjects.EntitySystems; using Content.Server.Interfaces; using Content.Server.Utility; diff --git a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/WeaponCapacitorChargerComponent.cs b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/WeaponCapacitorChargerComponent.cs index 4257742afa..bbbb29375a 100644 --- a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/WeaponCapacitorChargerComponent.cs +++ b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/WeaponCapacitorChargerComponent.cs @@ -1,5 +1,6 @@ using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; diff --git a/Content.Server/GameObjects/Components/Power/PowerNetComponents/SolarControlConsoleComponent.cs b/Content.Server/GameObjects/Components/Power/PowerNetComponents/SolarControlConsoleComponent.cs index 954dc1bcec..24270c597e 100644 --- a/Content.Server/GameObjects/Components/Power/PowerNetComponents/SolarControlConsoleComponent.cs +++ b/Content.Server/GameObjects/Components/Power/PowerNetComponents/SolarControlConsoleComponent.cs @@ -1,11 +1,11 @@ -using Content.Server.GameObjects.Components.Power.ApcNetComponents; +using Content.Server.Interfaces.GameObjects.Components.Interaction; +using Content.Server.GameObjects.Components.Power.ApcNetComponents; using Content.Server.GameObjects.Components.Power; using Content.Server.GameObjects.EntitySystems; using Content.Server.Interfaces.GameTicking; using Content.Shared.GameObjects.Components.Power; using Robust.Server.GameObjects.Components.UserInterface; using Robust.Server.Interfaces.GameObjects; -using Robust.Server.Interfaces.Player; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.IoC; diff --git a/Content.Server/GameObjects/Components/Power/PowerNetComponents/SolarPanelComponent.cs b/Content.Server/GameObjects/Components/Power/PowerNetComponents/SolarPanelComponent.cs index 7884358cfe..4cb7cde036 100644 --- a/Content.Server/GameObjects/Components/Power/PowerNetComponents/SolarPanelComponent.cs +++ b/Content.Server/GameObjects/Components/Power/PowerNetComponents/SolarPanelComponent.cs @@ -1,5 +1,6 @@ using System; using Content.Server.GameObjects.Components.Damage; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.GameObjects.Components.Power.PowerNetComponents; using Content.Server.GameObjects.EntitySystems; using Content.Shared.Audio; diff --git a/Content.Server/GameObjects/Components/Power/WireComponent.cs b/Content.Server/GameObjects/Components/Power/WireComponent.cs index dce421d617..70b7d81193 100644 --- a/Content.Server/GameObjects/Components/Power/WireComponent.cs +++ b/Content.Server/GameObjects/Components/Power/WireComponent.cs @@ -1,6 +1,7 @@ using Content.Server.GameObjects.Components.Interactable; using Content.Server.GameObjects.Components.Stack; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects.Components.Interactable; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs b/Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs index 323abcf8c5..b23a3cbf90 100644 --- a/Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs +++ b/Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs @@ -2,7 +2,7 @@ using Content.Server.GameObjects.Components.NodeContainer.NodeGroups; using Content.Server.GameObjects.Components.NodeContainer.Nodes; using Content.Server.GameObjects.Components.Stack; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Robust.Server.Interfaces.GameObjects; using Robust.Shared.GameObjects; diff --git a/Content.Server/GameObjects/Components/Projectiles/ThrownItemComponent.cs b/Content.Server/GameObjects/Components/Projectiles/ThrownItemComponent.cs index 1f5600b186..357724ba53 100644 --- a/Content.Server/GameObjects/Components/Projectiles/ThrownItemComponent.cs +++ b/Content.Server/GameObjects/Components/Projectiles/ThrownItemComponent.cs @@ -1,5 +1,6 @@ -using Content.Server.GameObjects.Components.Projectiles; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.Components.Projectiles; +using Content.Server.GameObjects.EntitySystems.Click; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects; using Content.Shared.Physics; using Robust.Shared.GameObjects; diff --git a/Content.Server/GameObjects/Components/Research/LatheComponent.cs b/Content.Server/GameObjects/Components/Research/LatheComponent.cs index bc6f16ac72..639664bdfa 100644 --- a/Content.Server/GameObjects/Components/Research/LatheComponent.cs +++ b/Content.Server/GameObjects/Components/Research/LatheComponent.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; using System.Linq; using Content.Server.GameObjects.Components.Power; using Content.Server.GameObjects.Components.Stack; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Content.Shared.GameObjects.Components.Materials; using Content.Shared.GameObjects.Components.Power; diff --git a/Content.Server/GameObjects/Components/Research/ResearchClientComponent.cs b/Content.Server/GameObjects/Components/Research/ResearchClientComponent.cs index ad63bb4bb7..3f14fe00da 100644 --- a/Content.Server/GameObjects/Components/Research/ResearchClientComponent.cs +++ b/Content.Server/GameObjects/Components/Research/ResearchClientComponent.cs @@ -1,4 +1,4 @@ -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Content.Shared.GameObjects.Components.Research; using Robust.Server.GameObjects.Components.UserInterface; diff --git a/Content.Server/GameObjects/Components/Research/ResearchConsoleComponent.cs b/Content.Server/GameObjects/Components/Research/ResearchConsoleComponent.cs index 6bef26d671..2a2c8ce62c 100644 --- a/Content.Server/GameObjects/Components/Research/ResearchConsoleComponent.cs +++ b/Content.Server/GameObjects/Components/Research/ResearchConsoleComponent.cs @@ -1,6 +1,6 @@ using Content.Server.GameObjects.Components.Power.ApcNetComponents; using Content.Server.GameObjects.Components.Power; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Content.Shared.Audio; using Content.Shared.GameObjects.Components.Research; diff --git a/Content.Server/GameObjects/Components/Research/ResearchPointSourceComponent.cs b/Content.Server/GameObjects/Components/Research/ResearchPointSourceComponent.cs index b273e41c26..c6d60cbd8a 100644 --- a/Content.Server/GameObjects/Components/Research/ResearchPointSourceComponent.cs +++ b/Content.Server/GameObjects/Components/Research/ResearchPointSourceComponent.cs @@ -1,6 +1,6 @@ using Content.Server.GameObjects.Components.Power.ApcNetComponents; using Content.Server.GameObjects.Components.Power; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; diff --git a/Content.Server/GameObjects/Components/Research/ResearchServerComponent.cs b/Content.Server/GameObjects/Components/Research/ResearchServerComponent.cs index 148663a380..4060b01368 100644 --- a/Content.Server/GameObjects/Components/Research/ResearchServerComponent.cs +++ b/Content.Server/GameObjects/Components/Research/ResearchServerComponent.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using Content.Server.GameObjects.Components.Power; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.Research; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; diff --git a/Content.Server/GameObjects/Components/Sound/EmitSoundOnThrowComponent.cs b/Content.Server/GameObjects/Components/Sound/EmitSoundOnThrowComponent.cs index 19d6f81922..25b0f149f5 100644 --- a/Content.Server/GameObjects/Components/Sound/EmitSoundOnThrowComponent.cs +++ b/Content.Server/GameObjects/Components/Sound/EmitSoundOnThrowComponent.cs @@ -1,4 +1,5 @@ using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.Audio; using Robust.Server.GameObjects.EntitySystems; using Robust.Shared.Audio; diff --git a/Content.Server/GameObjects/Components/Sound/EmitSoundOnUseComponent.cs b/Content.Server/GameObjects/Components/Sound/EmitSoundOnUseComponent.cs index e81c57a7df..ef6f330ffc 100644 --- a/Content.Server/GameObjects/Components/Sound/EmitSoundOnUseComponent.cs +++ b/Content.Server/GameObjects/Components/Sound/EmitSoundOnUseComponent.cs @@ -1,4 +1,4 @@ -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.Audio; using Robust.Server.GameObjects.EntitySystems; using Robust.Shared.Audio; diff --git a/Content.Server/GameObjects/Components/Stack/StackComponent.cs b/Content.Server/GameObjects/Components/Stack/StackComponent.cs index 3db7729d5c..3d6d18d46d 100644 --- a/Content.Server/GameObjects/Components/Stack/StackComponent.cs +++ b/Content.Server/GameObjects/Components/Stack/StackComponent.cs @@ -1,5 +1,6 @@ using System; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.EntitySystems.Click; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Content.Shared.GameObjects.Components; using Content.Shared.Interfaces; diff --git a/Content.Server/GameObjects/Components/Strap/StrapComponent.cs b/Content.Server/GameObjects/Components/Strap/StrapComponent.cs index 9060193c1f..97da26fce6 100644 --- a/Content.Server/GameObjects/Components/Strap/StrapComponent.cs +++ b/Content.Server/GameObjects/Components/Strap/StrapComponent.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Strap; using Content.Shared.GameObjects.EntitySystems; diff --git a/Content.Server/GameObjects/Components/Trigger/TimerTrigger/OnUseTimerTriggerComponent.cs b/Content.Server/GameObjects/Components/Trigger/TimerTrigger/OnUseTimerTriggerComponent.cs index 19d77f4ad7..81657b1063 100644 --- a/Content.Server/GameObjects/Components/Trigger/TimerTrigger/OnUseTimerTriggerComponent.cs +++ b/Content.Server/GameObjects/Components/Trigger/TimerTrigger/OnUseTimerTriggerComponent.cs @@ -1,5 +1,5 @@ using System; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects.Components.Triggers; using Robust.Server.GameObjects; using Robust.Shared.GameObjects; diff --git a/Content.Server/GameObjects/Components/Utensil/UtensilComponent.cs b/Content.Server/GameObjects/Components/Utensil/UtensilComponent.cs index 3069bd72c3..797a2160d9 100644 --- a/Content.Server/GameObjects/Components/Utensil/UtensilComponent.cs +++ b/Content.Server/GameObjects/Components/Utensil/UtensilComponent.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using Content.Server.GameObjects.Components.Nutrition; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Content.Shared.GameObjects.Components.Utensil; using Robust.Server.GameObjects.EntitySystems; diff --git a/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs b/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs index 4f730b77dd..6473490d56 100644 --- a/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs +++ b/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs @@ -3,6 +3,9 @@ using System.Collections.Generic; using System.Linq; using Content.Server.GameObjects.Components.Power.ApcNetComponents; using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.Components.Power; +using Content.Server.GameObjects.EntitySystems.Click; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Content.Shared.GameObjects.Components.VendingMachines; using Content.Shared.VendingMachines; diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs index 78fae35837..29dbe2f98c 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Items; using Robust.Server.GameObjects.EntitySystems; diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs index 15310511b9..029610ba15 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs @@ -1,7 +1,8 @@ using System.Collections.Generic; using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Power; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.EntitySystems.Click; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces.GameObjects; using Content.Shared.Audio; using Content.Shared.GameObjects; diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/AmmoBoxComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/AmmoBoxComponent.cs index 9d7d6a869d..2c733d186f 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/AmmoBoxComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/AmmoBoxComponent.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.Audio; using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels; diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/RangedMagazineComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/RangedMagazineComponent.cs index 92393e4d31..1f24d682fa 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/RangedMagazineComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/RangedMagazineComponent.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.Audio; using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels; using Content.Shared.Interfaces; @@ -32,7 +33,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition public int ShotsLeft => _spawnedAmmo.Count + _unspawnedCount; public int Capacity => _capacity; private int _capacity; - + public MagazineType MagazineType => _magazineType; private MagazineType _magazineType; public BallisticCaliber Caliber => _caliber; @@ -87,7 +88,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition { _appearanceComponent = appearanceComponent; } - + _appearanceComponent?.SetData(MagazineBarrelVisuals.MagLoaded, true); } @@ -96,7 +97,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition _appearanceComponent?.SetData(AmmoVisuals.AmmoCount, ShotsLeft); _appearanceComponent?.SetData(AmmoVisuals.AmmoMax, Capacity); } - + public bool TryInsertAmmo(IEntity user, IEntity ammo) { if (!ammo.TryGetComponent(out AmmoComponent ammoComponent)) @@ -136,7 +137,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition _unspawnedCount--; ammo = Owner.EntityManager.SpawnEntity(_fillPrototype, Owner.Transform.GridPosition); } - + UpdateAppearance(); return ammo; } diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/SpeedLoaderComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/SpeedLoaderComponent.cs index 89cceb6828..e44f6a560c 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/SpeedLoaderComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/SpeedLoaderComponent.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels; using Content.Shared.Interfaces; using Robust.Server.GameObjects; @@ -38,7 +39,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition serializer.DataField(ref _caliber, "caliber", BallisticCaliber.Unspecified); serializer.DataField(ref _capacity, "capacity", 6); serializer.DataField(ref _fillPrototype, "fillPrototype", null); - + _spawnedAmmo = new Stack(_capacity); } @@ -56,7 +57,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition } } } - + void IMapInit.MapInit() { _unspawnedCount += _capacity; @@ -91,7 +92,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition Owner.PopupMessage(user, Loc.GetString("No room")); return false; } - + _spawnedAmmo.Push(entity); _ammoContainer.Insert(entity); UpdateAppearance(); @@ -149,10 +150,10 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition { return; } - + // This area is dirty but not sure of an easier way to do it besides add an interface or somethin bool changed = false; - + if (eventArgs.Target.TryGetComponent(out RevolverBarrelComponent revolverBarrel)) { for (var i = 0; i < Capacity; i++) @@ -193,9 +194,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition TryInsertAmmo(eventArgs.User, ammo); break; } - + } - + if (changed) { UpdateAppearance(); @@ -212,4 +213,4 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition return UseEntity(eventArgs.User); } } -} \ No newline at end of file +} diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/BoltActionBarrelComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/BoltActionBarrelComponent.cs index bdee4823b6..6ee38d4337 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/BoltActionBarrelComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/BoltActionBarrelComponent.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using Content.Server.GameObjects.Components.Sound; using Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels; using Content.Shared.GameObjects.EntitySystems; diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/PumpBarrelComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/PumpBarrelComponent.cs index 405214490c..5116f2db5f 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/PumpBarrelComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/PumpBarrelComponent.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using Content.Server.GameObjects.Components.Sound; using Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels; using Content.Shared.Interfaces; using Robust.Server.GameObjects; diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/RevolverBarrelComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/RevolverBarrelComponent.cs index 1bbd687df2..3d07ecfe18 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/RevolverBarrelComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/RevolverBarrelComponent.cs @@ -2,6 +2,7 @@ using System; using Content.Server.GameObjects.Components.Sound; using Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels; using Content.Shared.GameObjects.EntitySystems; diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerBatteryBarrelComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerBatteryBarrelComponent.cs index 60a2135eba..9c0f1597dc 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerBatteryBarrelComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerBatteryBarrelComponent.cs @@ -4,6 +4,7 @@ using Content.Server.GameObjects.Components.Power; using Content.Server.GameObjects.Components.Projectiles; using Content.Server.GameObjects.Components.Sound; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels; using Robust.Server.GameObjects; @@ -68,9 +69,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels return (int) Math.Ceiling((float) (powerCell.GetComponent().MaxCharge / _baseFireCost)); } } - + private AppearanceComponent _appearanceComponent; - + // Sounds private string _soundPowerCellInsert; private string _soundPowerCellEject; @@ -110,10 +111,10 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels { _appearanceComponent = appearanceComponent; } - + UpdateAppearance(); } - + public void UpdateAppearance() { _appearanceComponent?.SetData(MagazineBarrelVisuals.MagLoaded, _powerCellContainer.ContainedEntity != null); @@ -223,14 +224,14 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels { return null; } - + var entity = _powerCellContainer.ContainedEntity; _powerCellContainer.Remove(entity); if (_soundPowerCellEject != null) { EntitySystem.Get().PlayAtCoords(_soundPowerCellEject, Owner.Transform.GridPosition, AudioParams.Default.WithVolume(-2)); } - + UpdateAppearance(); //Dirty(); return entity; @@ -242,8 +243,8 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels { return false; } - - if (!eventArgs.User.TryGetComponent(out HandsComponent handsComponent) || + + if (!eventArgs.User.TryGetComponent(out HandsComponent handsComponent) || PowerCellEntity == null) { return false; @@ -254,7 +255,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels { return false; } - + var powerCell = RemovePowerCell(); handsComponent.PutInHand(itemComponent); powerCell.Transform.GridPosition = eventArgs.User.Transform.GridPosition; diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerMagazineBarrelComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerMagazineBarrelComponent.cs index f10aab172d..21731fdfb9 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerMagazineBarrelComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerMagazineBarrelComponent.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Weapons.Ranged; using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels; diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerRangedBarrelComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerRangedBarrelComponent.cs index d074bb2ee9..dcf5af0083 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerRangedBarrelComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerRangedBarrelComponent.cs @@ -5,6 +5,7 @@ using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Projectiles; using Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.Audio; using Content.Shared.GameObjects.Components.Weapons.Ranged; using Robust.Server.GameObjects.EntitySystems; diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/ServerRangedWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/ServerRangedWeaponComponent.cs index c6cb930c1a..6ac04ed143 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/ServerRangedWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/ServerRangedWeaponComponent.cs @@ -2,6 +2,7 @@ using System; using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.GameObjects.Components.Weapons.Ranged; using Content.Shared.GameObjects.EntitySystems; using Robust.Shared.GameObjects; diff --git a/Content.Server/GameObjects/Components/WiresComponent.cs b/Content.Server/GameObjects/Components/WiresComponent.cs index 60d0dd0dc0..c1d91359a5 100644 --- a/Content.Server/GameObjects/Components/WiresComponent.cs +++ b/Content.Server/GameObjects/Components/WiresComponent.cs @@ -3,7 +3,8 @@ using System.Collections.Generic; using System.Linq; using Content.Server.GameObjects.Components.Interactable; using Content.Server.GameObjects.Components.VendingMachines; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.EntitySystems.Click; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces; using Content.Server.Interfaces.GameObjects; using Content.Shared.GameObjects.Components; diff --git a/Content.Server/GameObjects/EntitySystems/ActSystem.cs b/Content.Server/GameObjects/EntitySystems/ActSystem.cs index 56be8389ea..4fd95bb847 100644 --- a/Content.Server/GameObjects/EntitySystems/ActSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/ActSystem.cs @@ -5,7 +5,7 @@ using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Map; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { /// /// This interface gives components behavior on getting destoyed. diff --git a/Content.Server/GameObjects/EntitySystems/BaseChargerSystem.cs b/Content.Server/GameObjects/EntitySystems/BaseChargerSystem.cs index 6e0415b6a9..7e59153404 100644 --- a/Content.Server/GameObjects/EntitySystems/BaseChargerSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/BaseChargerSystem.cs @@ -3,7 +3,7 @@ using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { [UsedImplicitly] internal class BaseChargerSystem : EntitySystem diff --git a/Content.Server/GameObjects/EntitySystems/BloodstreamSystem.cs b/Content.Server/GameObjects/EntitySystems/BloodstreamSystem.cs index 7806e09b25..69b432084b 100644 --- a/Content.Server/GameObjects/EntitySystems/BloodstreamSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/BloodstreamSystem.cs @@ -3,7 +3,7 @@ using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { /// /// Triggers metabolism updates for diff --git a/Content.Server/GameObjects/EntitySystems/ChemistrySystem.cs b/Content.Server/GameObjects/EntitySystems/ChemistrySystem.cs index 69bd555460..39cca2be0e 100644 --- a/Content.Server/GameObjects/EntitySystems/ChemistrySystem.cs +++ b/Content.Server/GameObjects/EntitySystems/ChemistrySystem.cs @@ -4,7 +4,7 @@ using JetBrains.Annotations; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { /// /// This interface gives components behavior on whether entities solution (implying SolutionComponent is in place) is changed diff --git a/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs index fa7fdbaf4b..1babbc6ee6 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs @@ -9,7 +9,7 @@ using Robust.Shared.IoC; using Robust.Shared.Maths; using Robust.Shared.Utility; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.GameObjects.EntitySystems.Click { public interface IExamine { @@ -62,7 +62,7 @@ namespace Content.Server.GameObjects.EntitySystems var inDetailsRange = Get() .InRangeUnobstructed(examiner.Transform.MapPosition, entity.Transform.MapPosition, - ExamineDetailsRange, predicate: entity0 => entity0 == examiner || entity0 == entity, insideBlockerValid: true); + ExamineDetailsRange, predicate: entity0 => entity0 == examiner || entity0 == entity, ignoreInsideBlocker: true); //Add component statuses from components that report one foreach (var examineComponent in entity.GetAllComponents()) diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index c92df5fcc5..15ec860880 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -3,8 +3,10 @@ using System.Linq; using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Timing; using Content.Server.Interfaces.GameObjects; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Utility; using Content.Shared.GameObjects.Components.Inventory; +using Content.Shared.GameObjects.EntitySystemMessages; using Content.Shared.GameObjects.EntitySystems; using Content.Shared.Input; using JetBrains.Annotations; @@ -18,294 +20,14 @@ using Robust.Shared.Input.Binding; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects.Components; using Robust.Shared.Interfaces.Map; -using Robust.Shared.Interfaces.Physics; using Robust.Shared.IoC; -using Robust.Shared.Localization; using Robust.Shared.Log; using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Players; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.GameObjects.EntitySystems.Click { - /// - /// This interface gives components behavior when being clicked on by a user with an object in their hand - /// who is in range and has unobstructed reach of the target entity (allows inside blockers). - /// - public interface IInteractUsing - { - /// - /// Called when using one object on another when user is in range of the target entity. - /// - bool InteractUsing(InteractUsingEventArgs eventArgs); - } - - public class InteractUsingEventArgs : EventArgs, ITargetedInteractEventArgs - { - public IEntity User { get; set; } - public GridCoordinates ClickLocation { get; set; } - public IEntity Using { get; set; } - public IEntity Target { get; set; } - } - - public interface ITargetedInteractEventArgs - { - /// - /// Performer of the attack - /// - IEntity User { get; } - /// - /// Target of the attack - /// - IEntity Target { get; } - - } - - /// - /// This interface gives components behavior when being clicked on by a user with an empty hand - /// who is in range and has unobstructed reach of the target entity (allows inside blockers). - /// - public interface IInteractHand - { - /// - /// Called when a player directly interacts with an empty hand when user is in range of the target entity. - /// - bool InteractHand(InteractHandEventArgs eventArgs); - } - - public class InteractHandEventArgs : EventArgs, ITargetedInteractEventArgs - { - public IEntity User { get; set; } - public IEntity Target { get; set; } - } - - /// - /// This interface gives components behavior when being clicked on by a user with an object - /// outside the range of direct use - /// - public interface IRangedInteract - { - /// - /// Called when we try to interact with an entity out of range - /// - /// - bool RangedInteract(RangedInteractEventArgs eventArgs); - } - - [PublicAPI] - public class RangedInteractEventArgs : EventArgs - { - public IEntity User { get; set; } - public IEntity Using { get; set; } - public GridCoordinates ClickLocation { get; set; } - } - - /// - /// This interface gives components a behavior when clicking on another object and no interaction occurs, - /// at any range. - /// - public interface IAfterInteract - { - /// - /// Called when we interact with nothing, or when we interact with an entity out of range that has no behavior - /// - void AfterInteract(AfterInteractEventArgs eventArgs); - } - - public class AfterInteractEventArgs : EventArgs - { - public IEntity User { get; set; } - public GridCoordinates ClickLocation { get; set; } - public IEntity Target { get; set; } - } - - /// - /// This interface gives components behavior when using the entity in your hands - /// - public interface IUse - { - /// - /// Called when we activate an object we are holding to use it - /// - /// - bool UseEntity(UseEntityEventArgs eventArgs); - } - - public class UseEntityEventArgs : EventArgs - { - public IEntity User { get; set; } - } - - /// - /// This interface gives components behavior when being activated in the world when the user - /// is in range and has unobstructed access to the target entity (allows inside blockers). - /// - public interface IActivate - { - /// - /// Called when this component is activated by another entity who is in range. - /// - void Activate(ActivateEventArgs eventArgs); - } - - public class ActivateEventArgs : EventArgs, ITargetedInteractEventArgs - { - public IEntity User { get; set; } - public IEntity Target { get; set; } - } - - /// - /// This interface gives components behavior when thrown. - /// - public interface IThrown - { - void Thrown(ThrownEventArgs eventArgs); - } - - public class ThrownEventArgs : EventArgs - { - public ThrownEventArgs(IEntity user) - { - User = user; - } - - public IEntity User { get; } - } - - /// - /// This interface gives components behavior when landing after being thrown. - /// - public interface ILand - { - void Land(LandEventArgs eventArgs); - } - - public class LandEventArgs : EventArgs - { - public LandEventArgs(IEntity user, GridCoordinates landingLocation) - { - User = user; - LandingLocation = landingLocation; - } - - public IEntity User { get; } - public GridCoordinates LandingLocation { get; } - } - - /// - /// This interface gives components behavior when their owner is put in an inventory slot. - /// - public interface IEquipped - { - void Equipped(EquippedEventArgs eventArgs); - } - - public class EquippedEventArgs : EventArgs - { - public EquippedEventArgs(IEntity user, EquipmentSlotDefines.Slots slot) - { - User = user; - Slot = slot; - } - - public IEntity User { get; } - public EquipmentSlotDefines.Slots Slot { get; } - } - - /// - /// This interface gives components behavior when their owner is removed from an inventory slot. - /// - public interface IUnequipped - { - void Unequipped(UnequippedEventArgs eventArgs); - } - - public class UnequippedEventArgs : EventArgs - { - public UnequippedEventArgs(IEntity user, EquipmentSlotDefines.Slots slot) - { - User = user; - Slot = slot; - } - - public IEntity User { get; } - public EquipmentSlotDefines.Slots Slot { get; } - } - - /// - /// This interface gives components behavior when being used to "attack". - /// - public interface IAttack - { - void Attack(AttackEventArgs eventArgs); - } - - public class AttackEventArgs : EventArgs - { - public AttackEventArgs(IEntity user, GridCoordinates clickLocation) - { - User = user; - ClickLocation = clickLocation; - } - - public IEntity User { get; } - public GridCoordinates ClickLocation { get; } - } - - /// - /// This interface gives components behavior when they're held on the selected hand. - /// - public interface IHandSelected - { - void HandSelected(HandSelectedEventArgs eventArgs); - } - - public class HandSelectedEventArgs : EventArgs - { - public HandSelectedEventArgs(IEntity user) - { - User = user; - } - - public IEntity User { get; } - } - - /// - /// This interface gives components behavior when they're held on a deselected hand. - /// - public interface IHandDeselected - { - void HandDeselected(HandDeselectedEventArgs eventArgs); - } - - public class HandDeselectedEventArgs : EventArgs - { - public HandDeselectedEventArgs(IEntity user) - { - User = user; - } - - public IEntity User { get; } - } - - /// - /// This interface gives components behavior when they're dropped by a mob. - /// - public interface IDropped - { - void Dropped(DroppedEventArgs eventArgs); - } - - public class DroppedEventArgs : EventArgs - { - public DroppedEventArgs(IEntity user) - { - User = user; - } - - public IEntity User { get; } - } - /// /// Governs interactions during clicking on entities /// @@ -318,6 +40,8 @@ namespace Content.Server.GameObjects.EntitySystems public override void Initialize() { + SubscribeNetworkEvent(HandleDragDropMessage); + CommandBinds.Builder .Bind(EngineKeyFunctions.Use, new PointerInputCmdHandler(HandleClientUseItemInHand)) @@ -334,6 +58,30 @@ namespace Content.Server.GameObjects.EntitySystems base.Shutdown(); } + private void HandleDragDropMessage(DragDropMessage msg, EntitySessionEventArgs args) + { + var performer = args.SenderSession.AttachedEntity; + if (!EntityManager.TryGetEntity(msg.Dropped, out var dropped)) return; + if (!EntityManager.TryGetEntity(msg.Target, out var target)) return; + + var interactionArgs = new DragDropEventArgs(performer, msg.DropLocation, dropped, target); + + // must be in range of both the target and the object they are drag / dropping + if (!InteractionChecks.InRangeUnobstructed(interactionArgs)) return; + + // trigger dragdrops on the dropped entity + foreach (var dragDrop in dropped.GetAllComponents()) + { + if (dragDrop.DragDrop(interactionArgs)) return; + } + + // trigger dragdropons on the targeted entity + foreach (var dragDropOn in target.GetAllComponents()) + { + if (dragDropOn.DragDropOn(interactionArgs)) return; + } + } + private bool HandleActivateItemInWorld(ICommonSession session, GridCoordinates coords, EntityUid uid) { if (!EntityManager.TryGetEntity(uid, out var used)) @@ -572,7 +320,7 @@ namespace Content.Server.GameObjects.EntitySystems /// private void InteractAfter(IEntity user, IEntity weapon, GridCoordinates clickLocation) { - var message = new AfterAttackMessage(user, weapon, null, clickLocation); + var message = new AfterInteractMessage(user, weapon, null, clickLocation); RaiseLocalEvent(message); if (message.Handled) { @@ -594,7 +342,7 @@ namespace Content.Server.GameObjects.EntitySystems /// public void Interaction(IEntity user, IEntity weapon, IEntity attacked, GridCoordinates clickLocation) { - var attackMsg = new AttackByMessage(user, weapon, attacked, clickLocation); + var attackMsg = new InteractUsingMessage(user, weapon, attacked, clickLocation); RaiseLocalEvent(attackMsg); if (attackMsg.Handled) { @@ -620,7 +368,7 @@ namespace Content.Server.GameObjects.EntitySystems } } - var afterAtkMsg = new AfterAttackMessage(user, weapon, attacked, clickLocation); + var afterAtkMsg = new AfterInteractMessage(user, weapon, attacked, clickLocation); RaiseLocalEvent(afterAtkMsg); if (afterAtkMsg.Handled) { @@ -906,7 +654,7 @@ namespace Content.Server.GameObjects.EntitySystems /// public void RangedInteraction(IEntity user, IEntity weapon, IEntity attacked, GridCoordinates clickLocation) { - var rangedMsg = new RangedAttackMessage(user, weapon, attacked, clickLocation); + var rangedMsg = new RangedInteractMessage(user, weapon, attacked, clickLocation); RaiseLocalEvent(rangedMsg); if (rangedMsg.Handled) return; @@ -927,7 +675,7 @@ namespace Content.Server.GameObjects.EntitySystems } } - var afterAtkMsg = new AfterAttackMessage(user, weapon, attacked, clickLocation); + var afterAtkMsg = new AfterInteractMessage(user, weapon, attacked, clickLocation); RaiseLocalEvent(afterAtkMsg); if (afterAtkMsg.Handled) return; @@ -988,422 +736,4 @@ namespace Content.Server.GameObjects.EntitySystems } } } - - /// - /// Raised when being clicked on or "attacked" by a user with an object in their hand - /// - [PublicAPI] - public class AttackByMessage : EntitySystemMessage - { - /// - /// If this message has already been "handled" by a previous system. - /// - public bool Handled { get; set; } - - /// - /// Entity that triggered the attack. - /// - public IEntity User { get; } - - /// - /// Entity that the User attacked with. - /// - public IEntity ItemInHand { get; } - - /// - /// Entity that was attacked. - /// - public IEntity Attacked { get; } - - /// - /// The original location that was clicked by the user. - /// - public GridCoordinates ClickLocation { get; } - - public AttackByMessage(IEntity user, IEntity itemInHand, IEntity attacked, GridCoordinates clickLocation) - { - User = user; - ItemInHand = itemInHand; - Attacked = attacked; - ClickLocation = clickLocation; - } - } - - /// - /// Raised when being clicked on or "attacked" by a user with an empty hand. - /// - [PublicAPI] - public class AttackHandMessage : EntitySystemMessage - { - /// - /// If this message has already been "handled" by a previous system. - /// - public bool Handled { get; set; } - - /// - /// Entity that triggered the attack. - /// - public IEntity User { get; } - - /// - /// Entity that was attacked. - /// - public IEntity Attacked { get; } - - public AttackHandMessage(IEntity user, IEntity attacked) - { - User = user; - Attacked = attacked; - } - } - - /// - /// Raised when being clicked by objects outside the range of direct use. - /// - [PublicAPI] - public class RangedAttackMessage : EntitySystemMessage - { - /// - /// If this message has already been "handled" by a previous system. - /// - public bool Handled { get; set; } - - /// - /// Entity that triggered the attack. - /// - public IEntity User { get; } - - /// - /// Entity that the User attacked with. - /// - public IEntity ItemInHand { get; set; } - - /// - /// Entity that was attacked. - /// - public IEntity Attacked { get; } - - /// - /// Location that the user clicked outside of their interaction range. - /// - public GridCoordinates ClickLocation { get; } - - public RangedAttackMessage(IEntity user, IEntity itemInHand, IEntity attacked, GridCoordinates clickLocation) - { - User = user; - ItemInHand = itemInHand; - ClickLocation = clickLocation; - Attacked = attacked; - } - } - - /// - /// Raised when clicking on another object and no attack event was handled. - /// - [PublicAPI] - public class AfterAttackMessage : EntitySystemMessage - { - /// - /// If this message has already been "handled" by a previous system. - /// - public bool Handled { get; set; } - - /// - /// Entity that triggered the attack. - /// - public IEntity User { get; } - - /// - /// Entity that the User attacked with. - /// - public IEntity ItemInHand { get; set; } - - /// - /// Entity that was attacked. This can be null if the attack did not click on an entity. - /// - public IEntity Attacked { get; } - - /// - /// Location that the user clicked outside of their interaction range. - /// - public GridCoordinates ClickLocation { get; } - - public AfterAttackMessage(IEntity user, IEntity itemInHand, IEntity attacked, GridCoordinates clickLocation) - { - User = user; - Attacked = attacked; - ClickLocation = clickLocation; - ItemInHand = itemInHand; - } - } - - /// - /// Raised when using the entity in your hands. - /// - [PublicAPI] - public class UseInHandMessage : EntitySystemMessage - { - /// - /// If this message has already been "handled" by a previous system. - /// - public bool Handled { get; set; } - - /// - /// Entity holding the item in their hand. - /// - public IEntity User { get; } - - /// - /// Item that was used. - /// - public IEntity Used { get; } - - public UseInHandMessage(IEntity user, IEntity used) - { - User = user; - Used = used; - } - } - - /// - /// Raised when throwing the entity in your hands. - /// - [PublicAPI] - public class ThrownMessage : EntitySystemMessage - { - /// - /// If this message has already been "handled" by a previous system. - /// - public bool Handled { get; set; } - - /// - /// Entity that threw the item. - /// - public IEntity User { get; } - - /// - /// Item that was thrown. - /// - public IEntity Thrown { get; } - - public ThrownMessage(IEntity user, IEntity thrown) - { - User = user; - Thrown = thrown; - } - } - - /// - /// Raised when an entity that was thrown lands. - /// - [PublicAPI] - public class LandMessage : EntitySystemMessage - { - /// - /// If this message has already been "handled" by a previous system. - /// - public bool Handled { get; set; } - - /// - /// Entity that threw the item. - /// - public IEntity User { get; } - - /// - /// Item that was thrown. - /// - public IEntity Thrown { get; } - - /// - /// Location where the item landed. - /// - public GridCoordinates LandLocation { get; } - - public LandMessage(IEntity user, IEntity thrown, GridCoordinates landLocation) - { - User = user; - Thrown = thrown; - LandLocation = landLocation; - } - } - - /// - /// Raised when equipping the entity in an inventory slot. - /// - [PublicAPI] - public class EquippedMessage : EntitySystemMessage - { - /// - /// If this message has already been "handled" by a previous system. - /// - public bool Handled { get; set; } - - /// - /// Entity that equipped the item. - /// - public IEntity User { get; } - - /// - /// Item that was equipped. - /// - public IEntity Equipped { get; } - - /// - /// Slot where the item was placed. - /// - public EquipmentSlotDefines.Slots Slot { get; } - - public EquippedMessage(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot) - { - User = user; - Equipped = equipped; - Slot = slot; - } - } - - /// - /// Raised when removing the entity from an inventory slot. - /// - [PublicAPI] - public class UnequippedMessage : EntitySystemMessage - { - /// - /// If this message has already been "handled" by a previous system. - /// - public bool Handled { get; set; } - - /// - /// Entity that equipped the item. - /// - public IEntity User { get; } - - /// - /// Item that was equipped. - /// - public IEntity Equipped { get; } - - /// - /// Slot where the item was removed from. - /// - public EquipmentSlotDefines.Slots Slot { get; } - - public UnequippedMessage(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot) - { - User = user; - Equipped = equipped; - Slot = slot; - } - } - - /// - /// Raised when an entity that was thrown lands. - /// - [PublicAPI] - public class DroppedMessage : EntitySystemMessage - { - /// - /// If this message has already been "handled" by a previous system. - /// - public bool Handled { get; set; } - - /// - /// Entity that dropped the item. - /// - public IEntity User { get; } - - /// - /// Item that was dropped. - /// - public IEntity Dropped { get; } - - public DroppedMessage(IEntity user, IEntity dropped) - { - User = user; - Dropped = dropped; - } - } - - /// - /// Raised when an entity item in a hand is selected. - /// - [PublicAPI] - public class HandSelectedMessage : EntitySystemMessage - { - /// - /// If this message has already been "handled" by a previous system. - /// - public bool Handled { get; set; } - - /// - /// Entity that owns the selected hand. - /// - public IEntity User { get; } - - /// - /// The item in question. - /// - public IEntity Item { get; } - - public HandSelectedMessage(IEntity user, IEntity item) - { - User = user; - Item = item; - } - } - - /// - /// Raised when an entity item in a hand is deselected. - /// - [PublicAPI] - public class HandDeselectedMessage : EntitySystemMessage - { - /// - /// If this message has already been "handled" by a previous system. - /// - public bool Handled { get; set; } - - /// - /// Entity that owns the deselected hand. - /// - public IEntity User { get; } - - /// - /// The item in question. - /// - public IEntity Item { get; } - - public HandDeselectedMessage(IEntity user, IEntity item) - { - User = user; - Item = item; - } - } - - /// - /// Raised when an entity is activated in the world. - /// - [PublicAPI] - public class ActivateInWorldMessage : EntitySystemMessage - { - /// - /// If this message has already been "handled" by a previous system. - /// - public bool Handled { get; set; } - - /// - /// Entity that activated the world entity. - /// - public IEntity User { get; } - - /// - /// Entity that was activated in the world. - /// - public IEntity Activated { get; } - - public ActivateInWorldMessage(IEntity user, IEntity activated) - { - User = user; - Activated = activated; - } - } } diff --git a/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs b/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs index 926dbc15a2..f8fd65915e 100644 --- a/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs @@ -11,7 +11,7 @@ using Robust.Shared.Log; using Robust.Shared.Players; using Robust.Shared.Random; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { [UsedImplicitly] public sealed class CombatModeSystem : SharedCombatModeSystem diff --git a/Content.Server/GameObjects/EntitySystems/ConstructionSystem.cs b/Content.Server/GameObjects/EntitySystems/ConstructionSystem.cs index 7e656d7cd1..b3c390909a 100644 --- a/Content.Server/GameObjects/EntitySystems/ConstructionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/ConstructionSystem.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using Content.Server.GameObjects.Components.Construction; using Content.Server.GameObjects.Components.Interactable; using Content.Server.GameObjects.Components.Stack; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces; using Content.Server.Utility; using Content.Shared.Construction; @@ -52,7 +53,7 @@ namespace Content.Server.GameObjects.EntitySystems SubscribeNetworkEvent(HandleStartStructureConstruction); SubscribeNetworkEvent(HandleStartItemConstruction); - SubscribeLocalEvent(HandleToolInteraction); + SubscribeLocalEvent(HandleToolInteraction); } private void HandleStartStructureConstruction(TryStartStructureConstructionMessage msg, EntitySessionEventArgs args) @@ -71,7 +72,7 @@ namespace Content.Server.GameObjects.EntitySystems TryStartItemConstruction(placingEnt, msg.PrototypeName); } - private void HandleToolInteraction(AfterAttackMessage msg) + private void HandleToolInteraction(AfterInteractMessage msg) { if(msg.Handled) return; @@ -238,7 +239,7 @@ namespace Content.Server.GameObjects.EntitySystems var prototype = _prototypeManager.Index(prototypeName); if (!InteractionChecks.InRangeUnobstructed(placingEnt, loc.ToMap(_mapManager), - ignoredEnt: placingEnt, insideBlockerValid: prototype.CanBuildInImpassable)) + ignoredEnt: placingEnt, ignoreInsideBlocker: prototype.CanBuildInImpassable)) { return false; } @@ -436,7 +437,7 @@ namespace Content.Server.GameObjects.EntitySystems { return false; } - + var sound = EntitySystemManager.GetEntitySystem(); switch (step) diff --git a/Content.Server/GameObjects/EntitySystems/DoorSystem.cs b/Content.Server/GameObjects/EntitySystems/DoorSystem.cs index 4455f8b3a7..fbe47ad5cc 100644 --- a/Content.Server/GameObjects/EntitySystems/DoorSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/DoorSystem.cs @@ -1,7 +1,8 @@ -using Robust.Shared.GameObjects; +using Content.Server.GameObjects; +using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { class DoorSystem : EntitySystem { diff --git a/Content.Server/GameObjects/EntitySystems/GravitySystem.cs b/Content.Server/GameObjects/EntitySystems/GravitySystem.cs index d257bcec53..27eb28a6c5 100644 --- a/Content.Server/GameObjects/EntitySystems/GravitySystem.cs +++ b/Content.Server/GameObjects/EntitySystems/GravitySystem.cs @@ -16,7 +16,7 @@ using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Random; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { [UsedImplicitly] public class GravitySystem: EntitySystem diff --git a/Content.Server/GameObjects/EntitySystems/HandHeldLightSystem.cs b/Content.Server/GameObjects/EntitySystems/HandHeldLightSystem.cs index a6df7eaae8..8dd40458c3 100644 --- a/Content.Server/GameObjects/EntitySystems/HandHeldLightSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/HandHeldLightSystem.cs @@ -2,7 +2,7 @@ using Content.Server.GameObjects.Components.Interactable; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { public class HandHeldLightSystem : EntitySystem { diff --git a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs index a78c90043a..7cb3f9481c 100644 --- a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs @@ -19,8 +19,10 @@ using Robust.Shared.Map; using Robust.Shared.Players; using System; using Content.Shared.GameObjects.EntitySystems; +using Content.Server.GameObjects; +using Content.Server.GameObjects.EntitySystems.Click; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { [UsedImplicitly] internal sealed class HandsSystem : EntitySystem diff --git a/Content.Server/GameObjects/EntitySystems/HungerSystem.cs b/Content.Server/GameObjects/EntitySystems/HungerSystem.cs index 671bc7f051..08d2c9bf98 100644 --- a/Content.Server/GameObjects/EntitySystems/HungerSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/HungerSystem.cs @@ -3,7 +3,7 @@ using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { [UsedImplicitly] public class HungerSystem : EntitySystem diff --git a/Content.Server/GameObjects/EntitySystems/InstrumentSystem.cs b/Content.Server/GameObjects/EntitySystems/InstrumentSystem.cs index a64f1fec01..61e0b598a4 100644 --- a/Content.Server/GameObjects/EntitySystems/InstrumentSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/InstrumentSystem.cs @@ -2,7 +2,7 @@ using Content.Server.GameObjects.Components.Instruments; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { public class InstrumentSystem : EntitySystem { diff --git a/Content.Server/GameObjects/EntitySystems/LatheSystem.cs b/Content.Server/GameObjects/EntitySystems/LatheSystem.cs index b85a251a4a..7c39ae0cc3 100644 --- a/Content.Server/GameObjects/EntitySystems/LatheSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/LatheSystem.cs @@ -2,7 +2,7 @@ using Content.Server.GameObjects.Components.Research; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { public class LatheSystem : EntitySystem { diff --git a/Content.Server/GameObjects/EntitySystems/MedicalScannerSystem.cs b/Content.Server/GameObjects/EntitySystems/MedicalScannerSystem.cs index 54c90381c0..8dc8379b0d 100644 --- a/Content.Server/GameObjects/EntitySystems/MedicalScannerSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/MedicalScannerSystem.cs @@ -2,7 +2,7 @@ using Content.Server.GameObjects.Components.Medical; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { public class MedicalScannerSystem : EntitySystem { diff --git a/Content.Server/GameObjects/EntitySystems/MeleeWeaponSystem.cs b/Content.Server/GameObjects/EntitySystems/MeleeWeaponSystem.cs index 82ba72537a..9dfd278add 100644 --- a/Content.Server/GameObjects/EntitySystems/MeleeWeaponSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/MeleeWeaponSystem.cs @@ -5,7 +5,7 @@ using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Maths; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { public sealed class MeleeWeaponSystem : EntitySystem { diff --git a/Content.Server/GameObjects/EntitySystems/MicrowaveSystem.cs b/Content.Server/GameObjects/EntitySystems/MicrowaveSystem.cs index 0e5c1f782d..8bb7d80bdd 100644 --- a/Content.Server/GameObjects/EntitySystems/MicrowaveSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/MicrowaveSystem.cs @@ -2,7 +2,7 @@ using Content.Server.GameObjects.Components.Kitchen; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { public class MicrowaveSystem : EntitySystem { diff --git a/Content.Server/GameObjects/EntitySystems/MoverSystem.cs b/Content.Server/GameObjects/EntitySystems/MoverSystem.cs index f33243f5be..626e86a18e 100644 --- a/Content.Server/GameObjects/EntitySystems/MoverSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/MoverSystem.cs @@ -1,4 +1,5 @@ -using Content.Server.GameObjects.Components; +using Content.Server.GameObjects; +using Content.Server.GameObjects.Components; using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Movement; using Content.Server.GameObjects.Components.Sound; diff --git a/Content.Server/GameObjects/EntitySystems/PortalSystem.cs b/Content.Server/GameObjects/EntitySystems/PortalSystem.cs index 77eaf9bdcd..7ffc532422 100644 --- a/Content.Server/GameObjects/EntitySystems/PortalSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/PortalSystem.cs @@ -3,7 +3,7 @@ using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { [UsedImplicitly] public class PortalSystem : EntitySystem diff --git a/Content.Server/GameObjects/EntitySystems/PowerApcSystem.cs b/Content.Server/GameObjects/EntitySystems/PowerApcSystem.cs index 00e0ed20f1..cbaaaa981e 100644 --- a/Content.Server/GameObjects/EntitySystems/PowerApcSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/PowerApcSystem.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using Robust.Shared.IoC; using Robust.Server.Interfaces.Timing; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { public sealed class ApcSystem : EntitySystem { diff --git a/Content.Server/GameObjects/EntitySystems/PowerSmesSystem.cs b/Content.Server/GameObjects/EntitySystems/PowerSmesSystem.cs index db0068fec6..84f87f76b7 100644 --- a/Content.Server/GameObjects/EntitySystems/PowerSmesSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/PowerSmesSystem.cs @@ -2,7 +2,7 @@ using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { internal class PowerSmesSystem : EntitySystem { diff --git a/Content.Server/GameObjects/EntitySystems/PowerSolarSystem.cs b/Content.Server/GameObjects/EntitySystems/PowerSolarSystem.cs index fc01bada12..604e475d9c 100644 --- a/Content.Server/GameObjects/EntitySystems/PowerSolarSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/PowerSolarSystem.cs @@ -16,7 +16,7 @@ using CannyFastMath; using Math = CannyFastMath.Math; using MathF = CannyFastMath.MathF; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { /// /// Responsible for maintaining the solar-panel sun angle and updating coverage. diff --git a/Content.Server/GameObjects/EntitySystems/ProjectileSystem.cs b/Content.Server/GameObjects/EntitySystems/ProjectileSystem.cs index a1e4713aa5..6dd87f8b24 100644 --- a/Content.Server/GameObjects/EntitySystems/ProjectileSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/ProjectileSystem.cs @@ -3,7 +3,7 @@ using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { [UsedImplicitly] internal sealed class ProjectileSystem : EntitySystem diff --git a/Content.Server/GameObjects/EntitySystems/PuddleSystem.cs b/Content.Server/GameObjects/EntitySystems/PuddleSystem.cs index 4cb51c3f6e..77133b8462 100644 --- a/Content.Server/GameObjects/EntitySystems/PuddleSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/PuddleSystem.cs @@ -6,7 +6,7 @@ using Robust.Shared.Interfaces.Map; using Robust.Shared.IoC; using Robust.Shared.Map; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { public class PuddleSystem : EntitySystem { diff --git a/Content.Server/GameObjects/EntitySystems/ResearchSystem.cs b/Content.Server/GameObjects/EntitySystems/ResearchSystem.cs index 6e4734139b..e67bd34895 100644 --- a/Content.Server/GameObjects/EntitySystems/ResearchSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/ResearchSystem.cs @@ -4,7 +4,7 @@ using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { public class ResearchSystem : EntitySystem { diff --git a/Content.Server/GameObjects/EntitySystems/RoundEndSystem.cs b/Content.Server/GameObjects/EntitySystems/RoundEndSystem.cs index 9077e94184..485ccb6b6f 100644 --- a/Content.Server/GameObjects/EntitySystems/RoundEndSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/RoundEndSystem.cs @@ -6,7 +6,7 @@ using Robust.Shared.Interfaces.Timing; using Robust.Shared.IoC; using Timer = Robust.Shared.Timers.Timer; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { public class RoundEndSystem : EntitySystem { diff --git a/Content.Server/GameObjects/EntitySystems/StomachSystem.cs b/Content.Server/GameObjects/EntitySystems/StomachSystem.cs index 9e7e12aac7..bbdc796c98 100644 --- a/Content.Server/GameObjects/EntitySystems/StomachSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/StomachSystem.cs @@ -3,7 +3,7 @@ using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { /// /// Triggers digestion updates on diff --git a/Content.Server/GameObjects/EntitySystems/StorageSystem.cs b/Content.Server/GameObjects/EntitySystems/StorageSystem.cs index 9a57e99fe9..867c7dc50c 100644 --- a/Content.Server/GameObjects/EntitySystems/StorageSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/StorageSystem.cs @@ -1,11 +1,13 @@ using System.Collections.Generic; +using Content.Server.GameObjects; +using Content.Server.GameObjects.EntitySystems.Click; using Robust.Server.GameObjects.EntitySystemMessages; using Robust.Server.Interfaces.Player; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { class StorageSystem : EntitySystem { diff --git a/Content.Server/GameObjects/EntitySystems/StunSystem.cs b/Content.Server/GameObjects/EntitySystems/StunSystem.cs index fea2a19502..ad5db08de4 100644 --- a/Content.Server/GameObjects/EntitySystems/StunSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/StunSystem.cs @@ -4,7 +4,7 @@ using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { public class StunSystem : EntitySystem { diff --git a/Content.Server/GameObjects/EntitySystems/TemperatureSystem.cs b/Content.Server/GameObjects/EntitySystems/TemperatureSystem.cs index 76ddd151e3..a60c561bdf 100644 --- a/Content.Server/GameObjects/EntitySystems/TemperatureSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/TemperatureSystem.cs @@ -1,7 +1,8 @@ -using Robust.Shared.GameObjects; +using Content.Server.GameObjects; +using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { class TemperatureSystem : EntitySystem { diff --git a/Content.Server/GameObjects/EntitySystems/ThirstSystem.cs b/Content.Server/GameObjects/EntitySystems/ThirstSystem.cs index 1312b4e8ac..fa2b860f70 100644 --- a/Content.Server/GameObjects/EntitySystems/ThirstSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/ThirstSystem.cs @@ -3,7 +3,7 @@ using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { [UsedImplicitly] public class ThirstSystem : EntitySystem diff --git a/Content.Server/GameObjects/EntitySystems/TriggerSystem.cs b/Content.Server/GameObjects/EntitySystems/TriggerSystem.cs index 79b306c7d1..5a8bba0802 100644 --- a/Content.Server/GameObjects/EntitySystems/TriggerSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/TriggerSystem.cs @@ -5,7 +5,7 @@ using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Timers; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { /// /// This interface gives components behavior when being "triggered" by timer or other conditions @@ -50,4 +50,4 @@ namespace Content.Server.GameObjects.EntitySystems }); } } -} \ No newline at end of file +} diff --git a/Content.Server/GameObjects/EntitySystems/VerbSystem.cs b/Content.Server/GameObjects/EntitySystems/VerbSystem.cs index 3a19749cc8..047a16c7c6 100644 --- a/Content.Server/GameObjects/EntitySystems/VerbSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/VerbSystem.cs @@ -8,7 +8,7 @@ using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.IoC; using static Content.Shared.GameObjects.EntitySystemMessages.VerbSystemMessages; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { public class VerbSystem : EntitySystem { diff --git a/Content.Server/GameObjects/EntitySystems/WelderSystem.cs b/Content.Server/GameObjects/EntitySystems/WelderSystem.cs index 411e3546fc..e35cb6144a 100644 --- a/Content.Server/GameObjects/EntitySystems/WelderSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/WelderSystem.cs @@ -3,7 +3,7 @@ using System.Linq; using Content.Server.GameObjects.Components.Interactable; using Robust.Shared.GameObjects.Systems; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { /// /// Despite the name, it's only really used for the welder logic in tools. Go figure. diff --git a/Content.Server/GameObjects/EntitySystems/WireHackingSystem.cs b/Content.Server/GameObjects/EntitySystems/WireHackingSystem.cs index f13ae1c0a4..a8da8aff92 100644 --- a/Content.Server/GameObjects/EntitySystems/WireHackingSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/WireHackingSystem.cs @@ -3,7 +3,7 @@ using Robust.Shared.GameObjects.Systems; using Robust.Shared.ViewVariables; using static Content.Shared.GameObjects.Components.SharedWiresComponent; -namespace Content.Server.GameObjects.EntitySystems +namespace Content.Server.Interfaces.GameObjects.Components.Interaction { public class WireHackingSystem : EntitySystem { diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index 759914db40..8dca1a22a1 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -9,6 +9,7 @@ using Content.Server.GameObjects.Components.Markers; using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Observer; using Content.Server.GameObjects.Components.PDA; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.GameObjects.EntitySystems; using Content.Server.GameObjects.EntitySystems.AI.Pathfinding; using Content.Server.GameTicking.GamePresets; diff --git a/Content.Server/Health/BodySystem/BodyManagerComponent.cs b/Content.Server/Health/BodySystem/BodyManagerComponent.cs index 0c491f02e4..c7e299b1f8 100644 --- a/Content.Server/Health/BodySystem/BodyManagerComponent.cs +++ b/Content.Server/Health/BodySystem/BodyManagerComponent.cs @@ -9,7 +9,7 @@ using Robust.Shared.ViewVariables; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Map; using System.Linq; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; namespace Content.Server.BodySystem { diff --git a/Content.Server/Health/BodySystem/BodyPart/DroppedBodyPartComponent.cs b/Content.Server/Health/BodySystem/BodyPart/DroppedBodyPartComponent.cs index cb83dfea3f..ffad52bc07 100644 --- a/Content.Server/Health/BodySystem/BodyPart/DroppedBodyPartComponent.cs +++ b/Content.Server/Health/BodySystem/BodyPart/DroppedBodyPartComponent.cs @@ -15,6 +15,7 @@ using Robust.Server.Interfaces.Player; using Content.Shared.Interfaces; using Robust.Shared.Interfaces.Random; using System.Linq; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Robust.Shared.Localization; namespace Content.Server.BodySystem @@ -22,7 +23,7 @@ namespace Content.Server.BodySystem /// /// Component representing a dropped, tangible entity. - /// + /// [RegisterComponent] public class DroppedBodyPartComponent : Component, IAfterInteract, IBodyPartContainer { diff --git a/Content.Server/Health/BodySystem/BodyScanner/BodyScannerComponent.cs b/Content.Server/Health/BodySystem/BodyScanner/BodyScannerComponent.cs index f28f683e9b..4fe2a5f309 100644 --- a/Content.Server/Health/BodySystem/BodyScanner/BodyScannerComponent.cs +++ b/Content.Server/Health/BodySystem/BodyScanner/BodyScannerComponent.cs @@ -1,4 +1,4 @@ -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Robust.Server.GameObjects.Components.UserInterface; using Robust.Server.Interfaces.GameObjects; using Robust.Shared.GameObjects; diff --git a/Content.Server/Health/BodySystem/Mechanism/DroppedMechanismComponent.cs b/Content.Server/Health/BodySystem/Mechanism/DroppedMechanismComponent.cs index cf93a592a0..32c788d233 100644 --- a/Content.Server/Health/BodySystem/Mechanism/DroppedMechanismComponent.cs +++ b/Content.Server/Health/BodySystem/Mechanism/DroppedMechanismComponent.cs @@ -16,13 +16,14 @@ using Robust.Server.Interfaces.Player; using Robust.Shared.Interfaces.Random; using Robust.Shared.Interfaces.GameObjects; using System.Diagnostics; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Robust.Shared.Localization; namespace Content.Server.BodySystem { /// /// Component representing a dropped, tangible entity. - /// + /// [RegisterComponent] public class DroppedMechanismComponent : Component, IAfterInteract { @@ -130,7 +131,7 @@ namespace Content.Server.BodySystem { } /// - /// Called after the client chooses from a list of possible BodyParts that can be operated on. + /// Called after the client chooses from a list of possible BodyParts that can be operated on. /// private void HandleReceiveBodyPart(int key) { diff --git a/Content.Server/Health/BodySystem/Surgery/Surgeon/SurgeryToolComponent.cs b/Content.Server/Health/BodySystem/Surgery/Surgeon/SurgeryToolComponent.cs index 457a9fb55c..d908a053fe 100644 --- a/Content.Server/Health/BodySystem/Surgery/Surgeon/SurgeryToolComponent.cs +++ b/Content.Server/Health/BodySystem/Surgery/Surgeon/SurgeryToolComponent.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.BodySystem; using Content.Shared.GameObjects; using Content.Shared.Interfaces; @@ -65,7 +66,7 @@ namespace Content.Server.BodySystem { var toSend = new Dictionary(); //Create dictionary to send to client (text to be shown : data sent back if selected) foreach (var(key, value) in bodyManager.PartDictionary) { //For each limb in the target, add it to our cache if it is a valid option. - if (value.SurgeryCheck(_surgeryType)) + if (value.SurgeryCheck(_surgeryType)) { _optionsCache.Add(_idHash, value); toSend.Add(key + ": " + value.Name, _idHash++); @@ -171,7 +172,7 @@ namespace Content.Server.BodySystem } /// - /// Called after the client chooses from a list of possible BodyParts that can be operated on. + /// Called after the client chooses from a list of possible BodyParts that can be operated on. /// private void HandleReceiveBodyPart(int key) { diff --git a/Content.Server/Interfaces/GameObjects/Components/Interaction/IActivate.cs b/Content.Server/Interfaces/GameObjects/Components/Interaction/IActivate.cs new file mode 100644 index 0000000000..13e8c171ab --- /dev/null +++ b/Content.Server/Interfaces/GameObjects/Components/Interaction/IActivate.cs @@ -0,0 +1,53 @@ +using System; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.GameObjects; + +namespace Content.Server.Interfaces.GameObjects.Components.Interaction +{ + /// + /// This interface gives components behavior when being activated in the world when the user + /// is in range and has unobstructed access to the target entity (allows inside blockers). + /// + public interface IActivate + { + /// + /// Called when this component is activated by another entity who is in range. + /// + void Activate(ActivateEventArgs eventArgs); + } + + public class ActivateEventArgs : EventArgs, ITargetedInteractEventArgs + { + public IEntity User { get; set; } + public IEntity Target { get; set; } + } + + /// + /// Raised when an entity is activated in the world. + /// + [PublicAPI] + public class ActivateInWorldMessage : EntitySystemMessage + { + /// + /// If this message has already been "handled" by a previous system. + /// + public bool Handled { get; set; } + + /// + /// Entity that activated the world entity. + /// + public IEntity User { get; } + + /// + /// Entity that was activated in the world. + /// + public IEntity Activated { get; } + + public ActivateInWorldMessage(IEntity user, IEntity activated) + { + User = user; + Activated = activated; + } + } +} diff --git a/Content.Server/Interfaces/GameObjects/Components/Interaction/IAfterInteract.cs b/Content.Server/Interfaces/GameObjects/Components/Interaction/IAfterInteract.cs new file mode 100644 index 0000000000..ed0a167850 --- /dev/null +++ b/Content.Server/Interfaces/GameObjects/Components/Interaction/IAfterInteract.cs @@ -0,0 +1,68 @@ +using System; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.GameObjects; +using Robust.Shared.Map; + +namespace Content.Server.Interfaces.GameObjects.Components.Interaction +{ + /// + /// This interface gives components a behavior when clicking on another object and no interaction occurs, + /// at any range. + /// + public interface IAfterInteract + { + /// + /// Called when we interact with nothing, or when we interact with an entity out of range that has no behavior + /// + void AfterInteract(AfterInteractEventArgs eventArgs); + } + + public class AfterInteractEventArgs : EventArgs + { + public IEntity User { get; set; } + public GridCoordinates ClickLocation { get; set; } + public IEntity Target { get; set; } + } + + /// + /// Raised when clicking on another object and no attack event was handled. + /// + [PublicAPI] + public class AfterInteractMessage : EntitySystemMessage + { + /// + /// If this message has already been "handled" by a previous system. + /// + public bool Handled { get; set; } + + /// + /// Entity that triggered the attack. + /// + public IEntity User { get; } + + /// + /// Entity that the User attacked with. + /// + public IEntity ItemInHand { get; set; } + + /// + /// Entity that was attacked. This can be null if the attack did not click on an entity. + /// + public IEntity Attacked { get; } + + /// + /// Location that the user clicked outside of their interaction range. + /// + public GridCoordinates ClickLocation { get; } + + public AfterInteractMessage(IEntity user, IEntity itemInHand, IEntity attacked, GridCoordinates clickLocation) + { + User = user; + Attacked = attacked; + ClickLocation = clickLocation; + ItemInHand = itemInHand; + } + } + +} diff --git a/Content.Server/Interfaces/GameObjects/Components/Interaction/IAttack.cs b/Content.Server/Interfaces/GameObjects/Components/Interaction/IAttack.cs new file mode 100644 index 0000000000..1df2790bcb --- /dev/null +++ b/Content.Server/Interfaces/GameObjects/Components/Interaction/IAttack.cs @@ -0,0 +1,26 @@ +using System; +using Robust.Shared.Interfaces.GameObjects; +using Robust.Shared.Map; + +namespace Content.Server.Interfaces.GameObjects.Components.Interaction +{ + /// + /// This interface gives components behavior when being used to "attack". + /// + public interface IAttack + { + void Attack(AttackEventArgs eventArgs); + } + + public class AttackEventArgs : EventArgs + { + public AttackEventArgs(IEntity user, GridCoordinates clickLocation) + { + User = user; + ClickLocation = clickLocation; + } + + public IEntity User { get; } + public GridCoordinates ClickLocation { get; } + } +} diff --git a/Content.Server/Interfaces/GameObjects/Components/Interaction/IDragDrop.cs b/Content.Server/Interfaces/GameObjects/Components/Interaction/IDragDrop.cs new file mode 100644 index 0000000000..b9d47eef12 --- /dev/null +++ b/Content.Server/Interfaces/GameObjects/Components/Interaction/IDragDrop.cs @@ -0,0 +1,40 @@ +using System; +using Content.Server.Interfaces.GameObjects.Components.Interaction; +using Robust.Shared.Interfaces.GameObjects; +using Robust.Shared.Map; + +namespace Content.Server.Interfaces.GameObjects.Components.Interaction +{ + /// + /// This interface allows the component's entity to be dragged and dropped by mouse onto another entity and gives it + /// behavior when that occurs. + /// + public interface IDragDrop + { + /// + /// Invoked server-side when this component's entity is being dragged and dropped on another. + /// + /// There is no other server-side drag and drop check other than a range check, so make sure to validate + /// if this object can be dropped on the target object! + /// + /// true iff an interaction occurred and no further interaction should + /// be processed for this drop. + bool DragDrop(DragDropEventArgs eventArgs); + } + + public class DragDropEventArgs : EventArgs + { + public DragDropEventArgs(IEntity user, GridCoordinates dropLocation, IEntity dropped, IEntity target) + { + User = user; + DropLocation = dropLocation; + Dropped = dropped; + Target = target; + } + + public IEntity User { get; } + public GridCoordinates DropLocation { get; } + public IEntity Dropped { get; } + public IEntity Target { get; } + } +} diff --git a/Content.Server/Interfaces/GameObjects/Components/Interaction/IDragDropOn.cs b/Content.Server/Interfaces/GameObjects/Components/Interaction/IDragDropOn.cs new file mode 100644 index 0000000000..00ac843dda --- /dev/null +++ b/Content.Server/Interfaces/GameObjects/Components/Interaction/IDragDropOn.cs @@ -0,0 +1,24 @@ +using System; +using Content.Server.Interfaces.GameObjects.Components.Interaction; +using Robust.Shared.Interfaces.GameObjects; +using Robust.Shared.Map; + +namespace Content.Server.Interfaces.GameObjects.Components.Interaction +{ + /// + /// This interface allows the component's entity to be dragged and dropped onto by another entity and gives it + /// behavior when that occurs. + /// + public interface IDragDropOn + { + /// + /// Invoked server-side when another entity is being dragged and dropped onto this one + /// + /// There is no other server-side drag and drop check other than a range check, so make sure to validate + /// if this object can be dropped on the dropped object! + /// + /// true iff an interaction occurred and no further interaction should + /// be processed for this drop. + bool DragDropOn(DragDropEventArgs eventArgs); + } +} diff --git a/Content.Server/Interfaces/GameObjects/Components/Interaction/IDropped.cs b/Content.Server/Interfaces/GameObjects/Components/Interaction/IDropped.cs new file mode 100644 index 0000000000..a28c31dfe8 --- /dev/null +++ b/Content.Server/Interfaces/GameObjects/Components/Interaction/IDropped.cs @@ -0,0 +1,53 @@ +using System; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.GameObjects; + +namespace Content.Server.Interfaces.GameObjects.Components.Interaction +{ + /// + /// This interface gives components behavior when they're dropped by a mob. + /// + public interface IDropped + { + void Dropped(DroppedEventArgs eventArgs); + } + + public class DroppedEventArgs : EventArgs + { + public DroppedEventArgs(IEntity user) + { + User = user; + } + + public IEntity User { get; } + } + + /// + /// Raised when an entity is dropped + /// + [PublicAPI] + public class DroppedMessage : EntitySystemMessage + { + /// + /// If this message has already been "handled" by a previous system. + /// + public bool Handled { get; set; } + + /// + /// Entity that dropped the item. + /// + public IEntity User { get; } + + /// + /// Item that was dropped. + /// + public IEntity Dropped { get; } + + public DroppedMessage(IEntity user, IEntity dropped) + { + User = user; + Dropped = dropped; + } + } +} diff --git a/Content.Server/Interfaces/GameObjects/Components/Interaction/IEquipped.cs b/Content.Server/Interfaces/GameObjects/Components/Interaction/IEquipped.cs new file mode 100644 index 0000000000..ce99fed577 --- /dev/null +++ b/Content.Server/Interfaces/GameObjects/Components/Interaction/IEquipped.cs @@ -0,0 +1,62 @@ +using System; +using Content.Shared.GameObjects.Components.Inventory; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.GameObjects; + +namespace Content.Server.Interfaces.GameObjects.Components.Interaction +{ + /// + /// This interface gives components behavior when their owner is put in an inventory slot. + /// + public interface IEquipped + { + void Equipped(EquippedEventArgs eventArgs); + } + + public class EquippedEventArgs : EventArgs + { + public EquippedEventArgs(IEntity user, EquipmentSlotDefines.Slots slot) + { + User = user; + Slot = slot; + } + + public IEntity User { get; } + public EquipmentSlotDefines.Slots Slot { get; } + } + + /// + /// Raised when equipping the entity in an inventory slot. + /// + [PublicAPI] + public class EquippedMessage : EntitySystemMessage + { + /// + /// If this message has already been "handled" by a previous system. + /// + public bool Handled { get; set; } + + /// + /// Entity that equipped the item. + /// + public IEntity User { get; } + + /// + /// Item that was equipped. + /// + public IEntity Equipped { get; } + + /// + /// Slot where the item was placed. + /// + public EquipmentSlotDefines.Slots Slot { get; } + + public EquippedMessage(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot) + { + User = user; + Equipped = equipped; + Slot = slot; + } + } +} diff --git a/Content.Server/Interfaces/GameObjects/Components/Interaction/IHandDeselected.cs b/Content.Server/Interfaces/GameObjects/Components/Interaction/IHandDeselected.cs new file mode 100644 index 0000000000..a6e481613d --- /dev/null +++ b/Content.Server/Interfaces/GameObjects/Components/Interaction/IHandDeselected.cs @@ -0,0 +1,53 @@ +using System; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.GameObjects; + +namespace Content.Server.Interfaces.GameObjects.Components.Interaction +{ + /// + /// This interface gives components behavior when they're held on a deselected hand. + /// + public interface IHandDeselected + { + void HandDeselected(HandDeselectedEventArgs eventArgs); + } + + public class HandDeselectedEventArgs : EventArgs + { + public HandDeselectedEventArgs(IEntity user) + { + User = user; + } + + public IEntity User { get; } + } + + /// + /// Raised when an entity item in a hand is deselected. + /// + [PublicAPI] + public class HandDeselectedMessage : EntitySystemMessage + { + /// + /// If this message has already been "handled" by a previous system. + /// + public bool Handled { get; set; } + + /// + /// Entity that owns the deselected hand. + /// + public IEntity User { get; } + + /// + /// The item in question. + /// + public IEntity Item { get; } + + public HandDeselectedMessage(IEntity user, IEntity item) + { + User = user; + Item = item; + } + } +} diff --git a/Content.Server/Interfaces/GameObjects/Components/Interaction/IHandSelected.cs b/Content.Server/Interfaces/GameObjects/Components/Interaction/IHandSelected.cs new file mode 100644 index 0000000000..846ee64dd0 --- /dev/null +++ b/Content.Server/Interfaces/GameObjects/Components/Interaction/IHandSelected.cs @@ -0,0 +1,53 @@ +using System; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.GameObjects; + +namespace Content.Server.Interfaces.GameObjects.Components.Interaction +{ + /// + /// This interface gives components behavior when they're held on the selected hand. + /// + public interface IHandSelected + { + void HandSelected(HandSelectedEventArgs eventArgs); + } + + public class HandSelectedEventArgs : EventArgs + { + public HandSelectedEventArgs(IEntity user) + { + User = user; + } + + public IEntity User { get; } + } + + /// + /// Raised when an entity item in a hand is selected. + /// + [PublicAPI] + public class HandSelectedMessage : EntitySystemMessage + { + /// + /// If this message has already been "handled" by a previous system. + /// + public bool Handled { get; set; } + + /// + /// Entity that owns the selected hand. + /// + public IEntity User { get; } + + /// + /// The item in question. + /// + public IEntity Item { get; } + + public HandSelectedMessage(IEntity user, IEntity item) + { + User = user; + Item = item; + } + } +} diff --git a/Content.Server/Interfaces/GameObjects/Components/Interaction/IInteractHand.cs b/Content.Server/Interfaces/GameObjects/Components/Interaction/IInteractHand.cs new file mode 100644 index 0000000000..b4820980bd --- /dev/null +++ b/Content.Server/Interfaces/GameObjects/Components/Interaction/IInteractHand.cs @@ -0,0 +1,54 @@ +using System; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.GameObjects; + +namespace Content.Server.Interfaces.GameObjects.Components.Interaction +{ + /// + /// This interface gives components behavior when being clicked on by a user with an empty hand + /// who is in range and has unobstructed reach of the target entity (allows inside blockers). + /// + public interface IInteractHand + { + /// + /// Called when a player directly interacts with an empty hand when user is in range of the target entity. + /// + bool InteractHand(InteractHandEventArgs eventArgs); + } + + public class InteractHandEventArgs : EventArgs, ITargetedInteractEventArgs + { + public IEntity User { get; set; } + public IEntity Target { get; set; } + } + + + /// + /// Raised when being clicked on or "attacked" by a user with an empty hand. + /// + [PublicAPI] + public class AttackHandMessage : EntitySystemMessage + { + /// + /// If this message has already been "handled" by a previous system. + /// + public bool Handled { get; set; } + + /// + /// Entity that triggered the attack. + /// + public IEntity User { get; } + + /// + /// Entity that was attacked. + /// + public IEntity Attacked { get; } + + public AttackHandMessage(IEntity user, IEntity attacked) + { + User = user; + Attacked = attacked; + } + } +} diff --git a/Content.Server/Interfaces/GameObjects/Components/Interaction/IInteractUsing.cs b/Content.Server/Interfaces/GameObjects/Components/Interaction/IInteractUsing.cs new file mode 100644 index 0000000000..466b984fbf --- /dev/null +++ b/Content.Server/Interfaces/GameObjects/Components/Interaction/IInteractUsing.cs @@ -0,0 +1,68 @@ +using System; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.GameObjects; +using Robust.Shared.Map; + +namespace Content.Server.Interfaces.GameObjects.Components.Interaction +{ + /// + /// This interface gives components behavior when being clicked on by a user with an object in their hand + /// who is in range and has unobstructed reach of the target entity (allows inside blockers). + /// + public interface IInteractUsing + { + /// + /// Called when using one object on another when user is in range of the target entity. + /// + bool InteractUsing(InteractUsingEventArgs eventArgs); + } + + public class InteractUsingEventArgs : EventArgs, ITargetedInteractEventArgs + { + public IEntity User { get; set; } + public GridCoordinates ClickLocation { get; set; } + public IEntity Using { get; set; } + public IEntity Target { get; set; } + } + + /// + /// Raised when being clicked on or "attacked" by a user with an object in their hand + /// + [PublicAPI] + public class InteractUsingMessage : EntitySystemMessage + { + /// + /// If this message has already been "handled" by a previous system. + /// + public bool Handled { get; set; } + + /// + /// Entity that triggered the attack. + /// + public IEntity User { get; } + + /// + /// Entity that the User attacked with. + /// + public IEntity ItemInHand { get; } + + /// + /// Entity that was attacked. + /// + public IEntity Attacked { get; } + + /// + /// The original location that was clicked by the user. + /// + public GridCoordinates ClickLocation { get; } + + public InteractUsingMessage(IEntity user, IEntity itemInHand, IEntity attacked, GridCoordinates clickLocation) + { + User = user; + ItemInHand = itemInHand; + Attacked = attacked; + ClickLocation = clickLocation; + } + } +} diff --git a/Content.Server/Interfaces/GameObjects/Components/Interaction/ILand.cs b/Content.Server/Interfaces/GameObjects/Components/Interaction/ILand.cs new file mode 100644 index 0000000000..1915f5fc69 --- /dev/null +++ b/Content.Server/Interfaces/GameObjects/Components/Interaction/ILand.cs @@ -0,0 +1,62 @@ +using System; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.GameObjects; +using Robust.Shared.Map; + +namespace Content.Server.Interfaces.GameObjects.Components.Interaction +{ + /// + /// This interface gives components behavior when landing after being thrown. + /// + public interface ILand + { + void Land(LandEventArgs eventArgs); + } + + public class LandEventArgs : EventArgs + { + public LandEventArgs(IEntity user, GridCoordinates landingLocation) + { + User = user; + LandingLocation = landingLocation; + } + + public IEntity User { get; } + public GridCoordinates LandingLocation { get; } + } + + /// + /// Raised when an entity that was thrown lands. + /// + [PublicAPI] + public class LandMessage : EntitySystemMessage + { + /// + /// If this message has already been "handled" by a previous system. + /// + public bool Handled { get; set; } + + /// + /// Entity that threw the item. + /// + public IEntity User { get; } + + /// + /// Item that was thrown. + /// + public IEntity Thrown { get; } + + /// + /// Location where the item landed. + /// + public GridCoordinates LandLocation { get; } + + public LandMessage(IEntity user, IEntity thrown, GridCoordinates landLocation) + { + User = user; + Thrown = thrown; + LandLocation = landLocation; + } + } +} diff --git a/Content.Server/Interfaces/GameObjects/Components/Interaction/IRangedInteract.cs b/Content.Server/Interfaces/GameObjects/Components/Interaction/IRangedInteract.cs new file mode 100644 index 0000000000..d1f188cd4e --- /dev/null +++ b/Content.Server/Interfaces/GameObjects/Components/Interaction/IRangedInteract.cs @@ -0,0 +1,69 @@ +using System; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.GameObjects; +using Robust.Shared.Map; + +namespace Content.Server.Interfaces.GameObjects.Components.Interaction +{ + /// + /// This interface gives components behavior when being clicked on by a user with an object + /// outside the range of direct use + /// + public interface IRangedInteract + { + /// + /// Called when we try to interact with an entity out of range + /// + /// + bool RangedInteract(RangedInteractEventArgs eventArgs); + } + + [PublicAPI] + public class RangedInteractEventArgs : EventArgs + { + public IEntity User { get; set; } + public IEntity Using { get; set; } + public GridCoordinates ClickLocation { get; set; } + } + + /// + /// Raised when being clicked by objects outside the range of direct use. + /// + [PublicAPI] + public class RangedInteractMessage : EntitySystemMessage + { + /// + /// If this message has already been "handled" by a previous system. + /// + public bool Handled { get; set; } + + /// + /// Entity that triggered the attack. + /// + public IEntity User { get; } + + /// + /// Entity that the User attacked with. + /// + public IEntity ItemInHand { get; set; } + + /// + /// Entity that was attacked. + /// + public IEntity Attacked { get; } + + /// + /// Location that the user clicked outside of their interaction range. + /// + public GridCoordinates ClickLocation { get; } + + public RangedInteractMessage(IEntity user, IEntity itemInHand, IEntity attacked, GridCoordinates clickLocation) + { + User = user; + ItemInHand = itemInHand; + ClickLocation = clickLocation; + Attacked = attacked; + } + } +} diff --git a/Content.Server/Interfaces/GameObjects/Components/Interaction/ITargetedInteractEventArgs.cs b/Content.Server/Interfaces/GameObjects/Components/Interaction/ITargetedInteractEventArgs.cs new file mode 100644 index 0000000000..028e3d3643 --- /dev/null +++ b/Content.Server/Interfaces/GameObjects/Components/Interaction/ITargetedInteractEventArgs.cs @@ -0,0 +1,17 @@ +using Robust.Shared.Interfaces.GameObjects; + +namespace Content.Server.Interfaces.GameObjects.Components.Interaction +{ + public interface ITargetedInteractEventArgs + { + /// + /// Performer of the attack + /// + IEntity User { get; } + /// + /// Target of the attack + /// + IEntity Target { get; } + + } +} diff --git a/Content.Server/Interfaces/GameObjects/Components/Interaction/IThrown.cs b/Content.Server/Interfaces/GameObjects/Components/Interaction/IThrown.cs new file mode 100644 index 0000000000..ca3a798963 --- /dev/null +++ b/Content.Server/Interfaces/GameObjects/Components/Interaction/IThrown.cs @@ -0,0 +1,53 @@ +using System; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.GameObjects; + +namespace Content.Server.Interfaces.GameObjects.Components.Interaction +{ + /// + /// This interface gives components behavior when thrown. + /// + public interface IThrown + { + void Thrown(ThrownEventArgs eventArgs); + } + + public class ThrownEventArgs : EventArgs + { + public ThrownEventArgs(IEntity user) + { + User = user; + } + + public IEntity User { get; } + } + + /// + /// Raised when throwing the entity in your hands. + /// + [PublicAPI] + public class ThrownMessage : EntitySystemMessage + { + /// + /// If this message has already been "handled" by a previous system. + /// + public bool Handled { get; set; } + + /// + /// Entity that threw the item. + /// + public IEntity User { get; } + + /// + /// Item that was thrown. + /// + public IEntity Thrown { get; } + + public ThrownMessage(IEntity user, IEntity thrown) + { + User = user; + Thrown = thrown; + } + } +} diff --git a/Content.Server/Interfaces/GameObjects/Components/Interaction/IUnequipped.cs b/Content.Server/Interfaces/GameObjects/Components/Interaction/IUnequipped.cs new file mode 100644 index 0000000000..32f2efa087 --- /dev/null +++ b/Content.Server/Interfaces/GameObjects/Components/Interaction/IUnequipped.cs @@ -0,0 +1,64 @@ +using System; +using Content.Shared.GameObjects.Components.Inventory; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.GameObjects; + +namespace Content.Server.Interfaces.GameObjects.Components.Interaction +{ + /// + /// This interface gives components behavior when their owner is removed from an inventory slot. + /// + public interface IUnequipped + { + void Unequipped(UnequippedEventArgs eventArgs); + } + + public class UnequippedEventArgs : EventArgs + { + public UnequippedEventArgs(IEntity user, EquipmentSlotDefines.Slots slot) + { + User = user; + Slot = slot; + } + + public IEntity User { get; } + public EquipmentSlotDefines.Slots Slot { get; } + } + + /// + /// Raised when removing the entity from an inventory slot. + /// + [PublicAPI] + public class UnequippedMessage : EntitySystemMessage + { + /// + /// If this message has already been "handled" by a previous system. + /// + public bool Handled { get; set; } + + /// + /// Entity that equipped the item. + /// + public IEntity User { get; } + + /// + /// Item that was equipped. + /// + public IEntity Equipped { get; } + + /// + /// Slot where the item was removed from. + /// + public EquipmentSlotDefines.Slots Slot { get; } + + public UnequippedMessage(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot) + { + User = user; + Equipped = equipped; + Slot = slot; + } + } + + +} diff --git a/Content.Server/Interfaces/GameObjects/Components/Interaction/IUse.cs b/Content.Server/Interfaces/GameObjects/Components/Interaction/IUse.cs new file mode 100644 index 0000000000..6da5926e6c --- /dev/null +++ b/Content.Server/Interfaces/GameObjects/Components/Interaction/IUse.cs @@ -0,0 +1,52 @@ +using System; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.GameObjects; + +namespace Content.Server.Interfaces.GameObjects.Components.Interaction +{ + /// + /// This interface gives components behavior when using the entity in your hands + /// + public interface IUse + { + /// + /// Called when we activate an object we are holding to use it + /// + /// + bool UseEntity(UseEntityEventArgs eventArgs); + } + + public class UseEntityEventArgs : EventArgs + { + public IEntity User { get; set; } + } + + /// + /// Raised when using the entity in your hands. + /// + [PublicAPI] + public class UseInHandMessage : EntitySystemMessage + { + /// + /// If this message has already been "handled" by a previous system. + /// + public bool Handled { get; set; } + + /// + /// Entity holding the item in their hand. + /// + public IEntity User { get; } + + /// + /// Item that was used. + /// + public IEntity Used { get; } + + public UseInHandMessage(IEntity user, IEntity used) + { + User = user; + Used = used; + } + } +} diff --git a/Content.Server/Mobs/Mind.cs b/Content.Server/Mobs/Mind.cs index 5e631f68ec..17a453b0e5 100644 --- a/Content.Server/Mobs/Mind.cs +++ b/Content.Server/Mobs/Mind.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using Content.Server.GameObjects.Components.Mobs; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Players; using Robust.Server.Interfaces.GameObjects; using Robust.Server.Interfaces.Player; diff --git a/Content.Server/Mobs/Role.cs b/Content.Server/Mobs/Role.cs index d1980956a5..c5dff2391f 100644 --- a/Content.Server/Mobs/Role.cs +++ b/Content.Server/Mobs/Role.cs @@ -1,7 +1,7 @@ // Hey look, // Antag Datums. -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Robust.Shared.Utility; namespace Content.Server.Mobs diff --git a/Content.Server/Observer/Ghost.cs b/Content.Server/Observer/Ghost.cs index 31a1d42bd3..7924d9f704 100644 --- a/Content.Server/Observer/Ghost.cs +++ b/Content.Server/Observer/Ghost.cs @@ -1,6 +1,6 @@ using Content.Server.GameObjects; using Content.Server.GameObjects.Components.Observer; -using Content.Server.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.Interfaces.GameTicking; using Content.Server.Players; using Content.Shared.GameObjects; diff --git a/Content.Server/Utility/InteractionChecks.cs b/Content.Server/Utility/InteractionChecks.cs index 17fdf6f54b..b79952a5bb 100644 --- a/Content.Server/Utility/InteractionChecks.cs +++ b/Content.Server/Utility/InteractionChecks.cs @@ -1,6 +1,7 @@ using System; using Content.Server.GameObjects.EntitySystems; using Content.Shared.GameObjects.EntitySystems; +using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Shared.Interfaces; using Content.Shared.Physics; using Robust.Shared.GameObjects.Systems; @@ -22,14 +23,15 @@ namespace Content.Server.Utility /// /// Default interaction check for targeted attack interaction types. - /// Same as , but defaults to allow inside blockers. + /// Same as , but defaults to ignore inside blockers + /// (making the check less restrictive). /// Validates that attacker is in range of the attacked entity. Additionally shows a popup if /// validation fails. /// - public static bool InRangeUnobstructed(ITargetedInteractEventArgs eventArgs, bool insideBlockerValid = true) + public static bool InRangeUnobstructed(ITargetedInteractEventArgs eventArgs, bool ignoreInsideBlocker = true) { if (!EntitySystem.Get().InRangeUnobstructed(eventArgs.User.Transform.MapPosition, - eventArgs.Target.Transform.MapPosition, ignoredEnt: eventArgs.Target, insideBlockerValid: insideBlockerValid)) + eventArgs.Target.Transform.MapPosition, ignoredEnt: eventArgs.Target, ignoreInsideBlocker: ignoreInsideBlocker)) { var localizationManager = IoCManager.Resolve(); eventArgs.Target.PopupMessage(eventArgs.User, localizationManager.GetString("You can't reach there!")); @@ -39,19 +41,46 @@ namespace Content.Server.Utility return true; } + /// + /// Default interaction check for Drag drop interaction types. + /// Same as , but defaults to ignore inside blockers + /// (making the check less restrictive) and checks reachability of both the target and the dragged / dropped object. + /// Additionally shows a popup if validation fails. + /// + public static bool InRangeUnobstructed(DragDropEventArgs eventArgs, bool ignoreInsideBlocker = true) + { + if (!EntitySystem.Get().InRangeUnobstructed(eventArgs.User.Transform.MapPosition, + eventArgs.Target.Transform.MapPosition, ignoredEnt: eventArgs.Target, ignoreInsideBlocker: ignoreInsideBlocker)) + { + var localizationManager = IoCManager.Resolve(); + eventArgs.Target.PopupMessage(eventArgs.User, localizationManager.GetString("You can't reach there!")); + return false; + } + if (!EntitySystem.Get().InRangeUnobstructed(eventArgs.User.Transform.MapPosition, + eventArgs.Dropped.Transform.MapPosition, ignoredEnt: eventArgs.Dropped, ignoreInsideBlocker: ignoreInsideBlocker)) + { + var localizationManager = IoCManager.Resolve(); + eventArgs.Dropped.PopupMessage(eventArgs.User, localizationManager.GetString("You can't reach there!")); + return false; + } + + return true; + } + /// /// Default interaction check for after attack interaction types. - /// Same as , but defaults to allow inside blockers. + /// Same as , but defaults to ignore inside blockers + /// (making the check less restrictive). /// Validates that attacker is in range of the attacked entity, if there is such an entity. /// If there is no attacked entity, validates that they are in range of the clicked position. /// Additionally shows a popup if validation fails. /// - public static bool InRangeUnobstructed(AfterInteractEventArgs eventArgs, bool insideBlockerValid = true) + public static bool InRangeUnobstructed(AfterInteractEventArgs eventArgs, bool ignoreInsideBlocker = true) { if (eventArgs.Target != null) { if (!EntitySystem.Get().InRangeUnobstructed(eventArgs.User.Transform.MapPosition, - eventArgs.Target.Transform.MapPosition, ignoredEnt: eventArgs.Target, insideBlockerValid: insideBlockerValid)) + eventArgs.Target.Transform.MapPosition, ignoredEnt: eventArgs.Target, ignoreInsideBlocker: ignoreInsideBlocker)) { var localizationManager = IoCManager.Resolve(); eventArgs.Target.PopupMessage(eventArgs.User, localizationManager.GetString("You can't reach there!")); @@ -61,7 +90,7 @@ namespace Content.Server.Utility else { if (!EntitySystem.Get().InRangeUnobstructed(eventArgs.User.Transform.MapPosition, - eventArgs.ClickLocation.ToMap(IoCManager.Resolve()), ignoredEnt: eventArgs.User, insideBlockerValid: insideBlockerValid)) + eventArgs.ClickLocation.ToMap(IoCManager.Resolve()), ignoredEnt: eventArgs.User, ignoreInsideBlocker: ignoreInsideBlocker)) { var localizationManager = IoCManager.Resolve(); eventArgs.User.PopupMessage(eventArgs.User, localizationManager.GetString("You can't reach there!")); @@ -80,12 +109,12 @@ namespace Content.Server.Utility public static bool InRangeUnobstructed(IEntity user, MapCoordinates otherCoords, float range = SharedInteractionSystem.InteractionRange, int collisionMask = (int) CollisionGroup.Impassable, IEntity ignoredEnt = null, - bool insideBlockerValid = false) + bool ignoreInsideBlocker = false) { var mapManager = IoCManager.Resolve(); var interactionSystem = EntitySystem.Get(); if (!interactionSystem.InRangeUnobstructed(user.Transform.MapPosition, otherCoords, range, collisionMask, - ignoredEnt, insideBlockerValid)) + ignoredEnt, ignoreInsideBlocker)) { var localizationManager = IoCManager.Resolve(); user.PopupMessage(user, localizationManager.GetString("You can't reach there!")); diff --git a/Content.Shared/GameObjects/Components/SharedPlaceableSurfaceComponent.cs b/Content.Shared/GameObjects/Components/SharedPlaceableSurfaceComponent.cs new file mode 100644 index 0000000000..2461021357 --- /dev/null +++ b/Content.Shared/GameObjects/Components/SharedPlaceableSurfaceComponent.cs @@ -0,0 +1,9 @@ +using Robust.Shared.GameObjects; + +namespace Content.Shared.GameObjects.Components +{ + public abstract class SharedPlaceableSurfaceComponent : Component + { + public override string Name => "PlaceableSurface"; + } +} diff --git a/Content.Shared/GameObjects/EntitySystemMessages/DragDropMessage.cs b/Content.Shared/GameObjects/EntitySystemMessages/DragDropMessage.cs new file mode 100644 index 0000000000..8b5648e401 --- /dev/null +++ b/Content.Shared/GameObjects/EntitySystemMessages/DragDropMessage.cs @@ -0,0 +1,25 @@ +using System; +using Robust.Shared.GameObjects; +using Robust.Shared.Map; +using Robust.Shared.Serialization; + +namespace Content.Shared.GameObjects.EntitySystemMessages +{ + /// + /// Requests a drag / drop interaction to be performed + /// + [Serializable, NetSerializable] + public class DragDropMessage : EntitySystemMessage + { + public GridCoordinates DropLocation { get; } + public EntityUid Dropped { get; } + public EntityUid Target { get; } + + public DragDropMessage(GridCoordinates dropLocation, EntityUid dropped, EntityUid target) + { + DropLocation = dropLocation; + Dropped = dropped; + Target = target; + } + } +} diff --git a/Content.Shared/GameObjects/EntitySystems/ExamineSystemShared.cs b/Content.Shared/GameObjects/EntitySystems/ExamineSystemShared.cs index 80f4c88e7c..9b1946fc6f 100644 --- a/Content.Shared/GameObjects/EntitySystems/ExamineSystemShared.cs +++ b/Content.Shared/GameObjects/EntitySystems/ExamineSystemShared.cs @@ -2,7 +2,6 @@ using Content.Shared.GameObjects.Components.Mobs; using JetBrains.Annotations; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.Utility; namespace Content.Shared.GameObjects.EntitySystems { @@ -31,7 +30,7 @@ namespace Content.Shared.GameObjects.EntitySystems return EntitySystem.Get() .InRangeUnobstructed(examiner.Transform.MapPosition, examined.Transform.MapPosition, - ExamineRange, predicate: entity => entity == examiner || entity == examined, insideBlockerValid:true); + ExamineRange, predicate: entity => entity == examiner || entity == examined, ignoreInsideBlocker:true); } } } diff --git a/Content.Shared/GameObjects/EntitySystems/SharedInteractionSystem.cs b/Content.Shared/GameObjects/EntitySystems/SharedInteractionSystem.cs index 872cddbc5f..ca1fc0a5b9 100644 --- a/Content.Shared/GameObjects/EntitySystems/SharedInteractionSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/SharedInteractionSystem.cs @@ -72,10 +72,13 @@ namespace Content.Shared.GameObjects.EntitySystems /// maximum distance between the two sets of coordinates. /// the mask to check for collisions /// A predicate to check whether to ignore an entity or not. If it returns true, it will be ignored. - /// if coordinates inside obstructions count as obstructed or not + /// if true and the coordinates are inside the obstruction, ignores the obstruction and + /// considers the interaction unobstructed. Therefore, setting this to true makes this check more permissive, such + /// as allowing an interaction to occur inside something impassable (like a wall). The default, false, + /// makes the check more restrictive. /// True if the two points are within a given range without being obstructed. public bool InRangeUnobstructed(MapCoordinates coords, MapCoordinates otherCoords, float range = InteractionRange, - int collisionMask = (int)CollisionGroup.Impassable, Func predicate = null, bool insideBlockerValid = false) + int collisionMask = (int)CollisionGroup.Impassable, Func predicate = null, bool ignoreInsideBlocker = false) { if (!coords.InRange(otherCoords, range)) return false; @@ -87,7 +90,7 @@ namespace Content.Shared.GameObjects.EntitySystems var ray = new CollisionRay(coords.Position, dir.Normalized, collisionMask); var rayResults = _physicsManager.IntersectRayWithPredicate(coords.MapId, ray, dir.Length, predicate, returnOnFirstHit: false).ToList(); - return rayResults.Count == 0 || (insideBlockerValid && rayResults.Count > 0 && (rayResults[0].HitPos - otherCoords.Position).Length < 1f); + return rayResults.Count == 0 || (ignoreInsideBlocker && rayResults.Count > 0 && (rayResults[0].HitPos - otherCoords.Position).Length < 1f); } /// @@ -101,11 +104,14 @@ namespace Content.Shared.GameObjects.EntitySystems /// maximum distance between the two sets of coordinates. /// the mask to check for collisions /// the entity to be ignored when checking for collisions. - /// if coordinates inside obstructions count as obstructed or not + /// if true and the coordinates are inside the obstruction, ignores the obstruction and + /// considers the interaction unobstructed. Therefore, setting this to true makes this check more permissive, such + /// as allowing an interaction to occur inside something impassable (like a wall). The default, false, + /// makes the check more restrictive. /// True if the two points are within a given range without being obstructed. public bool InRangeUnobstructed(MapCoordinates coords, MapCoordinates otherCoords, float range = InteractionRange, - int collisionMask = (int)CollisionGroup.Impassable, IEntity ignoredEnt = null, bool insideBlockerValid = false) => + int collisionMask = (int)CollisionGroup.Impassable, IEntity ignoredEnt = null, bool ignoreInsideBlocker = false) => InRangeUnobstructed(coords, otherCoords, range, collisionMask, - ignoredEnt == null ? null : (Func)(entity => ignoredEnt == entity), insideBlockerValid); + ignoredEnt == null ? null : (Func)(entity => ignoredEnt == entity), ignoreInsideBlocker); } } diff --git a/Resources/Prototypes/Entities/Markers/drag_shadow.yml b/Resources/Prototypes/Entities/Markers/drag_shadow.yml new file mode 100644 index 0000000000..29643c4204 --- /dev/null +++ b/Resources/Prototypes/Entities/Markers/drag_shadow.yml @@ -0,0 +1,7 @@ +- type: entity + name: drag shadow + id: dragshadow + components: + - type: Sprite + layers: + - shader: unshaded diff --git a/RobustToolbox b/RobustToolbox index af4c920606..9e5374ac86 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit af4c920606932d0083ef794cdacd1cacb1e3a817 +Subproject commit 9e5374ac867e08a98046c2e71d772af6bedd7818