Add interaction checks to all interactions (#923)

This commit is contained in:
chairbender
2020-05-23 02:27:31 -07:00
committed by GitHub
parent af0ec2aeb9
commit 6a4d78cfac
63 changed files with 311 additions and 101 deletions

View File

@@ -8,6 +8,7 @@ using System.Linq;
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components.Materials;
using Content.Shared.GameObjects.Components.Power;
using Content.Shared.GameObjects.Components.Research;
@@ -97,7 +98,7 @@ namespace Content.Server.GameObjects.Components.Research
break;
}
}
@@ -150,12 +151,13 @@ namespace Content.Server.GameObjects.Components.Research
{
return;
}
OpenUserInterface(actor.playerSession);
}
bool IAttackBy.AttackBy(AttackByEventArgs eventArgs)
{
if (!Owner.TryGetComponent(out MaterialStorageComponent storage)
|| !eventArgs.AttackWith.TryGetComponent(out MaterialComponent material)) return false;
|| !eventArgs.AttackWith.TryGetComponent(out MaterialComponent material)) return false;
var multiplier = 1;

View File

@@ -1,4 +1,5 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components.Research;
using Robust.Server.GameObjects.Components.UserInterface;
using Robust.Server.Interfaces.GameObjects;
@@ -60,7 +61,6 @@ namespace Content.Server.GameObjects.Components.Research
return;
OpenUserInterface(actor.playerSession);
return;
}
public void UpdateUserInterface()

View File

@@ -1,5 +1,6 @@
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Utility;
using Content.Shared.Audio;
using Content.Shared.GameObjects.Components.Research;
using Content.Shared.Research;
@@ -110,6 +111,7 @@ namespace Content.Server.GameObjects.Components.Research
{
return;
}
OpenUserInterface(actor.playerSession);
PlayKeyboardSound();
return;

View File

@@ -3,10 +3,12 @@ using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Research;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
using Robust.Shared.Utility;
namespace Content.Server.GameObjects.Components.Research
{
@@ -73,7 +75,7 @@ namespace Content.Server.GameObjects.Components.Research
{
base.Initialize();
Id = ServerCount++;
IoCManager.Resolve<IEntitySystemManager>()?.GetEntitySystem<ResearchSystem>()?.RegisterServer(this);
EntitySystem.Get<ResearchSystem>()?.RegisterServer(this);
Database = Owner.GetComponent<TechnologyDatabaseComponent>();
Owner.TryGetComponent(out _powerDevice);
}
@@ -82,7 +84,7 @@ namespace Content.Server.GameObjects.Components.Research
protected override void Shutdown()
{
base.Shutdown();
IoCManager.Resolve<IEntitySystemManager>()?.GetEntitySystem<ResearchSystem>()?.UnregisterServer(this);
EntitySystem.Get<ResearchSystem>()?.UnregisterServer(this);
}
public override void ExposeData(ObjectSerializer serializer)