Replace obsolete EntityWhitelist IsValid usages (#28465)
* Replace obsolete whitelist is valid with whitelist system * Consistency * Fix logic * Bork * I figured out how to get whitelists on the client lol * test fail * woops * HELP ME FUNCTIONS * Fix errors * simplify --------- Co-authored-by: plykiya <plykiya@protonmail.com>
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Content.Client.UserInterface.Controls;
|
using Content.Client.UserInterface.Controls;
|
||||||
using Content.Shared.Chat.Prototypes;
|
using Content.Shared.Chat.Prototypes;
|
||||||
using Content.Shared.Speech;
|
using Content.Shared.Speech;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
@@ -19,6 +20,7 @@ public sealed partial class EmotesMenu : RadialMenu
|
|||||||
[Dependency] private readonly ISharedPlayerManager _playerManager = default!;
|
[Dependency] private readonly ISharedPlayerManager _playerManager = default!;
|
||||||
|
|
||||||
private readonly SpriteSystem _spriteSystem;
|
private readonly SpriteSystem _spriteSystem;
|
||||||
|
private readonly EntityWhitelistSystem _whitelistSystem;
|
||||||
|
|
||||||
public event Action<ProtoId<EmotePrototype>>? OnPlayEmote;
|
public event Action<ProtoId<EmotePrototype>>? OnPlayEmote;
|
||||||
|
|
||||||
@@ -28,6 +30,7 @@ public sealed partial class EmotesMenu : RadialMenu
|
|||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
|
|
||||||
_spriteSystem = _entManager.System<SpriteSystem>();
|
_spriteSystem = _entManager.System<SpriteSystem>();
|
||||||
|
_whitelistSystem = _entManager.System<EntityWhitelistSystem>();
|
||||||
|
|
||||||
var main = FindControl<RadialContainer>("Main");
|
var main = FindControl<RadialContainer>("Main");
|
||||||
|
|
||||||
@@ -37,8 +40,8 @@ public sealed partial class EmotesMenu : RadialMenu
|
|||||||
var player = _playerManager.LocalSession?.AttachedEntity;
|
var player = _playerManager.LocalSession?.AttachedEntity;
|
||||||
if (emote.Category == EmoteCategory.Invalid ||
|
if (emote.Category == EmoteCategory.Invalid ||
|
||||||
emote.ChatTriggers.Count == 0 ||
|
emote.ChatTriggers.Count == 0 ||
|
||||||
!(player.HasValue && (emote.Whitelist?.IsValid(player.Value, _entManager) ?? true)) ||
|
!(player.HasValue && _whitelistSystem.IsWhitelistPassOrNull(emote.Whitelist, player.Value)) ||
|
||||||
(emote.Blacklist?.IsValid(player.Value, _entManager) ?? false))
|
_whitelistSystem.IsBlacklistPass(emote.Blacklist, player.Value))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!emote.Available &&
|
if (!emote.Available &&
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Linq;
|
|||||||
using Content.Client.UserInterface.Systems.MenuBar.Widgets;
|
using Content.Client.UserInterface.Systems.MenuBar.Widgets;
|
||||||
using Content.Shared.Construction.Prototypes;
|
using Content.Shared.Construction.Prototypes;
|
||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.Placement;
|
using Robust.Client.Placement;
|
||||||
@@ -23,6 +24,7 @@ namespace Content.Client.Construction.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ConstructionMenuPresenter : IDisposable
|
internal sealed class ConstructionMenuPresenter : IDisposable
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly EntityManager _entManager = default!;
|
||||||
[Dependency] private readonly IEntitySystemManager _systemManager = default!;
|
[Dependency] private readonly IEntitySystemManager _systemManager = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IPlacementManager _placementManager = default!;
|
[Dependency] private readonly IPlacementManager _placementManager = default!;
|
||||||
@@ -30,6 +32,7 @@ namespace Content.Client.Construction.UI
|
|||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
|
|
||||||
private readonly IConstructionMenuView _constructionView;
|
private readonly IConstructionMenuView _constructionView;
|
||||||
|
private readonly EntityWhitelistSystem _whitelistSystem;
|
||||||
|
|
||||||
private ConstructionSystem? _constructionSystem;
|
private ConstructionSystem? _constructionSystem;
|
||||||
private ConstructionPrototype? _selected;
|
private ConstructionPrototype? _selected;
|
||||||
@@ -78,6 +81,7 @@ namespace Content.Client.Construction.UI
|
|||||||
// This is a lot easier than a factory
|
// This is a lot easier than a factory
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
_constructionView = new ConstructionMenu();
|
_constructionView = new ConstructionMenu();
|
||||||
|
_whitelistSystem = _entManager.System<EntityWhitelistSystem>();
|
||||||
|
|
||||||
// This is required so that if we load after the system is initialized, we can bind to it immediately
|
// This is required so that if we load after the system is initialized, we can bind to it immediately
|
||||||
if (_systemManager.TryGetEntitySystem<ConstructionSystem>(out var constructionSystem))
|
if (_systemManager.TryGetEntitySystem<ConstructionSystem>(out var constructionSystem))
|
||||||
@@ -157,7 +161,7 @@ namespace Content.Client.Construction.UI
|
|||||||
|
|
||||||
if (_playerManager.LocalSession == null
|
if (_playerManager.LocalSession == null
|
||||||
|| _playerManager.LocalEntity == null
|
|| _playerManager.LocalEntity == null
|
||||||
|| (recipe.EntityWhitelist != null && !recipe.EntityWhitelist.IsValid(_playerManager.LocalEntity.Value)))
|
|| _whitelistSystem.IsWhitelistFail(recipe.EntityWhitelist, _playerManager.LocalEntity.Value))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(search))
|
if (!string.IsNullOrEmpty(search))
|
||||||
|
|||||||
@@ -81,9 +81,7 @@ public partial class ChatSystem
|
|||||||
bool ignoreActionBlocker = false
|
bool ignoreActionBlocker = false
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!(emote.Whitelist?.IsValid(source, EntityManager) ?? true))
|
if (_whitelistSystem.IsWhitelistFailOrNull(emote.Whitelist, source) || _whitelistSystem.IsBlacklistPass(emote.Blacklist, source))
|
||||||
return;
|
|
||||||
if (emote.Blacklist?.IsValid(source, EntityManager) ?? false)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!emote.Available &&
|
if (!emote.Available &&
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using Content.Shared.Mobs.Systems;
|
|||||||
using Content.Shared.Players;
|
using Content.Shared.Players;
|
||||||
using Content.Shared.Radio;
|
using Content.Shared.Radio;
|
||||||
using Content.Shared.Speech;
|
using Content.Shared.Speech;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
@@ -58,6 +59,7 @@ public sealed partial class ChatSystem : SharedChatSystem
|
|||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||||
[Dependency] private readonly ReplacementAccentSystem _wordreplacement = default!;
|
[Dependency] private readonly ReplacementAccentSystem _wordreplacement = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
public const int VoiceRange = 10; // how far voice goes in world units
|
public const int VoiceRange = 10; // how far voice goes in world units
|
||||||
public const int WhisperClearRange = 2; // how far whisper goes while still being understandable, in world units
|
public const int WhisperClearRange = 2; // how far whisper goes while still being understandable, in world units
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.Gatherable.Components;
|
|||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
using Content.Shared.Weapons.Melee.Events;
|
using Content.Shared.Weapons.Melee.Events;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
@@ -18,6 +19,7 @@ public sealed partial class GatherableSystem : EntitySystem
|
|||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||||
[Dependency] private readonly TransformSystem _transform = default!;
|
[Dependency] private readonly TransformSystem _transform = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -30,7 +32,7 @@ public sealed partial class GatherableSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnAttacked(Entity<GatherableComponent> gatherable, ref AttackedEvent args)
|
private void OnAttacked(Entity<GatherableComponent> gatherable, ref AttackedEvent args)
|
||||||
{
|
{
|
||||||
if (gatherable.Comp.ToolWhitelist?.IsValid(args.Used, EntityManager) != true)
|
if (_whitelistSystem.IsWhitelistFailOrNull(gatherable.Comp.ToolWhitelist, args.Used))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Gather(gatherable, args.User);
|
Gather(gatherable, args.User);
|
||||||
@@ -41,7 +43,7 @@ public sealed partial class GatherableSystem : EntitySystem
|
|||||||
if (args.Handled || !args.Complex)
|
if (args.Handled || !args.Complex)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gatherable.Comp.ToolWhitelist?.IsValid(args.User, EntityManager) != true)
|
if (_whitelistSystem.IsWhitelistFailOrNull(gatherable.Comp.ToolWhitelist, args.User))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Gather(gatherable, args.User);
|
Gather(gatherable, args.User);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Content.Shared.NPC.Components;
|
using Content.Shared.NPC.Components;
|
||||||
using Content.Shared.NPC.Systems;
|
using Content.Shared.NPC.Systems;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Shared.Collections;
|
using Robust.Shared.Collections;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
@@ -13,6 +14,7 @@ public sealed partial class NPCImprintingOnSpawnBehaviourSystem : SharedNPCImpri
|
|||||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||||
[Dependency] private readonly NPCSystem _npc = default!;
|
[Dependency] private readonly NPCSystem _npc = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -27,7 +29,7 @@ public sealed partial class NPCImprintingOnSpawnBehaviourSystem : SharedNPCImpri
|
|||||||
|
|
||||||
foreach (var friend in friends)
|
foreach (var friend in friends)
|
||||||
{
|
{
|
||||||
if (imprinting.Comp.Whitelist?.IsValid(friend) != false)
|
if (_whitelistSystem.IsWhitelistPassOrNull(imprinting.Comp.Whitelist, friend))
|
||||||
{
|
{
|
||||||
AddImprintingTarget(imprinting, friend, imprinting.Comp);
|
AddImprintingTarget(imprinting, friend, imprinting.Comp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ using Content.Shared.Tools.Systems;
|
|||||||
using Content.Shared.Weapons.Melee;
|
using Content.Shared.Weapons.Melee;
|
||||||
using Content.Shared.Weapons.Ranged.Components;
|
using Content.Shared.Weapons.Ranged.Components;
|
||||||
using Content.Shared.Weapons.Ranged.Events;
|
using Content.Shared.Weapons.Ranged.Events;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Microsoft.Extensions.ObjectPool;
|
using Microsoft.Extensions.ObjectPool;
|
||||||
using Robust.Server.Containers;
|
using Robust.Server.Containers;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
@@ -46,6 +47,7 @@ public sealed class NPCUtilitySystem : EntitySystem
|
|||||||
[Dependency] private readonly SolutionContainerSystem _solutions = default!;
|
[Dependency] private readonly SolutionContainerSystem _solutions = default!;
|
||||||
[Dependency] private readonly WeldableSystem _weldable = default!;
|
[Dependency] private readonly WeldableSystem _weldable = default!;
|
||||||
[Dependency] private readonly ExamineSystemShared _examine = default!;
|
[Dependency] private readonly ExamineSystemShared _examine = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
private EntityQuery<PuddleComponent> _puddleQuery;
|
private EntityQuery<PuddleComponent> _puddleQuery;
|
||||||
private EntityQuery<TransformComponent> _xformQuery;
|
private EntityQuery<TransformComponent> _xformQuery;
|
||||||
@@ -249,7 +251,7 @@ public sealed class NPCUtilitySystem : EntitySystem
|
|||||||
return 0f;
|
return 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (heldGun.Whitelist?.IsValid(targetUid, EntityManager) != true)
|
if (_whitelistSystem.IsWhitelistFailOrNull(heldGun.Whitelist, targetUid))
|
||||||
{
|
{
|
||||||
return 0f;
|
return 0f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using Robust.Shared.Containers;
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Content.Shared.Storage.Components;
|
using Content.Shared.Storage.Components;
|
||||||
using Robust.Server.Containers;
|
using Robust.Server.Containers;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
|
|
||||||
namespace Content.Server.Power.EntitySystems;
|
namespace Content.Server.Power.EntitySystems;
|
||||||
|
|
||||||
@@ -20,6 +21,7 @@ internal sealed class ChargerSystem : EntitySystem
|
|||||||
[Dependency] private readonly PowerCellSystem _powerCell = default!;
|
[Dependency] private readonly PowerCellSystem _powerCell = default!;
|
||||||
[Dependency] private readonly BatterySystem _battery = default!;
|
[Dependency] private readonly BatterySystem _battery = default!;
|
||||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -208,7 +210,7 @@ internal sealed class ChargerSystem : EntitySystem
|
|||||||
if (!receiverComponent.Powered)
|
if (!receiverComponent.Powered)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (component.Whitelist?.IsValid(targetEntity, EntityManager) == false)
|
if (_whitelistSystem.IsWhitelistFail(component.Whitelist, targetEntity))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!SearchForBattery(targetEntity, out var batteryUid, out var heldBattery))
|
if (!SearchForBattery(targetEntity, out var batteryUid, out var heldBattery))
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ using Content.Shared.Revenant.Components;
|
|||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using Robust.Shared.Map.Components;
|
using Robust.Shared.Map.Components;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
|
|
||||||
namespace Content.Server.Revenant.EntitySystems;
|
namespace Content.Server.Revenant.EntitySystems;
|
||||||
|
|
||||||
@@ -40,6 +41,7 @@ public sealed partial class RevenantSystem
|
|||||||
[Dependency] private readonly MobThresholdSystem _mobThresholdSystem = default!;
|
[Dependency] private readonly MobThresholdSystem _mobThresholdSystem = default!;
|
||||||
[Dependency] private readonly GhostSystem _ghost = default!;
|
[Dependency] private readonly GhostSystem _ghost = default!;
|
||||||
[Dependency] private readonly TileSystem _tile = default!;
|
[Dependency] private readonly TileSystem _tile = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
private void InitializeAbilities()
|
private void InitializeAbilities()
|
||||||
{
|
{
|
||||||
@@ -331,10 +333,8 @@ public sealed partial class RevenantSystem
|
|||||||
|
|
||||||
foreach (var ent in _lookup.GetEntitiesInRange(uid, component.MalfunctionRadius))
|
foreach (var ent in _lookup.GetEntitiesInRange(uid, component.MalfunctionRadius))
|
||||||
{
|
{
|
||||||
if (component.MalfunctionWhitelist?.IsValid(ent, EntityManager) == false)
|
if (_whitelistSystem.IsWhitelistFail(component.MalfunctionWhitelist, ent) ||
|
||||||
continue;
|
_whitelistSystem.IsBlacklistPass(component.MalfunctionBlacklist, ent))
|
||||||
|
|
||||||
if (component.MalfunctionBlacklist?.IsValid(ent, EntityManager) == true)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
_emag.DoEmagEffect(uid, ent); //it does not emag itself. adorable.
|
_emag.DoEmagEffect(uid, ent); //it does not emag itself. adorable.
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ public sealed partial class BorgSystem
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (component.ModuleWhitelist?.IsValid(module, EntityManager) == false)
|
if (_whitelistSystem.IsWhitelistFail(component.ModuleWhitelist, module))
|
||||||
{
|
{
|
||||||
if (user != null)
|
if (user != null)
|
||||||
Popup.PopupEntity(Loc.GetString("borg-module-whitelist-deny"), uid, user.Value);
|
Popup.PopupEntity(Loc.GetString("borg-module-whitelist-deny"), uid, user.Value);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using Content.Shared.Roles;
|
|||||||
using Content.Shared.Silicons.Borgs;
|
using Content.Shared.Silicons.Borgs;
|
||||||
using Content.Shared.Silicons.Borgs.Components;
|
using Content.Shared.Silicons.Borgs.Components;
|
||||||
using Content.Shared.Throwing;
|
using Content.Shared.Throwing;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Content.Shared.Wires;
|
using Content.Shared.Wires;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
@@ -53,6 +54,8 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
|||||||
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
||||||
[Dependency] private readonly UserInterfaceSystem _ui = default!;
|
[Dependency] private readonly UserInterfaceSystem _ui = default!;
|
||||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
|
|
||||||
[ValidatePrototypeId<JobPrototype>]
|
[ValidatePrototypeId<JobPrototype>]
|
||||||
public const string BorgJobId = "Borg";
|
public const string BorgJobId = "Borg";
|
||||||
@@ -104,9 +107,8 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (component.BrainEntity == null &&
|
if (component.BrainEntity == null && brain != null &&
|
||||||
brain != null &&
|
_whitelistSystem.IsWhitelistPassOrNull(component.BrainWhitelist, used))
|
||||||
component.BrainWhitelist?.IsValid(used) != false)
|
|
||||||
{
|
{
|
||||||
if (_mind.TryGetMind(used, out _, out var mind) && mind.Session != null)
|
if (_mind.TryGetMind(used, out _, out var mind) && mind.Session != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Shared.Database;
|
|||||||
using Content.Shared.Hands.EntitySystems;
|
using Content.Shared.Hands.EntitySystems;
|
||||||
using Content.Shared.Storage;
|
using Content.Shared.Storage;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
@@ -15,6 +16,7 @@ public sealed class PickRandomSystem : EntitySystem
|
|||||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||||
[Dependency] private readonly SharedHandsSystem _hands = default!;
|
[Dependency] private readonly SharedHandsSystem _hands = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -30,7 +32,7 @@ public sealed class PickRandomSystem : EntitySystem
|
|||||||
|
|
||||||
var user = args.User;
|
var user = args.User;
|
||||||
|
|
||||||
var enabled = storage.Container.ContainedEntities.Any(item => comp.Whitelist?.IsValid(item, EntityManager) ?? true);
|
var enabled = storage.Container.ContainedEntities.Any(item => _whitelistSystem.IsWhitelistPassOrNull(comp.Whitelist, item));
|
||||||
|
|
||||||
// alt-click / alt-z to pick an item
|
// alt-click / alt-z to pick an item
|
||||||
args.Verbs.Add(new AlternativeVerb
|
args.Verbs.Add(new AlternativeVerb
|
||||||
@@ -48,7 +50,7 @@ public sealed class PickRandomSystem : EntitySystem
|
|||||||
|
|
||||||
private void TryPick(EntityUid uid, PickRandomComponent comp, StorageComponent storage, EntityUid user)
|
private void TryPick(EntityUid uid, PickRandomComponent comp, StorageComponent storage, EntityUid user)
|
||||||
{
|
{
|
||||||
var entities = storage.Container.ContainedEntities.Where(item => comp.Whitelist?.IsValid(item, EntityManager) ?? true).ToArray();
|
var entities = storage.Container.ContainedEntities.Where(item => _whitelistSystem.IsWhitelistPassOrNull(comp.Whitelist, item)).ToArray();
|
||||||
|
|
||||||
if (!entities.Any())
|
if (!entities.Any())
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Xenoarchaeology.XenoArtifacts.Events;
|
using Content.Server.Xenoarchaeology.XenoArtifacts.Events;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Content.Shared.Xenoarchaeology.XenoArtifacts;
|
using Content.Shared.Xenoarchaeology.XenoArtifacts;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Serialization.Manager;
|
|
||||||
|
|
||||||
namespace Content.Server.Xenoarchaeology.XenoArtifacts;
|
namespace Content.Server.Xenoarchaeology.XenoArtifacts;
|
||||||
|
|
||||||
public sealed partial class ArtifactSystem
|
public sealed partial class ArtifactSystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
private const int MaxEdgesPerNode = 4;
|
private const int MaxEdgesPerNode = 4;
|
||||||
|
|
||||||
private readonly HashSet<int> _usedNodeIds = new();
|
private readonly HashSet<int> _usedNodeIds = new();
|
||||||
@@ -81,7 +82,8 @@ public sealed partial class ArtifactSystem
|
|||||||
private string GetRandomTrigger(EntityUid artifact, ref ArtifactNode node)
|
private string GetRandomTrigger(EntityUid artifact, ref ArtifactNode node)
|
||||||
{
|
{
|
||||||
var allTriggers = _prototype.EnumeratePrototypes<ArtifactTriggerPrototype>()
|
var allTriggers = _prototype.EnumeratePrototypes<ArtifactTriggerPrototype>()
|
||||||
.Where(x => (x.Whitelist?.IsValid(artifact, EntityManager) ?? true) && (!x.Blacklist?.IsValid(artifact, EntityManager) ?? true)).ToList();
|
.Where(x => _whitelistSystem.IsWhitelistPassOrNull(x.Whitelist, artifact) &&
|
||||||
|
_whitelistSystem.IsBlacklistFailOrNull(x.Blacklist, artifact)).ToList();
|
||||||
var validDepth = allTriggers.Select(x => x.TargetDepth).Distinct().ToList();
|
var validDepth = allTriggers.Select(x => x.TargetDepth).Distinct().ToList();
|
||||||
|
|
||||||
var weights = GetDepthWeights(validDepth, node.Depth);
|
var weights = GetDepthWeights(validDepth, node.Depth);
|
||||||
@@ -95,7 +97,8 @@ public sealed partial class ArtifactSystem
|
|||||||
private string GetRandomEffect(EntityUid artifact, ref ArtifactNode node)
|
private string GetRandomEffect(EntityUid artifact, ref ArtifactNode node)
|
||||||
{
|
{
|
||||||
var allEffects = _prototype.EnumeratePrototypes<ArtifactEffectPrototype>()
|
var allEffects = _prototype.EnumeratePrototypes<ArtifactEffectPrototype>()
|
||||||
.Where(x => (x.Whitelist?.IsValid(artifact, EntityManager) ?? true) && (!x.Blacklist?.IsValid(artifact, EntityManager) ?? true)).ToList();
|
.Where(x => _whitelistSystem.IsWhitelistPassOrNull(x.Whitelist, artifact) &&
|
||||||
|
_whitelistSystem.IsBlacklistFailOrNull(x.Blacklist, artifact)).ToList();
|
||||||
var validDepth = allEffects.Select(x => x.TargetDepth).Distinct().ToList();
|
var validDepth = allEffects.Select(x => x.TargetDepth).Distinct().ToList();
|
||||||
|
|
||||||
var weights = GetDepthWeights(validDepth, node.Depth);
|
var weights = GetDepthWeights(validDepth, node.Depth);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Shared.Interaction;
|
|||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
@@ -31,6 +32,7 @@ namespace Content.Shared.Containers.ItemSlots
|
|||||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -266,8 +268,7 @@ namespace Content.Shared.Containers.ItemSlots
|
|||||||
if (slot.ContainerSlot == null)
|
if (slot.ContainerSlot == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((!slot.Whitelist?.IsValid(usedUid) ?? false) ||
|
if (_whitelistSystem.IsWhitelistFail(slot.Whitelist, usedUid) || _whitelistSystem.IsBlacklistPass(slot.Blacklist, usedUid))
|
||||||
(slot.Blacklist?.IsValid(usedUid) ?? false))
|
|
||||||
{
|
{
|
||||||
if (popup.HasValue && slot.WhitelistFailPopup.HasValue)
|
if (popup.HasValue && slot.WhitelistFailPopup.HasValue)
|
||||||
_popupSystem.PopupClient(Loc.GetString(slot.WhitelistFailPopup), uid, popup.Value);
|
_popupSystem.PopupClient(Loc.GetString(slot.WhitelistFailPopup), uid, popup.Value);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Shared.Damage.Components;
|
using Content.Shared.Damage.Components;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Physics.Events;
|
using Robust.Shared.Physics.Events;
|
||||||
using Robust.Shared.Physics.Systems;
|
using Robust.Shared.Physics.Systems;
|
||||||
@@ -11,6 +12,7 @@ public sealed class DamageContactsSystem : EntitySystem
|
|||||||
[Dependency] private readonly IGameTiming _timing = default!;
|
[Dependency] private readonly IGameTiming _timing = default!;
|
||||||
[Dependency] private readonly DamageableSystem _damageable = default!;
|
[Dependency] private readonly DamageableSystem _damageable = default!;
|
||||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -63,7 +65,7 @@ public sealed class DamageContactsSystem : EntitySystem
|
|||||||
if (HasComp<DamagedByContactComponent>(otherUid))
|
if (HasComp<DamagedByContactComponent>(otherUid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (component.IgnoreWhitelist?.IsValid(otherUid) ?? false)
|
if (_whitelistSystem.IsWhitelistFail(component.IgnoreWhitelist, otherUid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var damagedByContact = EnsureComp<DamagedByContactComponent>(otherUid);
|
var damagedByContact = EnsureComp<DamagedByContactComponent>(otherUid);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Shared.DoAfter;
|
|||||||
using Content.Shared.Mobs;
|
using Content.Shared.Mobs;
|
||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
@@ -18,6 +19,7 @@ public abstract class SharedDevourSystem : EntitySystem
|
|||||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||||
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
|
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
|
||||||
[Dependency] protected readonly SharedContainerSystem ContainerSystem = default!;
|
[Dependency] protected readonly SharedContainerSystem ContainerSystem = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -41,7 +43,7 @@ public abstract class SharedDevourSystem : EntitySystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected void OnDevourAction(EntityUid uid, DevourerComponent component, DevourActionEvent args)
|
protected void OnDevourAction(EntityUid uid, DevourerComponent component, DevourActionEvent args)
|
||||||
{
|
{
|
||||||
if (args.Handled || component.Whitelist?.IsValid(args.Target, EntityManager) != true)
|
if (args.Handled || _whitelistSystem.IsWhitelistFailOrNull(component.Whitelist, args.Target))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Content.Shared.DragDrop;
|
|||||||
using Content.Shared.Emag.Systems;
|
using Content.Shared.Emag.Systems;
|
||||||
using Content.Shared.Item;
|
using Content.Shared.Item;
|
||||||
using Content.Shared.Throwing;
|
using Content.Shared.Throwing;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Physics.Events;
|
using Robust.Shared.Physics.Events;
|
||||||
@@ -25,6 +26,7 @@ public abstract class SharedDisposalUnitSystem : EntitySystem
|
|||||||
[Dependency] protected readonly IGameTiming GameTiming = default!;
|
[Dependency] protected readonly IGameTiming GameTiming = default!;
|
||||||
[Dependency] protected readonly MetaDataSystem Metadata = default!;
|
[Dependency] protected readonly MetaDataSystem Metadata = default!;
|
||||||
[Dependency] protected readonly SharedJointSystem Joints = default!;
|
[Dependency] protected readonly SharedJointSystem Joints = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
protected static TimeSpan ExitAttemptDelay = TimeSpan.FromSeconds(0.5);
|
protected static TimeSpan ExitAttemptDelay = TimeSpan.FromSeconds(0.5);
|
||||||
|
|
||||||
@@ -113,10 +115,8 @@ public abstract class SharedDisposalUnitSystem : EntitySystem
|
|||||||
if (!storable && !HasComp<BodyComponent>(entity))
|
if (!storable && !HasComp<BodyComponent>(entity))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (component.Blacklist?.IsValid(entity, EntityManager) == true)
|
if (_whitelistSystem.IsBlacklistPass(component.Blacklist, entity) ||
|
||||||
return false;
|
_whitelistSystem.IsWhitelistFail(component.Whitelist, entity))
|
||||||
|
|
||||||
if (component.Whitelist != null && component.Whitelist?.IsValid(entity, EntityManager) != true)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (TryComp<PhysicsComponent>(entity, out var physics) && (physics.CanCollide) || storable)
|
if (TryComp<PhysicsComponent>(entity, out var physics) && (physics.CanCollide) || storable)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public abstract class SharedImplanterSystem : EntitySystem
|
|||||||
[Dependency] private readonly ItemSlotsSystem _itemSlots = default!;
|
[Dependency] private readonly ItemSlotsSystem _itemSlots = default!;
|
||||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -105,8 +106,8 @@ public abstract class SharedImplanterSystem : EntitySystem
|
|||||||
|
|
||||||
protected bool CheckTarget(EntityUid target, EntityWhitelist? whitelist, EntityWhitelist? blacklist)
|
protected bool CheckTarget(EntityUid target, EntityWhitelist? whitelist, EntityWhitelist? blacklist)
|
||||||
{
|
{
|
||||||
return whitelist?.IsValid(target, EntityManager) != false &&
|
return _whitelistSystem.IsWhitelistPassOrNull(whitelist, target) &&
|
||||||
blacklist?.IsValid(target, EntityManager) != true;
|
_whitelistSystem.IsBlacklistFailOrNull(blacklist, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Draw the implant out of the target
|
//Draw the implant out of the target
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Content.Shared.ActionBlocker;
|
using Content.Shared.ActionBlocker;
|
||||||
using Content.Shared.Containers.ItemSlots;
|
using Content.Shared.Containers.ItemSlots;
|
||||||
using Content.Shared.Hands.Components;
|
using Content.Shared.Hands.Components;
|
||||||
using Content.Shared.Hands.EntitySystems;
|
using Content.Shared.Hands.EntitySystems;
|
||||||
@@ -7,6 +7,7 @@ using Content.Shared.Inventory;
|
|||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Content.Shared.Storage;
|
using Content.Shared.Storage;
|
||||||
using Content.Shared.Storage.EntitySystems;
|
using Content.Shared.Storage.EntitySystems;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Input.Binding;
|
using Robust.Shared.Input.Binding;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -25,6 +26,7 @@ public sealed class SmartEquipSystem : EntitySystem
|
|||||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||||
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
|
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -182,7 +184,7 @@ public sealed class SmartEquipSystem : EntitySystem
|
|||||||
foreach (var slot in slots.Slots.Values)
|
foreach (var slot in slots.Slots.Values)
|
||||||
{
|
{
|
||||||
if (!slot.HasItem
|
if (!slot.HasItem
|
||||||
&& (slot.Whitelist?.IsValid(handItem.Value, EntityManager) ?? true)
|
&& _whitelistSystem.IsWhitelistPassOrNull(slot.Whitelist, handItem.Value)
|
||||||
&& slot.Priority > (toInsertTo?.Priority ?? int.MinValue))
|
&& slot.Priority > (toInsertTo?.Priority ?? int.MinValue))
|
||||||
{
|
{
|
||||||
toInsertTo = slot;
|
toInsertTo = slot;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Linq;
|
|||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Interaction.Components;
|
using Content.Shared.Interaction.Components;
|
||||||
using Content.Shared.Stacks;
|
using Content.Shared.Stacks;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
@@ -17,6 +18,7 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
|
|||||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
[Dependency] private readonly IGameTiming _timing = default!;
|
[Dependency] private readonly IGameTiming _timing = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default volume for a sheet if the material's entity prototype has no material composition.
|
/// Default volume for a sheet if the material's entity prototype has no material composition.
|
||||||
@@ -121,7 +123,7 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
|
|||||||
if (!CanTakeVolume(uid, volume, component))
|
if (!CanTakeVolume(uid, volume, component))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (component.MaterialWhiteList != null && !component.MaterialWhiteList.Contains(materialId))
|
if (component.MaterialWhiteList == null ? false : component.MaterialWhiteList.Contains(materialId))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var amount = component.Storage.GetValueOrDefault(materialId);
|
var amount = component.Storage.GetValueOrDefault(materialId);
|
||||||
@@ -239,7 +241,7 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
|
|||||||
if (!Resolve(toInsert, ref material, ref composition, false))
|
if (!Resolve(toInsert, ref material, ref composition, false))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (storage.Whitelist?.IsValid(toInsert) == false)
|
if (_whitelistSystem.IsWhitelistFail(storage.Whitelist, toInsert))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (HasComp<UnremoveableComponent>(toInsert))
|
if (HasComp<UnremoveableComponent>(toInsert))
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Content.Shared.Popups;
|
|||||||
using Robust.Shared.Serialization.Manager;
|
using Robust.Shared.Serialization.Manager;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
|
|
||||||
namespace Content.Shared.Polymorph.Systems;
|
namespace Content.Shared.Polymorph.Systems;
|
||||||
|
|
||||||
@@ -18,6 +19,7 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem
|
|||||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||||
[Dependency] private readonly ISerializationManager _serMan = default!;
|
[Dependency] private readonly ISerializationManager _serMan = default!;
|
||||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -49,8 +51,8 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsInvalid(ChameleonProjectorComponent comp, EntityUid target)
|
public bool IsInvalid(ChameleonProjectorComponent comp, EntityUid target)
|
||||||
{
|
{
|
||||||
return (comp.Whitelist?.IsValid(target, EntityManager) == false)
|
return _whitelistSystem.IsWhitelistFail(comp.Whitelist, target)
|
||||||
|| (comp.Blacklist?.IsValid(target, EntityManager) == true);
|
|| _whitelistSystem.IsBlacklistPass(comp.Blacklist, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Content.Shared.Interaction;
|
|||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Content.Shared.Stacks;
|
using Content.Shared.Stacks;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
@@ -30,6 +31,7 @@ public abstract partial class SharedFultonSystem : EntitySystem
|
|||||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||||
[Dependency] private readonly SharedStackSystem _stack = default!;
|
[Dependency] private readonly SharedStackSystem _stack = default!;
|
||||||
[Dependency] protected readonly SharedTransformSystem TransformSystem = default!;
|
[Dependency] protected readonly SharedTransformSystem TransformSystem = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
[ValidatePrototypeId<EntityPrototype>] public const string EffectProto = "FultonEffect";
|
[ValidatePrototypeId<EntityPrototype>] public const string EffectProto = "FultonEffect";
|
||||||
protected static readonly Vector2 EffectOffset = Vector2.Zero;
|
protected static readonly Vector2 EffectOffset = Vector2.Zero;
|
||||||
@@ -176,7 +178,7 @@ public abstract partial class SharedFultonSystem : EntitySystem
|
|||||||
if (!CanFulton(targetUid))
|
if (!CanFulton(targetUid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (component.Whitelist?.IsValid(targetUid, EntityManager) != true)
|
if (_whitelistSystem.IsWhitelistFailOrNull(component.Whitelist, targetUid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Containers.ItemSlots;
|
|||||||
using Content.Shared.Shuttles.BUIStates;
|
using Content.Shared.Shuttles.BUIStates;
|
||||||
using Content.Shared.Shuttles.Components;
|
using Content.Shared.Shuttles.Components;
|
||||||
using Content.Shared.Shuttles.UI.MapObjects;
|
using Content.Shared.Shuttles.UI.MapObjects;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Map.Components;
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics.Collision.Shapes;
|
using Robust.Shared.Physics.Collision.Shapes;
|
||||||
@@ -15,6 +16,7 @@ public abstract partial class SharedShuttleSystem : EntitySystem
|
|||||||
[Dependency] private readonly ItemSlotsSystem _itemSlots = default!;
|
[Dependency] private readonly ItemSlotsSystem _itemSlots = default!;
|
||||||
[Dependency] protected readonly SharedMapSystem Maps = default!;
|
[Dependency] protected readonly SharedMapSystem Maps = default!;
|
||||||
[Dependency] protected readonly SharedTransformSystem XformSystem = default!;
|
[Dependency] protected readonly SharedTransformSystem XformSystem = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
public const float FTLRange = 512f;
|
public const float FTLRange = 512f;
|
||||||
public const float FTLBufferRange = 8f;
|
public const float FTLBufferRange = 8f;
|
||||||
@@ -83,7 +85,7 @@ public abstract partial class SharedShuttleSystem : EntitySystem
|
|||||||
if (HasComp<FTLMapComponent>(mapUid))
|
if (HasComp<FTLMapComponent>(mapUid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return destination.Whitelist?.IsValid(shuttleUid, EntityManager) != false;
|
return _whitelistSystem.IsWhitelistPassOrNull(destination.Whitelist, shuttleUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.Storage.Components;
|
using Content.Server.Storage.Components;
|
||||||
using Content.Shared.Inventory;
|
using Content.Shared.Inventory;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
@@ -16,6 +17,8 @@ public sealed class MagnetPickupSystem : EntitySystem
|
|||||||
[Dependency] private readonly InventorySystem _inventory = default!;
|
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||||
[Dependency] private readonly SharedStorageSystem _storage = default!;
|
[Dependency] private readonly SharedStorageSystem _storage = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
|
|
||||||
private static readonly TimeSpan ScanDelay = TimeSpan.FromSeconds(1);
|
private static readonly TimeSpan ScanDelay = TimeSpan.FromSeconds(1);
|
||||||
|
|
||||||
@@ -63,7 +66,7 @@ public sealed class MagnetPickupSystem : EntitySystem
|
|||||||
|
|
||||||
foreach (var near in _lookup.GetEntitiesInRange(uid, comp.Range, LookupFlags.Dynamic | LookupFlags.Sundries))
|
foreach (var near in _lookup.GetEntitiesInRange(uid, comp.Range, LookupFlags.Dynamic | LookupFlags.Sundries))
|
||||||
{
|
{
|
||||||
if (storage.Whitelist?.IsValid(near, EntityManager) == false)
|
if (_whitelistSystem.IsWhitelistFail(storage.Whitelist, near))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!_physicsQuery.TryGetComponent(near, out var physics) || physics.BodyStatus != BodyStatus.OnGround)
|
if (!_physicsQuery.TryGetComponent(near, out var physics) || physics.BodyStatus != BodyStatus.OnGround)
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using Content.Shared.Storage.Components;
|
|||||||
using Content.Shared.Tools.Systems;
|
using Content.Shared.Tools.Systems;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using Content.Shared.Wall;
|
using Content.Shared.Wall;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
@@ -45,6 +46,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
|||||||
[Dependency] protected readonly SharedPopupSystem Popup = default!;
|
[Dependency] protected readonly SharedPopupSystem Popup = default!;
|
||||||
[Dependency] protected readonly SharedTransformSystem TransformSystem = default!;
|
[Dependency] protected readonly SharedTransformSystem TransformSystem = default!;
|
||||||
[Dependency] private readonly WeldableSystem _weldable = default!;
|
[Dependency] private readonly WeldableSystem _weldable = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
public const string ContainerName = "entity_storage";
|
public const string ContainerName = "entity_storage";
|
||||||
|
|
||||||
@@ -432,7 +434,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
|||||||
|
|
||||||
var targetIsMob = HasComp<BodyComponent>(toInsert);
|
var targetIsMob = HasComp<BodyComponent>(toInsert);
|
||||||
var storageIsItem = HasComp<ItemComponent>(container);
|
var storageIsItem = HasComp<ItemComponent>(container);
|
||||||
var allowedToEat = component.Whitelist?.IsValid(toInsert) ?? HasComp<ItemComponent>(toInsert);
|
var allowedToEat = component.Whitelist == null ? HasComp<ItemComponent>(toInsert) : _whitelistSystem.IsValid(component.Whitelist, toInsert);
|
||||||
|
|
||||||
// BEFORE REPLACING THIS WITH, I.E. A PROPERTY:
|
// BEFORE REPLACING THIS WITH, I.E. A PROPERTY:
|
||||||
// Make absolutely 100% sure you have worked out how to stop people ending up in backpacks.
|
// Make absolutely 100% sure you have worked out how to stop people ending up in backpacks.
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public abstract class SharedStorageSystem : EntitySystem
|
|||||||
[Dependency] protected readonly SharedTransformSystem TransformSystem = default!;
|
[Dependency] protected readonly SharedTransformSystem TransformSystem = default!;
|
||||||
[Dependency] private readonly SharedUserInterfaceSystem _ui = default!;
|
[Dependency] private readonly SharedUserInterfaceSystem _ui = default!;
|
||||||
[Dependency] protected readonly UseDelaySystem UseDelay = default!;
|
[Dependency] protected readonly UseDelaySystem UseDelay = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
private EntityQuery<ItemComponent> _itemQuery;
|
private EntityQuery<ItemComponent> _itemQuery;
|
||||||
private EntityQuery<StackComponent> _stackQuery;
|
private EntityQuery<StackComponent> _stackQuery;
|
||||||
@@ -860,13 +861,8 @@ public abstract class SharedStorageSystem : EntitySystem
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storageComp.Whitelist?.IsValid(insertEnt, EntityManager) == false)
|
if (_whitelistSystem.IsWhitelistFail(storageComp.Whitelist, insertEnt) ||
|
||||||
{
|
_whitelistSystem.IsBlacklistPass(storageComp.Blacklist, insertEnt))
|
||||||
reason = "comp-storage-invalid-container";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (storageComp.Blacklist?.IsValid(insertEnt, EntityManager) == true)
|
|
||||||
{
|
{
|
||||||
reason = "comp-storage-invalid-container";
|
reason = "comp-storage-invalid-container";
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.Projectiles;
|
using Content.Shared.Projectiles;
|
||||||
using Content.Shared.Weapons.Melee.Events;
|
using Content.Shared.Weapons.Melee.Events;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
@@ -15,6 +16,7 @@ public abstract class SharedDamageMarkerSystem : EntitySystem
|
|||||||
[Dependency] private readonly INetManager _netManager = default!;
|
[Dependency] private readonly INetManager _netManager = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly DamageableSystem _damageable = default!;
|
[Dependency] private readonly DamageableSystem _damageable = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -58,7 +60,7 @@ public abstract class SharedDamageMarkerSystem : EntitySystem
|
|||||||
if (!args.OtherFixture.Hard ||
|
if (!args.OtherFixture.Hard ||
|
||||||
args.OurFixtureId != SharedProjectileSystem.ProjectileFixture ||
|
args.OurFixtureId != SharedProjectileSystem.ProjectileFixture ||
|
||||||
component.Amount <= 0 ||
|
component.Amount <= 0 ||
|
||||||
component.Whitelist?.IsValid(args.OtherEntity, EntityManager) == false ||
|
_whitelistSystem.IsWhitelistFail(component.Whitelist, args.OtherEntity) ||
|
||||||
!TryComp<ProjectileComponent>(uid, out var projectile) ||
|
!TryComp<ProjectileComponent>(uid, out var projectile) ||
|
||||||
projectile.Weapon == null)
|
projectile.Weapon == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,7 +41,10 @@ public abstract partial class SharedGunSystem
|
|||||||
|
|
||||||
private void OnBallisticInteractUsing(EntityUid uid, BallisticAmmoProviderComponent component, InteractUsingEvent args)
|
private void OnBallisticInteractUsing(EntityUid uid, BallisticAmmoProviderComponent component, InteractUsingEvent args)
|
||||||
{
|
{
|
||||||
if (args.Handled || component.Whitelist?.IsValid(args.Used, EntityManager) != true)
|
if (args.Handled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_whitelistSystem.IsWhitelistFailOrNull(component.Whitelist, args.Used))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (GetBallisticShots(component) >= component.Capacity)
|
if (GetBallisticShots(component) >= component.Capacity)
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public partial class SharedGunSystem
|
|||||||
|
|
||||||
public bool TryRevolverInsert(EntityUid revolverUid, RevolverAmmoProviderComponent component, EntityUid uid, EntityUid? user)
|
public bool TryRevolverInsert(EntityUid revolverUid, RevolverAmmoProviderComponent component, EntityUid uid, EntityUid? user)
|
||||||
{
|
{
|
||||||
if (component.Whitelist?.IsValid(uid, EntityManager) == false)
|
if (_whitelistSystem.IsWhitelistFail(component.Whitelist, uid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// If it's a speedloader try to get ammo from it.
|
// If it's a speedloader try to get ammo from it.
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ using Content.Shared.Weapons.Melee;
|
|||||||
using Content.Shared.Weapons.Melee.Events;
|
using Content.Shared.Weapons.Melee.Events;
|
||||||
using Content.Shared.Weapons.Ranged.Components;
|
using Content.Shared.Weapons.Ranged.Components;
|
||||||
using Content.Shared.Weapons.Ranged.Events;
|
using Content.Shared.Weapons.Ranged.Events;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
@@ -63,6 +64,7 @@ public abstract partial class SharedGunSystem : EntitySystem
|
|||||||
[Dependency] protected readonly TagSystem TagSystem = default!;
|
[Dependency] protected readonly TagSystem TagSystem = default!;
|
||||||
[Dependency] protected readonly ThrowingSystem ThrowingSystem = default!;
|
[Dependency] protected readonly ThrowingSystem ThrowingSystem = default!;
|
||||||
[Dependency] private readonly UseDelaySystem _useDelay = default!;
|
[Dependency] private readonly UseDelaySystem _useDelay = default!;
|
||||||
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
|
||||||
private const float InteractNextFire = 0.3f;
|
private const float InteractNextFire = 0.3f;
|
||||||
private const double SafetyNextFire = 0.5;
|
private const double SafetyNextFire = 0.5;
|
||||||
|
|||||||
@@ -60,6 +60,90 @@ public sealed class EntityWhitelistSystem : EntitySystem
|
|||||||
|
|
||||||
return list.RequireAll;
|
return list.RequireAll;
|
||||||
}
|
}
|
||||||
|
/// The following are a list of "helper functions" that are basically the same as each other
|
||||||
|
/// to help make code that uses EntityWhitelist a bit more readable because at the moment
|
||||||
|
/// it is quite clunky having to write out component.Whitelist == null ? true : _whitelist.IsValid(component.Whitelist, uid)
|
||||||
|
/// several times in a row and makes comparisons easier to read
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper function to determine if Whitelist is not null and entity is on list
|
||||||
|
/// </summary>
|
||||||
|
public bool IsWhitelistPass(EntityWhitelist? whitelist, EntityUid uid)
|
||||||
|
{
|
||||||
|
if (whitelist == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return IsValid(whitelist, uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper function to determine if Whitelist is not null and entity is not on the list
|
||||||
|
/// </summary>
|
||||||
|
public bool IsWhitelistFail(EntityWhitelist? whitelist, EntityUid uid)
|
||||||
|
{
|
||||||
|
if (whitelist == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return !IsValid(whitelist, uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper function to determine if Whitelist is either null or the entity is on the list
|
||||||
|
/// </summary>
|
||||||
|
public bool IsWhitelistPassOrNull(EntityWhitelist? whitelist, EntityUid uid)
|
||||||
|
{
|
||||||
|
if (whitelist == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return IsValid(whitelist, uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper function to determine if Whitelist is either null or the entity is not on the list
|
||||||
|
/// </summary>
|
||||||
|
public bool IsWhitelistFailOrNull(EntityWhitelist? whitelist, EntityUid uid)
|
||||||
|
{
|
||||||
|
if (whitelist == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return !IsValid(whitelist, uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper function to determine if Blacklist is not null and entity is on list
|
||||||
|
/// Duplicate of equivalent Whitelist function
|
||||||
|
/// </summary>
|
||||||
|
public bool IsBlacklistPass(EntityWhitelist? blacklist, EntityUid uid)
|
||||||
|
{
|
||||||
|
return IsWhitelistPass(blacklist, uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper function to determine if Blacklist is not null and entity is not on the list
|
||||||
|
/// Duplicate of equivalent Whitelist function
|
||||||
|
/// </summary>
|
||||||
|
public bool IsBlacklistFail(EntityWhitelist? blacklist, EntityUid uid)
|
||||||
|
{
|
||||||
|
return IsWhitelistFail(blacklist, uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper function to determine if Blacklist is either null or the entity is on the list
|
||||||
|
/// Duplicate of equivalent Whitelist function
|
||||||
|
/// </summary>
|
||||||
|
public bool IsBlacklistPassOrNull(EntityWhitelist? blacklist, EntityUid uid)
|
||||||
|
{
|
||||||
|
return IsWhitelistPassOrNull(blacklist, uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper function to determine if Blacklist is either null or the entity is not on the list
|
||||||
|
/// Duplicate of equivalent Whitelist function
|
||||||
|
/// </summary>
|
||||||
|
public bool IsBlacklistFailOrNull(EntityWhitelist? blacklist, EntityUid uid)
|
||||||
|
{
|
||||||
|
return IsWhitelistFailOrNull(blacklist, uid);
|
||||||
|
}
|
||||||
|
|
||||||
private void EnsureRegistrations(EntityWhitelist list)
|
private void EnsureRegistrations(EntityWhitelist list)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user