Click Drag Functionality + Refactor Interaction Interfaces (#1125)

Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
Co-authored-by: ComicIronic <comicironic@gmail.com>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
chairbender
2020-07-06 14:27:03 -07:00
committed by GitHub
parent c019d428a7
commit b35333d366
184 changed files with 1792 additions and 895 deletions

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects;
using Content.Server.Utility;

View File

@@ -1,5 +1,5 @@
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects.Components.Interactable;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components;

View File

@@ -1,6 +1,7 @@
using Content.Server.Cargo;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects.Components.Cargo;
using Content.Shared.Prototypes.Cargo;
using JetBrains.Annotations;

View File

@@ -1,6 +1,6 @@
using System;
using Content.Server.GameObjects.Components.Metabolism;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Server.Utility;
using Content.Shared.Chemistry;

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;
using Content.Server.GameObjects.Components.Nutrition;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Server.Utility;
using Content.Shared.Chemistry;

View File

@@ -1,7 +1,7 @@
using System;
using System.Linq;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.GameObjects.Components.Power;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects;

View File

@@ -1,5 +1,5 @@
using Content.Server.Chemistry;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Chemistry;
@@ -19,6 +19,7 @@ using System.Collections.Generic;
using System.Linq;
using Content.Shared.GameObjects.EntitySystems;
using Robust.Shared.GameObjects.Systems;
using Content.Server.GameObjects.EntitySystems.Click;
namespace Content.Server.GameObjects.Components.Chemistry
{

View File

@@ -1,4 +1,4 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Chemistry;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;

View File

@@ -1,6 +1,6 @@
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces.GameTicking;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components.Command;

View File

@@ -1,4 +1,11 @@
using Content.Shared.Construction;
using System;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.GameObjects.Components.Stack;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Server.Utility;
using Content.Shared.Construction;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Shared.GameObjects;
using Robust.Shared.GameObjects;

View File

@@ -4,6 +4,7 @@ using Content.Shared.GameObjects.Components.Interactable;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
using System.Collections.Generic;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
namespace Content.Server.GameObjects.Components.Damage
{
@@ -43,7 +44,7 @@ namespace Content.Server.GameObjects.Components.Damage
{
if (welder.WelderLit) return CallDamage(eventArgs, tool);
}
break; //If the tool quality is welding and its not lit or its not actually a welder that can be lit then its pointless to continue.
break; //If the tool quality is welding and its not lit or its not actually a welder that can be lit then its pointless to continue.
}
if (tool.HasQuality(toolQuality)) return CallDamage(eventArgs, tool);

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Shared.GameObjects;
using Robust.Server.GameObjects.EntitySystems;

View File

@@ -3,7 +3,7 @@ using System.Threading;
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.Components.VendingMachines;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Shared.GameObjects.Components.Doors;
using Content.Shared.GameObjects.Components.Interactable;

View File

@@ -1,6 +1,8 @@
using System;
using Content.Server.GameObjects.Components.Access;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components.Doors;
using Content.Shared.GameObjects.Components.Movement;
using Robust.Server.GameObjects;

View File

@@ -1,5 +1,5 @@
using Content.Server.Explosions;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;

View File

@@ -1,5 +1,6 @@
using Content.Server.GameObjects.Components.Weapon;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
@@ -51,7 +52,7 @@ namespace Content.Server.GameObjects.Components.Explosion
{
Owner.Delete();
}
return true;
}

View File

@@ -1,7 +1,7 @@
using System;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.Chemistry;
using Content.Shared.Interfaces;

View File

@@ -1,7 +1,7 @@
using System;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.Chemistry;
using Content.Shared.Interfaces;

View File

@@ -2,7 +2,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks.Dataflow;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.EntitySystems;

View File

@@ -5,6 +5,8 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.GameObjects;
using Robust.Server.GameObjects;

View File

@@ -2,7 +2,7 @@
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components.Gravity;

View File

@@ -1,5 +1,5 @@
using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.GameObjects;
using Robust.Shared.GameObjects;

View File

@@ -1,7 +1,7 @@
using System;
using System.Linq;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Server.Mobs;
using Content.Shared.GameObjects.Components.Instruments;

View File

@@ -1,4 +1,7 @@
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.GameObjects;

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Interactable;
using Robust.Server.GameObjects;

View File

@@ -1,4 +1,5 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects.Components.Interactable;
using Content.Shared.Maps;
using Robust.Shared.GameObjects;

View File

@@ -3,6 +3,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata.Ecma335;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Audio;
using Content.Shared.GameObjects.Components.Interactable;
using Content.Shared.GameObjects.EntitySystems;

View File

@@ -1,7 +1,8 @@
using System;
using System.Runtime.Remoting;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Server.Interfaces.Chat;
using Content.Server.Interfaces.GameObjects;

View File

@@ -3,7 +3,7 @@
using Robust.Shared.Utility;
using System;
using System.Collections.Generic;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Items;

View File

@@ -1,5 +1,6 @@
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.Audio;
using Robust.Server.GameObjects;

View File

@@ -1,5 +1,5 @@
using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.Maps;
using Robust.Server.GameObjects.EntitySystems;

View File

@@ -3,7 +3,7 @@ using System.Linq;
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Interactable;
using Content.Shared.GameObjects.Components.Storage;

View File

@@ -1,4 +1,8 @@
using Content.Server.GameObjects.EntitySystems;
using System;
using Content.Server.GameObjects.Components;
using Content.Server.GameObjects.Components.Destructible;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects;
using Content.Server.Throw;
using Content.Server.Utility;
@@ -89,7 +93,7 @@ namespace Content.Server.GameObjects
var userPos = user.Transform.MapPosition;
var itemPos = Owner.Transform.MapPosition;
return InteractionChecks.InRangeUnobstructed(user, itemPos, ignoredEnt: Owner, insideBlockerValid:true);
return InteractionChecks.InRangeUnobstructed(user, itemPos, ignoredEnt: Owner, ignoreInsideBlocker:true);
}
public bool InteractHand(InteractHandEventArgs eventArgs)

