Dewarns access (#16666)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -11,14 +11,16 @@ public sealed class AccessOverlay : Overlay
|
|||||||
{
|
{
|
||||||
private readonly IEntityManager _entityManager;
|
private readonly IEntityManager _entityManager;
|
||||||
private readonly EntityLookupSystem _lookup;
|
private readonly EntityLookupSystem _lookup;
|
||||||
|
private readonly SharedTransformSystem _xform;
|
||||||
private readonly Font _font;
|
private readonly Font _font;
|
||||||
|
|
||||||
public override OverlaySpace Space => OverlaySpace.ScreenSpace;
|
public override OverlaySpace Space => OverlaySpace.ScreenSpace;
|
||||||
|
|
||||||
public AccessOverlay(IEntityManager entManager, IResourceCache cache, EntityLookupSystem lookup)
|
public AccessOverlay(IEntityManager entManager, IResourceCache cache, EntityLookupSystem lookup, SharedTransformSystem xform)
|
||||||
{
|
{
|
||||||
_entityManager = entManager;
|
_entityManager = entManager;
|
||||||
_lookup = lookup;
|
_lookup = lookup;
|
||||||
|
_xform = xform;
|
||||||
|
|
||||||
_font = cache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 12);
|
_font = cache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 12);
|
||||||
}
|
}
|
||||||
@@ -71,7 +73,7 @@ public sealed class AccessOverlay : Overlay
|
|||||||
textStr = "";
|
textStr = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
var screenPos = args.ViewportControl.WorldToScreen(xform.WorldPosition);
|
var screenPos = args.ViewportControl.WorldToScreen(_xform.GetWorldPosition(xform));
|
||||||
|
|
||||||
args.ScreenHandle.DrawString(_font, screenPos, textStr, Color.Gold);
|
args.ScreenHandle.DrawString(_font, screenPos, textStr, Color.Gold);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,4 +2,6 @@ using Content.Shared.Access.Systems;
|
|||||||
|
|
||||||
namespace Content.Client.Access;
|
namespace Content.Client.Access;
|
||||||
|
|
||||||
public sealed class AccessSystem : SharedAccessSystem {}
|
public sealed class AccessSystem : SharedAccessSystem
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ public sealed class ShowAccessReadersCommand : IConsoleCommand
|
|||||||
{
|
{
|
||||||
var collection = IoCManager.Instance;
|
var collection = IoCManager.Instance;
|
||||||
|
|
||||||
if (collection == null) return;
|
if (collection == null)
|
||||||
|
return;
|
||||||
|
|
||||||
var overlay = collection.Resolve<IOverlayManager>();
|
var overlay = collection.Resolve<IOverlayManager>();
|
||||||
|
|
||||||
@@ -25,9 +26,10 @@ public sealed class ShowAccessReadersCommand : IConsoleCommand
|
|||||||
|
|
||||||
var entManager = collection.Resolve<IEntityManager>();
|
var entManager = collection.Resolve<IEntityManager>();
|
||||||
var cache = collection.Resolve<IResourceCache>();
|
var cache = collection.Resolve<IResourceCache>();
|
||||||
var system = entManager.EntitySysManager.GetEntitySystem<EntityLookupSystem>();
|
var lookup = entManager.System<EntityLookupSystem>();
|
||||||
|
var xform = entManager.System<SharedTransformSystem>();
|
||||||
|
|
||||||
overlay.AddOverlay(new AccessOverlay(entManager, cache, system));
|
overlay.AddOverlay(new AccessOverlay(entManager, cache, lookup, xform));
|
||||||
shell.WriteLine($"Set access reader debug overlay to true");
|
shell.WriteLine($"Set access reader debug overlay to true");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,9 +56,10 @@ namespace Content.Client.Access.UI
|
|||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
if (!disposing) return;
|
if (!disposing)
|
||||||
|
return;
|
||||||
|
|
||||||
_window?.Dispose();
|
_window?.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,9 @@ namespace Content.Client.Access.UI
|
|||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
if (!disposing) return;
|
if (!disposing)
|
||||||
|
return;
|
||||||
|
|
||||||
_window?.Dispose();
|
_window?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ namespace Content.Client.Access.UI
|
|||||||
public sealed partial class IdCardConsoleWindow : DefaultWindow
|
public sealed partial class IdCardConsoleWindow : DefaultWindow
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
|
[Dependency] private readonly ILogManager _logManager = default!;
|
||||||
|
private readonly ISawmill _logMill = default!;
|
||||||
|
|
||||||
private readonly IdCardConsoleBoundUserInterface _owner;
|
private readonly IdCardConsoleBoundUserInterface _owner;
|
||||||
|
|
||||||
@@ -30,6 +32,7 @@ namespace Content.Client.Access.UI
|
|||||||
{
|
{
|
||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
|
_logMill = _logManager.GetSawmill(SharedIdCardConsoleSystem.Sawmill);
|
||||||
|
|
||||||
_owner = owner;
|
_owner = owner;
|
||||||
|
|
||||||
@@ -67,7 +70,7 @@ namespace Content.Client.Access.UI
|
|||||||
{
|
{
|
||||||
if (!prototypeManager.TryIndex<AccessLevelPrototype>(access, out var accessLevel))
|
if (!prototypeManager.TryIndex<AccessLevelPrototype>(access, out var accessLevel))
|
||||||
{
|
{
|
||||||
Logger.ErrorS(SharedIdCardConsoleSystem.Sawmill, $"Unable to find accesslevel for {access}");
|
_logMill.Error($"Unable to find accesslevel for {access}");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Content.Shared.Access;
|
||||||
using Content.Shared.Access.Components;
|
using Content.Shared.Access.Components;
|
||||||
using Content.Shared.Access.Systems;
|
using Content.Shared.Access.Systems;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests.Access
|
namespace Content.IntegrationTests.Tests.Access
|
||||||
{
|
{
|
||||||
@@ -9,6 +13,35 @@ namespace Content.IntegrationTests.Tests.Access
|
|||||||
[TestOf(typeof(AccessReaderComponent))]
|
[TestOf(typeof(AccessReaderComponent))]
|
||||||
public sealed class AccessReaderTest
|
public sealed class AccessReaderTest
|
||||||
{
|
{
|
||||||
|
[Test]
|
||||||
|
public async Task TestProtoTags()
|
||||||
|
{
|
||||||
|
await using var pair = await PoolManager.GetServerClient(new PoolSettings() { NoClient = true });
|
||||||
|
var server = pair.Pair.Server;
|
||||||
|
|
||||||
|
var protoManager = server.ResolveDependency<IPrototypeManager>();
|
||||||
|
var accessName = server.ResolveDependency<IComponentFactory>().GetComponentName(typeof(AccessReaderComponent));
|
||||||
|
|
||||||
|
await server.WaitAssertion(() =>
|
||||||
|
{
|
||||||
|
foreach (var ent in protoManager.EnumeratePrototypes<EntityPrototype>())
|
||||||
|
{
|
||||||
|
if (!ent.Components.TryGetComponent(accessName, out var access))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var reader = (AccessReaderComponent) access;
|
||||||
|
var allTags = reader.AccessLists.SelectMany(c => c).Union(reader.DenyTags);
|
||||||
|
|
||||||
|
foreach (var level in allTags)
|
||||||
|
{
|
||||||
|
Assert.That(protoManager.HasIndex<AccessLevelPrototype>(level), $"Invalid access level: {level} found on {ent}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await pair.CleanReturnAsync();
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task TestTags()
|
public async Task TestTags()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,5 +2,6 @@ namespace Content.Server.Access.Components
|
|||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed class AgentIDCardComponent : Component
|
public sealed class AgentIDCardComponent : Component
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,5 +4,4 @@ namespace Content.Server.Access.Systems;
|
|||||||
|
|
||||||
public sealed class AccessSystem : SharedAccessSystem
|
public sealed class AccessSystem : SharedAccessSystem
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace Content.Server.Access.Systems
|
|||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
|
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -112,7 +113,7 @@ namespace Content.Server.Access.Systems
|
|||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
_adminLogger.Add(LogType.Identity, LogImpact.Low,
|
_adminLogger.Add(LogType.Identity, LogImpact.Low,
|
||||||
$"{ToPrettyString(player.Value):player} has changed the job title of {ToPrettyString(id.Owner):entity} to {jobTitle} ");
|
$"{ToPrettyString(player.Value):player} has changed the job title of {ToPrettyString(uid):entity} to {jobTitle} ");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -149,7 +150,7 @@ namespace Content.Server.Access.Systems
|
|||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
_adminLogger.Add(LogType.Identity, LogImpact.Low,
|
_adminLogger.Add(LogType.Identity, LogImpact.Low,
|
||||||
$"{ToPrettyString(player.Value):player} has changed the name of {ToPrettyString(id.Owner):entity} to {fullName} ");
|
$"{ToPrettyString(player.Value):player} has changed the name of {ToPrettyString(uid):entity} to {fullName} ");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -174,7 +175,7 @@ namespace Content.Server.Access.Systems
|
|||||||
: Loc.GetString("access-id-card-component-owner-full-name-job-title-text",
|
: Loc.GetString("access-id-card-component-owner-full-name-job-title-text",
|
||||||
("fullName", id.FullName),
|
("fullName", id.FullName),
|
||||||
("jobSuffix", jobSuffix));
|
("jobSuffix", jobSuffix));
|
||||||
EntityManager.GetComponent<MetaDataComponent>(id.Owner).EntityName = val;
|
_metaSystem.SetEntityName(uid, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,8 @@ public sealed class IdExaminableSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnGetExamineVerbs(EntityUid uid, IdExaminableComponent component, GetVerbsEvent<ExamineVerb> args)
|
private void OnGetExamineVerbs(EntityUid uid, IdExaminableComponent component, GetVerbsEvent<ExamineVerb> args)
|
||||||
{
|
{
|
||||||
|
|
||||||
var detailsRange = _examineSystem.IsInDetailsRange(args.User, uid);
|
var detailsRange = _examineSystem.IsInDetailsRange(args.User, uid);
|
||||||
var info = GetInfo(component.Owner) ?? Loc.GetString("id-examinable-component-verb-no-id");
|
var info = GetInfo(uid) ?? Loc.GetString("id-examinable-component-verb-no-id");
|
||||||
|
|
||||||
var verb = new ExamineVerb()
|
var verb = new ExamineVerb()
|
||||||
{
|
{
|
||||||
@@ -36,7 +35,7 @@ public sealed class IdExaminableSystem : EntitySystem
|
|||||||
Category = VerbCategory.Examine,
|
Category = VerbCategory.Examine,
|
||||||
Disabled = !detailsRange,
|
Disabled = !detailsRange,
|
||||||
Message = Loc.GetString("id-examinable-component-verb-disabled"),
|
Message = Loc.GetString("id-examinable-component-verb-disabled"),
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/character.svg.192dpi.png"))
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/character.svg.192dpi.png"))
|
||||||
};
|
};
|
||||||
|
|
||||||
args.Verbs.Add(verb);
|
args.Verbs.Add(verb);
|
||||||
@@ -47,12 +46,13 @@ public sealed class IdExaminableSystem : EntitySystem
|
|||||||
if (_inventorySystem.TryGetSlotEntity(uid, "id", out var idUid))
|
if (_inventorySystem.TryGetSlotEntity(uid, "id", out var idUid))
|
||||||
{
|
{
|
||||||
// PDA
|
// PDA
|
||||||
if (EntityManager.TryGetComponent(idUid, out PdaComponent? pda) && pda.ContainedId is not null)
|
if (EntityManager.TryGetComponent(idUid, out PdaComponent? pda) &&
|
||||||
|
TryComp<IdCardComponent>(pda.ContainedId, out var id))
|
||||||
{
|
{
|
||||||
return GetNameAndJob(pda.ContainedId);
|
return GetNameAndJob(id);
|
||||||
}
|
}
|
||||||
// ID Card
|
// ID Card
|
||||||
if (EntityManager.TryGetComponent(idUid, out IdCardComponent? id))
|
if (EntityManager.TryGetComponent(idUid, out id))
|
||||||
{
|
{
|
||||||
return GetNameAndJob(id);
|
return GetNameAndJob(id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,15 +26,16 @@ namespace Content.Server.Access.Systems
|
|||||||
{
|
{
|
||||||
// Go over all ID cards and make sure they're correctly configured for extended access.
|
// Go over all ID cards and make sure they're correctly configured for extended access.
|
||||||
|
|
||||||
foreach (var card in EntityQuery<PresetIdCardComponent>())
|
var query = EntityQueryEnumerator<PresetIdCardComponent>();
|
||||||
|
while (query.MoveNext(out var uid, out var card))
|
||||||
{
|
{
|
||||||
var station = _stationSystem.GetOwningStation(card.Owner);
|
var station = _stationSystem.GetOwningStation(uid);
|
||||||
|
|
||||||
// If we're not on an extended access station, the ID is already configured correctly from MapInit.
|
// If we're not on an extended access station, the ID is already configured correctly from MapInit.
|
||||||
if (station == null || !Comp<StationJobsComponent>(station.Value).ExtendedAccess)
|
if (station == null || !Comp<StationJobsComponent>(station.Value).ExtendedAccess)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetupIdAccess(card.Owner, card, true);
|
SetupIdAccess(uid, card, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ namespace Content.Server.Access.Systems
|
|||||||
// or may not yet know whether it is on extended access (players not spawned yet).
|
// or may not yet know whether it is on extended access (players not spawned yet).
|
||||||
// PlayerJobsAssigned makes sure extended access is configured correctly in that case.
|
// PlayerJobsAssigned makes sure extended access is configured correctly in that case.
|
||||||
|
|
||||||
var station = _stationSystem.GetOwningStation(id.Owner);
|
var station = _stationSystem.GetOwningStation(uid);
|
||||||
var extended = false;
|
var extended = false;
|
||||||
if (station != null)
|
if (station != null)
|
||||||
extended = Comp<StationJobsComponent>(station.Value).ExtendedAccess;
|
extended = Comp<StationJobsComponent>(station.Value).ExtendedAccess;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Server.Administration.UI;
|
|||||||
using Content.Server.EUI;
|
using Content.Server.EUI;
|
||||||
using Content.Server.Hands.Systems;
|
using Content.Server.Hands.Systems;
|
||||||
using Content.Server.Preferences.Managers;
|
using Content.Server.Preferences.Managers;
|
||||||
|
using Content.Shared.Access.Components;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.Hands.Components;
|
using Content.Shared.Hands.Components;
|
||||||
using Content.Shared.Inventory;
|
using Content.Shared.Inventory;
|
||||||
@@ -16,7 +17,7 @@ using Robust.Shared.Prototypes;
|
|||||||
namespace Content.Server.Administration.Commands
|
namespace Content.Server.Administration.Commands
|
||||||
{
|
{
|
||||||
[AdminCommand(AdminFlags.Admin)]
|
[AdminCommand(AdminFlags.Admin)]
|
||||||
sealed class SetOutfitCommand : IConsoleCommand
|
public sealed class SetOutfitCommand : IConsoleCommand
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entities = default!;
|
[Dependency] private readonly IEntityManager _entities = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypes = default!;
|
[Dependency] private readonly IPrototypeManager _prototypes = default!;
|
||||||
@@ -25,7 +26,7 @@ namespace Content.Server.Administration.Commands
|
|||||||
|
|
||||||
public string Description => Loc.GetString("set-outfit-command-description", ("requiredComponent", nameof(InventoryComponent)));
|
public string Description => Loc.GetString("set-outfit-command-description", ("requiredComponent", nameof(InventoryComponent)));
|
||||||
|
|
||||||
public string Help => Loc.GetString("set-outfit-command-help-text", ("command",Command));
|
public string Help => Loc.GetString("set-outfit-command-help-text", ("command", Command));
|
||||||
|
|
||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
@@ -51,7 +52,7 @@ namespace Content.Server.Administration.Commands
|
|||||||
|
|
||||||
if (!_entities.HasComponent<InventoryComponent?>(target))
|
if (!_entities.HasComponent<InventoryComponent?>(target))
|
||||||
{
|
{
|
||||||
shell.WriteLine(Loc.GetString("shell-target-entity-does-not-have-message",("missing", "inventory")));
|
shell.WriteLine(Loc.GetString("shell-target-entity-does-not-have-message", ("missing", "inventory")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,9 +107,9 @@ namespace Content.Server.Administration.Commands
|
|||||||
var equipmentEntity = entityManager.SpawnEntity(gearStr, entityManager.GetComponent<TransformComponent>(target).Coordinates);
|
var equipmentEntity = entityManager.SpawnEntity(gearStr, entityManager.GetComponent<TransformComponent>(target).Coordinates);
|
||||||
if (slot.Name == "id" &&
|
if (slot.Name == "id" &&
|
||||||
entityManager.TryGetComponent<PdaComponent?>(equipmentEntity, out var pdaComponent) &&
|
entityManager.TryGetComponent<PdaComponent?>(equipmentEntity, out var pdaComponent) &&
|
||||||
pdaComponent.ContainedId != null)
|
entityManager.TryGetComponent<IdCardComponent>(pdaComponent.ContainedId, out var id))
|
||||||
{
|
{
|
||||||
pdaComponent.ContainedId.FullName = entityManager.GetComponent<MetaDataComponent>(target).EntityName;
|
id.FullName = entityManager.GetComponent<MetaDataComponent>(target).EntityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
invSystem.TryEquip(target, equipmentEntity, slot.Name, silent: true, force: true, inventory: inventoryComponent);
|
invSystem.TryEquip(target, equipmentEntity, slot.Name, silent: true, force: true, inventory: inventoryComponent);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using Content.Server.Damage.Components;
|
|||||||
using Content.Server.Doors.Systems;
|
using Content.Server.Doors.Systems;
|
||||||
using Content.Server.Hands.Systems;
|
using Content.Server.Hands.Systems;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
|
using Content.Server.Power.EntitySystems;
|
||||||
using Content.Server.Stack;
|
using Content.Server.Stack;
|
||||||
using Content.Server.Station.Components;
|
using Content.Server.Station.Components;
|
||||||
using Content.Server.Station.Systems;
|
using Content.Server.Station.Systems;
|
||||||
@@ -49,6 +50,9 @@ public sealed partial class AdminVerbSystem
|
|||||||
[Dependency] private readonly AdminTestArenaSystem _adminTestArenaSystem = default!;
|
[Dependency] private readonly AdminTestArenaSystem _adminTestArenaSystem = default!;
|
||||||
[Dependency] private readonly StationJobsSystem _stationJobsSystem = default!;
|
[Dependency] private readonly StationJobsSystem _stationJobsSystem = default!;
|
||||||
[Dependency] private readonly JointSystem _jointSystem = default!;
|
[Dependency] private readonly JointSystem _jointSystem = default!;
|
||||||
|
[Dependency] private readonly BatterySystem _batterySystem = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
|
||||||
|
|
||||||
private void AddTricksVerbs(GetVerbsEvent<Verb> args)
|
private void AddTricksVerbs(GetVerbsEvent<Verb> args)
|
||||||
{
|
{
|
||||||
@@ -80,7 +84,6 @@ public sealed partial class AdminVerbSystem
|
|||||||
? "admin-trick-unbolt-description"
|
? "admin-trick-unbolt-description"
|
||||||
: "admin-trick-bolt-description"),
|
: "admin-trick-bolt-description"),
|
||||||
Priority = (int) (bolts.BoltsDown ? TricksVerbPriorities.Unbolt : TricksVerbPriorities.Bolt),
|
Priority = (int) (bolts.BoltsDown ? TricksVerbPriorities.Unbolt : TricksVerbPriorities.Bolt),
|
||||||
|
|
||||||
};
|
};
|
||||||
args.Verbs.Add(bolt);
|
args.Verbs.Add(bolt);
|
||||||
}
|
}
|
||||||
@@ -91,7 +94,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = airlock.EmergencyAccess ? "Emergency Access Off" : "Emergency Access On",
|
Text = airlock.EmergencyAccess ? "Emergency Access Off" : "Emergency Access On",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/emergency_access.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/emergency_access.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
_airlockSystem.ToggleEmergencyAccess(args.Target, airlock);
|
_airlockSystem.ToggleEmergencyAccess(args.Target, airlock);
|
||||||
@@ -100,9 +103,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
Message = Loc.GetString(airlock.EmergencyAccess
|
Message = Loc.GetString(airlock.EmergencyAccess
|
||||||
? "admin-trick-emergency-access-off-description"
|
? "admin-trick-emergency-access-off-description"
|
||||||
: "admin-trick-emergency-access-on-description"),
|
: "admin-trick-emergency-access-on-description"),
|
||||||
Priority = (int) (airlock.EmergencyAccess
|
Priority = (int) (airlock.EmergencyAccess ? TricksVerbPriorities.EmergencyAccessOff : TricksVerbPriorities.EmergencyAccessOn),
|
||||||
? TricksVerbPriorities.EmergencyAccessOff
|
|
||||||
: TricksVerbPriorities.EmergencyAccessOn),
|
|
||||||
};
|
};
|
||||||
args.Verbs.Add(emergencyAccess);
|
args.Verbs.Add(emergencyAccess);
|
||||||
}
|
}
|
||||||
@@ -113,7 +114,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Rejuvenate",
|
Text = "Rejuvenate",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/rejuvenate.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/rejuvenate.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
RejuvenateCommand.PerformRejuvenate(args.Target);
|
RejuvenateCommand.PerformRejuvenate(args.Target);
|
||||||
@@ -131,7 +132,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Make Indestructible",
|
Text = "Make Indestructible",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/plus.svg.192dpi.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/plus.svg.192dpi.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
_godmodeSystem.EnableGodmode(args.Target);
|
_godmodeSystem.EnableGodmode(args.Target);
|
||||||
@@ -148,7 +149,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Make Vulnerable",
|
Text = "Make Vulnerable",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/plus.svg.192dpi.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/plus.svg.192dpi.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
_godmodeSystem.DisableGodmode(args.Target);
|
_godmodeSystem.DisableGodmode(args.Target);
|
||||||
@@ -166,11 +167,11 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Refill Battery",
|
Text = "Refill Battery",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/fill_battery.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/fill_battery.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
battery.CurrentCharge = battery.MaxCharge;
|
_batterySystem.SetCharge(args.Target, battery.MaxCharge, battery);
|
||||||
Dirty(battery);
|
Dirty(args.Target, battery);
|
||||||
},
|
},
|
||||||
Impact = LogImpact.Medium,
|
Impact = LogImpact.Medium,
|
||||||
Message = Loc.GetString("admin-trick-refill-battery-description"),
|
Message = Loc.GetString("admin-trick-refill-battery-description"),
|
||||||
@@ -182,11 +183,11 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Drain Battery",
|
Text = "Drain Battery",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/drain_battery.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/drain_battery.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
battery.CurrentCharge = 0;
|
_batterySystem.SetCharge(args.Target, 0, battery);
|
||||||
Dirty(battery);
|
Dirty(args.Target, battery);
|
||||||
},
|
},
|
||||||
Impact = LogImpact.Medium,
|
Impact = LogImpact.Medium,
|
||||||
Message = Loc.GetString("admin-trick-drain-battery-description"),
|
Message = Loc.GetString("admin-trick-drain-battery-description"),
|
||||||
@@ -198,7 +199,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Infinite Battery",
|
Text = "Infinite Battery",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/infinite_battery.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/infinite_battery.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
var recharger = EnsureComp<BatterySelfRechargerComponent>(args.Target);
|
var recharger = EnsureComp<BatterySelfRechargerComponent>(args.Target);
|
||||||
@@ -218,7 +219,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Block Unanchoring",
|
Text = "Block Unanchoring",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/anchor.svg.192dpi.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/anchor.svg.192dpi.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
RemComp(args.Target, anchor);
|
RemComp(args.Target, anchor);
|
||||||
@@ -236,7 +237,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Refill Internals Oxygen",
|
Text = "Refill Internals Oxygen",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Tanks/oxygen.rsi"), "icon"),
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/oxygen.rsi"), "icon"),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
RefillGasTank(args.Target, Gas.Oxygen, tank);
|
RefillGasTank(args.Target, Gas.Oxygen, tank);
|
||||||
@@ -251,7 +252,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Refill Internals Nitrogen",
|
Text = "Refill Internals Nitrogen",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Tanks/red.rsi"), "icon"),
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/red.rsi"), "icon"),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
RefillGasTank(args.Target, Gas.Nitrogen, tank);
|
RefillGasTank(args.Target, Gas.Nitrogen, tank);
|
||||||
@@ -266,7 +267,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Refill Internals Plasma",
|
Text = "Refill Internals Plasma",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Tanks/plasma.rsi"), "icon"),
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/plasma.rsi"), "icon"),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
RefillGasTank(args.Target, Gas.Plasma, tank);
|
RefillGasTank(args.Target, Gas.Plasma, tank);
|
||||||
@@ -284,7 +285,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Refill Internals Oxygen",
|
Text = "Refill Internals Oxygen",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Tanks/oxygen.rsi"), "icon"),
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/oxygen.rsi"), "icon"),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
foreach (var slot in _inventorySystem.GetSlots(args.Target))
|
foreach (var slot in _inventorySystem.GetSlots(args.Target))
|
||||||
@@ -316,7 +317,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Refill Internals Nitrogen",
|
Text = "Refill Internals Nitrogen",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Tanks/red.rsi"), "icon"),
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/red.rsi"), "icon"),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
foreach (var slot in _inventorySystem.GetSlots(args.Target))
|
foreach (var slot in _inventorySystem.GetSlots(args.Target))
|
||||||
@@ -348,7 +349,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Refill Internals Plasma",
|
Text = "Refill Internals Plasma",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Tanks/plasma.rsi"), "icon"),
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/plasma.rsi"), "icon"),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
foreach (var slot in _inventorySystem.GetSlots(args.Target))
|
foreach (var slot in _inventorySystem.GetSlots(args.Target))
|
||||||
@@ -381,12 +382,12 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Send to test arena",
|
Text = "Send to test arena",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/eject.svg.192dpi.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/eject.svg.192dpi.png")),
|
||||||
|
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
var (mapUid, gridUid) = _adminTestArenaSystem.AssertArenaLoaded(player);
|
var (mapUid, gridUid) = _adminTestArenaSystem.AssertArenaLoaded(player);
|
||||||
Transform(args.Target).Coordinates = new EntityCoordinates(gridUid ?? mapUid, Vector2.One);
|
_xformSystem.SetCoordinates(args.Target, new EntityCoordinates(gridUid ?? mapUid, Vector2.One));
|
||||||
},
|
},
|
||||||
Impact = LogImpact.Medium,
|
Impact = LogImpact.Medium,
|
||||||
Message = Loc.GetString("admin-trick-send-to-test-arena-description"),
|
Message = Loc.GetString("admin-trick-send-to-test-arena-description"),
|
||||||
@@ -402,7 +403,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Grant All Access",
|
Text = "Grant All Access",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Misc/id_cards.rsi"), "centcom"),
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Misc/id_cards.rsi"), "centcom"),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
GiveAllAccess(activeId.Value);
|
GiveAllAccess(activeId.Value);
|
||||||
@@ -417,7 +418,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Revoke All Access",
|
Text = "Revoke All Access",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Misc/id_cards.rsi"), "default"),
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Misc/id_cards.rsi"), "default"),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
RevokeAllAccess(activeId.Value);
|
RevokeAllAccess(activeId.Value);
|
||||||
@@ -435,7 +436,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Grant All Access",
|
Text = "Grant All Access",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Misc/id_cards.rsi"), "centcom"),
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Misc/id_cards.rsi"), "centcom"),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
GiveAllAccess(args.Target);
|
GiveAllAccess(args.Target);
|
||||||
@@ -450,7 +451,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Revoke All Access",
|
Text = "Revoke All Access",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Misc/id_cards.rsi"), "default"),
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Misc/id_cards.rsi"), "default"),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
RevokeAllAccess(args.Target);
|
RevokeAllAccess(args.Target);
|
||||||
@@ -469,7 +470,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Adjust Stack",
|
Text = "Adjust Stack",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/adjust-stack.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/adjust-stack.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
// Unbounded intentionally.
|
// Unbounded intentionally.
|
||||||
@@ -488,7 +489,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Fill Stack",
|
Text = "Fill Stack",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/fill-stack.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/fill-stack.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
_stackSystem.SetCount(args.Target, _stackSystem.GetMaxCount(stack), stack);
|
_stackSystem.SetCount(args.Target, _stackSystem.GetMaxCount(stack), stack);
|
||||||
@@ -504,12 +505,12 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Rename",
|
Text = "Rename",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/rename.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/rename.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
_quickDialog.OpenDialog(player, "Rename", "Name", (string newName) =>
|
_quickDialog.OpenDialog(player, "Rename", "Name", (string newName) =>
|
||||||
{
|
{
|
||||||
MetaData(args.Target).EntityName = newName;
|
_metaSystem.SetEntityName(args.Target, newName);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
Impact = LogImpact.Medium,
|
Impact = LogImpact.Medium,
|
||||||
@@ -522,12 +523,12 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Redescribe",
|
Text = "Redescribe",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/redescribe.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/redescribe.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
_quickDialog.OpenDialog(player, "Redescribe", "Description", (LongString newDescription) =>
|
_quickDialog.OpenDialog(player, "Redescribe", "Description", (LongString newDescription) =>
|
||||||
{
|
{
|
||||||
MetaData(args.Target).EntityDescription = newDescription.String;
|
_metaSystem.SetEntityDescription(args.Target, newDescription.String);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
Impact = LogImpact.Medium,
|
Impact = LogImpact.Medium,
|
||||||
@@ -540,15 +541,15 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Redescribe",
|
Text = "Redescribe",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/rename_and_redescribe.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/rename_and_redescribe.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
_quickDialog.OpenDialog(player, "Rename & Redescribe", "Name", "Description",
|
_quickDialog.OpenDialog(player, "Rename & Redescribe", "Name", "Description",
|
||||||
(string newName, LongString newDescription) =>
|
(string newName, LongString newDescription) =>
|
||||||
{
|
{
|
||||||
var meta = MetaData(args.Target);
|
var meta = MetaData(args.Target);
|
||||||
meta.EntityName = newName;
|
_metaSystem.SetEntityName(args.Target, newName, meta);
|
||||||
meta.EntityDescription = newDescription.String;
|
_metaSystem.SetEntityDescription(args.Target, newDescription.String, meta);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
Impact = LogImpact.Medium,
|
Impact = LogImpact.Medium,
|
||||||
@@ -565,7 +566,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Bar job slots",
|
Text = "Bar job slots",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/bar_jobslots.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/bar_jobslots.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
foreach (var (job, _) in _stationJobsSystem.GetJobs(args.Target))
|
foreach (var (job, _) in _stationJobsSystem.GetJobs(args.Target))
|
||||||
@@ -584,7 +585,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Locate Cargo Shuttle",
|
Text = "Locate Cargo Shuttle",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Clothing/Head/Soft/cargosoft.rsi"), "icon"),
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Clothing/Head/Soft/cargosoft.rsi"), "icon"),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
var shuttle = Comp<StationCargoOrderDatabaseComponent>(args.Target).Shuttle;
|
var shuttle = Comp<StationCargoOrderDatabaseComponent>(args.Target).Shuttle;
|
||||||
@@ -592,7 +593,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
if (shuttle is null)
|
if (shuttle is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Transform(args.User).Coordinates = new EntityCoordinates(shuttle.Value, Vector2.Zero);
|
_xformSystem.SetCoordinates(args.User, new EntityCoordinates(shuttle.Value, Vector2.Zero));
|
||||||
},
|
},
|
||||||
Impact = LogImpact.Low,
|
Impact = LogImpact.Low,
|
||||||
Message = Loc.GetString("admin-trick-locate-cargo-shuttle-description"),
|
Message = Loc.GetString("admin-trick-locate-cargo-shuttle-description"),
|
||||||
@@ -607,7 +608,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Refill Battery",
|
Text = "Refill Battery",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/fill_battery.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/fill_battery.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
foreach (var ent in childEnum)
|
foreach (var ent in childEnum)
|
||||||
@@ -615,8 +616,8 @@ public sealed partial class AdminVerbSystem
|
|||||||
if (!HasComp<StationInfiniteBatteryTargetComponent>(ent))
|
if (!HasComp<StationInfiniteBatteryTargetComponent>(ent))
|
||||||
continue;
|
continue;
|
||||||
var battery = EnsureComp<BatteryComponent>(ent);
|
var battery = EnsureComp<BatteryComponent>(ent);
|
||||||
battery.CurrentCharge = battery.MaxCharge;
|
_batterySystem.SetCharge(ent, battery.MaxCharge, battery);
|
||||||
Dirty(battery);
|
Dirty(ent, battery);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Impact = LogImpact.Extreme,
|
Impact = LogImpact.Extreme,
|
||||||
@@ -629,7 +630,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Drain Battery",
|
Text = "Drain Battery",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/drain_battery.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/drain_battery.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
foreach (var ent in childEnum)
|
foreach (var ent in childEnum)
|
||||||
@@ -637,8 +638,8 @@ public sealed partial class AdminVerbSystem
|
|||||||
if (!HasComp<StationInfiniteBatteryTargetComponent>(ent))
|
if (!HasComp<StationInfiniteBatteryTargetComponent>(ent))
|
||||||
continue;
|
continue;
|
||||||
var battery = EnsureComp<BatteryComponent>(ent);
|
var battery = EnsureComp<BatteryComponent>(ent);
|
||||||
battery.CurrentCharge = 0;
|
_batterySystem.SetCharge(ent, 0, battery);
|
||||||
Dirty(battery);
|
Dirty(ent, battery);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Impact = LogImpact.Extreme,
|
Impact = LogImpact.Extreme,
|
||||||
@@ -651,7 +652,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Infinite Battery",
|
Text = "Infinite Battery",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/infinite_battery.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/infinite_battery.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
// this kills the sloth
|
// this kills the sloth
|
||||||
@@ -680,7 +681,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Halt Movement",
|
Text = "Halt Movement",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/halt.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/halt.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
_physics.SetLinearVelocity(args.Target, Vector2.Zero, body: physics);
|
_physics.SetLinearVelocity(args.Target, Vector2.Zero, body: physics);
|
||||||
@@ -703,7 +704,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Unpause Map",
|
Text = "Unpause Map",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/play.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/play.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
_mapManager.SetMapPaused(map.MapId, false);
|
_mapManager.SetMapPaused(map.MapId, false);
|
||||||
@@ -720,7 +721,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Pause Map",
|
Text = "Pause Map",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/pause.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/pause.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
_mapManager.SetMapPaused(map.MapId, true);
|
_mapManager.SetMapPaused(map.MapId, true);
|
||||||
@@ -740,10 +741,10 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Snap Joints",
|
Text = "Snap Joints",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/AdminActions/snap_joints.png")),
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/snap_joints.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
_jointSystem.ClearJoints(joints);
|
_jointSystem.ClearJoints(args.Target, joints);
|
||||||
},
|
},
|
||||||
Impact = LogImpact.Medium,
|
Impact = LogImpact.Medium,
|
||||||
Message = Loc.GetString("admin-trick-snap-joints-description"),
|
Message = Loc.GetString("admin-trick-snap-joints-description"),
|
||||||
@@ -758,7 +759,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Make Minigun",
|
Text = "Make Minigun",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Weapons/Guns/HMGs/minigun.rsi"), "icon"),
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Weapons/Guns/HMGs/minigun.rsi"), "icon"),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
gun.FireRate = 15;
|
gun.FireRate = 15;
|
||||||
@@ -776,7 +777,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
Text = "Set Bullet Amount",
|
Text = "Set Bullet Amount",
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Fun/caps.rsi"), "mag-6"),
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Fun/caps.rsi"), "mag-6"),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
_quickDialog.OpenDialog(player, "Set Bullet Amount", $"Amount (max {ballisticAmmo.Capacity}):", (int amount) =>
|
_quickDialog.OpenDialog(player, "Set Bullet Amount", $"Amount (max {ballisticAmmo.Capacity}):", (int amount) =>
|
||||||
@@ -858,12 +859,10 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
return slotEntity.Value;
|
return slotEntity.Value;
|
||||||
}
|
}
|
||||||
else if (TryComp<PdaComponent>(slotEntity, out var pda))
|
else if (TryComp<PdaComponent>(slotEntity, out var pda)
|
||||||
|
&& HasComp<IdCardComponent>(pda.ContainedId))
|
||||||
{
|
{
|
||||||
if (pda.ContainedId != null)
|
return pda.ContainedId;
|
||||||
{
|
|
||||||
return pda.ContainedId.Owner;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (TryComp<HandsComponent>(target, out var hands))
|
else if (TryComp<HandsComponent>(target, out var hands))
|
||||||
@@ -891,40 +890,40 @@ public sealed partial class AdminVerbSystem
|
|||||||
|
|
||||||
private void RevokeAllAccess(EntityUid entity)
|
private void RevokeAllAccess(EntityUid entity)
|
||||||
{
|
{
|
||||||
_accessSystem.TrySetTags(entity, new string[]{});
|
_accessSystem.TrySetTags(entity, Array.Empty<string>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TricksVerbPriorities
|
public enum TricksVerbPriorities
|
||||||
{
|
{
|
||||||
Bolt = 0,
|
Bolt = 0,
|
||||||
Unbolt = 0,
|
Unbolt = -1,
|
||||||
EmergencyAccessOn = -1, // These are separate intentionally for `invokeverb` shenanigans.
|
EmergencyAccessOn = -2,
|
||||||
EmergencyAccessOff = -1,
|
EmergencyAccessOff = -3,
|
||||||
MakeIndestructible = -2,
|
MakeIndestructible = -4,
|
||||||
MakeVulnerable = -2,
|
MakeVulnerable = -5,
|
||||||
BlockUnanchoring = -3,
|
BlockUnanchoring = -6,
|
||||||
RefillBattery = -4,
|
RefillBattery = -7,
|
||||||
DrainBattery = -5,
|
DrainBattery = -8,
|
||||||
RefillOxygen = -6,
|
RefillOxygen = -9,
|
||||||
RefillNitrogen = -7,
|
RefillNitrogen = -10,
|
||||||
RefillPlasma = -8,
|
RefillPlasma = -11,
|
||||||
SendToTestArena = -9,
|
SendToTestArena = -12,
|
||||||
GrantAllAccess = -10,
|
GrantAllAccess = -13,
|
||||||
RevokeAllAccess = -11,
|
RevokeAllAccess = -14,
|
||||||
Rejuvenate = -12,
|
Rejuvenate = -15,
|
||||||
AdjustStack = -13,
|
AdjustStack = -16,
|
||||||
FillStack = -14,
|
FillStack = -17,
|
||||||
Rename = -15,
|
Rename = -18,
|
||||||
Redescribe = -16,
|
Redescribe = -19,
|
||||||
RenameAndRedescribe = -17,
|
RenameAndRedescribe = -20,
|
||||||
BarJobSlots = -18,
|
BarJobSlots = -21,
|
||||||
LocateCargoShuttle = -19,
|
LocateCargoShuttle = -22,
|
||||||
InfiniteBattery = -20,
|
InfiniteBattery = -23,
|
||||||
HaltMovement = -21,
|
HaltMovement = -24,
|
||||||
Unpause = -22,
|
Unpause = -25,
|
||||||
Pause = -23,
|
Pause = -26,
|
||||||
SnapJoints = -24,
|
SnapJoints = -27,
|
||||||
MakeMinigun = -25,
|
MakeMinigun = -28,
|
||||||
SetBulletAmount = -26,
|
SetBulletAmount = -29,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Server.PDA.Ringer;
|
|||||||
using Content.Server.Station.Systems;
|
using Content.Server.Station.Systems;
|
||||||
using Content.Server.Store.Components;
|
using Content.Server.Store.Components;
|
||||||
using Content.Server.Store.Systems;
|
using Content.Server.Store.Systems;
|
||||||
|
using Content.Shared.Access.Components;
|
||||||
using Content.Shared.PDA;
|
using Content.Shared.PDA;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
@@ -117,14 +118,15 @@ namespace Content.Server.PDA
|
|||||||
// TODO: Update the level and name of the station with each call to UpdatePdaUi is only needed for latejoin players.
|
// TODO: Update the level and name of the station with each call to UpdatePdaUi is only needed for latejoin players.
|
||||||
// TODO: If someone can implement changing the level and name of the station when changing the PDA grid, this can be removed.
|
// TODO: If someone can implement changing the level and name of the station when changing the PDA grid, this can be removed.
|
||||||
|
|
||||||
|
var id = CompOrNull<IdCardComponent>(pda.ContainedId);
|
||||||
var state = new PdaUpdateState(
|
var state = new PdaUpdateState(
|
||||||
pda.FlashlightOn,
|
pda.FlashlightOn,
|
||||||
pda.PenSlot.HasItem,
|
pda.PenSlot.HasItem,
|
||||||
new PdaIdInfoText
|
new PdaIdInfoText
|
||||||
{
|
{
|
||||||
ActualOwnerName = pda.OwnerName,
|
ActualOwnerName = pda.OwnerName,
|
||||||
IdOwner = pda.ContainedId?.FullName,
|
IdOwner = id?.FullName,
|
||||||
JobTitle = pda.ContainedId?.JobTitle,
|
JobTitle = id?.JobTitle,
|
||||||
StationAlertLevel = pda.StationAlertLevel,
|
StationAlertLevel = pda.StationAlertLevel,
|
||||||
StationAlertColor = pda.StationAlertColor
|
StationAlertColor = pda.StationAlertColor
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ namespace Content.Server.Sandbox
|
|||||||
if (e.NewStatus != SessionStatus.Connected || e.OldStatus != SessionStatus.Connecting)
|
if (e.NewStatus != SessionStatus.Connected || e.OldStatus != SessionStatus.Connecting)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RaiseNetworkEvent(new MsgSandboxStatus {SandboxAllowed = IsSandboxEnabled}, e.Session.ConnectedClient);
|
RaiseNetworkEvent(new MsgSandboxStatus { SandboxAllowed = IsSandboxEnabled }, e.Session.ConnectedClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SandboxRespawnReceived(MsgSandboxRespawn message, EntitySessionEventArgs args)
|
private void SandboxRespawnReceived(MsgSandboxRespawn message, EntitySessionEventArgs args)
|
||||||
@@ -113,7 +113,7 @@ namespace Content.Server.Sandbox
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var player = _playerManager.GetSessionByChannel(args.SenderSession.ConnectedClient);
|
var player = _playerManager.GetSessionByChannel(args.SenderSession.ConnectedClient);
|
||||||
if (player.AttachedEntity is not {} attached)
|
if (player.AttachedEntity is not { } attached)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -130,17 +130,17 @@ namespace Content.Server.Sandbox
|
|||||||
}
|
}
|
||||||
else if (TryComp<PdaComponent>(slotEntity, out var pda))
|
else if (TryComp<PdaComponent>(slotEntity, out var pda))
|
||||||
{
|
{
|
||||||
if (pda.ContainedId == null)
|
if (pda.ContainedId is null)
|
||||||
{
|
{
|
||||||
var newID = CreateFreshId();
|
var newID = CreateFreshId();
|
||||||
if (TryComp<ItemSlotsComponent>(pda.Owner, out var itemSlots))
|
if (TryComp<ItemSlotsComponent>(slotEntity, out var itemSlots))
|
||||||
{
|
{
|
||||||
_slots.TryInsert(slotEntity.Value, pda.IdSlot, newID, null);
|
_slots.TryInsert(slotEntity.Value, pda.IdSlot, newID, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpgradeId(pda.ContainedId.Owner);
|
UpgradeId(pda.ContainedId!.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,7 +189,7 @@ namespace Content.Server.Sandbox
|
|||||||
|
|
||||||
private void UpdateSandboxStatusForAll()
|
private void UpdateSandboxStatusForAll()
|
||||||
{
|
{
|
||||||
RaiseNetworkEvent(new MsgSandboxStatus {SandboxAllowed = IsSandboxEnabled});
|
RaiseNetworkEvent(new MsgSandboxStatus { SandboxAllowed = IsSandboxEnabled });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Content.Server.Mind.Commands;
|
|||||||
using Content.Server.PDA;
|
using Content.Server.PDA;
|
||||||
using Content.Server.Roles;
|
using Content.Server.Roles;
|
||||||
using Content.Server.Station.Components;
|
using Content.Server.Station.Components;
|
||||||
|
using Content.Shared.Access.Components;
|
||||||
using Content.Shared.Access.Systems;
|
using Content.Shared.Access.Systems;
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Hands.Components;
|
using Content.Shared.Hands.Components;
|
||||||
@@ -44,6 +45,7 @@ public sealed class StationSpawningSystem : EntitySystem
|
|||||||
[Dependency] private readonly PdaSystem _pdaSystem = default!;
|
[Dependency] private readonly PdaSystem _pdaSystem = default!;
|
||||||
[Dependency] private readonly SharedAccessSystem _accessSystem = default!;
|
[Dependency] private readonly SharedAccessSystem _accessSystem = default!;
|
||||||
[Dependency] private readonly IdentitySystem _identity = default!;
|
[Dependency] private readonly IdentitySystem _identity = default!;
|
||||||
|
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
|
||||||
|
|
||||||
private bool _randomizeCharacters;
|
private bool _randomizeCharacters;
|
||||||
|
|
||||||
@@ -73,7 +75,7 @@ public sealed class StationSpawningSystem : EntitySystem
|
|||||||
var ev = new PlayerSpawningEvent(job, profile, station);
|
var ev = new PlayerSpawningEvent(job, profile, station);
|
||||||
RaiseLocalEvent(ev);
|
RaiseLocalEvent(ev);
|
||||||
|
|
||||||
DebugTools.Assert(ev.SpawnResult is {Valid: true} or null);
|
DebugTools.Assert(ev.SpawnResult is { Valid: true } or null);
|
||||||
|
|
||||||
return ev.SpawnResult;
|
return ev.SpawnResult;
|
||||||
}
|
}
|
||||||
@@ -146,7 +148,7 @@ public sealed class StationSpawningSystem : EntitySystem
|
|||||||
if (profile != null)
|
if (profile != null)
|
||||||
{
|
{
|
||||||
_humanoidSystem.LoadProfile(entity.Value, profile);
|
_humanoidSystem.LoadProfile(entity.Value, profile);
|
||||||
MetaData(entity.Value).EntityName = profile.Name;
|
_metaSystem.SetEntityName(entity.Value, profile.Name);
|
||||||
if (profile.FlavorText != "" && _configurationManager.GetCVar(CCVars.FlavorText))
|
if (profile.FlavorText != "" && _configurationManager.GetCVar(CCVars.FlavorText))
|
||||||
{
|
{
|
||||||
AddComp<DetailExaminableComponent>(entity.Value).Content = profile.FlavorText;
|
AddComp<DetailExaminableComponent>(entity.Value).Content = profile.FlavorText;
|
||||||
@@ -158,7 +160,7 @@ public sealed class StationSpawningSystem : EntitySystem
|
|||||||
return entity.Value;
|
return entity.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoJobSpecials(Job? job, EntityUid entity)
|
private static void DoJobSpecials(Job? job, EntityUid entity)
|
||||||
{
|
{
|
||||||
foreach (var jobSpecial in job?.Prototype.Special ?? Array.Empty<JobSpecial>())
|
foreach (var jobSpecial in job?.Prototype.Special ?? Array.Empty<JobSpecial>())
|
||||||
{
|
{
|
||||||
@@ -211,11 +213,10 @@ public sealed class StationSpawningSystem : EntitySystem
|
|||||||
if (!_inventorySystem.TryGetSlotEntity(entity, "id", out var idUid))
|
if (!_inventorySystem.TryGetSlotEntity(entity, "id", out var idUid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!EntityManager.TryGetComponent(idUid, out PdaComponent? pdaComponent) || pdaComponent.ContainedId == null)
|
if (!EntityManager.TryGetComponent(idUid, out PdaComponent? pdaComponent) || !TryComp<IdCardComponent>(pdaComponent.ContainedId, out var card))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var card = pdaComponent.ContainedId;
|
var cardId = pdaComponent.ContainedId.Value;
|
||||||
var cardId = card.Owner;
|
|
||||||
_cardSystem.TryChangeFullName(cardId, characterName, card);
|
_cardSystem.TryChangeFullName(cardId, characterName, card);
|
||||||
_cardSystem.TryChangeJobTitle(cardId, jobPrototype.LocalizedName, card);
|
_cardSystem.TryChangeJobTitle(cardId, jobPrototype.LocalizedName, card);
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public sealed class StationRecordsSystem : EntitySystem
|
|||||||
string? jobId, StationRecordsComponent? records = null)
|
string? jobId, StationRecordsComponent? records = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(station, ref records)
|
if (!Resolve(station, ref records)
|
||||||
|| String.IsNullOrEmpty(jobId)
|
|| string.IsNullOrEmpty(jobId)
|
||||||
|| !_prototypeManager.HasIndex<JobPrototype>(jobId))
|
|| !_prototypeManager.HasIndex<JobPrototype>(jobId))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -204,7 +204,7 @@ public sealed class StationRecordsSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
if (!Resolve(station, ref records))
|
if (!Resolve(station, ref records))
|
||||||
{
|
{
|
||||||
return new (StationRecordKey, T)[]{};
|
return Array.Empty<(StationRecordKey, T)>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return records.Records.GetRecordsOfType<T>();
|
return records.Records.GetRecordsOfType<T>();
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace Content.Server.Verbs.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
var verbSystem = EntitySystem.Get<SharedVerbSystem>();
|
var verbSystem = entityManager.System<SharedVerbSystem>();
|
||||||
|
|
||||||
// get the 'player' entity (defaulting to command user, otherwise uses a uid)
|
// get the 'player' entity (defaulting to command user, otherwise uses a uid)
|
||||||
EntityUid? playerEntity = null;
|
EntityUid? playerEntity = null;
|
||||||
|
|||||||
@@ -14,6 +14,6 @@ public sealed class AccessGroupPrototype : IPrototype
|
|||||||
[IdDataField]
|
[IdDataField]
|
||||||
public string ID { get; } = default!;
|
public string ID { get; } = default!;
|
||||||
|
|
||||||
[DataField("tags", required: true, customTypeSerializer:typeof(PrototypeIdHashSetSerializer<AccessLevelPrototype>))]
|
[DataField("tags", required: true, customTypeSerializer: typeof(PrototypeIdHashSetSerializer<AccessLevelPrototype>))]
|
||||||
public HashSet<string> Tags = default!;
|
public HashSet<string> Tags = default!;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using Content.Shared.Access.Systems;
|
|
||||||
using Content.Shared.StationRecords;
|
using Content.Shared.StationRecords;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -59,4 +58,3 @@ public sealed class AccessReaderComponentState : ComponentState
|
|||||||
AccessKeys = accessKeys;
|
AccessKeys = accessKeys;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using Content.Shared.Access.Systems;
|
using Content.Shared.Access.Systems;
|
||||||
using Content.Shared.PDA;
|
using Content.Shared.PDA;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Serialization;
|
|
||||||
|
|
||||||
namespace Content.Shared.Access.Components
|
namespace Content.Shared.Access.Components
|
||||||
{
|
{
|
||||||
@@ -17,8 +16,7 @@ namespace Content.Shared.Access.Components
|
|||||||
|
|
||||||
[DataField("jobTitle")]
|
[DataField("jobTitle")]
|
||||||
[AutoNetworkedField]
|
[AutoNetworkedField]
|
||||||
[Access(typeof(SharedIdCardSystem), typeof(SharedPdaSystem), typeof(SharedAgentIdCardSystem),
|
[Access(typeof(SharedIdCardSystem), typeof(SharedPdaSystem), typeof(SharedAgentIdCardSystem), Other = AccessPermissions.ReadWrite)]
|
||||||
Other = AccessPermissions.ReadWrite)]
|
|
||||||
public string? JobTitle;
|
public string? JobTitle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ namespace Content.Shared.Access.Systems
|
|||||||
public sealed class AgentIDCardJobChangedMessage : BoundUserInterfaceMessage
|
public sealed class AgentIDCardJobChangedMessage : BoundUserInterfaceMessage
|
||||||
{
|
{
|
||||||
public string Job { get; }
|
public string Job { get; }
|
||||||
|
|
||||||
public AgentIDCardJobChangedMessage(string job)
|
public AgentIDCardJobChangedMessage(string job)
|
||||||
{
|
{
|
||||||
Job = job;
|
Job = job;
|
||||||
|
|||||||
@@ -11,18 +11,17 @@ using Content.Shared.Hands.EntitySystems;
|
|||||||
using Content.Shared.StationRecords;
|
using Content.Shared.StationRecords;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
|
|
||||||
namespace Content.Shared.Access.Systems
|
namespace Content.Shared.Access.Systems;
|
||||||
|
|
||||||
|
public sealed class AccessReaderSystem : EntitySystem
|
||||||
{
|
{
|
||||||
public sealed class AccessReaderSystem : EntitySystem
|
|
||||||
{
|
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
||||||
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
||||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeLocalEvent<AccessReaderComponent, ComponentInit>(OnInit);
|
|
||||||
SubscribeLocalEvent<AccessReaderComponent, GotEmaggedEvent>(OnEmagged);
|
SubscribeLocalEvent<AccessReaderComponent, GotEmaggedEvent>(OnEmagged);
|
||||||
SubscribeLocalEvent<AccessReaderComponent, LinkAttemptEvent>(OnLinkAttempt);
|
SubscribeLocalEvent<AccessReaderComponent, LinkAttemptEvent>(OnLinkAttempt);
|
||||||
|
|
||||||
@@ -54,18 +53,6 @@ namespace Content.Shared.Access.Systems
|
|||||||
args.Cancel();
|
args.Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInit(EntityUid uid, AccessReaderComponent reader, ComponentInit args)
|
|
||||||
{
|
|
||||||
var allTags = reader.AccessLists.SelectMany(c => c).Union(reader.DenyTags);
|
|
||||||
foreach (var level in allTags)
|
|
||||||
{
|
|
||||||
if (!_prototypeManager.HasIndex<AccessLevelPrototype>(level))
|
|
||||||
{
|
|
||||||
Logger.ErrorS("access", $"Invalid access level: {level}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnEmagged(EntityUid uid, AccessReaderComponent reader, ref GotEmaggedEvent args)
|
private void OnEmagged(EntityUid uid, AccessReaderComponent reader, ref GotEmaggedEvent args)
|
||||||
{
|
{
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
@@ -257,7 +244,7 @@ namespace Content.Shared.Access.Systems
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (TryComp(uid, out PdaComponent? pda) &&
|
if (TryComp(uid, out PdaComponent? pda) &&
|
||||||
pda.ContainedId?.Owner is {Valid: true} id)
|
pda.ContainedId is { Valid: true } id)
|
||||||
{
|
{
|
||||||
tags = EntityManager.GetComponent<AccessComponent>(id).Tags;
|
tags = EntityManager.GetComponent<AccessComponent>(id).Tags;
|
||||||
return true;
|
return true;
|
||||||
@@ -280,7 +267,7 @@ namespace Content.Shared.Access.Systems
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (TryComp<PdaComponent>(uid, out var pda) &&
|
if (TryComp<PdaComponent>(uid, out var pda) &&
|
||||||
pda.ContainedId?.Owner is {Valid: true} id)
|
pda.ContainedId is { Valid: true } id)
|
||||||
{
|
{
|
||||||
if (TryComp<StationRecordKeyStorageComponent>(id, out var pdastorage) && pdastorage.Key != null)
|
if (TryComp<StationRecordKeyStorageComponent>(id, out var pdastorage) && pdastorage.Key != null)
|
||||||
{
|
{
|
||||||
@@ -292,5 +279,4 @@ namespace Content.Shared.Access.Systems
|
|||||||
key = null;
|
key = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public abstract class SharedIdCardSystem : EntitySystem
|
|||||||
public bool TryFindIdCard(EntityUid uid, [NotNullWhen(true)] out IdCardComponent? idCard)
|
public bool TryFindIdCard(EntityUid uid, [NotNullWhen(true)] out IdCardComponent? idCard)
|
||||||
{
|
{
|
||||||
// check held item?
|
// check held item?
|
||||||
if (EntityManager.TryGetComponent(uid, out HandsComponent? hands) &&
|
if (TryComp(uid, out HandsComponent? hands) &&
|
||||||
hands.ActiveHandEntity is EntityUid heldItem &&
|
hands.ActiveHandEntity is EntityUid heldItem &&
|
||||||
TryGetIdCard(heldItem, out idCard))
|
TryGetIdCard(heldItem, out idCard))
|
||||||
{
|
{
|
||||||
@@ -30,9 +30,7 @@ public abstract class SharedIdCardSystem : EntitySystem
|
|||||||
|
|
||||||
// check inventory slot?
|
// check inventory slot?
|
||||||
if (_inventorySystem.TryGetSlotEntity(uid, "id", out var idUid) && TryGetIdCard(idUid.Value, out idCard))
|
if (_inventorySystem.TryGetSlotEntity(uid, "id", out var idUid) && TryGetIdCard(idUid.Value, out idCard))
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -43,12 +41,12 @@ public abstract class SharedIdCardSystem : EntitySystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool TryGetIdCard(EntityUid uid, [NotNullWhen(true)] out IdCardComponent? idCard)
|
public bool TryGetIdCard(EntityUid uid, [NotNullWhen(true)] out IdCardComponent? idCard)
|
||||||
{
|
{
|
||||||
if (EntityManager.TryGetComponent(uid, out idCard))
|
if (TryComp(uid, out idCard))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (EntityManager.TryGetComponent(uid, out PdaComponent? pda) && pda.ContainedId != null)
|
if (TryComp(uid, out PdaComponent? pda)
|
||||||
|
&& TryComp(pda.ContainedId, out idCard))
|
||||||
{
|
{
|
||||||
idCard = pda.ContainedId;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace Content.Shared.PDA
|
|||||||
[DataField("id", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
[DataField("id", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||||
public string? IdCard;
|
public string? IdCard;
|
||||||
|
|
||||||
[ViewVariables] public IdCardComponent? ContainedId;
|
[ViewVariables] public EntityUid? ContainedId;
|
||||||
[ViewVariables] public bool FlashlightOn;
|
[ViewVariables] public bool FlashlightOn;
|
||||||
|
|
||||||
[ViewVariables] public string? OwnerName;
|
[ViewVariables] public string? OwnerName;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace Content.Shared.PDA
|
|||||||
protected virtual void OnItemInserted(EntityUid uid, PdaComponent pda, EntInsertedIntoContainerMessage args)
|
protected virtual void OnItemInserted(EntityUid uid, PdaComponent pda, EntInsertedIntoContainerMessage args)
|
||||||
{
|
{
|
||||||
if (args.Container.ID == PdaComponent.PdaIdSlotId)
|
if (args.Container.ID == PdaComponent.PdaIdSlotId)
|
||||||
pda.ContainedId = CompOrNull<IdCardComponent>(args.Entity);
|
pda.ContainedId = args.Entity;
|
||||||
|
|
||||||
UpdatePdaAppearance(uid, pda);
|
UpdatePdaAppearance(uid, pda);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user