prevent borgs unlocking eachother and robotics console (#27888)

* prevent borgs from using locks

* e

* bru

* a

* blacklist borgs and robotics console

* frogro

* add IsAllowed to EntityWhitelistSystem

* use IsAllowed

* move thing to new LockingWhitelistSystem

* :trollface:

* review

* use renamed CheckBoth in locking whitelist

* remove unused stuff and add more to doc

* Use target entity instead to remove self check

* Rename to _whitelistSystem

* Add deny lock toggle popup

* Prevent duplicate checks and popups

* Fix wrong entity in popup when toggling another borg

* Make new event

* Update comment to user for new event

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
This commit is contained in:
deltanedas
2024-07-25 03:54:51 +00:00
committed by GitHub
parent b6811d3570
commit 8f6326c3e0
7 changed files with 82 additions and 2 deletions

View File

@@ -23,6 +23,23 @@ public sealed class EntityWhitelistSystem : EntitySystem
return uid != null && IsValid(list, uid.Value);
}
/// <summary>
/// Checks whether a given entity is allowed by a whitelist and not blocked by a blacklist.
/// If a blacklist is provided and it matches then this returns false.
/// If a whitelist is provided and it does not match then this returns false.
/// If either list is null it does not get checked.
/// </summary>
public bool CheckBoth([NotNullWhen(true)] EntityUid? uid, EntityWhitelist? blacklist = null, EntityWhitelist? whitelist = null)
{
if (uid == null)
return false;
if (blacklist != null && IsValid(blacklist, uid))
return false;
return whitelist == null || IsValid(whitelist, uid);
}
/// <summary>
/// Checks whether a given entity satisfies a whitelist.
/// </summary>