* Moved pen slot to separate component * Moved it all to more generic item slot class * Add sounds * Item slots now supports many slots * Some clean-up * Refactored slots a bit * Moving ID card out * Moving pda to system * Moving PDA owner to ECS * Moved PDA flashlight to separate component * Toggle lights work through events * Fixing UI * Moving uplink to separate component * Continue moving uplink to separate component * More cleaning * Removing pda shared * Nuked shared pda component * Fixed flashlight * Pen slot now showed in UI * Light toggle now shows correctly in UI * Small refactoring of item slots * Added contained entity * Fixed tests * Finished with PDA * Moving PDA uplink to separate window * Adding-removing uplink should show new button * Working on a better debug * Debug command to add uplink * Uplink send state to UI * Almost working UI * Uplink correcty updates when you buy-sell items * Ups * Moved localization to separate file * Minor fixes * Removed item slots methods events * Removed PDA owner name * Removed one uplink event * Deleted all uplink events * Removed flashlight events * Update Content.Shared/Traitor/Uplink/UplinkVisuals.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Update Content.Server/Containers/ItemSlot/ItemSlotsSystem.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Update Content.Server/Containers/ItemSlot/ItemSlotsSystem.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Update Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Item slots system review * Flashlight review * PDA to XAML * Move UplinkMenu to seperate class, fix WeightedColors methods * Move UI to XAML * Moved events to entity id * Address review * Removed uplink extensions * Minor fix * Moved item slots to shared * My bad Robust... * Fixed pda sound * Fixed pda tests * Fixed pda test again Co-authored-by: Alexander Evgrashin <evgrashin.adl@gmail.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Visne <vincefvanwijk@gmail.com>
119 lines
3.4 KiB
C#
119 lines
3.4 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Content.Server.PDA
|
|
{
|
|
public sealed class PDAAccessSet : ISet<string>
|
|
{
|
|
private readonly PDAComponent _pdaComponent;
|
|
private static readonly HashSet<string> EmptySet = new();
|
|
|
|
public PDAAccessSet(PDAComponent pdaComponent)
|
|
{
|
|
_pdaComponent = pdaComponent;
|
|
}
|
|
|
|
public IEnumerator<string> GetEnumerator()
|
|
{
|
|
var contained = _pdaComponent.GetContainedAccess() ?? EmptySet;
|
|
return contained.GetEnumerator();
|
|
}
|
|
|
|
IEnumerator IEnumerable.GetEnumerator()
|
|
{
|
|
return GetEnumerator();
|
|
}
|
|
|
|
void ICollection<string>.Add(string item)
|
|
{
|
|
throw new NotSupportedException("PDA access list is read-only.");
|
|
}
|
|
|
|
public void ExceptWith(IEnumerable<string> other)
|
|
{
|
|
throw new NotSupportedException("PDA access list is read-only.");
|
|
}
|
|
|
|
public void IntersectWith(IEnumerable<string> other)
|
|
{
|
|
throw new NotSupportedException("PDA access list is read-only.");
|
|
}
|
|
|
|
public bool IsProperSubsetOf(IEnumerable<string> other)
|
|
{
|
|
var set = _pdaComponent.GetContainedAccess() ?? EmptySet;
|
|
return set.IsProperSubsetOf(other);
|
|
}
|
|
|
|
public bool IsProperSupersetOf(IEnumerable<string> other)
|
|
{
|
|
var set = _pdaComponent.GetContainedAccess() ?? EmptySet;
|
|
return set.IsProperSupersetOf(other);
|
|
}
|
|
|
|
public bool IsSubsetOf(IEnumerable<string> other)
|
|
{
|
|
var set = _pdaComponent.GetContainedAccess() ?? EmptySet;
|
|
return set.IsSubsetOf(other);
|
|
}
|
|
|
|
public bool IsSupersetOf(IEnumerable<string> other)
|
|
{
|
|
var set = _pdaComponent.GetContainedAccess() ?? EmptySet;
|
|
return set.IsSupersetOf(other);
|
|
}
|
|
|
|
public bool Overlaps(IEnumerable<string> other)
|
|
{
|
|
var set = _pdaComponent.GetContainedAccess() ?? EmptySet;
|
|
return set.Overlaps(other);
|
|
}
|
|
|
|
public bool SetEquals(IEnumerable<string> other)
|
|
{
|
|
var set = _pdaComponent.GetContainedAccess() ?? EmptySet;
|
|
return set.SetEquals(other);
|
|
}
|
|
|
|
public void SymmetricExceptWith(IEnumerable<string> other)
|
|
{
|
|
throw new NotSupportedException("PDA access list is read-only.");
|
|
}
|
|
|
|
public void UnionWith(IEnumerable<string> other)
|
|
{
|
|
throw new NotSupportedException("PDA access list is read-only.");
|
|
}
|
|
|
|
bool ISet<string>.Add(string item)
|
|
{
|
|
throw new NotSupportedException("PDA access list is read-only.");
|
|
}
|
|
|
|
public void Clear()
|
|
{
|
|
throw new NotSupportedException("PDA access list is read-only.");
|
|
}
|
|
|
|
public bool Contains(string item)
|
|
{
|
|
return _pdaComponent.GetContainedAccess()?.Contains(item) ?? false;
|
|
}
|
|
|
|
public void CopyTo(string[] array, int arrayIndex)
|
|
{
|
|
var set = _pdaComponent.GetContainedAccess() ?? EmptySet;
|
|
set.CopyTo(array, arrayIndex);
|
|
}
|
|
|
|
public bool Remove(string item)
|
|
{
|
|
throw new NotSupportedException("PDA access list is read-only.");
|
|
}
|
|
|
|
public int Count => _pdaComponent.GetContainedAccess()?.Count ?? 0;
|
|
public bool IsReadOnly => true;
|
|
}
|
|
}
|