Add interaction checks to all interactions (#923)
This commit is contained in:
@@ -4,6 +4,7 @@ using Content.Shared.GameObjects.Components.Markers;
|
|||||||
using Robust.Client.Interfaces.Console;
|
using Robust.Client.Interfaces.Console;
|
||||||
using Robust.Client.Interfaces.GameObjects.Components;
|
using Robust.Client.Interfaces.GameObjects.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
@@ -48,8 +49,7 @@ namespace Content.Client.Commands
|
|||||||
|
|
||||||
public bool Execute(IDebugConsole console, params string[] args)
|
public bool Execute(IDebugConsole console, params string[] args)
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntitySystemManager>()
|
EntitySystem.Get<SubFloorHideSystem>()
|
||||||
.GetEntitySystem<SubFloorHideSystem>()
|
|
||||||
.EnableAll ^= true;
|
.EnableAll ^= true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|||||||
using Content.Shared.GameObjects.Components.Sound;
|
using Content.Shared.GameObjects.Components.Sound;
|
||||||
using Robust.Client.GameObjects.EntitySystems;
|
using Robust.Client.GameObjects.EntitySystems;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Network;
|
using Robust.Shared.Interfaces.Network;
|
||||||
using Robust.Shared.Interfaces.Random;
|
using Robust.Shared.Interfaces.Random;
|
||||||
@@ -9,6 +10,7 @@ using Robust.Shared.IoC;
|
|||||||
using Robust.Shared.Players;
|
using Robust.Shared.Players;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.Timers;
|
using Robust.Shared.Timers;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Sound
|
namespace Content.Client.GameObjects.Components.Sound
|
||||||
{
|
{
|
||||||
@@ -54,7 +56,7 @@ namespace Content.Client.GameObjects.Components.Sound
|
|||||||
Timer.Spawn((int) schedule.Delay + (_random.Next((int) schedule.RandomDelay)),() =>
|
Timer.Spawn((int) schedule.Delay + (_random.Next((int) schedule.RandomDelay)),() =>
|
||||||
{
|
{
|
||||||
if (!schedule.Play) return; // We make sure this hasn't changed.
|
if (!schedule.Play) return; // We make sure this hasn't changed.
|
||||||
if (_audioSystem == null) _audioSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>();
|
if (_audioSystem == null) _audioSystem = EntitySystem.Get<AudioSystem>();
|
||||||
_audioStreams.Add(schedule,_audioSystem.Play(schedule.Filename, Owner, schedule.AudioParams));
|
_audioStreams.Add(schedule,_audioSystem.Play(schedule.Filename, Owner, schedule.AudioParams));
|
||||||
|
|
||||||
if (schedule.Times == 0) return;
|
if (schedule.Times == 0) return;
|
||||||
@@ -87,7 +89,7 @@ namespace Content.Client.GameObjects.Components.Sound
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
IoCManager.Resolve<IEntitySystemManager>().TryGetEntitySystem(out _audioSystem);
|
EntitySystem.TryGet(out _audioSystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Server.Interfaces.GameObjects;
|
using Content.Server.Interfaces.GameObjects;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Access;
|
using Content.Shared.Access;
|
||||||
using Content.Shared.GameObjects.Components.Access;
|
using Content.Shared.GameObjects.Components.Access;
|
||||||
using Robust.Server.GameObjects.Components.Container;
|
using Robust.Server.GameObjects.Components.Container;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Cargo
|
namespace Content.Server.GameObjects.Components.Cargo
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Content.Server.GameObjects.Components.Metabolism;
|
using Content.Server.GameObjects.Components.Metabolism;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
using Content.Shared.GameObjects.Components.Chemistry;
|
using Content.Shared.GameObjects.Components.Chemistry;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -110,6 +111,8 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
/// <param name="eventArgs"></param>
|
/// <param name="eventArgs"></param>
|
||||||
void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs)
|
void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
|
if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return;
|
||||||
|
|
||||||
//Make sure we have the attacking entity
|
//Make sure we have the attacking entity
|
||||||
if (eventArgs.Attacked == null || !_internalContents.Injector)
|
if (eventArgs.Attacked == null || !_internalContents.Injector)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,12 +4,15 @@ using System.Text;
|
|||||||
using Content.Server.GameObjects.Components.Nutrition;
|
using Content.Server.GameObjects.Components.Nutrition;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Chemistry
|
namespace Content.Server.GameObjects.Components.Chemistry
|
||||||
{
|
{
|
||||||
@@ -25,6 +28,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
#pragma warning disable 649
|
#pragma warning disable 649
|
||||||
[Dependency] private readonly IServerNotifyManager _notifyManager;
|
[Dependency] private readonly IServerNotifyManager _notifyManager;
|
||||||
[Dependency] private readonly ILocalizationManager _localizationManager;
|
[Dependency] private readonly ILocalizationManager _localizationManager;
|
||||||
|
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||||
#pragma warning restore 649
|
#pragma warning restore 649
|
||||||
|
|
||||||
public override string Name => "Pourable";
|
public override string Name => "Pourable";
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Server.GameObjects.EntitySystems;
|
|||||||
using Content.Server.GameObjects.Components.Power;
|
using Content.Server.GameObjects.Components.Power;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Server.Interfaces.GameObjects;
|
using Content.Server.Interfaces.GameObjects;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
using Content.Shared.GameObjects.Components.Chemistry;
|
using Content.Shared.GameObjects.Components.Chemistry;
|
||||||
using Robust.Server.GameObjects.Components.Container;
|
using Robust.Server.GameObjects.Components.Container;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.GameObjects.Components.Power;
|
using Content.Server.GameObjects.Components.Power;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces.GameTicking;
|
using Content.Server.Interfaces.GameTicking;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Command;
|
using Content.Shared.GameObjects.Components.Command;
|
||||||
using Robust.Server.GameObjects.Components.UserInterface;
|
using Robust.Server.GameObjects.Components.UserInterface;
|
||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ using Content.Server.GameObjects.Components.Interactable.Tools;
|
|||||||
using Content.Server.GameObjects.Components.Stack;
|
using Content.Server.GameObjects.Components.Stack;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.GameObjects.EntitySystems;
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.GameObjects.Components;
|
using Robust.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Shared.Interfaces.Random;
|
using Robust.Shared.Interfaces.Random;
|
||||||
@@ -18,6 +20,8 @@ using Robust.Shared.Localization;
|
|||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
using static Content.Shared.Construction.ConstructionStepMaterial;
|
using static Content.Shared.Construction.ConstructionStepMaterial;
|
||||||
using static Content.Shared.Construction.ConstructionStepTool;
|
using static Content.Shared.Construction.ConstructionStepTool;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Construction
|
namespace Content.Server.GameObjects.Components.Construction
|
||||||
{
|
{
|
||||||
@@ -46,18 +50,16 @@ namespace Content.Server.GameObjects.Components.Construction
|
|||||||
|
|
||||||
Sprite = Owner.GetComponent<SpriteComponent>();
|
Sprite = Owner.GetComponent<SpriteComponent>();
|
||||||
Transform = Owner.GetComponent<ITransformComponent>();
|
Transform = Owner.GetComponent<ITransformComponent>();
|
||||||
var systemman = IoCManager.Resolve<IEntitySystemManager>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AttackBy(AttackByEventArgs eventArgs)
|
public bool AttackBy(AttackByEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
var playerEntity = eventArgs.User;
|
// default interaction check for AttackBy allows inside blockers, so we will check if its blocked if
|
||||||
var interactionSystem = _entitySystemManager.GetEntitySystem<InteractionSystem>();
|
// we're not allowed to build on impassable stuff
|
||||||
if (!interactionSystem.InRangeUnobstructed(playerEntity.Transform.MapPosition, Owner.Transform.WorldPosition, ignoredEnt: Owner, insideBlockerValid: Prototype.CanBuildInImpassable))
|
if (Prototype.CanBuildInImpassable == false)
|
||||||
{
|
{
|
||||||
_notifyManager.PopupMessage(Owner.Transform.GridPosition, playerEntity,
|
if (!InteractionChecks.InRangeUnobstructed(eventArgs, false))
|
||||||
_localizationManager.GetString("You can't reach there!"));
|
return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var stage = Prototype.Stages[Stage];
|
var stage = Prototype.Stages[Stage];
|
||||||
@@ -124,7 +126,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var sound = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>();
|
var sound = EntitySystem.Get<AudioSystem>();
|
||||||
|
|
||||||
switch (step)
|
switch (step)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.GameObjects.Components.Stack;
|
using Content.Server.GameObjects.Components.Stack;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using Content.Shared.GameObjects.Components.Construction;
|
using Content.Shared.GameObjects.Components.Construction;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Robust.Server.GameObjects.EntitySystems;
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Map;
|
using Robust.Shared.Interfaces.Map;
|
||||||
using Robust.Shared.Interfaces.Network;
|
using Robust.Shared.Interfaces.Network;
|
||||||
@@ -16,6 +18,7 @@ using Robust.Shared.Map;
|
|||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Players;
|
using Robust.Shared.Players;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Construction
|
namespace Content.Server.GameObjects.Components.Construction
|
||||||
{
|
{
|
||||||
@@ -47,16 +50,13 @@ namespace Content.Server.GameObjects.Components.Construction
|
|||||||
{
|
{
|
||||||
var prototype = _prototypeManager.Index<ConstructionPrototype>(prototypeName);
|
var prototype = _prototypeManager.Index<ConstructionPrototype>(prototypeName);
|
||||||
|
|
||||||
var transform = Owner.Transform;
|
if (!InteractionChecks.InRangeUnobstructed(Owner, loc.ToMapPos(_mapManager),
|
||||||
|
ignoredEnt: Owner, insideBlockerValid: prototype.CanBuildInImpassable))
|
||||||
var interactionSystem = _entitySystemManager.GetEntitySystem<InteractionSystem>();
|
|
||||||
if (!interactionSystem.InRangeUnobstructed(loc.ToMap(_mapManager), Owner.Transform.WorldPosition, ignoredEnt: Owner, insideBlockerValid: prototype.CanBuildInImpassable))
|
|
||||||
{
|
{
|
||||||
_notifyManager.PopupMessage(transform.GridPosition, Owner,
|
|
||||||
_localizationManager.GetString("You can't reach there!"));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (prototype.Stages.Count < 2)
|
if (prototype.Stages.Count < 2)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException($"Prototype '{prototypeName}' does not have enough stages.");
|
throw new InvalidOperationException($"Prototype '{prototypeName}' does not have enough stages.");
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Server.GameObjects.Components.Power;
|
|||||||
using Content.Server.GameObjects.Components.VendingMachines;
|
using Content.Server.GameObjects.Components.VendingMachines;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Doors;
|
using Content.Shared.GameObjects.Components.Doors;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Server.GameObjects.Components.Access;
|
using Content.Server.GameObjects.Components.Access;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Doors;
|
using Content.Shared.GameObjects.Components.Doors;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System;
|
|||||||
using Content.Server.GameObjects.Components.Chemistry;
|
using Content.Server.GameObjects.Components.Chemistry;
|
||||||
using Content.Server.GameObjects.Components.Sound;
|
using Content.Server.GameObjects.Components.Sound;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System;
|
|||||||
using Content.Server.GameObjects.Components.Chemistry;
|
using Content.Server.GameObjects.Components.Chemistry;
|
||||||
using Content.Server.GameObjects.Components.Sound;
|
using Content.Server.GameObjects.Components.Sound;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -59,6 +60,8 @@ namespace Content.Server.GameObjects.Components.Fluids
|
|||||||
|
|
||||||
void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs)
|
void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
|
if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return;
|
||||||
|
|
||||||
Solution solution;
|
Solution solution;
|
||||||
if (eventArgs.Attacked == null)
|
if (eventArgs.Attacked == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Robust.Server.GameObjects.EntitySystems;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Components;
|
using Robust.Shared.GameObjects.Components;
|
||||||
using Robust.Shared.GameObjects.Components.Transform;
|
using Robust.Shared.GameObjects.Components.Transform;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Random;
|
using Robust.Shared.Interfaces.Random;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -17,6 +18,7 @@ using Robust.Shared.Serialization;
|
|||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
using Timer = Robust.Shared.Timers.Timer;
|
using Timer = Robust.Shared.Timers.Timer;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Fluids
|
namespace Content.Server.GameObjects.Components.Fluids
|
||||||
{
|
{
|
||||||
@@ -137,8 +139,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entitySystemManager = IoCManager.Resolve<IEntitySystemManager>();
|
EntitySystem.Get<AudioSystem>().Play(_spillSound);
|
||||||
entitySystemManager.GetEntitySystem<AudioSystem>().Play(_spillSound);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.GameObjects.Components.Interactable.Tools;
|
|||||||
using Content.Server.GameObjects.Components.Power;
|
using Content.Server.GameObjects.Components.Power;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Gravity;
|
using Content.Shared.GameObjects.Components.Gravity;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
@@ -11,10 +12,12 @@ using Robust.Server.GameObjects.EntitySystems;
|
|||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Server.Interfaces.Player;
|
using Robust.Server.Interfaces.Player;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Gravity
|
namespace Content.Server.GameObjects.Components.Gravity
|
||||||
{
|
{
|
||||||
@@ -101,6 +104,7 @@ namespace Content.Server.GameObjects.Components.Gravity
|
|||||||
public bool AttackBy(AttackByEventArgs eventArgs)
|
public bool AttackBy(AttackByEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (!eventArgs.AttackWith.TryGetComponent<WelderComponent>(out var welder)) return false;
|
if (!eventArgs.AttackWith.TryGetComponent<WelderComponent>(out var welder)) return false;
|
||||||
|
|
||||||
if (welder.TryUse(5.0f))
|
if (welder.TryUse(5.0f))
|
||||||
{
|
{
|
||||||
// Repair generator
|
// Repair generator
|
||||||
@@ -110,10 +114,9 @@ namespace Content.Server.GameObjects.Components.Gravity
|
|||||||
breakable.broken = false;
|
breakable.broken = false;
|
||||||
_intact = true;
|
_intact = true;
|
||||||
|
|
||||||
var entitySystemManager = IoCManager.Resolve<IEntitySystemManager>();
|
|
||||||
var notifyManager = IoCManager.Resolve<IServerNotifyManager>();
|
var notifyManager = IoCManager.Resolve<IServerNotifyManager>();
|
||||||
|
|
||||||
entitySystemManager.GetEntitySystem<AudioSystem>().Play("/Audio/items/welder2.ogg", Owner);
|
EntitySystem.Get<AudioSystem>().Play("/Audio/items/welder2.ogg", Owner);
|
||||||
notifyManager.PopupMessage(Owner, eventArgs.User, Loc.GetString("You repair the gravity generator with the welder"));
|
notifyManager.PopupMessage(Owner, eventArgs.User, Loc.GetString("You repair the gravity generator with the welder"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.GameObjects.Components.Stack;
|
using Content.Server.GameObjects.Components.Stack;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -24,6 +25,8 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
|||||||
|
|
||||||
void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs)
|
void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
|
if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return;
|
||||||
|
|
||||||
if (eventArgs.Attacked == null)
|
if (eventArgs.Attacked == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.GameObjects.EntitySystems;
|
|||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Server.Interfaces.GameObjects;
|
using Content.Server.Interfaces.GameObjects;
|
||||||
using Content.Server.Mobs;
|
using Content.Server.Mobs;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Instruments;
|
using Content.Shared.GameObjects.Components.Instruments;
|
||||||
using NFluidsynth;
|
using NFluidsynth;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Content.Server.GameObjects.Components.Sound;
|
using Content.Server.GameObjects.Components.Sound;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces.GameObjects;
|
using Content.Server.Interfaces.GameObjects;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
using Robust.Server.GameObjects.EntitySystems;
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -25,17 +26,11 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools
|
|||||||
|
|
||||||
public void AfterAttack(AfterAttackEventArgs eventArgs)
|
public void AfterAttack(AfterAttackEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
|
if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return;
|
||||||
|
|
||||||
var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GridID);
|
var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GridID);
|
||||||
var tile = mapGrid.GetTileRef(eventArgs.ClickLocation);
|
var tile = mapGrid.GetTileRef(eventArgs.ClickLocation);
|
||||||
|
|
||||||
var coordinates = mapGrid.GridTileToLocal(tile.GridIndices);
|
var coordinates = mapGrid.GridTileToLocal(tile.GridIndices);
|
||||||
float distance = coordinates.Distance(_mapManager, Owner.Transform.GridPosition);
|
|
||||||
|
|
||||||
if (distance > InteractionSystem.InteractionRange)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var tileDef = (ContentTileDefinition)_tileDefinitionManager[tile.Tile.TypeId];
|
var tileDef = (ContentTileDefinition)_tileDefinitionManager[tile.Tile.TypeId];
|
||||||
if (tileDef.CanCrowbar)
|
if (tileDef.CanCrowbar)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.GameObjects.Components.Sound;
|
using Content.Server.GameObjects.Components.Sound;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.GameObjects.Components.Stack;
|
using Content.Server.GameObjects.Components.Stack;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
using Robust.Server.GameObjects.EntitySystems;
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -40,18 +41,11 @@ namespace Content.Server.GameObjects.Components.Items
|
|||||||
}
|
}
|
||||||
public void AfterAttack(AfterAttackEventArgs eventArgs)
|
public void AfterAttack(AfterAttackEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
|
if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return;
|
||||||
|
|
||||||
var attacked = eventArgs.Attacked;
|
var attacked = eventArgs.Attacked;
|
||||||
var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GridID);
|
var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GridID);
|
||||||
var tile = mapGrid.GetTileRef(eventArgs.ClickLocation);
|
var tile = mapGrid.GetTileRef(eventArgs.ClickLocation);
|
||||||
|
|
||||||
var coordinates = mapGrid.GridTileToLocal(tile.GridIndices);
|
|
||||||
float distance = coordinates.Distance(_mapManager, Owner.Transform.GridPosition);
|
|
||||||
|
|
||||||
if (distance > InteractionSystem.InteractionRange)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var tileDef = (ContentTileDefinition)_tileDefinitionManager[tile.Tile.TypeId];
|
var tileDef = (ContentTileDefinition)_tileDefinitionManager[tile.Tile.TypeId];
|
||||||
if (tileDef.IsSubFloor && attacked == null && Stack.Use(1))
|
if (tileDef.IsSubFloor && attacked == null && Stack.Use(1))
|
||||||
{
|
{
|
||||||
@@ -63,7 +57,7 @@ namespace Content.Server.GameObjects.Components.Items
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Linq;
|
|||||||
using Content.Server.GameObjects.Components.Items.Storage;
|
using Content.Server.GameObjects.Components.Items.Storage;
|
||||||
using Content.Server.GameObjects.Components.Sound;
|
using Content.Server.GameObjects.Components.Sound;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Content.Shared.GameObjects.Components.Storage;
|
using Content.Shared.GameObjects.Components.Storage;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Server.GameObjects.Components.Destructible;
|
|||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces.GameObjects;
|
using Content.Server.Interfaces.GameObjects;
|
||||||
using Content.Server.Throw;
|
using Content.Server.Throw;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Content.Shared.GameObjects.Components.Items;
|
using Content.Shared.GameObjects.Components.Items;
|
||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
@@ -12,6 +13,7 @@ using Robust.Server.Interfaces.GameObjects;
|
|||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Components;
|
using Robust.Shared.GameObjects.Components;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.GameObjects.Components;
|
using Robust.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Shared.Interfaces.Map;
|
using Robust.Shared.Interfaces.Map;
|
||||||
@@ -23,6 +25,7 @@ using Robust.Shared.Maths;
|
|||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects
|
namespace Content.Server.GameObjects
|
||||||
{
|
{
|
||||||
@@ -35,7 +38,6 @@ namespace Content.Server.GameObjects
|
|||||||
|
|
||||||
#pragma warning disable 649
|
#pragma warning disable 649
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom;
|
[Dependency] private readonly IRobustRandom _robustRandom;
|
||||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
|
||||||
[Dependency] private readonly IMapManager _mapManager;
|
[Dependency] private readonly IMapManager _mapManager;
|
||||||
#pragma warning restore 649
|
#pragma warning restore 649
|
||||||
|
|
||||||
@@ -97,8 +99,7 @@ namespace Content.Server.GameObjects
|
|||||||
var userPos = user.Transform.MapPosition;
|
var userPos = user.Transform.MapPosition;
|
||||||
var itemPos = Owner.Transform.WorldPosition;
|
var itemPos = Owner.Transform.WorldPosition;
|
||||||
|
|
||||||
return _entitySystemManager.GetEntitySystem<InteractionSystem>()
|
return InteractionChecks.InRangeUnobstructed(user, itemPos, ignoredEnt: Owner, insideBlockerValid:true);
|
||||||
.InRangeUnobstructed(userPos, itemPos, ignoredEnt: Owner, insideBlockerValid:true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AttackHand(AttackHandEventArgs eventArgs)
|
public bool AttackHand(AttackHandEventArgs eventArgs)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Server.GameObjects.Components;
|
|||||||
using Content.Server.GameObjects.Components.Items.Storage;
|
using Content.Server.GameObjects.Components.Items.Storage;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces.GameObjects;
|
using Content.Server.Interfaces.GameObjects;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Storage;
|
using Content.Shared.GameObjects.Components.Storage;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
@@ -149,6 +150,8 @@ namespace Content.Server.GameObjects
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return PlayerInsertEntity(eventArgs.User);
|
return PlayerInsertEntity(eventArgs.User);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ using Robust.Server.GameObjects.Components.UserInterface;
|
|||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Kitchen
|
namespace Content.Server.GameObjects.Components.Kitchen
|
||||||
@@ -177,6 +178,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
_userInterface.Open(actor.playerSession);
|
_userInterface.Open(actor.playerSession);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.GameObjects.Components.Mobs;
|
using Content.Server.GameObjects.Components.Mobs;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Content.Shared.Preferences.Appearance;
|
using Content.Shared.Preferences.Appearance;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Server.GameObjects.EntitySystems;
|
|||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Content.Shared.GameObjects.Components.Medical;
|
using Content.Shared.GameObjects.Components.Medical;
|
||||||
using Content.Server.GameObjects.Components.Power;
|
using Content.Server.GameObjects.Components.Power;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.GameObjects.Components.Container;
|
using Robust.Server.GameObjects.Components.Container;
|
||||||
using Robust.Server.GameObjects.Components.UserInterface;
|
using Robust.Server.GameObjects.Components.UserInterface;
|
||||||
@@ -120,8 +121,10 @@ namespace Content.Server.GameObjects.Components.Medical
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Powered)
|
if (!Powered)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_userInterface.Open(actor.playerSession);
|
_userInterface.Open(actor.playerSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.GameObjects.Components.Sound;
|
using Content.Server.GameObjects.Components.Sound;
|
||||||
using Content.Server.GameObjects.Components.Weapon.Melee;
|
using Content.Server.GameObjects.Components.Weapon.Melee;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
|||||||
@@ -6,11 +6,13 @@ using Robust.Server.GameObjects.EntitySystems;
|
|||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Components;
|
using Robust.Shared.GameObjects.Components;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.Timers;
|
using Robust.Shared.Timers;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Movement
|
namespace Content.Server.GameObjects.Components.Movement
|
||||||
{
|
{
|
||||||
@@ -195,7 +197,7 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
if (!immuneEntities.Contains(entity))
|
if (!immuneEntities.Contains(entity))
|
||||||
{
|
{
|
||||||
var position = _connectingTeleporter.Transform.GridPosition;
|
var position = _connectingTeleporter.Transform.GridPosition;
|
||||||
var soundPlayer = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>();
|
var soundPlayer = EntitySystem.Get<AudioSystem>();
|
||||||
|
|
||||||
// Departure
|
// Departure
|
||||||
// Do we need to rate-limit sounds to stop ear BLAST?
|
// Do we need to rate-limit sounds to stop ear BLAST?
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Robust.Server.GameObjects.EntitySystems;
|
|||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Components;
|
using Robust.Shared.GameObjects.Components;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Map;
|
using Robust.Shared.Interfaces.Map;
|
||||||
using Robust.Shared.Interfaces.Random;
|
using Robust.Shared.Interfaces.Random;
|
||||||
@@ -16,6 +17,7 @@ using Robust.Shared.Maths;
|
|||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.Timers;
|
using Robust.Shared.Timers;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Movement
|
namespace Content.Server.GameObjects.Components.Movement
|
||||||
{
|
{
|
||||||
@@ -141,7 +143,7 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
Timer.Spawn(TimeSpan.FromSeconds(_chargeTime + _cooldown), () => SetState(ItemTeleporterState.Off));
|
Timer.Spawn(TimeSpan.FromSeconds(_chargeTime + _cooldown), () => SetState(ItemTeleporterState.Off));
|
||||||
if (_cooldownSound != null)
|
if (_cooldownSound != null)
|
||||||
{
|
{
|
||||||
var soundPlayer = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>();
|
var soundPlayer = EntitySystem.Get<AudioSystem>();
|
||||||
soundPlayer.Play(_cooldownSound, Owner);
|
soundPlayer.Play(_cooldownSound, Owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,7 +229,7 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
{
|
{
|
||||||
// Messy maybe?
|
// Messy maybe?
|
||||||
GridCoordinates targetGrid = new GridCoordinates(vector, user.Transform.GridID);
|
GridCoordinates targetGrid = new GridCoordinates(vector, user.Transform.GridID);
|
||||||
var soundPlayer = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>();
|
var soundPlayer = EntitySystem.Get<AudioSystem>();
|
||||||
|
|
||||||
// If portals use those, otherwise just move em over
|
// If portals use those, otherwise just move em over
|
||||||
if (_portalAliveTime > 0.0f)
|
if (_portalAliveTime > 0.0f)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Linq;
|
|||||||
using Content.Server.GameObjects.Components.Chemistry;
|
using Content.Server.GameObjects.Components.Chemistry;
|
||||||
using Content.Server.GameObjects.Components.Sound;
|
using Content.Server.GameObjects.Components.Sound;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
using Content.Shared.GameObjects.Components.Nutrition;
|
using Content.Shared.GameObjects.Components.Nutrition;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
@@ -11,11 +12,13 @@ using Robust.Server.GameObjects;
|
|||||||
using Robust.Server.GameObjects.EntitySystems;
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Nutrition
|
namespace Content.Server.GameObjects.Components.Nutrition
|
||||||
{
|
{
|
||||||
@@ -99,23 +102,25 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
|||||||
|
|
||||||
void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs)
|
void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
|
if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return;
|
||||||
|
|
||||||
UseDrink(eventArgs.Attacked);
|
UseDrink(eventArgs.Attacked);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UseDrink(IEntity user)
|
private void UseDrink(IEntity targetEntity)
|
||||||
{
|
{
|
||||||
if (user == null)
|
if (targetEntity == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UsesLeft() == 0 && !_despawnOnFinish)
|
if (UsesLeft() == 0 && !_despawnOnFinish)
|
||||||
{
|
{
|
||||||
user.PopupMessage(user, _localizationManager.GetString("Empty"));
|
targetEntity.PopupMessage(targetEntity, _localizationManager.GetString("Empty"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user.TryGetComponent(out StomachComponent stomachComponent))
|
if (targetEntity.TryGetComponent(out StomachComponent stomachComponent))
|
||||||
{
|
{
|
||||||
_drinking = true;
|
_drinking = true;
|
||||||
var transferAmount = ReagentUnit.Min(_transferAmount, _contents.CurrentVolume);
|
var transferAmount = ReagentUnit.Min(_transferAmount, _contents.CurrentVolume);
|
||||||
@@ -125,17 +130,16 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
|||||||
// When we split Finish gets called which may delete the can so need to use the entity system for sound
|
// When we split Finish gets called which may delete the can so need to use the entity system for sound
|
||||||
if (_useSound != null)
|
if (_useSound != null)
|
||||||
{
|
{
|
||||||
var entitySystemManager = IoCManager.Resolve<IEntitySystemManager>();
|
var audioSystem = EntitySystem.Get<AudioSystem>();
|
||||||
var audioSystem = entitySystemManager.GetEntitySystem<AudioSystem>();
|
|
||||||
audioSystem.Play(_useSound, Owner, AudioParams.Default.WithVolume(-2f));
|
audioSystem.Play(_useSound, Owner, AudioParams.Default.WithVolume(-2f));
|
||||||
user.PopupMessage(user, _localizationManager.GetString("Slurp"));
|
targetEntity.PopupMessage(targetEntity, _localizationManager.GetString("Slurp"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Add it back in
|
// Add it back in
|
||||||
_contents.TryAddSolution(split);
|
_contents.TryAddSolution(split);
|
||||||
user.PopupMessage(user, _localizationManager.GetString("Can't drink"));
|
targetEntity.PopupMessage(targetEntity, _localizationManager.GetString("Can't drink"));
|
||||||
}
|
}
|
||||||
_drinking = false;
|
_drinking = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Content.Server.GameObjects.Components.Chemistry;
|
using Content.Server.GameObjects.Components.Chemistry;
|
||||||
using Content.Server.GameObjects.Components.Sound;
|
using Content.Server.GameObjects.Components.Sound;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
using Content.Shared.GameObjects.Components.Nutrition;
|
using Content.Shared.GameObjects.Components.Nutrition;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
@@ -111,6 +112,8 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
|||||||
|
|
||||||
void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs)
|
void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
|
if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return;
|
||||||
|
|
||||||
UseFood(eventArgs.Attacked);
|
UseFood(eventArgs.Attacked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.GameObjects.Components.UserInterface;
|
using Robust.Server.GameObjects.Components.UserInterface;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.GameObjects.Components.Sound;
|
using Content.Server.GameObjects.Components.Sound;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Power;
|
using Content.Shared.GameObjects.Components.Power;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.GameObjects.Components.UserInterface;
|
using Robust.Server.GameObjects.Components.UserInterface;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Content.Shared.GameObjects.Components.Power;
|
using Content.Shared.GameObjects.Components.Power;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan;
|
using Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Content.Shared.GameObjects.Components.Power;
|
using Content.Shared.GameObjects.Components.Power;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Shared.Audio;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.GameObjects.EntitySystems;
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Random;
|
using Robust.Shared.Interfaces.Random;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -12,6 +13,7 @@ using Robust.Shared.Prototypes;
|
|||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Power
|
namespace Content.Server.GameObjects.Components.Power
|
||||||
{
|
{
|
||||||
@@ -126,7 +128,7 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>("glassbreak");
|
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>("glassbreak");
|
||||||
var file = _random.Pick(soundCollection.PickFiles);
|
var file = _random.Pick(soundCollection.PickFiles);
|
||||||
|
|
||||||
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>().Play(file, Owner);
|
EntitySystem.Get<AudioSystem>().Play(file, Owner);
|
||||||
|
|
||||||
State = LightBulbState.Broken;
|
State = LightBulbState.Broken;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Content.Server.GameObjects.Components.Interactable.Tools;
|
using Content.Server.GameObjects.Components.Interactable.Tools;
|
||||||
using Content.Server.GameObjects.Components.Stack;
|
using Content.Server.GameObjects.Components.Stack;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Components.Transform;
|
using Robust.Shared.GameObjects.Components.Transform;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.GameObjects.Components.Sound;
|
using Content.Server.GameObjects.Components.Sound;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.GameObjects.Components.Container;
|
using Robust.Server.GameObjects.Components.Container;
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Power
|
namespace Content.Server.GameObjects.Components.Power
|
||||||
{
|
{
|
||||||
@@ -15,8 +17,7 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
{
|
{
|
||||||
public Powernet()
|
public Powernet()
|
||||||
{
|
{
|
||||||
var EntitySystemManager = IoCManager.Resolve<IEntitySystemManager>();
|
var powerSystem = EntitySystem.Get<PowerSystem>();
|
||||||
var powerSystem = EntitySystemManager.GetEntitySystem<PowerSystem>();
|
|
||||||
powerSystem.Powernets.Add(this);
|
powerSystem.Powernets.Add(this);
|
||||||
Uid = powerSystem.NewUid();
|
Uid = powerSystem.NewUid();
|
||||||
}
|
}
|
||||||
@@ -374,8 +375,7 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void RemoveFromSystem()
|
private void RemoveFromSystem()
|
||||||
{
|
{
|
||||||
var EntitySystemManager = IoCManager.Resolve<IEntitySystemManager>();
|
EntitySystem.Get<PowerSystem>().Powernets.Remove(this);
|
||||||
EntitySystemManager.GetEntitySystem<PowerSystem>().Powernets.Remove(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Registration
|
#region Registration
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.GameObjects.Components.Stack;
|
using Content.Server.GameObjects.Components.Stack;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -25,6 +26,8 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void AfterAttack(AfterAttackEventArgs eventArgs)
|
public void AfterAttack(AfterAttackEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
|
if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return;
|
||||||
|
|
||||||
if(!_mapManager.TryGetGrid(eventArgs.ClickLocation.GridID, out var grid))
|
if(!_mapManager.TryGetGrid(eventArgs.ClickLocation.GridID, out var grid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using System.Linq;
|
|||||||
using Content.Server.GameObjects.Components.Power;
|
using Content.Server.GameObjects.Components.Power;
|
||||||
using Content.Server.GameObjects.Components.Stack;
|
using Content.Server.GameObjects.Components.Stack;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Materials;
|
using Content.Shared.GameObjects.Components.Materials;
|
||||||
using Content.Shared.GameObjects.Components.Power;
|
using Content.Shared.GameObjects.Components.Power;
|
||||||
using Content.Shared.GameObjects.Components.Research;
|
using Content.Shared.GameObjects.Components.Research;
|
||||||
@@ -97,7 +98,7 @@ namespace Content.Server.GameObjects.Components.Research
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,12 +151,13 @@ namespace Content.Server.GameObjects.Components.Research
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenUserInterface(actor.playerSession);
|
OpenUserInterface(actor.playerSession);
|
||||||
}
|
}
|
||||||
bool IAttackBy.AttackBy(AttackByEventArgs eventArgs)
|
bool IAttackBy.AttackBy(AttackByEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent(out MaterialStorageComponent storage)
|
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;
|
var multiplier = 1;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Research;
|
using Content.Shared.GameObjects.Components.Research;
|
||||||
using Robust.Server.GameObjects.Components.UserInterface;
|
using Robust.Server.GameObjects.Components.UserInterface;
|
||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
@@ -60,7 +61,6 @@ namespace Content.Server.GameObjects.Components.Research
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
OpenUserInterface(actor.playerSession);
|
OpenUserInterface(actor.playerSession);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateUserInterface()
|
public void UpdateUserInterface()
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.GameObjects.Components.Power;
|
using Content.Server.GameObjects.Components.Power;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
using Content.Shared.GameObjects.Components.Research;
|
using Content.Shared.GameObjects.Components.Research;
|
||||||
using Content.Shared.Research;
|
using Content.Shared.Research;
|
||||||
@@ -110,6 +111,7 @@ namespace Content.Server.GameObjects.Components.Research
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenUserInterface(actor.playerSession);
|
OpenUserInterface(actor.playerSession);
|
||||||
PlayKeyboardSound();
|
PlayKeyboardSound();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -3,10 +3,12 @@ using Content.Server.GameObjects.Components.Power;
|
|||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Research;
|
using Content.Shared.Research;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Research
|
namespace Content.Server.GameObjects.Components.Research
|
||||||
{
|
{
|
||||||
@@ -73,7 +75,7 @@ namespace Content.Server.GameObjects.Components.Research
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
Id = ServerCount++;
|
Id = ServerCount++;
|
||||||
IoCManager.Resolve<IEntitySystemManager>()?.GetEntitySystem<ResearchSystem>()?.RegisterServer(this);
|
EntitySystem.Get<ResearchSystem>()?.RegisterServer(this);
|
||||||
Database = Owner.GetComponent<TechnologyDatabaseComponent>();
|
Database = Owner.GetComponent<TechnologyDatabaseComponent>();
|
||||||
Owner.TryGetComponent(out _powerDevice);
|
Owner.TryGetComponent(out _powerDevice);
|
||||||
}
|
}
|
||||||
@@ -82,7 +84,7 @@ namespace Content.Server.GameObjects.Components.Research
|
|||||||
protected override void Shutdown()
|
protected override void Shutdown()
|
||||||
{
|
{
|
||||||
base.Shutdown();
|
base.Shutdown();
|
||||||
IoCManager.Resolve<IEntitySystemManager>()?.GetEntitySystem<ResearchSystem>()?.UnregisterServer(this);
|
EntitySystem.Get<ResearchSystem>()?.UnregisterServer(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.GameObjects.Components.Power;
|
using Content.Server.GameObjects.Components.Power;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.VendingMachines;
|
using Content.Shared.GameObjects.Components.VendingMachines;
|
||||||
using Content.Shared.VendingMachines;
|
using Content.Shared.VendingMachines;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Linq;
|
|||||||
using Content.Server.GameObjects.Components.Power;
|
using Content.Server.GameObjects.Components.Power;
|
||||||
using Content.Server.GameObjects.Components.Sound;
|
using Content.Server.GameObjects.Components.Sound;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
@@ -10,6 +11,7 @@ using Robust.Server.GameObjects.EntitySystems;
|
|||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.EntitySystemMessages;
|
using Robust.Shared.GameObjects.EntitySystemMessages;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Physics;
|
using Robust.Shared.Interfaces.Physics;
|
||||||
using Robust.Shared.Interfaces.Timing;
|
using Robust.Shared.Interfaces.Timing;
|
||||||
@@ -18,6 +20,7 @@ using Robust.Shared.Map;
|
|||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
|
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
|
||||||
{
|
{
|
||||||
@@ -129,8 +132,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
|
|||||||
|
|
||||||
Shaded = false
|
Shaded = false
|
||||||
};
|
};
|
||||||
var mgr = IoCManager.Resolve<IEntitySystemManager>();
|
EntitySystem.Get<EffectSystem>().CreateParticle(message);
|
||||||
mgr.GetEntitySystem<EffectSystem>().CreateParticle(message);
|
|
||||||
Owner.GetComponent<SoundComponent>().Play(_fireSound, AudioParams.Default.WithVolume(-5));
|
Owner.GetComponent<SoundComponent>().Play(_fireSound, AudioParams.Default.WithVolume(-5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Weapons.Ranged;
|
using Content.Shared.GameObjects.Components.Weapons.Ranged;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Weapons.Ranged;
|
using Content.Shared.GameObjects.Components.Weapons.Ranged;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Server.GameObjects.Components.Sound;
|
using Content.Server.GameObjects.Components.Sound;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Content.Shared.GameObjects.Components.Weapons.Ranged;
|
using Content.Shared.GameObjects.Components.Weapons.Ranged;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Content.Server.GameObjects.Components.VendingMachines;
|
|||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Server.Interfaces.GameObjects;
|
using Content.Server.Interfaces.GameObjects;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
@@ -13,6 +14,7 @@ using Robust.Server.GameObjects.Components.UserInterface;
|
|||||||
using Robust.Server.GameObjects.EntitySystems;
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Server.Interfaces.Player;
|
using Robust.Server.Interfaces.Player;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Random;
|
using Robust.Shared.Interfaces.Random;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -20,6 +22,7 @@ using Robust.Shared.Localization;
|
|||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components
|
namespace Content.Server.GameObjects.Components
|
||||||
{
|
{
|
||||||
@@ -108,7 +111,7 @@ namespace Content.Server.GameObjects.Components
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
_audioSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>();
|
_audioSystem = EntitySystem.Get<AudioSystem>();
|
||||||
_appearance = Owner.GetComponent<AppearanceComponent>();
|
_appearance = Owner.GetComponent<AppearanceComponent>();
|
||||||
_appearance.SetData(WiresVisuals.MaintenancePanelState, IsPanelOpen);
|
_appearance.SetData(WiresVisuals.MaintenancePanelState, IsPanelOpen);
|
||||||
_userInterface = Owner.GetComponent<ServerUserInterfaceComponent>()
|
_userInterface = Owner.GetComponent<ServerUserInterfaceComponent>()
|
||||||
@@ -235,8 +238,7 @@ namespace Content.Server.GameObjects.Components
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var interactionSystem = IoCManager.Resolve<EntitySystemManager>().GetEntitySystem<InteractionSystem>();
|
if (!EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(player.Transform.MapPosition, Owner.Transform.WorldPosition, ignoredEnt: Owner))
|
||||||
if (!interactionSystem.InRangeUnobstructed(player.Transform.MapPosition, Owner.Transform.WorldPosition, ignoredEnt: Owner))
|
|
||||||
{
|
{
|
||||||
_notifyManager.PopupMessage(Owner.Transform.GridPosition, player, _localizationManager.GetString("You can't reach there!"));
|
_notifyManager.PopupMessage(Owner.Transform.GridPosition, player, _localizationManager.GetString("You can't reach there!"));
|
||||||
return;
|
return;
|
||||||
@@ -302,8 +304,7 @@ namespace Content.Server.GameObjects.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
IsPanelOpen = !IsPanelOpen;
|
IsPanelOpen = !IsPanelOpen;
|
||||||
IoCManager.Resolve<IEntitySystemManager>()
|
EntitySystem.Get<AudioSystem>()
|
||||||
.GetEntitySystem<AudioSystem>()
|
|
||||||
.Play(IsPanelOpen ? "/Audio/machines/screwdriveropen.ogg" : "/Audio/machines/screwdriverclose.ogg");
|
.Play(IsPanelOpen ? "/Audio/machines/screwdriveropen.ogg" : "/Audio/machines/screwdriverclose.ogg");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
using Content.Server.GameObjects.Components.Interactable.Tools;
|
using Content.Server.GameObjects.Components.Interactable.Tools;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.GameObjects.EntitySystems;
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components
|
namespace Content.Server.GameObjects.Components
|
||||||
{
|
{
|
||||||
@@ -17,7 +20,7 @@ namespace Content.Server.GameObjects.Components
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
_audioSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>();
|
_audioSystem = EntitySystem.Get<AudioSystem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AttackBy(AttackByEventArgs eventArgs)
|
public bool AttackBy(AttackByEventArgs eventArgs)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using Robust.Shared.GameObjects.Systems;
|
|||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Reflection;
|
using Robust.Shared.Interfaces.Reflection;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.EntitySystems
|
namespace Content.Server.GameObjects.EntitySystems
|
||||||
{
|
{
|
||||||
@@ -101,7 +102,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
var processorId = args[0];
|
var processorId = args[0];
|
||||||
var entId = new EntityUid(int.Parse(args[1]));
|
var entId = new EntityUid(int.Parse(args[1]));
|
||||||
var ent = IoCManager.Resolve<IEntityManager>().GetEntity(entId);
|
var ent = IoCManager.Resolve<IEntityManager>().GetEntity(entId);
|
||||||
var aiSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AiSystem>();
|
var aiSystem = EntitySystem.Get<AiSystem>();
|
||||||
|
|
||||||
if (!aiSystem.ProcessorTypeExists(processorId))
|
if (!aiSystem.ProcessorTypeExists(processorId))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Linq;
|
|||||||
using Content.Server.GameObjects.Components.Mobs;
|
using Content.Server.GameObjects.Components.Mobs;
|
||||||
using Content.Server.GameObjects.Components.Timing;
|
using Content.Server.GameObjects.Components.Timing;
|
||||||
using Content.Server.Interfaces.GameObjects;
|
using Content.Server.Interfaces.GameObjects;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Inventory;
|
using Content.Shared.GameObjects.Components.Inventory;
|
||||||
using Content.Shared.Input;
|
using Content.Shared.Input;
|
||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
@@ -18,6 +19,7 @@ using Robust.Shared.Interfaces.GameObjects.Components;
|
|||||||
using Robust.Shared.Interfaces.Map;
|
using Robust.Shared.Interfaces.Map;
|
||||||
using Robust.Shared.Interfaces.Physics;
|
using Robust.Shared.Interfaces.Physics;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -27,36 +29,53 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This interface gives components behavior when being clicked on or "attacked" by a user with an object in their hand
|
/// This interface gives components behavior when being clicked on or "attacked" 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>
|
/// </summary>
|
||||||
public interface IAttackBy
|
public interface IAttackBy
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when using one object on another
|
/// Called when using one object on another when user is in range of the target entity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool AttackBy(AttackByEventArgs eventArgs);
|
bool AttackBy(AttackByEventArgs eventArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AttackByEventArgs : EventArgs
|
public class AttackByEventArgs : EventArgs, ITargetedAttackEventArgs
|
||||||
{
|
{
|
||||||
public IEntity User { get; set; }
|
public IEntity User { get; set; }
|
||||||
public GridCoordinates ClickLocation { get; set; }
|
public GridCoordinates ClickLocation { get; set; }
|
||||||
public IEntity AttackWith { get; set; }
|
public IEntity AttackWith { get; set; }
|
||||||
|
public IEntity Attacked { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ITargetedAttackEventArgs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Performer of the attack
|
||||||
|
/// </summary>
|
||||||
|
IEntity User { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Target of the attack
|
||||||
|
/// </summary>
|
||||||
|
IEntity Attacked { get; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This interface gives components behavior when being clicked on or "attacked" by a user with an empty hand
|
/// This interface gives components behavior when being clicked on or "attacked" by a user with an empty hand
|
||||||
|
/// who is in range and has unobstructed reach of the target entity (allows inside blockers).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IAttackHand
|
public interface IAttackHand
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when a player directly interacts with an empty hand
|
/// Called when a player directly interacts with an empty hand when user is in range of the target entity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool AttackHand(AttackHandEventArgs eventArgs);
|
bool AttackHand(AttackHandEventArgs eventArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AttackHandEventArgs : EventArgs
|
public class AttackHandEventArgs : EventArgs, ITargetedAttackEventArgs
|
||||||
{
|
{
|
||||||
public IEntity User { get; set; }
|
public IEntity User { get; set; }
|
||||||
|
public IEntity Attacked { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -80,8 +99,8 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This interface gives components a behavior when clicking on another object and no interaction occurs
|
/// This interface gives components a behavior when clicking on another object and no interaction occurs,
|
||||||
/// Doesn't pass what you clicked on as an argument, but if it becomes necessary we can add it later
|
/// at any range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IAfterAttack
|
public interface IAfterAttack
|
||||||
{
|
{
|
||||||
@@ -116,19 +135,21 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This interface gives components behavior when being activated in the world.
|
/// 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>
|
/// </summary>
|
||||||
public interface IActivate
|
public interface IActivate
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when this component is activated by another entity.
|
/// Called when this component is activated by another entity who is in range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Activate(ActivateEventArgs eventArgs);
|
void Activate(ActivateEventArgs eventArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ActivateEventArgs : EventArgs
|
public class ActivateEventArgs : EventArgs, ITargetedAttackEventArgs
|
||||||
{
|
{
|
||||||
public IEntity User { get; set; }
|
public IEntity User { get; set; }
|
||||||
|
public IEntity Attacked { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -292,6 +313,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
#pragma warning disable 649
|
#pragma warning disable 649
|
||||||
[Dependency] private readonly IMapManager _mapManager;
|
[Dependency] private readonly IMapManager _mapManager;
|
||||||
[Dependency] private readonly IPhysicsManager _physicsManager;
|
[Dependency] private readonly IPhysicsManager _physicsManager;
|
||||||
|
[Dependency] private readonly ILocalizationManager _localizationManager;
|
||||||
#pragma warning restore 649
|
#pragma warning restore 649
|
||||||
|
|
||||||
public const float InteractionRange = 2;
|
public const float InteractionRange = 2;
|
||||||
@@ -359,7 +381,12 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
activateComp.Activate(new ActivateEventArgs {User = user});
|
// all activates should only fire when in range / unbostructed
|
||||||
|
var activateEventArgs = new ActivateEventArgs {User = user, Attacked = used};
|
||||||
|
if (InteractionChecks.InRangeUnobstructed(activateEventArgs))
|
||||||
|
{
|
||||||
|
activateComp.Activate(activateEventArgs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool HandleWideAttack(ICommonSession session, GridCoordinates coords, EntityUid uid)
|
private bool HandleWideAttack(ICommonSession session, GridCoordinates coords, EntityUid uid)
|
||||||
@@ -556,15 +583,19 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
var attackBys = attacked.GetAllComponents<IAttackBy>().ToList();
|
var attackBys = attacked.GetAllComponents<IAttackBy>().ToList();
|
||||||
var attackByEventArgs = new AttackByEventArgs
|
var attackByEventArgs = new AttackByEventArgs
|
||||||
{
|
{
|
||||||
User = user, ClickLocation = clickLocation, AttackWith = weapon
|
User = user, ClickLocation = clickLocation, AttackWith = weapon, Attacked = attacked
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var attackBy in attackBys)
|
// all AttackBys should only happen when in range / unobstructed, so no range check is needed
|
||||||
|
if (InteractionChecks.InRangeUnobstructed(attackByEventArgs))
|
||||||
{
|
{
|
||||||
if (attackBy.AttackBy(attackByEventArgs))
|
foreach (var attackBy in attackBys)
|
||||||
{
|
{
|
||||||
// If an AttackBy returns a status completion we finish our attack
|
if (attackBy.AttackBy(attackByEventArgs))
|
||||||
return;
|
{
|
||||||
|
// If an AttackBy returns a status completion we finish our attack
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -602,14 +633,18 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
var attackHands = attacked.GetAllComponents<IAttackHand>().ToList();
|
var attackHands = attacked.GetAllComponents<IAttackHand>().ToList();
|
||||||
var attackHandEventArgs = new AttackHandEventArgs {User = user};
|
var attackHandEventArgs = new AttackHandEventArgs {User = user, Attacked = attacked};
|
||||||
|
|
||||||
foreach (var attackHand in attackHands)
|
// all attackHands should only fire when in range / unbostructed
|
||||||
|
if (InteractionChecks.InRangeUnobstructed(attackHandEventArgs))
|
||||||
{
|
{
|
||||||
if (attackHand.AttackHand(attackHandEventArgs))
|
foreach (var attackHand in attackHands)
|
||||||
{
|
{
|
||||||
// If an AttackHand returns a status completion we finish our attack
|
if (attackHand.AttackHand(attackHandEventArgs))
|
||||||
return;
|
{
|
||||||
|
// If an AttackHand returns a status completion we finish our attack
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ using Robust.Shared.Map;
|
|||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Players;
|
using Robust.Shared.Players;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.EntitySystems
|
namespace Content.Server.GameObjects.EntitySystems
|
||||||
{
|
{
|
||||||
@@ -105,7 +106,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
if (!TryGetAttachedComponent(session as IPlayerSession, out HandsComponent handsComp))
|
if (!TryGetAttachedComponent(session as IPlayerSession, out HandsComponent handsComp))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var interactionSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InteractionSystem>();
|
var interactionSystem = EntitySystem.Get<InteractionSystem>();
|
||||||
|
|
||||||
var oldItem = handsComp.GetActiveHand;
|
var oldItem = handsComp.GetActiveHand;
|
||||||
|
|
||||||
@@ -133,9 +134,8 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
if (handsComp.GetActiveHand == null)
|
if (handsComp.GetActiveHand == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var interactionSystem = _entitySystemManager.GetEntitySystem<InteractionSystem>();
|
|
||||||
|
|
||||||
if(interactionSystem.InRangeUnobstructed(coords.ToMap(_mapManager), ent.Transform.WorldPosition, ignoredEnt: ent))
|
if(EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(coords.ToMap(_mapManager), ent.Transform.WorldPosition, ignoredEnt: ent))
|
||||||
if (coords.InRange(_mapManager, ent.Transform.GridPosition, InteractionSystem.InteractionRange))
|
if (coords.InRange(_mapManager, ent.Transform.GridPosition, InteractionSystem.InteractionRange))
|
||||||
{
|
{
|
||||||
handsComp.Drop(handsComp.ActiveIndex, coords);
|
handsComp.Drop(handsComp.ActiveIndex, coords);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.BodySystem;
|
using Content.Shared.BodySystem;
|
||||||
|
|
||||||
|
|
||||||
@@ -41,6 +42,7 @@ namespace Content.Server.BodySystem
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actor.playerSession.AttachedEntity.TryGetComponent(out BodyManagerComponent attempt))
|
if (actor.playerSession.AttachedEntity.TryGetComponent(out BodyManagerComponent attempt))
|
||||||
{
|
{
|
||||||
_userInterface.SetState(PrepareBodyScannerInterfaceState(attempt.Template, attempt.PartDictionary));
|
_userInterface.SetState(PrepareBodyScannerInterfaceState(attempt.Template, attempt.PartDictionary));
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Server.BodySystem;
|
using Content.Server.BodySystem;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.BodySystem;
|
using Content.Shared.BodySystem;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Content.Shared.GameObjects.Components.Items;
|
using Content.Shared.GameObjects.Components.Items;
|
||||||
@@ -42,6 +43,8 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
|||||||
|
|
||||||
void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs)
|
void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
|
if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return;
|
||||||
|
|
||||||
if (eventArgs.Attacked == null)
|
if (eventArgs.Attacked == null)
|
||||||
return;
|
return;
|
||||||
if (eventArgs.Attacked.TryGetComponent<BodySystem.BodyManagerComponent>(out BodySystem.BodyManagerComponent bodyManager))
|
if (eventArgs.Attacked.TryGetComponent<BodySystem.BodyManagerComponent>(out BodySystem.BodyManagerComponent bodyManager))
|
||||||
|
|||||||
100
Content.Server/Utility/InteractionChecks.cs
Normal file
100
Content.Server/Utility/InteractionChecks.cs
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
using System;
|
||||||
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Shared.Interfaces;
|
||||||
|
using Content.Shared.Physics;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
using Robust.Shared.Interfaces.Map;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Localization;
|
||||||
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Maths;
|
||||||
|
|
||||||
|
namespace Content.Server.Utility
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Convenient methods for checking for various conditions commonly needed
|
||||||
|
/// for interactions.
|
||||||
|
/// </summary>
|
||||||
|
public static class InteractionChecks
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default interaction check for targeted attack interaction types.
|
||||||
|
/// Same as <see cref="SharedInteractionSystem.InRangeUnobstructed"/>, but defaults to allow inside blockers.
|
||||||
|
/// Validates that attacker is in range of the attacked entity. Additionally shows a popup if
|
||||||
|
/// validation fails.
|
||||||
|
/// </summary>
|
||||||
|
public static bool InRangeUnobstructed(ITargetedAttackEventArgs eventArgs, bool insideBlockerValid = true)
|
||||||
|
{
|
||||||
|
if (!EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(eventArgs.User.Transform.MapPosition,
|
||||||
|
eventArgs.Attacked.Transform.WorldPosition, ignoredEnt: eventArgs.Attacked, insideBlockerValid: insideBlockerValid))
|
||||||
|
{
|
||||||
|
var localizationManager = IoCManager.Resolve<ILocalizationManager>();
|
||||||
|
eventArgs.Attacked.PopupMessage(eventArgs.User, localizationManager.GetString("You can't reach there!"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default interaction check for after attack interaction types.
|
||||||
|
/// Same as <see cref="SharedInteractionSystem.InRangeUnobstructed"/>, but defaults to allow inside blockers.
|
||||||
|
/// Validates that attacker is in range of the attacked entity, if there is such an entity.
|
||||||
|
/// If there is no attacked entity, validates that they are in range of the clicked position.
|
||||||
|
/// Additionally shows a popup if validation fails.
|
||||||
|
/// </summary>
|
||||||
|
public static bool InRangeUnobstructed(AfterAttackEventArgs eventArgs, bool insideBlockerValid = true)
|
||||||
|
{
|
||||||
|
if (eventArgs.Attacked != null)
|
||||||
|
{
|
||||||
|
if (!EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(eventArgs.User.Transform.MapPosition,
|
||||||
|
eventArgs.Attacked.Transform.WorldPosition, ignoredEnt: eventArgs.Attacked, insideBlockerValid: insideBlockerValid))
|
||||||
|
{
|
||||||
|
var localizationManager = IoCManager.Resolve<ILocalizationManager>();
|
||||||
|
eventArgs.Attacked.PopupMessage(eventArgs.User, localizationManager.GetString("You can't reach there!"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
|
if (!EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(eventArgs.User.Transform.MapPosition,
|
||||||
|
eventArgs.ClickLocation.ToMapPos(mapManager), ignoredEnt: eventArgs.User, insideBlockerValid: insideBlockerValid))
|
||||||
|
{
|
||||||
|
var localizationManager = IoCManager.Resolve<ILocalizationManager>();
|
||||||
|
eventArgs.User.PopupMessage(eventArgs.User, localizationManager.GetString("You can't reach there!"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Convenient static alternative to <see cref="SharedInteractionSystem.InRangeUnobstructed"/>, which also
|
||||||
|
/// shows a popup message if not in range.
|
||||||
|
/// </summary>
|
||||||
|
public static bool InRangeUnobstructed(IEntity user, Vector2 targetWorldCoords,
|
||||||
|
float range = SharedInteractionSystem.InteractionRange,
|
||||||
|
int collisionMask = (int) CollisionGroup.Impassable, IEntity ignoredEnt = null,
|
||||||
|
bool insideBlockerValid = false)
|
||||||
|
{
|
||||||
|
var interactionSystem = EntitySystem.Get<SharedInteractionSystem>();
|
||||||
|
if (!interactionSystem.InRangeUnobstructed(user.Transform.MapPosition, targetWorldCoords, range, collisionMask,
|
||||||
|
ignoredEnt, insideBlockerValid))
|
||||||
|
{
|
||||||
|
var localizationManager = IoCManager.Resolve<ILocalizationManager>();
|
||||||
|
user.PopupMessage(user, localizationManager.GetString("You can't reach there!"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ using Content.Shared.GameObjects.Components.Mobs;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Shared.GameObjects.EntitySystems
|
namespace Content.Shared.GameObjects.EntitySystems
|
||||||
{
|
{
|
||||||
@@ -30,8 +30,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return IoCManager.Resolve<IEntitySystemManager>()
|
return EntitySystem.Get<SharedInteractionSystem>()
|
||||||
.GetEntitySystem<SharedInteractionSystem>()
|
|
||||||
.InRangeUnobstructed(examiner.Transform.MapPosition, examined.Transform.MapPosition.Position,
|
.InRangeUnobstructed(examiner.Transform.MapPosition, examined.Transform.MapPosition.Position,
|
||||||
ExamineRange, predicate: entity => entity == examiner || entity == examined, insideBlockerValid:true);
|
ExamineRange, predicate: entity => entity == examiner || entity == examined, insideBlockerValid:true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
/// <param name="range">maximum distance between the two sets of coordinates.</param>
|
/// <param name="range">maximum distance between the two sets of coordinates.</param>
|
||||||
/// <param name="collisionMask">the mask to check for collisions</param>
|
/// <param name="collisionMask">the mask to check for collisions</param>
|
||||||
/// <param name="predicate">.</param>
|
/// <param name="predicate">.</param>
|
||||||
/// <param name="mapManager">Map manager containing the two GridIds.</param>
|
|
||||||
/// <param name="insideBlockerValid">if coordinates inside obstructions count as obstructed or not</param>
|
/// <param name="insideBlockerValid">if coordinates inside obstructions count as obstructed or not</param>
|
||||||
/// <returns>True if the two points are within a given range without being obstructed.</returns>
|
/// <returns>True if the two points are within a given range without being obstructed.</returns>
|
||||||
public bool InRangeUnobstructed(MapCoordinates coords, Vector2 otherCoords, float range = InteractionRange,
|
public bool InRangeUnobstructed(MapCoordinates coords, Vector2 otherCoords, float range = InteractionRange,
|
||||||
@@ -78,7 +77,6 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
/// <param name="range">maximum distance between the two sets of coordinates.</param>
|
/// <param name="range">maximum distance between the two sets of coordinates.</param>
|
||||||
/// <param name="collisionMask">the mask to check for collisions</param>
|
/// <param name="collisionMask">the mask to check for collisions</param>
|
||||||
/// <param name="ignoredEnt">the entity to be ignored when checking for collisions.</param>
|
/// <param name="ignoredEnt">the entity to be ignored when checking for collisions.</param>
|
||||||
/// <param name="mapManager">Map manager containing the two GridIds.</param>
|
|
||||||
/// <param name="insideBlockerValid">if coordinates inside obstructions count as obstructed or not</param>
|
/// <param name="insideBlockerValid">if coordinates inside obstructions count as obstructed or not</param>
|
||||||
/// <returns>True if the two points are within a given range without being obstructed.</returns>
|
/// <returns>True if the two points are within a given range without being obstructed.</returns>
|
||||||
public bool InRangeUnobstructed(MapCoordinates coords, Vector2 otherCoords, float range = InteractionRange,
|
public bool InRangeUnobstructed(MapCoordinates coords, Vector2 otherCoords, float range = InteractionRange,
|
||||||
|
|||||||
Reference in New Issue
Block a user