View File

@@ -1,5 +1,5 @@
using Content.Server.GameObjects.Components.Access;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Storage;

View File

@@ -3,7 +3,8 @@ using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces.GameObjects;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components.Storage;
@@ -21,6 +22,7 @@ using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.Players;
using Robust.Shared.Serialization;
@@ -32,7 +34,8 @@ namespace Content.Server.GameObjects
[RegisterComponent]
[ComponentReference(typeof(IActivate))]
[ComponentReference(typeof(IStorageComponent))]
public class ServerStorageComponent : SharedStorageComponent, IInteractUsing, IUse, IActivate, IStorageComponent, IDestroyAct, IExAct
public class ServerStorageComponent : SharedStorageComponent, IInteractUsing, IUse, IActivate, IStorageComponent, IDestroyAct, IExAct,
IDragDrop
{
#pragma warning disable 649
[Dependency] private readonly IMapManager _mapManager;
@@ -409,5 +412,26 @@ namespace Content.Server.GameObjects
Owner.PopupMessage(player, "Can't insert.");
return false;
}
public bool DragDrop(DragDropEventArgs eventArgs)
{
if (eventArgs.Target.TryGetComponent<PlaceableSurfaceComponent>(out var placeableSurface))
{
if (!placeableSurface.IsPlaceable) return false;
// empty everything out
foreach (var storedEntity in StoredEntities.ToList())
{
if (Remove(storedEntity))
{
storedEntity.Transform.WorldPosition = eventArgs.DropLocation.Position;
}
}
return true;
}
return false;
}
}
}

View File

@@ -1,5 +1,6 @@
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.Audio;
using Robust.Server.GameObjects;

View File

@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.ViewVariables;

View File

@@ -1,5 +1,5 @@
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components;
using Content.Shared.Interfaces;

View File

@@ -1,4 +1,5 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Serialization;

View File

@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Medical;
using Content.Server.GameObjects.Components.Power;

View File

@@ -1,6 +1,6 @@
using System.Linq;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Chemistry;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;

View File

@@ -1,6 +1,6 @@
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.Components.Weapon.Melee;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.GameObjects;
using Robust.Server.GameObjects;

View File

@@ -1,6 +1,7 @@
using Content.Server.GameObjects.Components.Strap;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Mobs;
using Content.Server.Utility;
using Content.Shared.GameObjects;

View File

@@ -1,5 +1,5 @@
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Mobs;
using Content.Shared.Audio;
using Content.Shared.GameObjects.Components.Mobs;

View File

@@ -1,5 +1,6 @@
using Content.Server.GameObjects.Components.Observer;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces.GameTicking;
using Content.Server.Mobs;
using Robust.Shared.GameObjects;

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Server.Observer;
using Content.Shared.GameObjects;

View File

@@ -1,5 +1,8 @@
using System;
using System.Threading;
using Content.Server.GameObjects.Components.Movement;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces.GameObjects;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Mobs;
using Content.Shared.Audio;

View File

@@ -1,6 +1,6 @@
using System;
using System.Linq;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects.Components.Movement;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.EntitySystems;

View File

@@ -1,6 +1,7 @@
using System;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Audio;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.Components.Nutrition;

View File

@@ -4,6 +4,8 @@ using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.Components.Utensil;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Utility;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.Components.Utensil;
using Content.Shared.Interfaces;

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects.Components.Nutrition;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;

View File

@@ -1,4 +1,4 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Players;
using Content.Shared.GameObjects.Components.Observer;
using Content.Shared.GameObjects.EntitySystems;

View File

@@ -3,7 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.Access;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Server.Interfaces.PDA;
using Content.Shared.GameObjects;

View File

@@ -1,4 +1,5 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components;
using Robust.Server.GameObjects;

View File

