Move Access to ECS (#4826)

* Moved access to ecs

* Fixed tests

* Moved test to integration

* Better IoC

* Moved preset ID card

* Moved id card to ECS

* Moved access component to ECS

* Fixed pda access

* Final touches

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Alex Evgrashin
2021-10-22 05:31:07 +03:00
committed by GitHub
parent 430485de06
commit a3f16295ea
26 changed files with 409 additions and 466 deletions

View File

@@ -7,27 +7,11 @@ using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.Access.Components
{
[RegisterComponent]
public class PresetIdCardComponent : Component, IMapInit
public class PresetIdCardComponent : Component
{
public override string Name => "PresetIdCard";
[DataField("job")]
private string? _jobName;
void IMapInit.MapInit()
{
if (_jobName == null)
{
return;
}
var prototypes = IoCManager.Resolve<IPrototypeManager>();
var job = prototypes.Index<JobPrototype>(_jobName);
var access = Owner.GetComponent<AccessComponent>();
var idCard = Owner.GetComponent<IdCardComponent>();
access.SetTags(job.Access);
idCard.JobTitle = job.Name;
}
public readonly string? JobName;
}
}