ECS dragdrop (#12973)
* ECS dragdrop No more excuses. * AAAAAAAAAAAAAA * kry * events * aaaaaaaaaa * HUH * Fix stripping * aaaaaa * spoike * asease * fix table vaulting * ded * rebiew * aaaaaaaaaaaaa * drag * aeaeae * weh
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
using Robust.Client.Input;
|
using Robust.Client.Input;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
namespace Content.Client.DragDrop
|
namespace Content.Client.DragDrop;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper for implementing drag and drop interactions.
|
/// Helper for implementing drag and drop interactions.
|
||||||
///
|
///
|
||||||
@@ -161,5 +161,3 @@ namespace Content.Client.DragDrop
|
|||||||
/// should typically just clear the drag shadow.
|
/// should typically just clear the drag shadow.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public delegate void OnEndDrag();
|
public delegate void OnEndDrag();
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
using Content.Client.CombatMode;
|
using Content.Client.CombatMode;
|
||||||
using Content.Client.Gameplay;
|
using Content.Client.Gameplay;
|
||||||
using Content.Client.Outline;
|
using Content.Client.Outline;
|
||||||
using Content.Client.Viewport;
|
|
||||||
using Content.Shared.ActionBlocker;
|
using Content.Shared.ActionBlocker;
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.CombatMode;
|
|
||||||
using Content.Shared.DragDrop;
|
using Content.Shared.DragDrop;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
@@ -18,13 +16,15 @@ using Robust.Client.State;
|
|||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Input;
|
using Robust.Shared.Input;
|
||||||
using Robust.Shared.Input.Binding;
|
using Robust.Shared.Input.Binding;
|
||||||
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using DrawDepth = Content.Shared.DrawDepth.DrawDepth;
|
using DrawDepth = Content.Shared.DrawDepth.DrawDepth;
|
||||||
|
|
||||||
namespace Content.Client.DragDrop
|
namespace Content.Client.DragDrop;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles clientside drag and drop logic
|
/// Handles clientside drag and drop logic
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -43,6 +43,9 @@ namespace Content.Client.DragDrop
|
|||||||
[Dependency] private readonly InputSystem _inputSystem = default!;
|
[Dependency] private readonly InputSystem _inputSystem = default!;
|
||||||
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||||
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||||
|
|
||||||
|
private ISawmill _sawmill = default!;
|
||||||
|
|
||||||
// how often to recheck possible targets (prevents calling expensive
|
// how often to recheck possible targets (prevents calling expensive
|
||||||
// check logic each update)
|
// check logic each update)
|
||||||
@@ -56,23 +59,45 @@ namespace Content.Client.DragDrop
|
|||||||
private const string ShaderDropTargetInRange = "SelectionOutlineInrange";
|
private const string ShaderDropTargetInRange = "SelectionOutlineInrange";
|
||||||
private const string ShaderDropTargetOutOfRange = "SelectionOutline";
|
private const string ShaderDropTargetOutOfRange = "SelectionOutline";
|
||||||
|
|
||||||
// entity performing the drag action
|
/// <summary>
|
||||||
|
/// Current entity being dragged around.
|
||||||
|
/// </summary>
|
||||||
|
private EntityUid? _draggedEntity;
|
||||||
|
|
||||||
private EntityUid _dragger;
|
/// <summary>
|
||||||
private readonly List<IDraggable> _draggables = new();
|
/// If an entity is being dragged is there a drag shadow.
|
||||||
private EntityUid _dragShadow;
|
/// </summary>
|
||||||
|
private EntityUid? _dragShadow;
|
||||||
|
|
||||||
// time since mouse down over the dragged entity
|
/// <summary>
|
||||||
|
/// Time since mouse down over the dragged entity
|
||||||
|
/// </summary>
|
||||||
private float _mouseDownTime;
|
private float _mouseDownTime;
|
||||||
// how much time since last recheck of all possible targets
|
|
||||||
|
/// <summary>
|
||||||
|
/// how much time since last recheck of all possible targets
|
||||||
|
/// </summary>
|
||||||
private float _targetRecheckTime;
|
private float _targetRecheckTime;
|
||||||
// reserved initial mousedown event so we can replay it if no drag ends up being performed
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reserved initial mousedown event so we can replay it if no drag ends up being performed
|
||||||
|
/// </summary>
|
||||||
private PointerInputCmdHandler.PointerInputCmdArgs? _savedMouseDown;
|
private PointerInputCmdHandler.PointerInputCmdArgs? _savedMouseDown;
|
||||||
// whether we are currently replaying the original mouse down, so we
|
|
||||||
// can ignore any events sent to this system
|
/// <summary>
|
||||||
|
/// Whether we are currently replaying the original mouse down, so we
|
||||||
|
/// can ignore any events sent to this system
|
||||||
|
/// </summary>
|
||||||
private bool _isReplaying;
|
private bool _isReplaying;
|
||||||
|
|
||||||
private DragDropHelper<EntityUid> _dragDropHelper = default!;
|
private float _deadzone;
|
||||||
|
|
||||||
|
private DragState _state = DragState.NotDragging;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// screen pos where the mouse down began for the drag
|
||||||
|
/// </summary>
|
||||||
|
private ScreenCoordinates? _mouseDownScreenPos;
|
||||||
|
|
||||||
private ShaderInstance? _dropTargetInRangeShader;
|
private ShaderInstance? _dropTargetInRangeShader;
|
||||||
private ShaderInstance? _dropTargetOutOfRangeShader;
|
private ShaderInstance? _dropTargetOutOfRangeShader;
|
||||||
@@ -81,10 +106,11 @@ namespace Content.Client.DragDrop
|
|||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
base.Initialize();
|
||||||
|
_sawmill = Logger.GetSawmill("drag_drop");
|
||||||
UpdatesOutsidePrediction = true;
|
UpdatesOutsidePrediction = true;
|
||||||
UpdatesAfter.Add(typeof(EyeUpdateSystem));
|
UpdatesAfter.Add(typeof(EyeUpdateSystem));
|
||||||
|
|
||||||
_dragDropHelper = new DragDropHelper<EntityUid>(OnBeginDrag, OnContinueDrag, OnEndDrag);
|
|
||||||
_cfgMan.OnValueChanged(CCVars.DragDropDeadZone, SetDeadZone, true);
|
_cfgMan.OnValueChanged(CCVars.DragDropDeadZone, SetDeadZone, true);
|
||||||
|
|
||||||
_dropTargetInRangeShader = _prototypeManager.Index<ShaderPrototype>(ShaderDropTargetInRange).Instance();
|
_dropTargetInRangeShader = _prototypeManager.Index<ShaderPrototype>(ShaderDropTargetInRange).Instance();
|
||||||
@@ -97,13 +123,12 @@ namespace Content.Client.DragDrop
|
|||||||
|
|
||||||
private void SetDeadZone(float deadZone)
|
private void SetDeadZone(float deadZone)
|
||||||
{
|
{
|
||||||
_dragDropHelper.Deadzone = deadZone;
|
_deadzone = deadZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Shutdown()
|
public override void Shutdown()
|
||||||
{
|
{
|
||||||
_cfgMan.UnsubValueChanged(CCVars.DragDropDeadZone, SetDeadZone);
|
_cfgMan.UnsubValueChanged(CCVars.DragDropDeadZone, SetDeadZone);
|
||||||
_dragDropHelper.EndDrag();
|
|
||||||
CommandBinds.Unregister<DragDropSystem>();
|
CommandBinds.Unregister<DragDropSystem>();
|
||||||
base.Shutdown();
|
base.Shutdown();
|
||||||
}
|
}
|
||||||
@@ -111,17 +136,20 @@ namespace Content.Client.DragDrop
|
|||||||
private bool OnUse(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
private bool OnUse(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
||||||
{
|
{
|
||||||
// not currently predicted
|
// not currently predicted
|
||||||
if (_inputSystem.Predicted) return false;
|
if (_inputSystem.Predicted)
|
||||||
|
return false;
|
||||||
|
|
||||||
// currently replaying a saved click, don't handle this because
|
// currently replaying a saved click, don't handle this because
|
||||||
// we already decided this click doesn't represent an actual drag attempt
|
// we already decided this click doesn't represent an actual drag attempt
|
||||||
if (_isReplaying) return false;
|
if (_isReplaying)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (args.State == BoundKeyState.Down)
|
if (args.State == BoundKeyState.Down)
|
||||||
{
|
{
|
||||||
return OnUseMouseDown(args);
|
return OnUseMouseDown(args);
|
||||||
}
|
}
|
||||||
else if (args.State == BoundKeyState.Up)
|
|
||||||
|
if (args.State == BoundKeyState.Up)
|
||||||
{
|
{
|
||||||
return OnUseMouseUp(args);
|
return OnUseMouseUp(args);
|
||||||
}
|
}
|
||||||
@@ -129,6 +157,27 @@ namespace Content.Client.DragDrop
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void EndDrag()
|
||||||
|
{
|
||||||
|
if (_state == DragState.NotDragging)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_dragShadow != null)
|
||||||
|
{
|
||||||
|
Del(_dragShadow.Value);
|
||||||
|
_dragShadow = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
_draggedEntity = null;
|
||||||
|
_state = DragState.NotDragging;
|
||||||
|
_mouseDownScreenPos = null;
|
||||||
|
|
||||||
|
RemoveHighlights();
|
||||||
|
_outline.SetEnabled(true);
|
||||||
|
_mouseDownTime = 0;
|
||||||
|
_savedMouseDown = null;
|
||||||
|
}
|
||||||
|
|
||||||
private bool OnUseMouseDown(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
private bool OnUseMouseDown(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
||||||
{
|
{
|
||||||
if (args.Session?.AttachedEntity is not {Valid: true} dragger ||
|
if (args.Session?.AttachedEntity is not {Valid: true} dragger ||
|
||||||
@@ -139,11 +188,11 @@ namespace Content.Client.DragDrop
|
|||||||
|
|
||||||
// cancel any current dragging if there is one (shouldn't be because they would've had to have lifted
|
// 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)
|
// the mouse, canceling the drag, but just being cautious)
|
||||||
_dragDropHelper.EndDrag();
|
EndDrag();
|
||||||
|
|
||||||
// possibly initiating a drag
|
// possibly initiating a drag
|
||||||
// check if the clicked entity is draggable
|
// check if the clicked entity is draggable
|
||||||
if (!EntityManager.EntityExists(args.EntityUid))
|
if (!Exists(args.EntityUid))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -154,28 +203,16 @@ namespace Content.Client.DragDrop
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var canDrag = false;
|
var ev = new CanDragEvent();
|
||||||
foreach (var draggable in EntityManager.GetComponents<IDraggable>(args.EntityUid))
|
|
||||||
{
|
|
||||||
var dragEventArgs = new StartDragDropEvent(dragger, args.EntityUid);
|
|
||||||
|
|
||||||
if (!draggable.CanStartDrag(dragEventArgs))
|
RaiseLocalEvent(args.EntityUid, ref ev);
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
_draggables.Add(draggable);
|
if (ev.Handled != true)
|
||||||
canDrag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!canDrag)
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
// wait to initiate a drag
|
_draggedEntity = args.EntityUid;
|
||||||
_dragDropHelper.MouseDown(args.EntityUid);
|
_state = DragState.MouseDown;
|
||||||
_dragger = dragger;
|
_mouseDownScreenPos = _inputManager.MouseScreenPosition;
|
||||||
_mouseDownTime = 0;
|
_mouseDownTime = 0;
|
||||||
|
|
||||||
// don't want anything else to process the click,
|
// don't want anything else to process the click,
|
||||||
@@ -187,21 +224,26 @@ namespace Content.Client.DragDrop
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool OnBeginDrag()
|
private void StartDrag()
|
||||||
{
|
{
|
||||||
if (_dragDropHelper.Dragged == default || Deleted(_dragDropHelper.Dragged))
|
if (!Exists(_draggedEntity))
|
||||||
{
|
{
|
||||||
// something happened to the clicked entity or we moved the mouse off the target so
|
// something happened to the clicked entity or we moved the mouse off the target so
|
||||||
// we shouldn't replay the original click
|
// we shouldn't replay the original click
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EntityManager.TryGetComponent<SpriteComponent?>(_dragDropHelper.Dragged, out var draggedSprite))
|
_state = DragState.Dragging;
|
||||||
|
DebugTools.Assert(_dragShadow == null);
|
||||||
|
_outline.SetEnabled(false);
|
||||||
|
HighlightTargets();
|
||||||
|
|
||||||
|
if (TryComp<SpriteComponent>(_draggedEntity, out var draggedSprite))
|
||||||
{
|
{
|
||||||
// pop up drag shadow under mouse
|
// pop up drag shadow under mouse
|
||||||
var mousePos = _eyeManager.ScreenToMap(_dragDropHelper.MouseScreenPosition);
|
var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition);
|
||||||
_dragShadow = EntityManager.SpawnEntity("dragshadow", mousePos);
|
_dragShadow = EntityManager.SpawnEntity("dragshadow", mousePos);
|
||||||
var dragSprite = EntityManager.GetComponent<SpriteComponent>(_dragShadow);
|
var dragSprite = Comp<SpriteComponent>(_dragShadow.Value);
|
||||||
dragSprite.CopyFrom(draggedSprite);
|
dragSprite.CopyFrom(draggedSprite);
|
||||||
dragSprite.RenderOrder = EntityManager.CurrentTick.Value;
|
dragSprite.RenderOrder = EntityManager.CurrentTick.Value;
|
||||||
dragSprite.Color = dragSprite.Color.WithAlpha(0.7f);
|
dragSprite.Color = dragSprite.Color.WithAlpha(0.7f);
|
||||||
@@ -209,43 +251,37 @@ namespace Content.Client.DragDrop
|
|||||||
dragSprite.DrawDepth = (int) DrawDepth.Overlays;
|
dragSprite.DrawDepth = (int) DrawDepth.Overlays;
|
||||||
if (!dragSprite.NoRotation)
|
if (!dragSprite.NoRotation)
|
||||||
{
|
{
|
||||||
EntityManager.GetComponent<TransformComponent>(_dragShadow).WorldRotation = EntityManager.GetComponent<TransformComponent>(_dragDropHelper.Dragged).WorldRotation;
|
Transform(_dragShadow.Value).WorldRotation = Transform(_draggedEntity.Value).WorldRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
HighlightTargets();
|
|
||||||
_outline.SetEnabled(false);
|
|
||||||
|
|
||||||
// drag initiated
|
// drag initiated
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Warning("Unable to display drag shadow for {0} because it" +
|
_sawmill.Warning($"Unable to display drag shadow for {ToPrettyString(_draggedEntity.Value)} because it has no sprite component.");
|
||||||
" has no sprite component.", EntityManager.GetComponent<MetaDataComponent>(_dragDropHelper.Dragged).EntityName);
|
}
|
||||||
|
|
||||||
|
private bool UpdateDrag(float frameTime)
|
||||||
|
{
|
||||||
|
if (!Exists(_draggedEntity) || _combatMode.IsInCombatMode())
|
||||||
|
{
|
||||||
|
EndDrag();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool OnContinueDrag(float frameTime)
|
var player = _playerManager.LocalPlayer?.ControlledEntity;
|
||||||
{
|
|
||||||
if (_dragDropHelper.Dragged == default || Deleted(_dragDropHelper.Dragged) ||
|
|
||||||
_combatMode.IsInCombatMode())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugTools.AssertNotNull(_dragger);
|
|
||||||
|
|
||||||
// still in range of the thing we are dragging?
|
// still in range of the thing we are dragging?
|
||||||
if (!_interactionSystem.InRangeUnobstructed(_dragger, _dragDropHelper.Dragged))
|
if (player == null || !_interactionSystem.InRangeUnobstructed(player.Value, _draggedEntity.Value))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: would use MapPosition instead if it had a setter, but it has no setter.
|
if (_dragShadow == null)
|
||||||
// is that intentional, or should we add a setter for Transform.MapPosition?
|
|
||||||
if (_dragShadow == default)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
_targetRecheckTime += frameTime;
|
_targetRecheckTime += frameTime;
|
||||||
|
|
||||||
if (_targetRecheckTime > TargetRecheckInterval)
|
if (_targetRecheckTime > TargetRecheckInterval)
|
||||||
{
|
{
|
||||||
HighlightTargets();
|
HighlightTargets();
|
||||||
@@ -255,59 +291,56 @@ namespace Content.Client.DragDrop
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEndDrag()
|
|
||||||
{
|
|
||||||
RemoveHighlights();
|
|
||||||
if (_dragShadow != default)
|
|
||||||
{
|
|
||||||
EntityManager.DeleteEntity(_dragShadow);
|
|
||||||
}
|
|
||||||
|
|
||||||
_outline.SetEnabled(true);
|
|
||||||
_dragShadow = default;
|
|
||||||
_draggables.Clear();
|
|
||||||
_dragger = default;
|
|
||||||
_mouseDownTime = 0;
|
|
||||||
_savedMouseDown = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool OnUseMouseUp(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
private bool OnUseMouseUp(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
||||||
{
|
{
|
||||||
if (_dragDropHelper.IsDragging == false || _dragDropHelper.Dragged == default)
|
if (_state == DragState.MouseDown)
|
||||||
{
|
{
|
||||||
// haven't started the drag yet, quick mouseup, definitely treat it as a normal click by
|
// haven't started the drag yet, quick mouseup, definitely treat it as a normal click by
|
||||||
// replaying the original cmd
|
// replaying the original cmd
|
||||||
|
try
|
||||||
|
{
|
||||||
if (_savedMouseDown.HasValue && _mouseDownTime < MaxMouseDownTimeForReplayingClick)
|
if (_savedMouseDown.HasValue && _mouseDownTime < MaxMouseDownTimeForReplayingClick)
|
||||||
{
|
{
|
||||||
var savedValue = _savedMouseDown.Value;
|
var savedValue = _savedMouseDown.Value;
|
||||||
_isReplaying = true;
|
_isReplaying = true;
|
||||||
// adjust the timing info based on the current tick so it appears as if it happened now
|
// adjust the timing info based on the current tick so it appears as if it happened now
|
||||||
var replayMsg = savedValue.OriginalMessage;
|
var replayMsg = savedValue.OriginalMessage;
|
||||||
var adjustedInputMsg = new FullInputCmdMessage(args.OriginalMessage.Tick, args.OriginalMessage.SubTick,
|
|
||||||
replayMsg.InputFunctionId, replayMsg.State, replayMsg.Coordinates, replayMsg.ScreenCoordinates, replayMsg.Uid);
|
var adjustedInputMsg = new FullInputCmdMessage(args.OriginalMessage.Tick,
|
||||||
|
args.OriginalMessage.SubTick,
|
||||||
|
replayMsg.InputFunctionId, replayMsg.State, replayMsg.Coordinates, replayMsg.ScreenCoordinates,
|
||||||
|
replayMsg.Uid);
|
||||||
|
|
||||||
if (savedValue.Session != null)
|
if (savedValue.Session != null)
|
||||||
{
|
{
|
||||||
_inputSystem.HandleInputCommand(savedValue.Session, EngineKeyFunctions.Use, adjustedInputMsg, true);
|
_inputSystem.HandleInputCommand(savedValue.Session, EngineKeyFunctions.Use, adjustedInputMsg,
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
_isReplaying = false;
|
_isReplaying = false;
|
||||||
}
|
}
|
||||||
_dragDropHelper.EndDrag();
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
if (_dragger == default)
|
|
||||||
{
|
{
|
||||||
_dragDropHelper.EndDrag();
|
EndDrag();
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IList<EntityUid> entities;
|
var localPlayer = _playerManager.LocalPlayer?.ControlledEntity;
|
||||||
|
|
||||||
|
if (localPlayer == null || !Exists(_draggedEntity))
|
||||||
|
{
|
||||||
|
EndDrag();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerable<EntityUid> entities;
|
||||||
|
|
||||||
if (_stateManager.CurrentState is GameplayState screen)
|
if (_stateManager.CurrentState is GameplayState screen)
|
||||||
{
|
{
|
||||||
entities = screen.GetClickableEntities(args.Coordinates).ToList();
|
entities = screen.GetClickableEntities(args.Coordinates);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -315,61 +348,54 @@ namespace Content.Client.DragDrop
|
|||||||
}
|
}
|
||||||
|
|
||||||
var outOfRange = false;
|
var outOfRange = false;
|
||||||
|
var user = localPlayer.Value;
|
||||||
|
|
||||||
foreach (var entity in entities)
|
foreach (var entity in entities)
|
||||||
{
|
{
|
||||||
if (entity == _dragDropHelper.Dragged) continue;
|
if (entity == _draggedEntity)
|
||||||
|
continue;
|
||||||
|
|
||||||
// check if it's able to be dropped on by current dragged entity
|
// check if it's able to be dropped on by current dragged entity
|
||||||
var dropArgs = new DragDropEvent(_dragger, args.Coordinates, _dragDropHelper.Dragged, entity);
|
var valid = ValidDragDrop(user, _draggedEntity.Value, entity);
|
||||||
|
|
||||||
// TODO: Cache valid CanDragDrops
|
if (valid != true) continue;
|
||||||
if (ValidDragDrop(dropArgs) != true) continue;
|
|
||||||
|
|
||||||
if (!_interactionSystem.InRangeUnobstructed(dropArgs.User, dropArgs.Target)
|
if (!_interactionSystem.InRangeUnobstructed(user, entity)
|
||||||
|| !_interactionSystem.InRangeUnobstructed(dropArgs.User, dropArgs.Dragged))
|
|| !_interactionSystem.InRangeUnobstructed(user, _draggedEntity.Value))
|
||||||
{
|
{
|
||||||
outOfRange = true;
|
outOfRange = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var draggable in _draggables)
|
|
||||||
{
|
|
||||||
if (!draggable.CanDrop(dropArgs)) continue;
|
|
||||||
|
|
||||||
// tell the server about the drop attempt
|
// tell the server about the drop attempt
|
||||||
RaiseNetworkEvent(new DragDropRequestEvent(args.Coordinates, _dragDropHelper.Dragged,
|
RaiseNetworkEvent(new DragDropRequestEvent(_draggedEntity.Value, entity));
|
||||||
entity));
|
EndDrag();
|
||||||
|
|
||||||
draggable.Drop(dropArgs);
|
|
||||||
|
|
||||||
_dragDropHelper.EndDrag();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (outOfRange &&
|
if (outOfRange)
|
||||||
_playerManager.LocalPlayer?.ControlledEntity is { } player &&
|
|
||||||
player.IsValid())
|
|
||||||
{
|
{
|
||||||
player.PopupMessage(Loc.GetString("drag-drop-system-out-of-range-text"));
|
_popup.PopupEntity(Loc.GetString("drag-drop-system-out-of-range-text"), _draggedEntity.Value, Filter.Local(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
_dragDropHelper.EndDrag();
|
EndDrag();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO make this just use TargetOutlineSystem
|
// TODO make this just use TargetOutlineSystem
|
||||||
private void HighlightTargets()
|
private void HighlightTargets()
|
||||||
{
|
{
|
||||||
if (_dragDropHelper.Dragged == default || Deleted(_dragDropHelper.Dragged) ||
|
if (!Exists(_draggedEntity) ||
|
||||||
_dragShadow == default || Deleted(_dragShadow))
|
!Exists(_dragShadow))
|
||||||
{
|
{
|
||||||
Logger.Warning("Programming error. Can't highlight drag and drop targets, not currently " +
|
|
||||||
"dragging anything or dragged entity / shadow was deleted.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var user = _playerManager.LocalPlayer?.ControlledEntity;
|
||||||
|
|
||||||
|
if (user == null)
|
||||||
|
return;
|
||||||
|
|
||||||
// highlights the possible targets which are visible
|
// highlights the possible targets which are visible
|
||||||
// and able to be dropped on by the current dragged entity
|
// and able to be dropped on by the current dragged entity
|
||||||
|
|
||||||
@@ -378,32 +404,40 @@ namespace Content.Client.DragDrop
|
|||||||
|
|
||||||
// find possible targets on screen even if not reachable
|
// find possible targets on screen even if not reachable
|
||||||
// TODO: Duplicated in SpriteSystem and TargetOutlineSystem. Should probably be cached somewhere for a frame?
|
// TODO: Duplicated in SpriteSystem and TargetOutlineSystem. Should probably be cached somewhere for a frame?
|
||||||
var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition).Position;
|
var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition);
|
||||||
var bounds = new Box2(mousePos - 1.5f, mousePos + 1.5f);
|
var bounds = new Box2(mousePos.Position - 1.5f, mousePos.Position + 1.5f);
|
||||||
var pvsEntities = _lookup.GetEntitiesIntersecting(_eyeManager.CurrentMap, bounds, LookupFlags.Approximate | LookupFlags.Static);
|
var pvsEntities = _lookup.GetEntitiesIntersecting(mousePos.MapId, bounds);
|
||||||
foreach (var pvsEntity in pvsEntities)
|
|
||||||
|
var spriteQuery = GetEntityQuery<SpriteComponent>();
|
||||||
|
|
||||||
|
foreach (var entity in pvsEntities)
|
||||||
{
|
{
|
||||||
if (!EntityManager.TryGetComponent(pvsEntity, out SpriteComponent? inRangeSprite) ||
|
if (!spriteQuery.TryGetComponent(entity, out var inRangeSprite) ||
|
||||||
!inRangeSprite.Visible ||
|
!inRangeSprite.Visible ||
|
||||||
pvsEntity == _dragDropHelper.Dragged) continue;
|
entity == _draggedEntity)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var valid = ValidDragDrop(user.Value, _draggedEntity.Value, entity);
|
||||||
|
|
||||||
// check if it's able to be dropped on by current dragged entity
|
// check if it's able to be dropped on by current dragged entity
|
||||||
var dropArgs = new DragDropEvent(_dragger, EntityManager.GetComponent<TransformComponent>(pvsEntity).Coordinates, _dragDropHelper.Dragged, pvsEntity);
|
if (valid == null)
|
||||||
|
continue;
|
||||||
var valid = ValidDragDrop(dropArgs);
|
|
||||||
if (valid == null) continue;
|
|
||||||
|
|
||||||
// We'll do a final check given server-side does this before any dragdrop can take place.
|
// We'll do a final check given server-side does this before any dragdrop can take place.
|
||||||
if (valid.Value)
|
if (valid.Value)
|
||||||
{
|
{
|
||||||
valid = _interactionSystem.InRangeUnobstructed(dropArgs.Target, dropArgs.Dragged)
|
valid = _interactionSystem.InRangeUnobstructed(user.Value, _draggedEntity.Value)
|
||||||
&& _interactionSystem.InRangeUnobstructed(dropArgs.Target, dropArgs.Target);
|
&& _interactionSystem.InRangeUnobstructed(user.Value, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inRangeSprite.PostShader != null &&
|
if (inRangeSprite.PostShader != null &&
|
||||||
inRangeSprite.PostShader != _dropTargetInRangeShader &&
|
inRangeSprite.PostShader != _dropTargetInRangeShader &&
|
||||||
inRangeSprite.PostShader != _dropTargetOutOfRangeShader)
|
inRangeSprite.PostShader != _dropTargetOutOfRangeShader)
|
||||||
return;
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// highlight depending on whether its in or out of range
|
// highlight depending on whether its in or out of range
|
||||||
inRangeSprite.PostShader = valid.Value ? _dropTargetInRangeShader : _dropTargetOutOfRangeShader;
|
inRangeSprite.PostShader = valid.Value ? _dropTargetInRangeShader : _dropTargetOutOfRangeShader;
|
||||||
@@ -429,57 +463,64 @@ namespace Content.Client.DragDrop
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Are these args valid for drag-drop?
|
/// Are these args valid for drag-drop?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="eventArgs"></param>
|
/// <returns>
|
||||||
/// <returns>null if the target doesn't support IDragDropOn</returns>
|
/// Returns null if no interactions are available or the user / target cannot interact with each other.
|
||||||
private bool? ValidDragDrop(DragDropEvent eventArgs)
|
/// Returns false if interactions exist but are not available currently.
|
||||||
|
/// </returns>
|
||||||
|
private bool? ValidDragDrop(EntityUid user, EntityUid dragged, EntityUid target)
|
||||||
{
|
{
|
||||||
if (!_actionBlockerSystem.CanInteract(eventArgs.User, eventArgs.Target))
|
if (!_actionBlockerSystem.CanInteract(user, target))
|
||||||
{
|
return null;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// CanInteract() doesn't support checking a second "target" entity.
|
// CanInteract() doesn't support checking a second "target" entity.
|
||||||
// Doing so manually:
|
// Doing so manually:
|
||||||
var ev = new GettingInteractedWithAttemptEvent(eventArgs.User, eventArgs.Dragged);
|
var ev = new GettingInteractedWithAttemptEvent(user, dragged);
|
||||||
RaiseLocalEvent(eventArgs.Dragged, ev, true);
|
RaiseLocalEvent(dragged, ev, true);
|
||||||
|
|
||||||
if (ev.Cancelled)
|
if (ev.Cancelled)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var valid = CheckDragDropOn(eventArgs);
|
var dropEv = new CanDropDraggedEvent(user, target);
|
||||||
|
|
||||||
foreach (var comp in EntityManager.GetComponents<IDragDropOn>(eventArgs.Target))
|
RaiseLocalEvent(dragged, ref dropEv);
|
||||||
|
|
||||||
|
if (dropEv.Handled)
|
||||||
{
|
{
|
||||||
if (!comp.CanDragDropOn(eventArgs))
|
if (!dropEv.CanDrop)
|
||||||
{
|
return false;
|
||||||
valid = false;
|
|
||||||
// dragDropOn.Add(comp);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
valid = true;
|
var dropEv2 = new CanDropTargetEvent(user, dragged);
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (valid != true) return valid;
|
RaiseLocalEvent(target, ref dropEv2);
|
||||||
|
|
||||||
// Need at least one IDraggable to return true or else we can't do shit
|
if (dropEv2.Handled)
|
||||||
valid = false;
|
return dropEv2.CanDrop;
|
||||||
|
|
||||||
foreach (var comp in EntityManager.GetComponents<IDraggable>(eventArgs.User))
|
return null;
|
||||||
{
|
|
||||||
if (!comp.CanDrop(eventArgs)) continue;
|
|
||||||
valid = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return valid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
{
|
{
|
||||||
base.Update(frameTime);
|
base.Update(frameTime);
|
||||||
|
|
||||||
_dragDropHelper.Update(frameTime);
|
switch (_state)
|
||||||
|
{
|
||||||
|
// check if dragging should begin
|
||||||
|
case DragState.MouseDown:
|
||||||
|
{
|
||||||
|
var screenPos = _inputManager.MouseScreenPosition;
|
||||||
|
if ((_mouseDownScreenPos!.Value.Position - screenPos.Position).Length > _deadzone)
|
||||||
|
{
|
||||||
|
StartDrag();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DragState.Dragging:
|
||||||
|
UpdateDrag(frameTime);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void FrameUpdate(float frameTime)
|
public override void FrameUpdate(float frameTime)
|
||||||
@@ -487,11 +528,26 @@ namespace Content.Client.DragDrop
|
|||||||
base.FrameUpdate(frameTime);
|
base.FrameUpdate(frameTime);
|
||||||
|
|
||||||
// Update position every frame to make it smooth.
|
// Update position every frame to make it smooth.
|
||||||
if (_dragDropHelper.IsDragging)
|
if (Exists(_dragShadow))
|
||||||
{
|
{
|
||||||
var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition);
|
var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition);
|
||||||
Transform(_dragShadow).WorldPosition = mousePos.Position;
|
Transform(_dragShadow.Value).WorldPosition = mousePos.Position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum DragState : byte
|
||||||
|
{
|
||||||
|
NotDragging,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Not dragging yet, waiting to see
|
||||||
|
/// if they hold for long enough
|
||||||
|
/// </summary>
|
||||||
|
MouseDown,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Currently dragging something
|
||||||
|
/// </summary>
|
||||||
|
Dragging,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
using Content.Shared.DragDrop;
|
|
||||||
using Content.Shared.Kitchen.Components;
|
using Content.Shared.Kitchen.Components;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Client.Kitchen.Components
|
namespace Content.Client.Kitchen.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent, ComponentReference(typeof(SharedKitchenSpikeComponent))]
|
||||||
internal sealed class KitchenSpikeComponent : SharedKitchenSpikeComponent
|
public sealed class KitchenSpikeComponent : SharedKitchenSpikeComponent
|
||||||
{
|
{
|
||||||
public override bool DragDropOn(DragDropEvent eventArgs)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
8
Content.Client/Kitchen/KitchenSpikeSystem.cs
Normal file
8
Content.Client/Kitchen/KitchenSpikeSystem.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
using Content.Shared.Kitchen;
|
||||||
|
|
||||||
|
namespace Content.Client.Kitchen;
|
||||||
|
|
||||||
|
public sealed class KitchenSpikeSystem : SharedKitchenSpikeSystem
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,16 +1,9 @@
|
|||||||
using Content.Shared.DragDrop;
|
using Content.Shared.MedicalScanner;
|
||||||
using Content.Shared.MedicalScanner;
|
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Client.MedicalScanner
|
namespace Content.Client.MedicalScanner
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(SharedMedicalScannerComponent))]
|
|
||||||
public sealed class MedicalScannerComponent : SharedMedicalScannerComponent
|
public sealed class MedicalScannerComponent : SharedMedicalScannerComponent
|
||||||
{
|
{
|
||||||
public override bool DragDropOn(DragDropEvent eventArgs)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public sealed class ClimbSystem : SharedClimbSystem
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeLocalEvent<ClimbingComponent, ComponentHandleState>(OnClimbingState);
|
SubscribeLocalEvent<ClimbingComponent, ComponentHandleState>(OnClimbingState);
|
||||||
|
SubscribeLocalEvent<ClimbableComponent, CanDropTargetEvent>(OnCanDragDropOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnClimbingState(EntityUid uid, ClimbingComponent component, ref ComponentHandleState args)
|
private static void OnClimbingState(EntityUid uid, ClimbingComponent component, ref ComponentHandleState args)
|
||||||
@@ -24,15 +25,15 @@ public sealed class ClimbSystem : SharedClimbSystem
|
|||||||
component.OwnerIsTransitioning = climbModeState.IsTransitioning;
|
component.OwnerIsTransitioning = climbModeState.IsTransitioning;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnCanDragDropOn(EntityUid uid, ClimbableComponent component, CanDragDropOnEvent args)
|
protected override void OnCanDragDropOn(EntityUid uid, ClimbableComponent component, ref CanDropTargetEvent args)
|
||||||
{
|
{
|
||||||
base.OnCanDragDropOn(uid, component, args);
|
base.OnCanDragDropOn(uid, component, ref args);
|
||||||
|
|
||||||
if (!args.CanDrop)
|
if (!args.CanDrop)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var user = args.User;
|
var user = args.User;
|
||||||
var target = args.Target;
|
var target = uid;
|
||||||
var dragged = args.Dragged;
|
var dragged = args.Dragged;
|
||||||
bool Ignored(EntityUid entity) => entity == target || entity == user || entity == dragged;
|
bool Ignored(EntityUid entity) => entity == target || entity == user || entity == dragged;
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
using Content.Shared.DragDrop;
|
|
||||||
using Content.Shared.Strip.Components;
|
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Client.Strip
|
|
||||||
{
|
|
||||||
[RegisterComponent]
|
|
||||||
[ComponentReference(typeof(SharedStrippableComponent))]
|
|
||||||
public sealed class StrippableComponent : SharedStrippableComponent
|
|
||||||
{
|
|
||||||
public override bool Drop(DragDropEvent args)
|
|
||||||
{
|
|
||||||
// TODO: Prediction
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,8 @@ using Content.Shared.Cuffs.Components;
|
|||||||
using Content.Shared.Ensnaring.Components;
|
using Content.Shared.Ensnaring.Components;
|
||||||
using Content.Shared.Hands;
|
using Content.Shared.Hands;
|
||||||
using Content.Shared.Inventory.Events;
|
using Content.Shared.Inventory.Events;
|
||||||
|
using Content.Shared.Strip;
|
||||||
|
using Content.Shared.Strip.Components;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
|
|
||||||
namespace Content.Client.Strip;
|
namespace Content.Client.Strip;
|
||||||
@@ -10,7 +12,7 @@ namespace Content.Client.Strip;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is the client-side stripping system, which just triggers UI updates on events.
|
/// This is the client-side stripping system, which just triggers UI updates on events.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class StrippableSystem : EntitySystem
|
public sealed class StrippableSystem : SharedStrippableSystem
|
||||||
{
|
{
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ public sealed partial class BuckleSystem
|
|||||||
SubscribeLocalEvent<BuckleComponent, InteractHandEvent>(HandleInteractHand);
|
SubscribeLocalEvent<BuckleComponent, InteractHandEvent>(HandleInteractHand);
|
||||||
SubscribeLocalEvent<BuckleComponent, GetVerbsEvent<InteractionVerb>>(AddUnbuckleVerb);
|
SubscribeLocalEvent<BuckleComponent, GetVerbsEvent<InteractionVerb>>(AddUnbuckleVerb);
|
||||||
SubscribeLocalEvent<BuckleComponent, InsertIntoEntityStorageAttemptEvent>(OnEntityStorageInsertAttempt);
|
SubscribeLocalEvent<BuckleComponent, InsertIntoEntityStorageAttemptEvent>(OnEntityStorageInsertAttempt);
|
||||||
SubscribeLocalEvent<BuckleComponent, CanDropEvent>(OnBuckleCanDrop);
|
SubscribeLocalEvent<BuckleComponent, CanDropDraggedEvent>(OnBuckleCanDrop);
|
||||||
SubscribeLocalEvent<BuckleComponent, DragDropEvent>(OnBuckleDragDrop);
|
SubscribeLocalEvent<BuckleComponent, DragDropDraggedEvent>(OnBuckleDragDrop);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddUnbuckleVerb(EntityUid uid, BuckleComponent component, GetVerbsEvent<InteractionVerb> args)
|
private void AddUnbuckleVerb(EntityUid uid, BuckleComponent component, GetVerbsEvent<InteractionVerb> args)
|
||||||
@@ -104,12 +104,12 @@ public sealed partial class BuckleSystem
|
|||||||
args.Cancelled = true;
|
args.Cancelled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBuckleCanDrop(EntityUid uid, BuckleComponent component, CanDropEvent args)
|
private void OnBuckleCanDrop(EntityUid uid, BuckleComponent component, ref CanDropDraggedEvent args)
|
||||||
{
|
{
|
||||||
args.Handled = HasComp<StrapComponent>(args.Target);
|
args.Handled = HasComp<StrapComponent>(args.Target);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBuckleDragDrop(EntityUid uid, BuckleComponent component, DragDropEvent args)
|
private void OnBuckleDragDrop(EntityUid uid, BuckleComponent component, ref DragDropDraggedEvent args)
|
||||||
{
|
{
|
||||||
args.Handled = TryBuckle(uid, args.User, args.Target, component);
|
args.Handled = TryBuckle(uid, args.User, args.Target, component);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public sealed partial class BuckleSystem
|
|||||||
SubscribeLocalEvent<StrapComponent, DestructionEventArgs>((_,c,_) => StrapRemoveAll(c));
|
SubscribeLocalEvent<StrapComponent, DestructionEventArgs>((_,c,_) => StrapRemoveAll(c));
|
||||||
SubscribeLocalEvent<StrapComponent, BreakageEventArgs>((_, c, _) => StrapRemoveAll(c));
|
SubscribeLocalEvent<StrapComponent, BreakageEventArgs>((_, c, _) => StrapRemoveAll(c));
|
||||||
SubscribeLocalEvent<StrapComponent, ConstructionBeforeDeleteEvent>((_, c, _) => StrapRemoveAll(c));
|
SubscribeLocalEvent<StrapComponent, ConstructionBeforeDeleteEvent>((_, c, _) => StrapRemoveAll(c));
|
||||||
SubscribeLocalEvent<StrapComponent, DragDropEvent>(OnStrapDragDrop);
|
SubscribeLocalEvent<StrapComponent, DragDropTargetEvent>(OnStrapDragDrop);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnStrapGetState(EntityUid uid, StrapComponent component, ref ComponentGetState args)
|
private void OnStrapGetState(EntityUid uid, StrapComponent component, ref ComponentGetState args)
|
||||||
@@ -185,9 +185,9 @@ public sealed partial class BuckleSystem
|
|||||||
Dirty(strap);
|
Dirty(strap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnStrapDragDrop(EntityUid uid, StrapComponent component, DragDropEvent args)
|
private void OnStrapDragDrop(EntityUid uid, StrapComponent component, ref DragDropTargetEvent args)
|
||||||
{
|
{
|
||||||
if (!StrapCanDragDropOn(uid, args.User, args.Target, args.Dragged, component))
|
if (!StrapCanDragDropOn(uid, args.User, uid, args.Dragged, component))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
args.Handled = TryBuckle(args.Dragged, args.User, uid);
|
args.Handled = TryBuckle(args.Dragged, args.User, uid);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public sealed class ClimbSystem : SharedClimbSystem
|
|||||||
|
|
||||||
SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset);
|
SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset);
|
||||||
SubscribeLocalEvent<ClimbableComponent, GetVerbsEvent<AlternativeVerb>>(AddClimbableVerb);
|
SubscribeLocalEvent<ClimbableComponent, GetVerbsEvent<AlternativeVerb>>(AddClimbableVerb);
|
||||||
SubscribeLocalEvent<ClimbableComponent, DragDropEvent>(OnClimbableDragDrop);
|
SubscribeLocalEvent<ClimbableComponent, DragDropTargetEvent>(OnClimbableDragDrop);
|
||||||
|
|
||||||
SubscribeLocalEvent<ClimbingComponent, ClimbFinishedEvent>(OnClimbFinished);
|
SubscribeLocalEvent<ClimbingComponent, ClimbFinishedEvent>(OnClimbFinished);
|
||||||
SubscribeLocalEvent<ClimbingComponent, EndCollideEvent>(OnClimbEndCollide);
|
SubscribeLocalEvent<ClimbingComponent, EndCollideEvent>(OnClimbEndCollide);
|
||||||
@@ -68,17 +68,17 @@ public sealed class ClimbSystem : SharedClimbSystem
|
|||||||
SubscribeLocalEvent<GlassTableComponent, ClimbedOnEvent>(OnGlassClimbed);
|
SubscribeLocalEvent<GlassTableComponent, ClimbedOnEvent>(OnGlassClimbed);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnCanDragDropOn(EntityUid uid, ClimbableComponent component, CanDragDropOnEvent args)
|
protected override void OnCanDragDropOn(EntityUid uid, ClimbableComponent component, ref CanDropTargetEvent args)
|
||||||
{
|
{
|
||||||
base.OnCanDragDropOn(uid, component, args);
|
base.OnCanDragDropOn(uid, component, ref args);
|
||||||
|
|
||||||
if (!args.CanDrop)
|
if (!args.CanDrop)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string reason;
|
string reason;
|
||||||
var canVault = args.User == args.Dragged
|
var canVault = args.User == args.Dragged
|
||||||
? CanVault(component, args.User, args.Target, out reason)
|
? CanVault(component, args.User, uid, out reason)
|
||||||
: CanVault(component, args.User, args.Dragged, args.Target, out reason);
|
: CanVault(component, args.User, args.Dragged, uid, out reason);
|
||||||
|
|
||||||
if (!canVault)
|
if (!canVault)
|
||||||
_popupSystem.PopupEntity(reason, args.User, args.User);
|
_popupSystem.PopupEntity(reason, args.User, args.User);
|
||||||
@@ -103,9 +103,9 @@ public sealed class ClimbSystem : SharedClimbSystem
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnClimbableDragDrop(EntityUid uid, ClimbableComponent component, DragDropEvent args)
|
private void OnClimbableDragDrop(EntityUid uid, ClimbableComponent component, ref DragDropTargetEvent args)
|
||||||
{
|
{
|
||||||
TryMoveEntity(component, args.User, args.Dragged, args.Target);
|
TryMoveEntity(component, args.User, args.Dragged, uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TryMoveEntity(ClimbableComponent component, EntityUid user, EntityUid entityToMove,
|
private void TryMoveEntity(ClimbableComponent component, EntityUid user, EntityUid entityToMove,
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
|||||||
// Interactions
|
// Interactions
|
||||||
SubscribeLocalEvent<DisposalUnitComponent, ActivateInWorldEvent>(HandleActivate);
|
SubscribeLocalEvent<DisposalUnitComponent, ActivateInWorldEvent>(HandleActivate);
|
||||||
SubscribeLocalEvent<DisposalUnitComponent, AfterInteractUsingEvent>(HandleAfterInteractUsing);
|
SubscribeLocalEvent<DisposalUnitComponent, AfterInteractUsingEvent>(HandleAfterInteractUsing);
|
||||||
SubscribeLocalEvent<DisposalUnitComponent, DragDropEvent>(HandleDragDropOn);
|
SubscribeLocalEvent<DisposalUnitComponent, DragDropTargetEvent>(HandleDragDropOn);
|
||||||
SubscribeLocalEvent<DisposalUnitComponent, DestructionEventArgs>(HandleDestruction);
|
SubscribeLocalEvent<DisposalUnitComponent, DestructionEventArgs>(HandleDestruction);
|
||||||
|
|
||||||
// Verbs
|
// Verbs
|
||||||
@@ -391,7 +391,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
|||||||
TryEjectContents(uid, component);
|
TryEjectContents(uid, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleDragDropOn(EntityUid uid, DisposalUnitComponent component, DragDropEvent args)
|
private void HandleDragDropOn(EntityUid uid, DisposalUnitComponent component, ref DragDropTargetEvent args)
|
||||||
{
|
{
|
||||||
args.Handled = TryInsert(uid, args.Dragged, args.User);
|
args.Handled = TryInsert(uid, args.Dragged, args.User);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,58 +60,38 @@ namespace Content.Server.Interaction
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region Drag drop
|
#region Drag drop
|
||||||
|
|
||||||
private void HandleDragDropRequestEvent(DragDropRequestEvent msg, EntitySessionEventArgs args)
|
private void HandleDragDropRequestEvent(DragDropRequestEvent msg, EntitySessionEventArgs args)
|
||||||
{
|
{
|
||||||
if (!ValidateClientInput(args.SenderSession, msg.DropLocation, msg.Target, out var userEntity))
|
if (Deleted(msg.Dragged) || Deleted(msg.Target))
|
||||||
{
|
|
||||||
Logger.InfoS("system.interaction", $"DragDropRequestEvent input validation failed");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Deleted(msg.Dropped) || Deleted(msg.Target))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!_actionBlockerSystem.CanInteract(userEntity.Value, msg.Target))
|
var user = args.SenderSession.AttachedEntity;
|
||||||
return;
|
|
||||||
|
|
||||||
var interactionArgs = new DragDropEvent(userEntity.Value, msg.DropLocation, msg.Dropped, msg.Target);
|
if (user == null || !_actionBlockerSystem.CanInteract(user.Value, msg.Target))
|
||||||
|
return;
|
||||||
|
|
||||||
// must be in range of both the target and the object they are drag / dropping
|
// must be in range of both the target and the object they are drag / dropping
|
||||||
// Client also does this check but ya know we gotta validate it.
|
// Client also does this check but ya know we gotta validate it.
|
||||||
if (!InRangeUnobstructed(interactionArgs.User, interactionArgs.Dragged, popup: true)
|
if (!InRangeUnobstructed(user.Value, msg.Dragged, popup: true)
|
||||||
|| !InRangeUnobstructed(interactionArgs.User, interactionArgs.Target, popup: true))
|
|| !InRangeUnobstructed(user.Value, msg.Target, popup: true))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dragArgs = new DragDropDraggedEvent(user.Value, msg.Target);
|
||||||
|
|
||||||
// trigger dragdrops on the dropped entity
|
// trigger dragdrops on the dropped entity
|
||||||
RaiseLocalEvent(msg.Dropped, interactionArgs, true);
|
RaiseLocalEvent(msg.Dragged, ref dragArgs);
|
||||||
|
|
||||||
if (interactionArgs.Handled)
|
if (dragArgs.Handled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var dragDrop in AllComps<IDraggable>(msg.Dropped))
|
var dropArgs = new DragDropTargetEvent(user.Value, msg.Dragged);
|
||||||
{
|
|
||||||
if (dragDrop.CanDrop(interactionArgs) &&
|
RaiseLocalEvent(msg.Target, ref dropArgs);
|
||||||
dragDrop.Drop(interactionArgs))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// trigger dragdropons on the targeted entity
|
|
||||||
RaiseLocalEvent(msg.Target, interactionArgs, false);
|
|
||||||
|
|
||||||
if (interactionArgs.Handled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
foreach (var dragDropOn in AllComps<IDragDropOn>(msg.Target))
|
|
||||||
{
|
|
||||||
if (dragDropOn.CanDragDropOn(interactionArgs) &&
|
|
||||||
dragDropOn.DragDropOn(interactionArgs))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
using Content.Server.Kitchen.EntitySystems;
|
using Content.Server.Kitchen.EntitySystems;
|
||||||
using Content.Shared.DragDrop;
|
|
||||||
using Content.Shared.Kitchen.Components;
|
using Content.Shared.Kitchen.Components;
|
||||||
|
|
||||||
namespace Content.Server.Kitchen.Components
|
namespace Content.Server.Kitchen.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent, Access(typeof(KitchenSpikeSystem))]
|
[RegisterComponent, Access(typeof(KitchenSpikeSystem)), ComponentReference(typeof(SharedKitchenSpikeComponent))]
|
||||||
public sealed class KitchenSpikeComponent : SharedKitchenSpikeComponent
|
public sealed class KitchenSpikeComponent : SharedKitchenSpikeComponent
|
||||||
{
|
{
|
||||||
public List<string?>? PrototypesToSpawn;
|
public List<string?>? PrototypesToSpawn;
|
||||||
@@ -16,11 +15,5 @@ namespace Content.Server.Kitchen.Components
|
|||||||
|
|
||||||
// Prevents simultaneous spiking of two bodies (could be replaced with CancellationToken, but I don't see any situation where Cancel could be called)
|
// Prevents simultaneous spiking of two bodies (could be replaced with CancellationToken, but I don't see any situation where Cancel could be called)
|
||||||
public bool InUse;
|
public bool InUse;
|
||||||
|
|
||||||
// ECS this out!, when DragDropSystem and InteractionSystem refactored
|
|
||||||
public override bool DragDropOn(DragDropEvent eventArgs)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using Content.Server.DoAfter;
|
|||||||
using Content.Server.Kitchen.Components;
|
using Content.Server.Kitchen.Components;
|
||||||
using Content.Server.Nutrition.Components;
|
using Content.Server.Nutrition.Components;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Shared.Administration.Logs;
|
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.DragDrop;
|
using Content.Shared.DragDrop;
|
||||||
using Content.Shared.IdentityManagement;
|
using Content.Shared.IdentityManagement;
|
||||||
@@ -15,6 +14,7 @@ using Content.Shared.Storage;
|
|||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using static Content.Shared.Kitchen.Components.SharedKitchenSpikeComponent;
|
using static Content.Shared.Kitchen.Components.SharedKitchenSpikeComponent;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
|
using Content.Shared.Kitchen;
|
||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Mobs.Systems;
|
using Content.Shared.Mobs.Systems;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
@@ -22,7 +22,7 @@ using Robust.Server.GameObjects;
|
|||||||
|
|
||||||
namespace Content.Server.Kitchen.EntitySystems
|
namespace Content.Server.Kitchen.EntitySystems
|
||||||
{
|
{
|
||||||
internal sealed class KitchenSpikeSystem : EntitySystem
|
public sealed class KitchenSpikeSystem : SharedKitchenSpikeSystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
[Dependency] private readonly DoAfterSystem _doAfter = default!;
|
[Dependency] private readonly DoAfterSystem _doAfter = default!;
|
||||||
@@ -37,13 +37,21 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
|
|
||||||
SubscribeLocalEvent<KitchenSpikeComponent, InteractUsingEvent>(OnInteractUsing);
|
SubscribeLocalEvent<KitchenSpikeComponent, InteractUsingEvent>(OnInteractUsing);
|
||||||
SubscribeLocalEvent<KitchenSpikeComponent, InteractHandEvent>(OnInteractHand);
|
SubscribeLocalEvent<KitchenSpikeComponent, InteractHandEvent>(OnInteractHand);
|
||||||
SubscribeLocalEvent<KitchenSpikeComponent, DragDropEvent>(OnDragDrop);
|
SubscribeLocalEvent<KitchenSpikeComponent, DragDropTargetEvent>(OnDragDrop);
|
||||||
|
|
||||||
//DoAfter
|
//DoAfter
|
||||||
SubscribeLocalEvent<KitchenSpikeComponent, SpikingFinishedEvent>(OnSpikingFinished);
|
SubscribeLocalEvent<KitchenSpikeComponent, SpikingFinishedEvent>(OnSpikingFinished);
|
||||||
SubscribeLocalEvent<KitchenSpikeComponent, SpikingFailEvent>(OnSpikingFail);
|
SubscribeLocalEvent<KitchenSpikeComponent, SpikingFailEvent>(OnSpikingFail);
|
||||||
|
|
||||||
SubscribeLocalEvent<KitchenSpikeComponent, SuicideEvent>(OnSuicide);
|
SubscribeLocalEvent<KitchenSpikeComponent, SuicideEvent>(OnSuicide);
|
||||||
|
|
||||||
|
SubscribeLocalEvent<ButcherableComponent, CanDropDraggedEvent>(OnButcherableCanDrop);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnButcherableCanDrop(EntityUid uid, ButcherableComponent component, ref CanDropDraggedEvent args)
|
||||||
|
{
|
||||||
|
args.Handled = true;
|
||||||
|
args.CanDrop |= component.Type != ButcheringType.Knife;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSuicide(EntityUid uid, KitchenSpikeComponent component, SuicideEvent args)
|
private void OnSuicide(EntityUid uid, KitchenSpikeComponent component, SuicideEvent args)
|
||||||
@@ -62,7 +70,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
{
|
{
|
||||||
component.InUse = false;
|
component.InUse = false;
|
||||||
|
|
||||||
if (EntityManager.TryGetComponent<SharedButcherableComponent>(args.VictimUid, out var butcherable))
|
if (EntityManager.TryGetComponent<ButcherableComponent>(args.VictimUid, out var butcherable))
|
||||||
butcherable.BeingButchered = false;
|
butcherable.BeingButchered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +78,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
{
|
{
|
||||||
component.InUse = false;
|
component.InUse = false;
|
||||||
|
|
||||||
if (EntityManager.TryGetComponent<SharedButcherableComponent>(args.VictimUid, out var butcherable))
|
if (EntityManager.TryGetComponent<ButcherableComponent>(args.VictimUid, out var butcherable))
|
||||||
butcherable.BeingButchered = false;
|
butcherable.BeingButchered = false;
|
||||||
|
|
||||||
if (Spikeable(uid, args.UserUid, args.VictimUid, component, butcherable))
|
if (Spikeable(uid, args.UserUid, args.VictimUid, component, butcherable))
|
||||||
@@ -79,7 +87,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDragDrop(EntityUid uid, KitchenSpikeComponent component, DragDropEvent args)
|
private void OnDragDrop(EntityUid uid, KitchenSpikeComponent component, ref DragDropTargetEvent args)
|
||||||
{
|
{
|
||||||
if (args.Handled)
|
if (args.Handled)
|
||||||
return;
|
return;
|
||||||
@@ -111,7 +119,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void Spike(EntityUid uid, EntityUid userUid, EntityUid victimUid,
|
private void Spike(EntityUid uid, EntityUid userUid, EntityUid victimUid,
|
||||||
KitchenSpikeComponent? component = null, SharedButcherableComponent? butcherable = null)
|
KitchenSpikeComponent? component = null, ButcherableComponent? butcherable = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref component) || !Resolve(victimUid, ref butcherable))
|
if (!Resolve(uid, ref component) || !Resolve(victimUid, ref butcherable))
|
||||||
return;
|
return;
|
||||||
@@ -177,7 +185,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
private bool Spikeable(EntityUid uid, EntityUid userUid, EntityUid victimUid,
|
private bool Spikeable(EntityUid uid, EntityUid userUid, EntityUid victimUid,
|
||||||
KitchenSpikeComponent? component = null, SharedButcherableComponent? butcherable = null)
|
KitchenSpikeComponent? component = null, ButcherableComponent? butcherable = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref component))
|
if (!Resolve(uid, ref component))
|
||||||
return false;
|
return false;
|
||||||
@@ -208,7 +216,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool TrySpike(EntityUid uid, EntityUid userUid, EntityUid victimUid, KitchenSpikeComponent? component = null,
|
public bool TrySpike(EntityUid uid, EntityUid userUid, EntityUid victimUid, KitchenSpikeComponent? component = null,
|
||||||
SharedButcherableComponent? butcherable = null, MobStateComponent? mobState = null)
|
ButcherableComponent? butcherable = null, MobStateComponent? mobState = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref component) || component.InUse ||
|
if (!Resolve(uid, ref component) || component.InUse ||
|
||||||
!Resolve(victimUid, ref butcherable) || butcherable.BeingButchered)
|
!Resolve(victimUid, ref butcherable) || butcherable.BeingButchered)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public sealed class SharpSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<SharpButcherDoafterComplete>(OnDoafterComplete);
|
SubscribeLocalEvent<SharpButcherDoafterComplete>(OnDoafterComplete);
|
||||||
SubscribeLocalEvent<SharpButcherDoafterCancelled>(OnDoafterCancelled);
|
SubscribeLocalEvent<SharpButcherDoafterCancelled>(OnDoafterCancelled);
|
||||||
|
|
||||||
SubscribeLocalEvent<SharedButcherableComponent, GetVerbsEvent<InteractionVerb>>(OnGetInteractionVerbs);
|
SubscribeLocalEvent<ButcherableComponent, GetVerbsEvent<InteractionVerb>>(OnGetInteractionVerbs);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAfterInteract(EntityUid uid, SharpComponent component, AfterInteractEvent args)
|
private void OnAfterInteract(EntityUid uid, SharpComponent component, AfterInteractEvent args)
|
||||||
@@ -47,7 +47,7 @@ public sealed class SharpSystem : EntitySystem
|
|||||||
|
|
||||||
private void TryStartButcherDoafter(EntityUid knife, EntityUid target, EntityUid user)
|
private void TryStartButcherDoafter(EntityUid knife, EntityUid target, EntityUid user)
|
||||||
{
|
{
|
||||||
if (!TryComp<SharedButcherableComponent>(target, out var butcher))
|
if (!TryComp<ButcherableComponent>(target, out var butcher))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!TryComp<SharpComponent>(knife, out var sharp))
|
if (!TryComp<SharpComponent>(knife, out var sharp))
|
||||||
@@ -79,7 +79,7 @@ public sealed class SharpSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnDoafterComplete(SharpButcherDoafterComplete ev)
|
private void OnDoafterComplete(SharpButcherDoafterComplete ev)
|
||||||
{
|
{
|
||||||
if (!TryComp<SharedButcherableComponent>(ev.Entity, out var butcher))
|
if (!TryComp<ButcherableComponent>(ev.Entity, out var butcher))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!TryComp<SharpComponent>(ev.Sharp, out var sharp))
|
if (!TryComp<SharpComponent>(ev.Sharp, out var sharp))
|
||||||
@@ -123,7 +123,7 @@ public sealed class SharpSystem : EntitySystem
|
|||||||
sharp.Butchering.Remove(ev.Entity);
|
sharp.Butchering.Remove(ev.Entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGetInteractionVerbs(EntityUid uid, SharedButcherableComponent component, GetVerbsEvent<InteractionVerb> args)
|
private void OnGetInteractionVerbs(EntityUid uid, ButcherableComponent component, GetVerbsEvent<InteractionVerb> args)
|
||||||
{
|
{
|
||||||
if (component.Type != ButcheringType.Knife || args.Hands == null)
|
if (component.Type != ButcheringType.Knife || args.Hands == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ namespace Content.Server.Medical.BiomassReclaimer
|
|||||||
{
|
{
|
||||||
component.BloodReagent = stream.BloodReagent;
|
component.BloodReagent = stream.BloodReagent;
|
||||||
}
|
}
|
||||||
if (TryComp<SharedButcherableComponent>(toProcess, out var butcherableComponent))
|
if (TryComp<ButcherableComponent>(toProcess, out var butcherableComponent))
|
||||||
{
|
{
|
||||||
component.SpawnedEntities = butcherableComponent.SpawnedEntities;
|
component.SpawnedEntities = butcherableComponent.SpawnedEntities;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,5 @@ namespace Content.Server.Medical.Components
|
|||||||
|
|
||||||
[DataField("partRatingCloningFailChanceMultiplier")]
|
[DataField("partRatingCloningFailChanceMultiplier")]
|
||||||
public float PartRatingFailMultiplier = 0.75f;
|
public float PartRatingFailMultiplier = 0.75f;
|
||||||
|
|
||||||
// ECS this out!, when DragDropSystem and InteractionSystem refactored
|
|
||||||
public override bool DragDropOn(DragDropEvent eventArgs)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ using Content.Shared.Chemistry;
|
|||||||
using Content.Shared.Chemistry.Components;
|
using Content.Shared.Chemistry.Components;
|
||||||
using Content.Shared.Chemistry.Reagent;
|
using Content.Shared.Chemistry.Reagent;
|
||||||
using Content.Shared.Containers.ItemSlots;
|
using Content.Shared.Containers.ItemSlots;
|
||||||
using Content.Shared.Destructible;
|
|
||||||
using Content.Shared.DragDrop;
|
using Content.Shared.DragDrop;
|
||||||
using Content.Shared.Emag.Systems;
|
using Content.Shared.Emag.Systems;
|
||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
@@ -54,6 +53,7 @@ public sealed partial class CryoPodSystem: SharedCryoPodSystem
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
|
SubscribeLocalEvent<CryoPodComponent, CanDropTargetEvent>(OnCryoPodCanDropOn);
|
||||||
SubscribeLocalEvent<CryoPodComponent, ComponentInit>(OnComponentInit);
|
SubscribeLocalEvent<CryoPodComponent, ComponentInit>(OnComponentInit);
|
||||||
SubscribeLocalEvent<CryoPodComponent, GetVerbsEvent<AlternativeVerb>>(AddAlternativeVerbs);
|
SubscribeLocalEvent<CryoPodComponent, GetVerbsEvent<AlternativeVerb>>(AddAlternativeVerbs);
|
||||||
SubscribeLocalEvent<CryoPodComponent, GotEmaggedEvent>(OnEmagged);
|
SubscribeLocalEvent<CryoPodComponent, GotEmaggedEvent>(OnEmagged);
|
||||||
@@ -63,7 +63,7 @@ public sealed partial class CryoPodSystem: SharedCryoPodSystem
|
|||||||
SubscribeLocalEvent<CryoPodComponent, CryoPodPryInterrupted>(OnCryoPodPryInterrupted);
|
SubscribeLocalEvent<CryoPodComponent, CryoPodPryInterrupted>(OnCryoPodPryInterrupted);
|
||||||
|
|
||||||
SubscribeLocalEvent<CryoPodComponent, AtmosDeviceUpdateEvent>(OnCryoPodUpdateAtmosphere);
|
SubscribeLocalEvent<CryoPodComponent, AtmosDeviceUpdateEvent>(OnCryoPodUpdateAtmosphere);
|
||||||
SubscribeLocalEvent<CryoPodComponent, DragDropEvent>(HandleDragDropOn);
|
SubscribeLocalEvent<CryoPodComponent, DragDropTargetEvent>(HandleDragDropOn);
|
||||||
SubscribeLocalEvent<CryoPodComponent, InteractUsingEvent>(OnInteractUsing);
|
SubscribeLocalEvent<CryoPodComponent, InteractUsingEvent>(OnInteractUsing);
|
||||||
SubscribeLocalEvent<CryoPodComponent, ExaminedEvent>(OnExamined);
|
SubscribeLocalEvent<CryoPodComponent, ExaminedEvent>(OnExamined);
|
||||||
SubscribeLocalEvent<CryoPodComponent, PowerChangedEvent>(OnPowerChanged);
|
SubscribeLocalEvent<CryoPodComponent, PowerChangedEvent>(OnPowerChanged);
|
||||||
@@ -127,7 +127,7 @@ public sealed partial class CryoPodSystem: SharedCryoPodSystem
|
|||||||
|
|
||||||
#region Interaction
|
#region Interaction
|
||||||
|
|
||||||
private void HandleDragDropOn(EntityUid uid, CryoPodComponent cryoPodComponent, DragDropEvent args)
|
private void HandleDragDropOn(EntityUid uid, CryoPodComponent cryoPodComponent, ref DragDropTargetEvent args)
|
||||||
{
|
{
|
||||||
if (cryoPodComponent.BodyContainer.ContainedEntity != null)
|
if (cryoPodComponent.BodyContainer.ContainedEntity != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ using Content.Server.MachineLinking.System;
|
|||||||
using Content.Server.MachineLinking.Events;
|
using Content.Server.MachineLinking.Events;
|
||||||
using Content.Server.Cloning.Components;
|
using Content.Server.Cloning.Components;
|
||||||
using Content.Server.Construction;
|
using Content.Server.Construction;
|
||||||
|
using Content.Server.Power.EntitySystems;
|
||||||
|
using Content.Shared.Body.Components;
|
||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Mobs.Systems;
|
using Content.Shared.Mobs.Systems;
|
||||||
using Robust.Server.Containers;
|
using Robust.Server.Containers;
|
||||||
@@ -42,11 +44,26 @@ namespace Content.Server.Medical
|
|||||||
SubscribeLocalEvent<MedicalScannerComponent, GetVerbsEvent<InteractionVerb>>(AddInsertOtherVerb);
|
SubscribeLocalEvent<MedicalScannerComponent, GetVerbsEvent<InteractionVerb>>(AddInsertOtherVerb);
|
||||||
SubscribeLocalEvent<MedicalScannerComponent, GetVerbsEvent<AlternativeVerb>>(AddAlternativeVerbs);
|
SubscribeLocalEvent<MedicalScannerComponent, GetVerbsEvent<AlternativeVerb>>(AddAlternativeVerbs);
|
||||||
SubscribeLocalEvent<MedicalScannerComponent, DestructionEventArgs>(OnDestroyed);
|
SubscribeLocalEvent<MedicalScannerComponent, DestructionEventArgs>(OnDestroyed);
|
||||||
SubscribeLocalEvent<MedicalScannerComponent, DragDropEvent>(HandleDragDropOn);
|
SubscribeLocalEvent<MedicalScannerComponent, DragDropTargetEvent>(OnDragDropOn);
|
||||||
SubscribeLocalEvent<MedicalScannerComponent, PortDisconnectedEvent>(OnPortDisconnected);
|
SubscribeLocalEvent<MedicalScannerComponent, PortDisconnectedEvent>(OnPortDisconnected);
|
||||||
SubscribeLocalEvent<MedicalScannerComponent, AnchorStateChangedEvent>(OnAnchorChanged);
|
SubscribeLocalEvent<MedicalScannerComponent, AnchorStateChangedEvent>(OnAnchorChanged);
|
||||||
SubscribeLocalEvent<MedicalScannerComponent, RefreshPartsEvent>(OnRefreshParts);
|
SubscribeLocalEvent<MedicalScannerComponent, RefreshPartsEvent>(OnRefreshParts);
|
||||||
SubscribeLocalEvent<MedicalScannerComponent, UpgradeExamineEvent>(OnUpgradeExamine);
|
SubscribeLocalEvent<MedicalScannerComponent, UpgradeExamineEvent>(OnUpgradeExamine);
|
||||||
|
SubscribeLocalEvent<MedicalScannerComponent, CanDropTargetEvent>(OnCanDragDropOn);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCanDragDropOn(EntityUid uid, MedicalScannerComponent component, ref CanDropTargetEvent args)
|
||||||
|
{
|
||||||
|
args.Handled = true;
|
||||||
|
args.CanDrop |= CanScannerInsert(uid, args.Dragged, component);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanScannerInsert(EntityUid uid, EntityUid target, MedicalScannerComponent? component = null)
|
||||||
|
{
|
||||||
|
if (!Resolve(uid, ref component))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return HasComp<BodyComponent>(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnComponentInit(EntityUid uid, MedicalScannerComponent scannerComponent, ComponentInit args)
|
private void OnComponentInit(EntityUid uid, MedicalScannerComponent scannerComponent, ComponentInit args)
|
||||||
@@ -58,7 +75,7 @@ namespace Content.Server.Medical
|
|||||||
|
|
||||||
private void OnRelayMovement(EntityUid uid, MedicalScannerComponent scannerComponent, ref ContainerRelayMovementEntityEvent args)
|
private void OnRelayMovement(EntityUid uid, MedicalScannerComponent scannerComponent, ref ContainerRelayMovementEntityEvent args)
|
||||||
{
|
{
|
||||||
if (!_blocker.CanInteract(args.Entity, scannerComponent.Owner))
|
if (!_blocker.CanInteract(args.Entity, uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EjectBody(uid, scannerComponent);
|
EjectBody(uid, scannerComponent);
|
||||||
@@ -70,7 +87,7 @@ namespace Content.Server.Medical
|
|||||||
!args.CanAccess ||
|
!args.CanAccess ||
|
||||||
!args.CanInteract ||
|
!args.CanInteract ||
|
||||||
IsOccupied(component) ||
|
IsOccupied(component) ||
|
||||||
!component.CanInsert(args.Using.Value))
|
!CanScannerInsert(uid, args.Using.Value, component))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string name = "Unknown";
|
string name = "Unknown";
|
||||||
@@ -79,7 +96,7 @@ namespace Content.Server.Medical
|
|||||||
|
|
||||||
InteractionVerb verb = new()
|
InteractionVerb verb = new()
|
||||||
{
|
{
|
||||||
Act = () => InsertBody(component.Owner, args.Target, component),
|
Act = () => InsertBody(uid, args.Target, component),
|
||||||
Category = VerbCategory.Insert,
|
Category = VerbCategory.Insert,
|
||||||
Text = name
|
Text = name
|
||||||
};
|
};
|
||||||
@@ -104,11 +121,11 @@ namespace Content.Server.Medical
|
|||||||
|
|
||||||
// Self-insert verb
|
// Self-insert verb
|
||||||
if (!IsOccupied(component) &&
|
if (!IsOccupied(component) &&
|
||||||
component.CanInsert(args.User) &&
|
CanScannerInsert(uid, args.User, component) &&
|
||||||
_blocker.CanMove(args.User))
|
_blocker.CanMove(args.User))
|
||||||
{
|
{
|
||||||
AlternativeVerb verb = new();
|
AlternativeVerb verb = new();
|
||||||
verb.Act = () => InsertBody(component.Owner, args.User, component);
|
verb.Act = () => InsertBody(uid, args.User, component);
|
||||||
verb.Text = Loc.GetString("medical-scanner-verb-enter");
|
verb.Text = Loc.GetString("medical-scanner-verb-enter");
|
||||||
args.Verbs.Add(verb);
|
args.Verbs.Add(verb);
|
||||||
}
|
}
|
||||||
@@ -119,7 +136,7 @@ namespace Content.Server.Medical
|
|||||||
EjectBody(uid, scannerComponent);
|
EjectBody(uid, scannerComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleDragDropOn(EntityUid uid, MedicalScannerComponent scannerComponent, DragDropEvent args)
|
private void OnDragDropOn(EntityUid uid, MedicalScannerComponent scannerComponent, ref DragDropTargetEvent args)
|
||||||
{
|
{
|
||||||
InsertBody(uid, args.Dragged, scannerComponent);
|
InsertBody(uid, args.Dragged, scannerComponent);
|
||||||
}
|
}
|
||||||
@@ -141,9 +158,9 @@ namespace Content.Server.Medical
|
|||||||
}
|
}
|
||||||
_cloningConsoleSystem.UpdateUserInterface(console);
|
_cloningConsoleSystem.UpdateUserInterface(console);
|
||||||
}
|
}
|
||||||
private MedicalScannerStatus GetStatus(MedicalScannerComponent scannerComponent)
|
private MedicalScannerStatus GetStatus(EntityUid uid, MedicalScannerComponent scannerComponent)
|
||||||
{
|
{
|
||||||
if (TryComp<ApcPowerReceiverComponent>(scannerComponent.Owner, out var power) && power.Powered)
|
if (this.IsPowered(uid, EntityManager))
|
||||||
{
|
{
|
||||||
var body = scannerComponent.BodyContainer.ContainedEntity;
|
var body = scannerComponent.BodyContainer.ContainedEntity;
|
||||||
if (body == null)
|
if (body == null)
|
||||||
@@ -180,9 +197,9 @@ namespace Content.Server.Medical
|
|||||||
|
|
||||||
private void UpdateAppearance(EntityUid uid, MedicalScannerComponent scannerComponent)
|
private void UpdateAppearance(EntityUid uid, MedicalScannerComponent scannerComponent)
|
||||||
{
|
{
|
||||||
if (TryComp<AppearanceComponent>(scannerComponent.Owner, out var appearance))
|
if (TryComp<AppearanceComponent>(uid, out var appearance))
|
||||||
{
|
{
|
||||||
_appearance.SetData(uid, MedicalScannerVisuals.Status, GetStatus(scannerComponent), appearance);
|
_appearance.SetData(uid, MedicalScannerVisuals.Status, GetStatus(uid, scannerComponent), appearance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,11 +227,11 @@ namespace Content.Server.Medical
|
|||||||
if (scannerComponent.BodyContainer.ContainedEntity != null)
|
if (scannerComponent.BodyContainer.ContainedEntity != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!TryComp<MobStateComponent>(user, out var comp))
|
if (!HasComp<MobStateComponent>(user))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
scannerComponent.BodyContainer.Insert(user);
|
scannerComponent.BodyContainer.Insert(user);
|
||||||
UpdateAppearance(scannerComponent.Owner, scannerComponent);
|
UpdateAppearance(uid, scannerComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EjectBody(EntityUid uid, MedicalScannerComponent? scannerComponent)
|
public void EjectBody(EntityUid uid, MedicalScannerComponent? scannerComponent)
|
||||||
@@ -222,11 +239,12 @@ namespace Content.Server.Medical
|
|||||||
if (!Resolve(uid, ref scannerComponent))
|
if (!Resolve(uid, ref scannerComponent))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (scannerComponent.BodyContainer.ContainedEntity is not {Valid: true} contained) return;
|
if (scannerComponent.BodyContainer.ContainedEntity is not {Valid: true} contained)
|
||||||
|
return;
|
||||||
|
|
||||||
scannerComponent.BodyContainer.Remove(contained);
|
scannerComponent.BodyContainer.Remove(contained);
|
||||||
_climbSystem.ForciblySetClimbing(contained, uid);
|
_climbSystem.ForciblySetClimbing(contained, uid);
|
||||||
UpdateAppearance(scannerComponent.Owner, scannerComponent);
|
UpdateAppearance(uid, scannerComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRefreshParts(EntityUid uid, MedicalScannerComponent component, RefreshPartsEvent args)
|
private void OnRefreshParts(EntityUid uid, MedicalScannerComponent component, RefreshPartsEvent args)
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
using System.Threading;
|
|
||||||
using Content.Shared.DragDrop;
|
|
||||||
using Content.Shared.Strip.Components;
|
|
||||||
|
|
||||||
namespace Content.Server.Strip
|
|
||||||
{
|
|
||||||
[RegisterComponent]
|
|
||||||
[ComponentReference(typeof(SharedStrippableComponent))]
|
|
||||||
[Access(typeof(StrippableSystem))]
|
|
||||||
public sealed class StrippableComponent : SharedStrippableComponent
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The strip delay for hands.
|
|
||||||
/// </summary>
|
|
||||||
[DataField("handDelay")]
|
|
||||||
public float HandStripDelay = 4f;
|
|
||||||
|
|
||||||
public override bool Drop(DragDropEvent args)
|
|
||||||
{
|
|
||||||
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<StrippableSystem>().StartOpeningStripper(args.User, this);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dictionary<EntityUid, CancellationTokenSource> CancelTokens = new();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,10 +17,11 @@ using Content.Server.Administration.Logs;
|
|||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Ensnaring.Components;
|
using Content.Shared.Ensnaring.Components;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
|
using Content.Shared.Strip;
|
||||||
|
|
||||||
namespace Content.Server.Strip
|
namespace Content.Server.Strip
|
||||||
{
|
{
|
||||||
public sealed class StrippableSystem : EntitySystem
|
public sealed class StrippableSystem : SharedStrippableSystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||||
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
||||||
@@ -104,8 +105,10 @@ namespace Content.Server.Strip
|
|||||||
TakeItemFromHands(user, handId, component);
|
TakeItemFromHands(user, handId, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartOpeningStripper(EntityUid user, StrippableComponent component, bool openInCombat = false)
|
public override void StartOpeningStripper(EntityUid user, StrippableComponent component, bool openInCombat = false)
|
||||||
{
|
{
|
||||||
|
base.StartOpeningStripper(user, component, openInCombat);
|
||||||
|
|
||||||
if (TryComp<SharedCombatModeComponent>(user, out var mode) && mode.IsInCombatMode && !openInCombat)
|
if (TryComp<SharedCombatModeComponent>(user, out var mode) && mode.IsInCombatMode && !openInCombat)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -446,25 +449,5 @@ namespace Content.Server.Strip
|
|||||||
// hand update will trigger strippable update
|
// hand update will trigger strippable update
|
||||||
_adminLogger.Add(LogType.Stripping, LogImpact.Medium, $"{ToPrettyString(user):user} has stripped the item {ToPrettyString(held):item} from {ToPrettyString(component.Owner):target}");
|
_adminLogger.Add(LogType.Stripping, LogImpact.Medium, $"{ToPrettyString(user):user} has stripped the item {ToPrettyString(held):item} from {ToPrettyString(component.Owner):target}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private sealed class OpenStrippingCompleteEvent
|
|
||||||
{
|
|
||||||
public readonly EntityUid User;
|
|
||||||
|
|
||||||
public OpenStrippingCompleteEvent(EntityUid user)
|
|
||||||
{
|
|
||||||
User = user;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private sealed class OpenStrippingCancelledEvent
|
|
||||||
{
|
|
||||||
public readonly EntityUid User;
|
|
||||||
|
|
||||||
public OpenStrippingCancelledEvent(EntityUid user)
|
|
||||||
{
|
|
||||||
User = user;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.Body.Events;
|
using Content.Shared.Body.Events;
|
||||||
using Content.Shared.DragDrop;
|
using Content.Shared.DragDrop;
|
||||||
using Content.Shared.Emoting;
|
using Content.Shared.Emoting;
|
||||||
|
using Content.Shared.Hands;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Item;
|
using Content.Shared.Item;
|
||||||
@@ -115,7 +116,7 @@ namespace Content.Shared.ActionBlocker
|
|||||||
|
|
||||||
public bool CanDrop(EntityUid uid)
|
public bool CanDrop(EntityUid uid)
|
||||||
{
|
{
|
||||||
var ev = new DropAttemptEvent(uid);
|
var ev = new DropAttemptEvent();
|
||||||
RaiseLocalEvent(uid, ev);
|
RaiseLocalEvent(uid, ev);
|
||||||
|
|
||||||
return !ev.Cancelled;
|
return !ev.Cancelled;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using Content.Shared.Body.Part;
|
using Content.Shared.Body.Part;
|
||||||
using Content.Shared.Body.Prototypes;
|
using Content.Shared.Body.Prototypes;
|
||||||
using Content.Shared.Body.Systems;
|
using Content.Shared.Body.Systems;
|
||||||
using Content.Shared.DragDrop;
|
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
@@ -10,7 +9,7 @@ namespace Content.Shared.Body.Components;
|
|||||||
|
|
||||||
[RegisterComponent, NetworkedComponent]
|
[RegisterComponent, NetworkedComponent]
|
||||||
[Access(typeof(SharedBodySystem))]
|
[Access(typeof(SharedBodySystem))]
|
||||||
public sealed class BodyComponent : Component, IDraggable
|
public sealed class BodyComponent : Component
|
||||||
{
|
{
|
||||||
[DataField("prototype", customTypeSerializer: typeof(PrototypeIdSerializer<BodyPrototype>))]
|
[DataField("prototype", customTypeSerializer: typeof(PrototypeIdSerializer<BodyPrototype>))]
|
||||||
public readonly string? Prototype;
|
public readonly string? Prototype;
|
||||||
@@ -27,14 +26,4 @@ public sealed class BodyComponent : Component, IDraggable
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("requiredLegs")]
|
[DataField("requiredLegs")]
|
||||||
public int RequiredLegs;
|
public int RequiredLegs;
|
||||||
|
|
||||||
bool IDraggable.CanStartDrag(StartDragDropEvent args)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IDraggable.CanDrop(CanDropEvent args)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Shared.Body.Organ;
|
|||||||
using Content.Shared.Body.Part;
|
using Content.Shared.Body.Part;
|
||||||
using Content.Shared.Body.Prototypes;
|
using Content.Shared.Body.Prototypes;
|
||||||
using Content.Shared.Coordinates;
|
using Content.Shared.Coordinates;
|
||||||
|
using Content.Shared.DragDrop;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
|
|
||||||
@@ -18,6 +19,12 @@ public partial class SharedBodySystem
|
|||||||
|
|
||||||
SubscribeLocalEvent<BodyComponent, ComponentGetState>(OnBodyGetState);
|
SubscribeLocalEvent<BodyComponent, ComponentGetState>(OnBodyGetState);
|
||||||
SubscribeLocalEvent<BodyComponent, ComponentHandleState>(OnBodyHandleState);
|
SubscribeLocalEvent<BodyComponent, ComponentHandleState>(OnBodyHandleState);
|
||||||
|
SubscribeLocalEvent<BodyComponent, CanDragEvent>(OnBodyCanDrag);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnBodyCanDrag(EntityUid uid, BodyComponent component, ref CanDragEvent args)
|
||||||
|
{
|
||||||
|
args.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBodyInit(EntityUid bodyId, BodyComponent body, ComponentInit args)
|
private void OnBodyInit(EntityUid bodyId, BodyComponent body, ComponentInit args)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public abstract partial class SharedBuckleSystem
|
|||||||
{
|
{
|
||||||
SubscribeLocalEvent<StrapComponent, MoveEvent>(OnStrapRotate);
|
SubscribeLocalEvent<StrapComponent, MoveEvent>(OnStrapRotate);
|
||||||
SubscribeLocalEvent<StrapComponent, ComponentHandleState>(OnStrapHandleState);
|
SubscribeLocalEvent<StrapComponent, ComponentHandleState>(OnStrapHandleState);
|
||||||
SubscribeLocalEvent<StrapComponent, CanDragDropOnEvent>(OnStrapCanDragDropOn);
|
SubscribeLocalEvent<StrapComponent, CanDropTargetEvent>(OnStrapCanDropOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnStrapHandleState(EntityUid uid, StrapComponent component, ref ComponentHandleState args)
|
private void OnStrapHandleState(EntityUid uid, StrapComponent component, ref ComponentHandleState args)
|
||||||
@@ -85,9 +85,9 @@ public abstract partial class SharedBuckleSystem
|
|||||||
return _interactions.InRangeUnobstructed(target, buckleId, buckle.Range, predicate: Ignored);
|
return _interactions.InRangeUnobstructed(target, buckleId, buckle.Range, predicate: Ignored);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnStrapCanDragDropOn(EntityUid uid, StrapComponent strap, CanDragDropOnEvent args)
|
private void OnStrapCanDropOn(EntityUid uid, StrapComponent strap, ref CanDropTargetEvent args)
|
||||||
{
|
{
|
||||||
args.CanDrop = StrapCanDragDropOn(args.Target, args.User, args.Target, args.Dragged, strap);
|
args.CanDrop = StrapCanDragDropOn(uid, args.User, uid, args.Dragged, strap);
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public sealed class BonkSystem : EntitySystem
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeLocalEvent<BonkableComponent, DragDropEvent>(OnDragDrop);
|
SubscribeLocalEvent<BonkableComponent, DragDropTargetEvent>(OnDragDrop);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryBonk(EntityUid user, EntityUid bonkableUid, BonkableComponent? bonkableComponent = null)
|
public bool TryBonk(EntityUid user, EntityUid bonkableUid, BonkableComponent? bonkableComponent = null)
|
||||||
@@ -56,8 +56,8 @@ public sealed class BonkSystem : EntitySystem
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDragDrop(EntityUid user, BonkableComponent bonkableComponent, DragDropEvent args)
|
private void OnDragDrop(EntityUid uid, BonkableComponent bonkableComponent, ref DragDropTargetEvent args)
|
||||||
{
|
{
|
||||||
TryBonk(args.Dragged, args.Target);
|
TryBonk(args.Dragged, uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Content.Shared.DragDrop;
|
using Content.Shared.DragDrop;
|
||||||
using Content.Shared.Movement;
|
|
||||||
using Content.Shared.Movement.Events;
|
using Content.Shared.Movement.Events;
|
||||||
|
|
||||||
namespace Content.Shared.Climbing;
|
namespace Content.Shared.Climbing;
|
||||||
@@ -10,7 +9,6 @@ public abstract class SharedClimbSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeLocalEvent<ClimbingComponent, UpdateCanMoveEvent>(HandleMoveAttempt);
|
SubscribeLocalEvent<ClimbingComponent, UpdateCanMoveEvent>(HandleMoveAttempt);
|
||||||
SubscribeLocalEvent<ClimbableComponent, CanDragDropOnEvent>(OnCanDragDropOn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HandleMoveAttempt(EntityUid uid, ClimbingComponent component, UpdateCanMoveEvent args)
|
private static void HandleMoveAttempt(EntityUid uid, ClimbingComponent component, UpdateCanMoveEvent args)
|
||||||
@@ -22,7 +20,7 @@ public abstract class SharedClimbSystem : EntitySystem
|
|||||||
args.Cancel();
|
args.Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnCanDragDropOn(EntityUid uid, ClimbableComponent component, CanDragDropOnEvent args)
|
protected virtual void OnCanDragDropOn(EntityUid uid, ClimbableComponent component, ref CanDropTargetEvent args)
|
||||||
{
|
{
|
||||||
args.CanDrop = HasComp<ClimbingComponent>(args.Dragged);
|
args.CanDrop = HasComp<ClimbingComponent>(args.Dragged);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.ActionBlocker;
|
|||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using Content.Shared.Cuffs.Components;
|
using Content.Shared.Cuffs.Components;
|
||||||
using Content.Shared.DragDrop;
|
using Content.Shared.DragDrop;
|
||||||
|
using Content.Shared.Hands;
|
||||||
using Content.Shared.Hands.Components;
|
using Content.Shared.Hands.Components;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Inventory.Events;
|
using Content.Shared.Inventory.Events;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace Content.Shared.Disposal
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeLocalEvent<SharedDisposalUnitComponent, PreventCollideEvent>(OnPreventCollide);
|
SubscribeLocalEvent<SharedDisposalUnitComponent, PreventCollideEvent>(OnPreventCollide);
|
||||||
SubscribeLocalEvent<SharedDisposalUnitComponent, CanDragDropOnEvent>(OnCanDragDropOn);
|
SubscribeLocalEvent<SharedDisposalUnitComponent, CanDropTargetEvent>(OnCanDragDropOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPreventCollide(EntityUid uid, SharedDisposalUnitComponent component, ref PreventCollideEvent args)
|
private void OnPreventCollide(EntityUid uid, SharedDisposalUnitComponent component, ref PreventCollideEvent args)
|
||||||
@@ -48,9 +48,10 @@ namespace Content.Shared.Disposal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCanDragDropOn(EntityUid uid, SharedDisposalUnitComponent component, CanDragDropOnEvent args)
|
private void OnCanDragDropOn(EntityUid uid, SharedDisposalUnitComponent component, ref CanDropTargetEvent args)
|
||||||
{
|
{
|
||||||
if (args.Handled) return;
|
if (args.Handled)
|
||||||
|
return;
|
||||||
|
|
||||||
args.CanDrop = CanInsert(component, args.Dragged);
|
args.CanDrop = CanInsert(component, args.Dragged);
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
namespace Content.Shared.DragDrop;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Event that gets send to the target of a drag drop action
|
|
||||||
/// Mark this event as handled to specify that the entity can be dropped on
|
|
||||||
/// and set CanDrop to true or false, depending on whether dropping the entity onto the target is actually possible.
|
|
||||||
/// </summary>
|
|
||||||
public sealed class CanDragDropOnEvent : HandledEntityEventArgs
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Entity doing the drag and drop.
|
|
||||||
/// </summary>
|
|
||||||
public EntityUid User { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Entity that is being dragged.
|
|
||||||
/// </summary>
|
|
||||||
public EntityUid Dragged { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Entity that is being dropped on.
|
|
||||||
/// </summary>
|
|
||||||
public EntityUid Target { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If the dragged entity can be dropped on the target.
|
|
||||||
/// </summary>
|
|
||||||
public bool CanDrop { get; set; } = false;
|
|
||||||
|
|
||||||
public CanDragDropOnEvent(EntityUid user, EntityUid dragged, EntityUid target)
|
|
||||||
{
|
|
||||||
User = user;
|
|
||||||
Dragged = dragged;
|
|
||||||
Target = target;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,33 +1,26 @@
|
|||||||
using Robust.Shared.Map;
|
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Shared.DragDrop
|
namespace Content.Shared.DragDrop
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Requests a drag / drop interaction to be performed
|
/// Raised on the client to the server requesting a drag-drop.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public sealed class DragDropRequestEvent : EntityEventArgs
|
public sealed class DragDropRequestEvent : EntityEventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Location that the entity was dropped.
|
|
||||||
/// </summary>
|
|
||||||
public EntityCoordinates DropLocation { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Entity that was dragged and dropped.
|
/// Entity that was dragged and dropped.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EntityUid Dropped { get; }
|
public EntityUid Dragged { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Entity that was drag dropped on.
|
/// Entity that was drag dropped on.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EntityUid Target { get; }
|
public EntityUid Target { get; }
|
||||||
|
|
||||||
public DragDropRequestEvent(EntityCoordinates dropLocation, EntityUid dropped, EntityUid target)
|
public DragDropRequestEvent(EntityUid dragged, EntityUid target)
|
||||||
{
|
{
|
||||||
DropLocation = dropLocation;
|
Dragged = dragged;
|
||||||
Dropped = dropped;
|
|
||||||
Target = target;
|
Target = target;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
67
Content.Shared/DragDrop/DraggableEvents.cs
Normal file
67
Content.Shared/DragDrop/DraggableEvents.cs
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
namespace Content.Shared.DragDrop;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised directed on an entity when attempting to start a drag.
|
||||||
|
/// </summary>
|
||||||
|
[ByRefEvent]
|
||||||
|
public record struct CanDragEvent
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// False if we are unable to drag this entity.
|
||||||
|
/// </summary>
|
||||||
|
public bool Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised directed on a dragged entity to indicate whether it has interactions with the target entity.
|
||||||
|
/// </summary>
|
||||||
|
[ByRefEvent]
|
||||||
|
public record struct CanDropDraggedEvent(EntityUid User, EntityUid Target)
|
||||||
|
{
|
||||||
|
public readonly EntityUid User = User;
|
||||||
|
public readonly EntityUid Target = Target;
|
||||||
|
public bool Handled = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Can we drop the entity onto the target? If the event is not handled then there is no supported interactions.
|
||||||
|
/// </summary>
|
||||||
|
public bool CanDrop = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised directed on the target entity to indicate whether it has interactions with the dragged entity.
|
||||||
|
/// </summary>
|
||||||
|
[ByRefEvent]
|
||||||
|
public record struct CanDropTargetEvent(EntityUid User, EntityUid Dragged)
|
||||||
|
{
|
||||||
|
public readonly EntityUid User = User;
|
||||||
|
public readonly EntityUid Dragged = Dragged;
|
||||||
|
public bool Handled = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <see cref="CanDropDraggedEvent"/>
|
||||||
|
/// </summary>
|
||||||
|
public bool CanDrop = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised directed on a dragged entity when it is dropped on a target entity.
|
||||||
|
/// </summary>
|
||||||
|
[ByRefEvent]
|
||||||
|
public record struct DragDropDraggedEvent(EntityUid User, EntityUid Target)
|
||||||
|
{
|
||||||
|
public readonly EntityUid User = User;
|
||||||
|
public readonly EntityUid Target = Target;
|
||||||
|
public bool Handled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised directed on the target entity when a dragged entity is dragged onto it.
|
||||||
|
/// </summary>
|
||||||
|
[ByRefEvent]
|
||||||
|
public record struct DragDropTargetEvent(EntityUid User, EntityUid Dragged)
|
||||||
|
{
|
||||||
|
public readonly EntityUid User = User;
|
||||||
|
public readonly EntityUid Dragged = Dragged;
|
||||||
|
public bool Handled = false;
|
||||||
|
}
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
namespace Content.Shared.DragDrop
|
|
||||||
{
|
|
||||||
public sealed class DropAttemptEvent : CancellableEntityEventArgs
|
|
||||||
{
|
|
||||||
public DropAttemptEvent(EntityUid uid)
|
|
||||||
{
|
|
||||||
Uid = uid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EntityUid Uid { get; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
namespace Content.Shared.DragDrop
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// This interface allows the component's entity to be dragged and dropped
|
|
||||||
/// onto by another entity and gives it behavior when that occurs.
|
|
||||||
/// </summary>
|
|
||||||
[RequiresExplicitImplementation]
|
|
||||||
public interface IDragDropOn
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Invoked when another entity is being dragged and dropped
|
|
||||||
/// onto this one before invoking <see cref="DragDropOn"/>.
|
|
||||||
/// Note that other drag and drop interactions may be attempted if
|
|
||||||
/// this one fails.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="eventArgs"></param>
|
|
||||||
/// <returns>true if <see cref="eventArgs"/> is valid, false otherwise.</returns>
|
|
||||||
bool CanDragDropOn(DragDropEvent eventArgs);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Invoked server-side when another entity is being dragged and dropped
|
|
||||||
/// onto this one before invoking <see cref="DragDropOn"/>
|
|
||||||
/// Note that other drag and drop interactions may be attempted if
|
|
||||||
/// this one fails.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>
|
|
||||||
/// true if an interaction occurred and no further interaction should
|
|
||||||
/// be processed for this drop.
|
|
||||||
/// </returns>
|
|
||||||
bool DragDropOn(DragDropEvent eventArgs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
using Robust.Shared.Map;
|
|
||||||
|
|
||||||
namespace Content.Shared.DragDrop
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// This interface allows a local client to initiate dragging of the component's
|
|
||||||
/// entity by mouse, for drag and drop interactions.
|
|
||||||
/// </summary>
|
|
||||||
[RequiresExplicitImplementation]
|
|
||||||
public interface IDraggable
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Invoked when an user is attempting to initiate a drag with
|
|
||||||
/// this component's entity in range. 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.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="args">
|
|
||||||
/// The information about the drag, such as who is doing it.
|
|
||||||
/// </param>
|
|
||||||
/// <returns>True if the drag should be initiated, false otherwise.</returns>
|
|
||||||
bool CanStartDrag(StartDragDropEvent args)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 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.
|
|
||||||
/// Returning true will cause the target entity to be highlighted as
|
|
||||||
/// a potential target and allow dropping when in range.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>
|
|
||||||
/// True if target is a valid target to be dropped on by this component's
|
|
||||||
/// entity, false otherwise.
|
|
||||||
/// </returns>
|
|
||||||
bool CanDrop(CanDropEvent args);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Invoked when this component's entity is being dropped on another.
|
|
||||||
/// Other drag and drop interactions may be attempted if this one fails.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="args">
|
|
||||||
/// The information about the drag, such as who is doing it.
|
|
||||||
/// </param>
|
|
||||||
/// <returns>
|
|
||||||
/// True if an interaction occurred and no further interaction should
|
|
||||||
/// be processed for this drop, false otherwise.
|
|
||||||
/// </returns>
|
|
||||||
bool Drop(DragDropEvent args)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Virtual]
|
|
||||||
public class StartDragDropEvent : HandledEntityEventArgs
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Entity doing the drag and drop.
|
|
||||||
/// </summary>
|
|
||||||
public EntityUid User { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Entity that is being dragged.
|
|
||||||
/// </summary>
|
|
||||||
public EntityUid Dragged { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a new instance of <see cref="StartDragDropEvent"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="user">The entity doing the drag and drop.</param>
|
|
||||||
/// <param name="dragged">The entity that is being dragged and dropped.</param>
|
|
||||||
public StartDragDropEvent(EntityUid user, EntityUid dragged)
|
|
||||||
{
|
|
||||||
User = user;
|
|
||||||
Dragged = dragged;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Virtual]
|
|
||||||
public class CanDropEvent : StartDragDropEvent
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The entity uid that <see cref="StartDragDropEvent.Dragged"/>
|
|
||||||
/// is being dropped onto.
|
|
||||||
/// </summary>
|
|
||||||
public EntityUid Target { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a new instance of <see cref="CanDropEvent"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="user">The entity doing the drag and drop.</param>
|
|
||||||
/// <param name="dragged">The entity that is being dragged and dropped.</param>
|
|
||||||
/// <param name="target">The entity that <see cref="dragged"/> is being dropped onto.</param>
|
|
||||||
public CanDropEvent(EntityUid user, EntityUid dragged, EntityUid target) : base(user, dragged)
|
|
||||||
{
|
|
||||||
Target = target;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Virtual]
|
|
||||||
public class DragDropEvent : CanDropEvent
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The location where <see cref="StartDragDropEvent.Dragged"/>
|
|
||||||
/// is being dropped.
|
|
||||||
/// </summary>
|
|
||||||
public EntityCoordinates DropLocation { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a new instance of <see cref="DragDropEvent"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="user">The entity doing the drag and drop.</param>
|
|
||||||
/// <param name="dropLocation">The location where <see cref="dropped"/> is being dropped.</param>
|
|
||||||
/// <param name="dragged">The entity that is being dragged and dropped.</param>
|
|
||||||
/// <param name="target">The entity that <see cref="dropped"/> is being dropped onto.</param>
|
|
||||||
public DragDropEvent(EntityUid user, EntityCoordinates dropLocation, EntityUid dragged, EntityUid target) : base(user, dragged, target)
|
|
||||||
{
|
|
||||||
DropLocation = dropLocation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,12 +2,5 @@
|
|||||||
|
|
||||||
public abstract class SharedDragDropSystem : EntitySystem
|
public abstract class SharedDragDropSystem : EntitySystem
|
||||||
{
|
{
|
||||||
protected bool? CheckDragDropOn(DragDropEvent eventArgs)
|
|
||||||
{
|
|
||||||
var canDragDropOnEvent = new CanDragDropOnEvent(eventArgs.User, eventArgs.Dragged, eventArgs.Target);
|
|
||||||
|
|
||||||
RaiseLocalEvent(eventArgs.Target, canDragDropOnEvent, false);
|
|
||||||
|
|
||||||
return canDragDropOnEvent.Handled ? canDragDropOnEvent.CanDrop : null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Shared.DragDrop;
|
using Content.Shared.DragDrop;
|
||||||
using Content.Shared.Emoting;
|
using Content.Shared.Emoting;
|
||||||
|
using Content.Shared.Hands;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Item;
|
using Content.Shared.Item;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|||||||
@@ -7,6 +7,14 @@ using static Robust.Shared.GameObjects.SharedSpriteComponent;
|
|||||||
|
|
||||||
namespace Content.Shared.Hands
|
namespace Content.Shared.Hands
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Raised directed on an entity when attempting to drop its hand items.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class DropAttemptEvent : CancellableEntityEventArgs
|
||||||
|
{
|
||||||
|
public readonly EntityUid Uid;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Raised directed at an item that needs to update its in-hand sprites/layers.
|
/// Raised directed at an item that needs to update its in-hand sprites/layers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -243,8 +243,8 @@ public abstract partial class InventorySystem
|
|||||||
// that requires server/client specific code.
|
// that requires server/client specific code.
|
||||||
// Uhhh TODO, fix this. This doesn't even fucking check if the target item is IN the targets inventory.
|
// Uhhh TODO, fix this. This doesn't even fucking check if the target item is IN the targets inventory.
|
||||||
return actor != target &&
|
return actor != target &&
|
||||||
HasComp<SharedStrippableComponent>(target) &&
|
HasComp<StrippableComponent>(target) &&
|
||||||
HasComp<SharedStrippingComponent>(actor) &&
|
HasComp<StrippingComponent>(actor) &&
|
||||||
HasComp<SharedHandsComponent>(actor);
|
HasComp<SharedHandsComponent>(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
using Content.Shared.DragDrop;
|
|
||||||
using Content.Shared.Nutrition.Components;
|
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Shared.Kitchen.Components
|
namespace Content.Shared.Kitchen.Components
|
||||||
{
|
{
|
||||||
public abstract class SharedKitchenSpikeComponent : Component, IDragDropOn
|
[NetworkedComponent]
|
||||||
|
public abstract class SharedKitchenSpikeComponent : Component
|
||||||
{
|
{
|
||||||
[DataField("delay")]
|
[DataField("delay")]
|
||||||
public float SpikeDelay = 7.0f;
|
public float SpikeDelay = 7.0f;
|
||||||
@@ -14,19 +14,6 @@ namespace Content.Shared.Kitchen.Components
|
|||||||
[DataField("sound")]
|
[DataField("sound")]
|
||||||
public SoundSpecifier SpikeSound = new SoundPathSpecifier("/Audio/Effects/Fluids/splat.ogg");
|
public SoundSpecifier SpikeSound = new SoundPathSpecifier("/Audio/Effects/Fluids/splat.ogg");
|
||||||
|
|
||||||
bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs)
|
|
||||||
{
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().HasComponent<SharedButcherableComponent>(eventArgs.Dragged))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Once we get silicons need to check organic
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract bool DragDropOn(DragDropEvent eventArgs);
|
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public enum KitchenSpikeVisuals : byte
|
public enum KitchenSpikeVisuals : byte
|
||||||
{
|
{
|
||||||
|
|||||||
31
Content.Shared/Kitchen/SharedKitchenSpikeSystem.cs
Normal file
31
Content.Shared/Kitchen/SharedKitchenSpikeSystem.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using Content.Shared.DragDrop;
|
||||||
|
using Content.Shared.Kitchen.Components;
|
||||||
|
using Content.Shared.Nutrition.Components;
|
||||||
|
|
||||||
|
namespace Content.Shared.Kitchen;
|
||||||
|
|
||||||
|
public abstract class SharedKitchenSpikeSystem : EntitySystem
|
||||||
|
{
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
SubscribeLocalEvent<SharedKitchenSpikeComponent, CanDropTargetEvent>(OnCanDrop);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCanDrop(EntityUid uid, SharedKitchenSpikeComponent component, ref CanDropTargetEvent args)
|
||||||
|
{
|
||||||
|
if (args.Handled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
args.Handled = true;
|
||||||
|
|
||||||
|
if (!HasComp<ButcherableComponent>(args.Dragged))
|
||||||
|
{
|
||||||
|
args.CanDrop = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Once we get silicons need to check organic
|
||||||
|
args.CanDrop = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
|||||||
namespace Content.Shared.Medical.Cryogenics;
|
namespace Content.Shared.Medical.Cryogenics;
|
||||||
|
|
||||||
[NetworkedComponent]
|
[NetworkedComponent]
|
||||||
public abstract class SharedCryoPodComponent: Component, IDragDropOn
|
public abstract class SharedCryoPodComponent: Component
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specifies the name of the atmospherics port to draw gas from.
|
/// Specifies the name of the atmospherics port to draw gas from.
|
||||||
@@ -87,19 +87,4 @@ public abstract class SharedCryoPodComponent: Component, IDragDropOn
|
|||||||
ContainsEntity,
|
ContainsEntity,
|
||||||
IsOn
|
IsOn
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanInsert(EntityUid entity)
|
|
||||||
{
|
|
||||||
return IoCManager.Resolve<IEntityManager>().HasComponent<BodyComponent>(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs)
|
|
||||||
{
|
|
||||||
return CanInsert(eventArgs.Dragged);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IDragDropOn.DragDropOn(DragDropEvent eventArgs)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using Content.Server.Medical.Components;
|
using Content.Server.Medical.Components;
|
||||||
|
using Content.Shared.Body.Components;
|
||||||
|
using Content.Shared.DragDrop;
|
||||||
using Content.Shared.Emag.Systems;
|
using Content.Shared.Emag.Systems;
|
||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Mobs.Systems;
|
using Content.Shared.Mobs.Systems;
|
||||||
@@ -26,6 +28,12 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
|
|||||||
InitializeInsideCryoPod();
|
InitializeInsideCryoPod();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void OnCryoPodCanDropOn(EntityUid uid, SharedCryoPodComponent component, ref CanDropTargetEvent args)
|
||||||
|
{
|
||||||
|
args.CanDrop = args.CanDrop && HasComp<BodyComponent>(args.Dragged);
|
||||||
|
args.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
protected void OnComponentInit(EntityUid uid, SharedCryoPodComponent cryoPodComponent, ComponentInit args)
|
protected void OnComponentInit(EntityUid uid, SharedCryoPodComponent cryoPodComponent, ComponentInit args)
|
||||||
{
|
{
|
||||||
cryoPodComponent.BodyContainer = _containerSystem.EnsureContainer<ContainerSlot>(uid, "scanner-body");
|
cryoPodComponent.BodyContainer = _containerSystem.EnsureContainer<ContainerSlot>(uid, "scanner-body");
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
using Content.Shared.Body.Components;
|
|
||||||
using Content.Shared.DragDrop;
|
using Content.Shared.DragDrop;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Shared.MedicalScanner
|
namespace Content.Shared.MedicalScanner
|
||||||
{
|
{
|
||||||
public abstract class SharedMedicalScannerComponent : Component, IDragDropOn
|
public abstract class SharedMedicalScannerComponent : Component
|
||||||
{
|
{
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public enum MedicalScannerVisuals
|
public enum MedicalScannerVisuals : byte
|
||||||
{
|
{
|
||||||
Status
|
Status
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public enum MedicalScannerStatus
|
public enum MedicalScannerStatus : byte
|
||||||
{
|
{
|
||||||
Off,
|
Off,
|
||||||
Open,
|
Open,
|
||||||
@@ -22,17 +21,5 @@ namespace Content.Shared.MedicalScanner
|
|||||||
Green,
|
Green,
|
||||||
Yellow,
|
Yellow,
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanInsert(EntityUid entity)
|
|
||||||
{
|
|
||||||
return IoCManager.Resolve<IEntityManager>().HasComponent<BodyComponent>(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs)
|
|
||||||
{
|
|
||||||
return CanInsert(eventArgs.Dragged);
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract bool DragDropOn(DragDropEvent eventArgs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Content.Shared.Disease.Events;
|
using Content.Shared.Disease.Events;
|
||||||
using Content.Shared.DragDrop;
|
using Content.Shared.DragDrop;
|
||||||
using Content.Shared.Emoting;
|
using Content.Shared.Emoting;
|
||||||
|
using Content.Shared.Hands;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Inventory.Events;
|
using Content.Shared.Inventory.Events;
|
||||||
using Content.Shared.Item;
|
using Content.Shared.Item;
|
||||||
|
|||||||
@@ -1,38 +1,31 @@
|
|||||||
using Content.Shared.DragDrop;
|
|
||||||
using Content.Shared.Storage;
|
using Content.Shared.Storage;
|
||||||
|
using Robust.Shared.GameStates;
|
||||||
|
|
||||||
namespace Content.Shared.Nutrition.Components
|
namespace Content.Shared.Nutrition.Components
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates that the entity can be thrown on a kitchen spike for butchering.
|
/// Indicates that the entity can be thrown on a kitchen spike for butchering.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent]
|
[RegisterComponent, NetworkedComponent]
|
||||||
public sealed class SharedButcherableComponent : Component, IDraggable
|
public sealed class ButcherableComponent : Component
|
||||||
{
|
{
|
||||||
[DataField("spawned", required: true)]
|
[DataField("spawned", required: true)]
|
||||||
public List<EntitySpawnEntry> SpawnedEntities = new();
|
public List<EntitySpawnEntry> SpawnedEntities = new();
|
||||||
|
|
||||||
[DataField("butcherDelay")]
|
[ViewVariables(VVAccess.ReadWrite), DataField("butcherDelay")]
|
||||||
public float ButcherDelay = 8.0f;
|
public float ButcherDelay = 8.0f;
|
||||||
|
|
||||||
[DataField("butcheringType")]
|
[ViewVariables(VVAccess.ReadWrite), DataField("butcheringType")]
|
||||||
public ButcheringType Type = ButcheringType.Knife;
|
public ButcheringType Type = ButcheringType.Knife;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prevents butchering same entity on two and more spikes simultaneously and multiple doAfters on the same Spike
|
/// Prevents butchering same entity on two and more spikes simultaneously and multiple doAfters on the same Spike
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ViewVariables]
|
||||||
public bool BeingButchered;
|
public bool BeingButchered;
|
||||||
|
|
||||||
// TODO: ECS this out!, my guess CanDropEvent should be client side only and then "ValidDragDrop" in the DragDropSystem needs a little touch
|
|
||||||
// But this may lead to creating client-side systems for every Draggable component subbed to CanDrop. Actually those systems could control
|
|
||||||
// CanDropOn behaviors as well (IDragDropOn)
|
|
||||||
bool IDraggable.CanDrop(CanDropEvent args)
|
|
||||||
{
|
|
||||||
return Type != ButcheringType.Knife;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ButcheringType
|
public enum ButcheringType : byte
|
||||||
{
|
{
|
||||||
Knife, // e.g. goliaths
|
Knife, // e.g. goliaths
|
||||||
Spike, // e.g. monkeys
|
Spike, // e.g. monkeys
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.ActionBlocker;
|
using Content.Shared.ActionBlocker;
|
||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
using Content.Shared.DragDrop;
|
using Content.Shared.DragDrop;
|
||||||
|
using Content.Shared.Hands;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Item;
|
using Content.Shared.Item;
|
||||||
using Content.Shared.Movement;
|
using Content.Shared.Movement;
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
using Content.Shared.ActionBlocker;
|
|
||||||
using Content.Shared.DragDrop;
|
|
||||||
using Content.Shared.Hands.Components;
|
|
||||||
|
|
||||||
namespace Content.Shared.Strip.Components
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Give to an entity to say they can strip another entity.
|
|
||||||
/// </summary>
|
|
||||||
[RegisterComponent]
|
|
||||||
public sealed class SharedStrippingComponent : Component, IDragDropOn
|
|
||||||
{
|
|
||||||
bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs)
|
|
||||||
{
|
|
||||||
var ent = IoCManager.Resolve<IEntityManager>();
|
|
||||||
return eventArgs.Target != eventArgs.Dragged &&
|
|
||||||
eventArgs.Target == eventArgs.User &&
|
|
||||||
ent.HasComponent<SharedStrippableComponent>(eventArgs.Dragged) &&
|
|
||||||
ent.HasComponent<SharedHandsComponent>(eventArgs.User) &&
|
|
||||||
ent.EntitySysManager.GetEntitySystem<ActionBlockerSystem>().CanInteract(eventArgs.User, eventArgs.Dragged);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IDragDropOn.DragDropOn(DragDropEvent eventArgs)
|
|
||||||
{
|
|
||||||
// Handled by StrippableComponent
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +1,17 @@
|
|||||||
using Content.Shared.ActionBlocker;
|
|
||||||
using Content.Shared.DragDrop;
|
|
||||||
using Content.Shared.Hands.Components;
|
|
||||||
using Content.Shared.Inventory;
|
using Content.Shared.Inventory;
|
||||||
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Shared.Strip.Components
|
namespace Content.Shared.Strip.Components
|
||||||
{
|
{
|
||||||
public abstract class SharedStrippableComponent : Component, IDraggable
|
[RegisterComponent, NetworkedComponent]
|
||||||
|
public sealed class StrippableComponent : Component
|
||||||
{
|
{
|
||||||
bool IDraggable.CanDrop(CanDropEvent args)
|
/// <summary>
|
||||||
{
|
/// The strip delay for hands.
|
||||||
var ent = IoCManager.Resolve<IEntityManager>();
|
/// </summary>
|
||||||
return args.Target != args.Dragged &&
|
[ViewVariables(VVAccess.ReadWrite), DataField("handDelay")]
|
||||||
args.Target == args.User &&
|
public float HandStripDelay = 4f;
|
||||||
ent.HasComponent<SharedStrippingComponent>(args.User) &&
|
|
||||||
ent.HasComponent<SharedHandsComponent>(args.User) &&
|
|
||||||
ent.EntitySysManager.GetEntitySystem<ActionBlockerSystem>().CanInteract(args.User, args.Dragged);
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract bool Drop(DragDropEvent args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[NetSerializable, Serializable]
|
[NetSerializable, Serializable]
|
||||||
10
Content.Shared/Strip/Components/StrippingComponent.cs
Normal file
10
Content.Shared/Strip/Components/StrippingComponent.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using Robust.Shared.GameStates;
|
||||||
|
|
||||||
|
namespace Content.Shared.Strip.Components
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Give to an entity to say they can strip another entity.
|
||||||
|
/// </summary>
|
||||||
|
[RegisterComponent, NetworkedComponent]
|
||||||
|
public sealed class StrippingComponent : Component {}
|
||||||
|
}
|
||||||
49
Content.Shared/Strip/SharedStrippableSystem.cs
Normal file
49
Content.Shared/Strip/SharedStrippableSystem.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
using Content.Shared.DragDrop;
|
||||||
|
using Content.Shared.Hands.Components;
|
||||||
|
using Content.Shared.Strip.Components;
|
||||||
|
|
||||||
|
namespace Content.Shared.Strip;
|
||||||
|
|
||||||
|
public abstract class SharedStrippableSystem : EntitySystem
|
||||||
|
{
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
SubscribeLocalEvent<StrippingComponent, CanDropTargetEvent>(OnCanDropOn);
|
||||||
|
SubscribeLocalEvent<StrippableComponent, CanDropDraggedEvent>(OnCanDrop);
|
||||||
|
SubscribeLocalEvent<StrippableComponent, DragDropDraggedEvent>(OnDragDrop);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDragDrop(EntityUid uid, StrippableComponent component, ref DragDropDraggedEvent args)
|
||||||
|
{
|
||||||
|
// If the user drags a strippable thing onto themselves.
|
||||||
|
if (args.Handled || args.Target != args.User)
|
||||||
|
return;
|
||||||
|
|
||||||
|
StartOpeningStripper(args.User, component);
|
||||||
|
args.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void StartOpeningStripper(EntityUid user, StrippableComponent component, bool openInCombat = false)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCanDropOn(EntityUid uid, StrippingComponent component, ref CanDropTargetEvent args)
|
||||||
|
{
|
||||||
|
args.Handled = true;
|
||||||
|
args.CanDrop |= uid == args.User &&
|
||||||
|
HasComp<StrippableComponent>(args.Dragged) &&
|
||||||
|
HasComp<SharedHandsComponent>(args.User);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCanDrop(EntityUid uid, StrippableComponent component, ref CanDropDraggedEvent args)
|
||||||
|
{
|
||||||
|
args.CanDrop |= args.Target == args.User &&
|
||||||
|
HasComp<StrippingComponent>(args.User) &&
|
||||||
|
HasComp<SharedHandsComponent>(args.User);
|
||||||
|
|
||||||
|
if (args.CanDrop)
|
||||||
|
args.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ using Content.Shared.Inventory.Events;
|
|||||||
using Content.Shared.Item;
|
using Content.Shared.Item;
|
||||||
using Content.Shared.Bed.Sleep;
|
using Content.Shared.Bed.Sleep;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
|
using Content.Shared.Hands;
|
||||||
using Content.Shared.Mobs;
|
using Content.Shared.Mobs;
|
||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Mobs.Systems;
|
using Content.Shared.Mobs.Systems;
|
||||||
|
|||||||
Reference in New Issue
Block a user