@@ -1,15 +1,14 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components
{
[RegisterComponent]
public class PlaceableSurfaceComponent : Component, IInteractUsing
public class PlaceableSurfaceComponent : SharedPlaceableSurfaceComponent, IInteractUsing
{
public override string Name => "PlaceableSurface";
private bool _isPlaceable;
public bool IsPlaceable { get => _isPlaceable; set => _isPlaceable = value; }

View File

@@ -1,4 +1,4 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.Audio;
using Content.Shared.Interfaces;

View File

@@ -11,6 +11,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.ViewVariables;
using System;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Robust.Shared.IoC;
using Robust.Shared.Interfaces.Timing;

View File

@@ -2,6 +2,7 @@
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Power;
using Content.Shared.GameObjects.EntitySystems;
@@ -104,7 +105,7 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
{
batteryBarrelComponent.UpdateAppearance();
}
UpdateStatus();
}

View File

@@ -1,5 +1,5 @@
using System;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Audio;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.EntitySystems;

View File

@@ -1,4 +1,5 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;

View File

@@ -1,6 +1,7 @@
using System;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces;
using Content.Server.Utility;

View File

@@ -1,5 +1,6 @@
using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;

View File

@@ -1,11 +1,11 @@
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameTicking;
using Content.Shared.GameObjects.Components.Power;
using Robust.Server.GameObjects.Components.UserInterface;
using Robust.Server.Interfaces.GameObjects;
using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;

View File

@@ -1,5 +1,6 @@
using System;
using Content.Server.GameObjects.Components.Damage;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.GameObjects.Components.Power.PowerNetComponents;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Audio;

View File

@@ -1,6 +1,7 @@
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects.Components.Interactable;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;

View File

@@ -2,7 +2,7 @@
using Content.Server.GameObjects.Components.NodeContainer.NodeGroups;
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;

View File

@@ -1,5 +1,6 @@
using Content.Server.GameObjects.Components.Projectiles;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.Components.Projectiles;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects;
using Content.Shared.Physics;
using Robust.Shared.GameObjects;

View File

@@ -7,7 +7,7 @@ using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components.Materials;
using Content.Shared.GameObjects.Components.Power;

View File

@@ -1,4 +1,4 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components.Research;
using Robust.Server.GameObjects.Components.UserInterface;

View File

@@ -1,6 +1,6 @@
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.Audio;
using Content.Shared.GameObjects.Components.Research;

View File

@@ -1,6 +1,6 @@
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;

View File

@@ -1,6 +1,6 @@
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Research;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;

View File

@@ -1,4 +1,5 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Audio;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.Audio;

View File

@@ -1,4 +1,4 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Audio;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.Audio;

View File

@@ -1,5 +1,6 @@
using System;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components;
using Content.Shared.Interfaces;

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Strap;
using Content.Shared.GameObjects.EntitySystems;

View File

@@ -1,5 +1,5 @@
using System;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects.Components.Triggers;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Nutrition;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components.Utensil;
using Robust.Server.GameObjects.EntitySystems;

View File

@@ -3,6 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components.VendingMachines;
using Content.Shared.VendingMachines;

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Items;
using Robust.Server.GameObjects.EntitySystems;

View File

@@ -1,7 +1,8 @@
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.Audio;
using Content.Shared.GameObjects;

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Audio;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Audio;
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;
using Content.Shared.Interfaces;
@@ -32,7 +33,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
public int ShotsLeft => _spawnedAmmo.Count + _unspawnedCount;
public int Capacity => _capacity;
private int _capacity;
public MagazineType MagazineType => _magazineType;
private MagazineType _magazineType;
public BallisticCaliber Caliber => _caliber;
@@ -87,7 +88,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
{
_appearanceComponent = appearanceComponent;
}
_appearanceComponent?.SetData(MagazineBarrelVisuals.MagLoaded, true);
}
@@ -96,7 +97,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
_appearanceComponent?.SetData(AmmoVisuals.AmmoCount, ShotsLeft);
_appearanceComponent?.SetData(AmmoVisuals.AmmoMax, Capacity);
}
public bool TryInsertAmmo(IEntity user, IEntity ammo)
{
if (!ammo.TryGetComponent(out AmmoComponent ammoComponent))
@@ -136,7 +137,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
_unspawnedCount--;
ammo = Owner.EntityManager.SpawnEntity(_fillPrototype, Owner.Transform.GridPosition);
}
UpdateAppearance();
return ammo;
}

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;
using Content.Shared.Interfaces;
using Robust.Server.GameObjects;
@@ -38,7 +39,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
serializer.DataField(ref _caliber, "caliber", BallisticCaliber.Unspecified);
serializer.DataField(ref _capacity, "capacity", 6);
serializer.DataField(ref _fillPrototype, "fillPrototype", null);
_spawnedAmmo = new Stack<IEntity>(_capacity);
}
@@ -56,7 +57,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
}
}
}
void IMapInit.MapInit()
{
_unspawnedCount += _capacity;
@@ -91,7 +92,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
Owner.PopupMessage(user, Loc.GetString("No room"));
return false;
}
_spawnedAmmo.Push(entity);
_ammoContainer.Insert(entity);
UpdateAppearance();
@@ -149,10 +150,10 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
{
return;
}
// This area is dirty but not sure of an easier way to do it besides add an interface or somethin
bool changed = false;
if (eventArgs.Target.TryGetComponent(out RevolverBarrelComponent revolverBarrel))
{
for (var i = 0; i < Capacity; i++)
@@ -193,9 +194,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
TryInsertAmmo(eventArgs.User, ammo);
break;
}
}
if (changed)
{
UpdateAppearance();
@@ -212,4 +213,4 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
return UseEntity(eventArgs.User);
}
}
}
}

