Interaction rework.
IActivate is now more used. IAttackHand falls back to IActivate.
This commit is contained in:
@@ -44,7 +44,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
var prototype = _prototypeManager.Index<ConstructionPrototype>(prototypeName);
|
||||
|
||||
var transform = Owner.Transform;
|
||||
if (!loc.InRange(_mapManager, transform.GridPosition, InteractionSystem.INTERACTION_RANGE))
|
||||
if (!loc.InRange(_mapManager, transform.GridPosition, InteractionSystem.InteractionRange))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ using Robust.Shared.Timers;
|
||||
|
||||
namespace Content.Server.GameObjects
|
||||
{
|
||||
public class ServerDoorComponent : Component, IAttackHand
|
||||
public class ServerDoorComponent : Component, IActivate
|
||||
{
|
||||
public override string Name => "Door";
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Content.Server.GameObjects
|
||||
base.OnRemove();
|
||||
}
|
||||
|
||||
public bool AttackHand(AttackHandEventArgs eventArgs)
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
if (_state == DoorState.Open)
|
||||
{
|
||||
@@ -51,7 +51,6 @@ namespace Content.Server.GameObjects
|
||||
{
|
||||
Open();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null, IComponent component = null)
|
||||
|
||||
@@ -14,7 +14,7 @@ using Robust.Server.GameObjects;
|
||||
|
||||
namespace Content.Server.GameObjects.Components
|
||||
{
|
||||
public class EntityStorageComponent : Component, IAttackHand, IStorageComponent
|
||||
public class EntityStorageComponent : Component, IActivate, IStorageComponent
|
||||
{
|
||||
public override string Name => "EntityStorage";
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Content.Server.GameObjects.Components
|
||||
[ViewVariables]
|
||||
public bool Open { get; private set; }
|
||||
|
||||
public bool AttackHand(AttackHandEventArgs eventArgs)
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
if (Open)
|
||||
{
|
||||
@@ -51,7 +51,6 @@ namespace Content.Server.GameObjects.Components
|
||||
{
|
||||
OpenStorage();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CloseStorage()
|
||||
|
||||
@@ -12,7 +12,7 @@ using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Power
|
||||
{
|
||||
public sealed class ApcComponent : SharedApcComponent, IAttackHand
|
||||
public sealed class ApcComponent : SharedApcComponent, IActivate
|
||||
{
|
||||
PowerStorageComponent Storage;
|
||||
AppearanceComponent Appearance;
|
||||
@@ -106,15 +106,14 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
return net.Lack > 0 ? ApcExternalPowerState.Low : ApcExternalPowerState.Good;
|
||||
}
|
||||
|
||||
bool IAttackHand.AttackHand(AttackHandEventArgs eventArgs)
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
if (!eventArgs.User.TryGetComponent(out IActorComponent actor))
|
||||
{
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
_userInterface.Open(actor.playerSession);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void _clickSound()
|
||||
|
||||
@@ -15,7 +15,7 @@ using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Research
|
||||
{
|
||||
public class LatheComponent : SharedLatheComponent, IAttackHand, IAttackBy, IActivate
|
||||
public class LatheComponent : SharedLatheComponent, IAttackBy, IActivate
|
||||
{
|
||||
public const int VolumePerSheet = 3750;
|
||||
|
||||
@@ -94,17 +94,6 @@ namespace Content.Server.GameObjects.Components.Research
|
||||
_userInterface.Open(actor.playerSession);
|
||||
return;
|
||||
}
|
||||
|
||||
bool IAttackHand.AttackHand(AttackHandEventArgs eventArgs)
|
||||
{
|
||||
|
||||
if (!eventArgs.User.TryGetComponent(out IActorComponent actor))
|
||||
return false;
|
||||
|
||||
_userInterface.Open(actor.playerSession);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IAttackBy.AttackBy(AttackByEventArgs eventArgs)
|
||||
{
|
||||
if (!Owner.TryGetComponent(out MaterialStorageComponent storage)
|
||||
|
||||
Reference in New Issue
Block a user