View File

@@ -2,6 +2,7 @@ using System.Collections.Generic;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;
using Content.Shared.GameObjects.EntitySystems;

View File

@@ -2,6 +2,7 @@ using System.Collections.Generic;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;
using Content.Shared.Interfaces;
using Robust.Server.GameObjects;

View File

@@ -2,6 +2,7 @@ using System;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;
using Content.Shared.GameObjects.EntitySystems;

View File

@@ -4,6 +4,7 @@ using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.Components.Projectiles;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;
using Robust.Server.GameObjects;
@@ -68,9 +69,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
return (int) Math.Ceiling((float) (powerCell.GetComponent<BatteryComponent>().MaxCharge / _baseFireCost));
}
}
private AppearanceComponent _appearanceComponent;
// Sounds
private string _soundPowerCellInsert;
private string _soundPowerCellEject;
@@ -110,10 +111,10 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
{
_appearanceComponent = appearanceComponent;
}
UpdateAppearance();
}
public void UpdateAppearance()
{
_appearanceComponent?.SetData(MagazineBarrelVisuals.MagLoaded, _powerCellContainer.ContainedEntity != null);
@@ -223,14 +224,14 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
{
return null;
}
var entity = _powerCellContainer.ContainedEntity;
_powerCellContainer.Remove(entity);
if (_soundPowerCellEject != null)
{
EntitySystem.Get<AudioSystem>().PlayAtCoords(_soundPowerCellEject, Owner.Transform.GridPosition, AudioParams.Default.WithVolume(-2));
}
UpdateAppearance();
//Dirty();
return entity;
@@ -242,8 +243,8 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
{
return false;
}
if (!eventArgs.User.TryGetComponent(out HandsComponent handsComponent) ||
if (!eventArgs.User.TryGetComponent(out HandsComponent handsComponent) ||
PowerCellEntity == null)
{
return false;
@@ -254,7 +255,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
{
return false;
}
var powerCell = RemovePowerCell();
handsComponent.PutInHand(itemComponent);
powerCell.Transform.GridPosition = eventArgs.User.Transform.GridPosition;

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Weapons.Ranged;
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;

View File

@@ -5,6 +5,7 @@ using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Projectiles;
using Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Audio;
using Content.Shared.GameObjects.Components.Weapons.Ranged;
using Robust.Server.GameObjects.EntitySystems;

View File

@@ -2,6 +2,7 @@ using System;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects.Components.Weapons.Ranged;
using Content.Shared.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;

View File

@@ -3,7 +3,8 @@ using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.GameObjects.Components.VendingMachines;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.GameObjects.Components;

View File

@@ -5,7 +5,7 @@ using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Map;
namespace Content.Server.GameObjects.EntitySystems
namespace Content.Server.Interfaces.GameObjects.Components.Interaction
{
/// <summary>
/// This interface gives components behavior on getting destoyed.

View File

@@ -3,7 +3,7 @@ using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
namespace Content.Server.GameObjects.EntitySystems
namespace Content.Server.Interfaces.GameObjects.Components.Interaction
{
[UsedImplicitly]
internal class BaseChargerSystem : EntitySystem

View File

@@ -3,7 +3,7 @@ using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
namespace Content.Server.GameObjects.EntitySystems
namespace Content.Server.Interfaces.GameObjects.Components.Interaction
{
/// <summary>
/// Triggers metabolism updates for <see cref="BloodstreamComponent"/>

View File

@@ -4,7 +4,7 @@ using JetBrains.Annotations;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.GameObjects.EntitySystems
namespace Content.Server.Interfaces.GameObjects.Components.Interaction
{
/// <summary>
/// This interface gives components behavior on whether entities solution (implying SolutionComponent is in place) is changed

View File

@@ -9,7 +9,7 @@ using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
namespace Content.Server.GameObjects.EntitySystems
namespace Content.Server.GameObjects.EntitySystems.Click
{
public interface IExamine
{
@@ -62,7 +62,7 @@ namespace Content.Server.GameObjects.EntitySystems
var inDetailsRange = Get<SharedInteractionSystem>()
.InRangeUnobstructed(examiner.Transform.MapPosition, entity.Transform.MapPosition,
ExamineDetailsRange, predicate: entity0 => entity0 == examiner || entity0 == entity, insideBlockerValid: true);
ExamineDetailsRange, predicate: entity0 => entity0 == examiner || entity0 == entity, ignoreInsideBlocker: true);
//Add component statuses from components that report one
foreach (var examineComponent in entity.GetAllComponents<IExamine>())

View File

@@ -3,8 +3,10 @@ using System.Linq;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Timing;
using Content.Server.Interfaces.GameObjects;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components.Inventory;
using Content.Shared.GameObjects.EntitySystemMessages;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Input;
using JetBrains.Annotations;
@@ -18,294 +20,14 @@ using Robust.Shared.Input.Binding;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Physics;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Log;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Players;
namespace Content.Server.GameObjects.EntitySystems
namespace Content.Server.GameObjects.EntitySystems.Click
{
/// <summary>
/// This interface gives components behavior when being clicked on by a user with an object in their hand
/// who is in range and has unobstructed reach of the target entity (allows inside blockers).
/// </summary>
public interface IInteractUsing
{
/// <summary>
/// Called when using one object on another when user is in range of the target entity.
/// </summary>
bool InteractUsing(InteractUsingEventArgs eventArgs);
}
public class InteractUsingEventArgs : EventArgs, ITargetedInteractEventArgs
{
public IEntity User { get; set; }
public GridCoordinates ClickLocation { get; set; }
public IEntity Using { get; set; }
public IEntity Target { get; set; }
}
public interface ITargetedInteractEventArgs
{
/// <summary>
/// Performer of the attack
/// </summary>
IEntity User { get; }
/// <summary>
/// Target of the attack
/// </summary>
IEntity Target { get; }
}
/// <summary>
/// This interface gives components behavior when being clicked on by a user with an empty hand
/// who is in range and has unobstructed reach of the target entity (allows inside blockers).
/// </summary>
public interface IInteractHand
{
/// <summary>
/// Called when a player directly interacts with an empty hand when user is in range of the target entity.
/// </summary>
bool InteractHand(InteractHandEventArgs eventArgs);
}
public class InteractHandEventArgs : EventArgs, ITargetedInteractEventArgs
{
public IEntity User { get; set; }
public IEntity Target { get; set; }
}
/// <summary>
/// This interface gives components behavior when being clicked on by a user with an object
/// outside the range of direct use
/// </summary>
public interface IRangedInteract
{
/// <summary>
/// Called when we try to interact with an entity out of range
/// </summary>
/// <returns></returns>
bool RangedInteract(RangedInteractEventArgs eventArgs);
}
[PublicAPI]
public class RangedInteractEventArgs : EventArgs
{
public IEntity User { get; set; }
public IEntity Using { get; set; }
public GridCoordinates ClickLocation { get; set; }
}
/// <summary>
/// This interface gives components a behavior when clicking on another object and no interaction occurs,
/// at any range.
/// </summary>
public interface IAfterInteract
{
/// <summary>
/// Called when we interact with nothing, or when we interact with an entity out of range that has no behavior
/// </summary>
void AfterInteract(AfterInteractEventArgs eventArgs);
}
public class AfterInteractEventArgs : EventArgs
{
public IEntity User { get; set; }
public GridCoordinates ClickLocation { get; set; }
public IEntity Target { get; set; }
}
/// <summary>
/// This interface gives components behavior when using the entity in your hands
/// </summary>
public interface IUse
{
/// <summary>
/// Called when we activate an object we are holding to use it
/// </summary>
/// <returns></returns>
bool UseEntity(UseEntityEventArgs eventArgs);
}
public class UseEntityEventArgs : EventArgs
{
public IEntity User { get; set; }
}
/// <summary>
/// This interface gives components behavior when being activated in the world when the user
/// is in range and has unobstructed access to the target entity (allows inside blockers).
/// </summary>
public interface IActivate
{
/// <summary>
/// Called when this component is activated by another entity who is in range.
/// </summary>
void Activate(ActivateEventArgs eventArgs);
}
public class ActivateEventArgs : EventArgs, ITargetedInteractEventArgs
{
public IEntity User { get; set; }
public IEntity Target { get; set; }
}
/// <summary>
/// This interface gives components behavior when thrown.
/// </summary>
public interface IThrown
{
void Thrown(ThrownEventArgs eventArgs);
}
public class ThrownEventArgs : EventArgs
{
public ThrownEventArgs(IEntity user)
{
User = user;
}
public IEntity User { get; }
}
/// <summary>
/// This interface gives components behavior when landing after being thrown.
/// </summary>
public interface ILand
{
void Land(LandEventArgs eventArgs);
}
public class LandEventArgs : EventArgs
{
public LandEventArgs(IEntity user, GridCoordinates landingLocation)
{
User = user;
LandingLocation = landingLocation;
}
public IEntity User { get; }
public GridCoordinates LandingLocation { get; }
}
/// <summary>
/// This interface gives components behavior when their owner is put in an inventory slot.
/// </summary>
public interface IEquipped
{
void Equipped(EquippedEventArgs eventArgs);
}
public class EquippedEventArgs : EventArgs
{
public EquippedEventArgs(IEntity user, EquipmentSlotDefines.Slots slot)
{
User = user;
Slot = slot;
}
public IEntity User { get; }
public EquipmentSlotDefines.Slots Slot { get; }
}
/// <summary>
/// This interface gives components behavior when their owner is removed from an inventory slot.
/// </summary>
public interface IUnequipped
{
void Unequipped(UnequippedEventArgs eventArgs);
}
public class UnequippedEventArgs : EventArgs
{
public UnequippedEventArgs(IEntity user, EquipmentSlotDefines.Slots slot)
{
User = user;
Slot = slot;
}
public IEntity User { get; }
public EquipmentSlotDefines.Slots Slot { get; }
}
/// <summary>
/// This interface gives components behavior when being used to "attack".
/// </summary>
public interface IAttack
{
void Attack(AttackEventArgs eventArgs);
}
public class AttackEventArgs : EventArgs
{
public AttackEventArgs(IEntity user, GridCoordinates clickLocation)
{
User = user;
ClickLocation = clickLocation;
}
public IEntity User { get; }
public GridCoordinates ClickLocation { get; }
}
/// <summary>
/// This interface gives components behavior when they're held on the selected hand.
/// </summary>
public interface IHandSelected
{
void HandSelected(HandSelectedEventArgs eventArgs);
}
public class HandSelectedEventArgs : EventArgs
{
public HandSelectedEventArgs(IEntity user)
{
User = user;
}
public IEntity User { get; }
}
/// <summary>
/// This interface gives components behavior when they're held on a deselected hand.
/// </summary>
public interface IHandDeselected
{
void HandDeselected(HandDeselectedEventArgs eventArgs);
}
public class HandDeselectedEventArgs : EventArgs
{
public HandDeselectedEventArgs(IEntity user)
{
User = user;
}
public IEntity User { get; }
}
/// <summary>
/// This interface gives components behavior when they're dropped by a mob.
/// </summary>
public interface IDropped
{
void Dropped(DroppedEventArgs eventArgs);
}
public class DroppedEventArgs : EventArgs
{
public DroppedEventArgs(IEntity user)
{
User = user;
}
public IEntity User { get; }
}
/// <summary>
/// Governs interactions during clicking on entities
/// </summary>
@@ -318,6 +40,8 @@ namespace Content.Server.GameObjects.EntitySystems
public override void Initialize()
{
SubscribeNetworkEvent<DragDropMessage>(HandleDragDropMessage);
CommandBinds.Builder
.Bind(EngineKeyFunctions.Use,
new PointerInputCmdHandler(HandleClientUseItemInHand))
@@ -334,6 +58,30 @@ namespace Content.Server.GameObjects.EntitySystems
base.Shutdown();
}
private void HandleDragDropMessage(DragDropMessage msg, EntitySessionEventArgs args)
{
var performer = args.SenderSession.AttachedEntity;
if (!EntityManager.TryGetEntity(msg.Dropped, out var dropped)) return;
if (!EntityManager.TryGetEntity(msg.Target, out var target)) return;
var interactionArgs = new DragDropEventArgs(performer, msg.DropLocation, dropped, target);
// must be in range of both the target and the object they are drag / dropping
if (!InteractionChecks.InRangeUnobstructed(interactionArgs)) return;
// trigger dragdrops on the dropped entity
foreach (var dragDrop in dropped.GetAllComponents<IDragDrop>())
{
if (dragDrop.DragDrop(interactionArgs)) return;
}
// trigger dragdropons on the targeted entity
foreach (var dragDropOn in target.GetAllComponents<IDragDropOn>())
{
if (dragDropOn.DragDropOn(interactionArgs)) return;
}
}
private bool HandleActivateItemInWorld(ICommonSession session, GridCoordinates coords, EntityUid uid)
{
if (!EntityManager.TryGetEntity(uid, out var used))
@@ -572,7 +320,7 @@ namespace Content.Server.GameObjects.EntitySystems
/// </summary>
private void InteractAfter(IEntity user, IEntity weapon, GridCoordinates clickLocation)
{
var message = new AfterAttackMessage(user, weapon, null, clickLocation);
var message = new AfterInteractMessage(user, weapon, null, clickLocation);
RaiseLocalEvent(message);
if (message.Handled)
{
@@ -594,7 +342,7 @@ namespace Content.Server.GameObjects.EntitySystems
/// </summary>
public void Interaction(IEntity user, IEntity weapon, IEntity attacked, GridCoordinates clickLocation)
{
var attackMsg = new AttackByMessage(user, weapon, attacked, clickLocation);
var attackMsg = new InteractUsingMessage(user, weapon, attacked, clickLocation);
RaiseLocalEvent(attackMsg);
if (attackMsg.Handled)
{
@@ -620,7 +368,7 @@ namespace Content.Server.GameObjects.EntitySystems
}
}
var afterAtkMsg = new AfterAttackMessage(user, weapon, attacked, clickLocation);
var afterAtkMsg = new AfterInteractMessage(user, weapon, attacked, clickLocation);
RaiseLocalEvent(afterAtkMsg);
if (afterAtkMsg.Handled)
{
@@ -906,7 +654,7 @@ namespace Content.Server.GameObjects.EntitySystems
/// </summary>
public void RangedInteraction(IEntity user, IEntity weapon, IEntity attacked, GridCoordinates clickLocation)
{
var rangedMsg = new RangedAttackMessage(user, weapon, attacked, clickLocation);
var rangedMsg = new RangedInteractMessage(user, weapon, attacked, clickLocation);
RaiseLocalEvent(rangedMsg);
if (rangedMsg.Handled)
return;
@@ -927,7 +675,7 @@ namespace Content.Server.GameObjects.EntitySystems
}
}
var afterAtkMsg = new AfterAttackMessage(user, weapon, attacked, clickLocation);
var afterAtkMsg = new AfterInteractMessage(user, weapon, attacked, clickLocation);
RaiseLocalEvent(afterAtkMsg);
if (afterAtkMsg.Handled)
return;
@@ -988,422 +736,4 @@ namespace Content.Server.GameObjects.EntitySystems
}
}
}
/// <summary>
/// Raised when being clicked on or "attacked" by a user with an object in their hand
/// </summary>
[PublicAPI]
public class AttackByMessage : EntitySystemMessage
{
/// <summary>
/// If this message has already been "handled" by a previous system.
/// </summary>
public bool Handled { get; set; }
/// <summary>
/// Entity that triggered the attack.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Entity that the User attacked with.
/// </summary>
public IEntity ItemInHand { get; }
/// <summary>
/// Entity that was attacked.
/// </summary>
public IEntity Attacked { get; }
/// <summary>
/// The original location that was clicked by the user.
/// </summary>
public GridCoordinates ClickLocation { get; }
public AttackByMessage(IEntity user, IEntity itemInHand, IEntity attacked, GridCoordinates clickLocation)
{
User = user;
ItemInHand = itemInHand;
Attacked = attacked;
ClickLocation = clickLocation;
}
}
/// <summary>
/// Raised when being clicked on or "attacked" by a user with an empty hand.
/// </summary>
[PublicAPI]
public class AttackHandMessage : EntitySystemMessage
{
/// <summary>
/// If this message has already been "handled" by a previous system.
/// </summary>
public bool Handled { get; set; }
/// <summary>
/// Entity that triggered the attack.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Entity that was attacked.
/// </summary>
public IEntity Attacked { get; }
public AttackHandMessage(IEntity user, IEntity attacked)
{
User = user;
Attacked = attacked;
}
}
/// <summary>
/// Raised when being clicked by objects outside the range of direct use.
/// </summary>
[PublicAPI]
public class RangedAttackMessage : EntitySystemMessage
{
/// <summary>
/// If this message has already been "handled" by a previous system.
/// </summary>
public bool Handled { get; set; }
/// <summary>
/// Entity that triggered the attack.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Entity that the User attacked with.
/// </summary>
public IEntity ItemInHand { get; set; }
/// <summary>
/// Entity that was attacked.
/// </summary>
public IEntity Attacked { get; }
/// <summary>
/// Location that the user clicked outside of their interaction range.
/// </summary>
public GridCoordinates ClickLocation { get; }
public RangedAttackMessage(IEntity user, IEntity itemInHand, IEntity attacked, GridCoordinates clickLocation)
{
User = user;
ItemInHand = itemInHand;
ClickLocation = clickLocation;
Attacked = attacked;
}
}
/// <summary>
/// Raised when clicking on another object and no attack event was handled.
/// </summary>
[PublicAPI]
public class AfterAttackMessage : EntitySystemMessage
{
/// <summary>
/// If this message has already been "handled" by a previous system.
/// </summary>
public bool Handled { get; set; }
/// <summary>
/// Entity that triggered the attack.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Entity that the User attacked with.
/// </summary>
public IEntity ItemInHand { get; set; }
/// <summary>
/// Entity that was attacked. This can be null if the attack did not click on an entity.
/// </summary>
public IEntity Attacked { get; }
/// <summary>
/// Location that the user clicked outside of their interaction range.
/// </summary>
public GridCoordinates ClickLocation { get; }
public AfterAttackMessage(IEntity user, IEntity itemInHand, IEntity attacked, GridCoordinates clickLocation)
{
User = user;
Attacked = attacked;
ClickLocation = clickLocation;
ItemInHand = itemInHand;
}
}
/// <summary>
/// Raised when using the entity in your hands.
/// </summary>
[PublicAPI]
public class UseInHandMessage : EntitySystemMessage
{
/// <summary>
/// If this message has already been "handled" by a previous system.
/// </summary>
public bool Handled { get; set; }
/// <summary>
/// Entity holding the item in their hand.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Item that was used.
/// </summary>
public IEntity Used { get; }
public UseInHandMessage(IEntity user, IEntity used)
{
User = user;
Used = used;
}
}
/// <summary>
/// Raised when throwing the entity in your hands.
/// </summary>
[PublicAPI]
public class ThrownMessage : EntitySystemMessage
{
/// <summary>
/// If this message has already been "handled" by a previous system.
/// </summary>
public bool Handled { get; set; }
/// <summary>
/// Entity that threw the item.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Item that was thrown.
/// </summary>
public IEntity Thrown { get; }
public ThrownMessage(IEntity user, IEntity thrown)
{
User = user;
Thrown = thrown;
}
}
/// <summary>
/// Raised when an entity that was thrown lands.
/// </summary>
[PublicAPI]
public class LandMessage : EntitySystemMessage
{
/// <summary>
/// If this message has already been "handled" by a previous system.
/// </summary>
public bool Handled { get; set; }
/// <summary>
/// Entity that threw the item.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Item that was thrown.
/// </summary>
public IEntity Thrown { get; }
/// <summary>
/// Location where the item landed.
/// </summary>
public GridCoordinates LandLocation { get; }
public LandMessage(IEntity user, IEntity thrown, GridCoordinates landLocation)
{
User = user;
Thrown = thrown;
LandLocation = landLocation;
}
}
/// <summary>
/// Raised when equipping the entity in an inventory slot.
/// </summary>
[PublicAPI]
public class EquippedMessage : EntitySystemMessage
{
/// <summary>
/// If this message has already been "handled" by a previous system.
/// </summary>
public bool Handled { get; set; }
/// <summary>
/// Entity that equipped the item.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Item that was equipped.
/// </summary>
public IEntity Equipped { get; }
/// <summary>
/// Slot where the item was placed.
/// </summary>
public EquipmentSlotDefines.Slots Slot { get; }
public EquippedMessage(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot)
{
User = user;
Equipped = equipped;
Slot = slot;
}
}
/// <summary>
/// Raised when removing the entity from an inventory slot.
/// </summary>
[PublicAPI]
public class UnequippedMessage : EntitySystemMessage
{
/// <summary>
/// If this message has already been "handled" by a previous system.
/// </summary>
public bool Handled { get; set; }
/// <summary>
/// Entity that equipped the item.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Item that was equipped.
/// </summary>
public IEntity Equipped { get; }
/// <summary>
/// Slot where the item was removed from.
/// </summary>
public EquipmentSlotDefines.Slots Slot { get; }
public UnequippedMessage(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot)
{
User = user;
Equipped = equipped;
Slot = slot;
}
}
/// <summary>
/// Raised when an entity that was thrown lands.
/// </summary>
[PublicAPI]
public class DroppedMessage : EntitySystemMessage
{
/// <summary>
/// If this message has already been "handled" by a previous system.
/// </summary>
public bool Handled { get; set; }
/// <summary>
/// Entity that dropped the item.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Item that was dropped.
/// </summary>
public IEntity Dropped { get; }
public DroppedMessage(IEntity user, IEntity dropped)
{
User = user;
Dropped = dropped;
}
}
/// <summary>
/// Raised when an entity item in a hand is selected.
/// </summary>
[PublicAPI]
public class HandSelectedMessage : EntitySystemMessage
{
/// <summary>
/// If this message has already been "handled" by a previous system.
/// </summary>
public bool Handled { get; set; }
/// <summary>
/// Entity that owns the selected hand.
/// </summary>
public IEntity User { get; }
/// <summary>
/// The item in question.
/// </summary>
public IEntity Item { get; }
public HandSelectedMessage(IEntity user, IEntity item)
{
User = user;
Item = item;
}
}
/// <summary>
/// Raised when an entity item in a hand is deselected.
/// </summary>
[PublicAPI]
public class HandDeselectedMessage : EntitySystemMessage
{
/// <summary>
/// If this message has already been "handled" by a previous system.
/// </summary>
public bool Handled { get; set; }
/// <summary>
/// Entity that owns the deselected hand.
/// </summary>
public IEntity User { get; }
/// <summary>
/// The item in question.
/// </summary>
public IEntity Item { get; }
public HandDeselectedMessage(IEntity user, IEntity item)
{
User = user;
Item = item;
}
}
/// <summary>
/// Raised when an entity is activated in the world.
/// </summary>
[PublicAPI]
public class ActivateInWorldMessage : EntitySystemMessage
{
/// <summary>
/// If this message has already been "handled" by a previous system.
/// </summary>
public bool Handled { get; set; }
/// <summary>
/// Entity that activated the world entity.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Entity that was activated in the world.
/// </summary>
public IEntity Activated { get; }
public ActivateInWorldMessage(IEntity user, IEntity activated)
{
User = user;
Activated = activated;
}
}
}

View File

@@ -11,7 +11,7 @@ using Robust.Shared.Log;
using Robust.Shared.Players;
using Robust.Shared.Random;
namespace Content.Server.GameObjects.EntitySystems
namespace Content.Server.Interfaces.GameObjects.Components.Interaction
{
[UsedImplicitly]
public sealed class CombatModeSystem : SharedCombatModeSystem

Some files were not shown because too many files have changed in this diff Show More