CatStation/Content.Server/Security/GenpopSystem.cs
DrSmugleaf 65f5f67cd5
Make every EntitySystem partial (#45220)
* Make every EntitySystem partial

* Oobs thats for a diff PR

* Also oops on that one

* Test systems

* git are we fr

* Update file templates

* cleanup empty classes while we are here

* forgor

---------

Co-authored-by: AJCM-git <ajcm_mail@disroot.org>
2026-08-14 18:24:47 +00:00

39 lines
1.7 KiB
C#

using Content.Shared.Security.Components;
using Content.Shared.Security.Systems;
using Content.Shared.Wall;
namespace Content.Server.Security;
public sealed partial class GenpopSystem : SharedGenpopSystem
{
private const float GenpopIDEjectDistanceFromWall = 1f;
protected override void CreateId(Entity<GenpopLockerComponent> ent, string name, float sentence, string crime)
{
// Default to prisoner locker coordinates for ID spawn
var xform = Transform(ent);
var spawnCoordinates = xform.Coordinates;
// Offset prisoner wall locker coordinates in wallmount direction for ID spawn; avoids spawning ID inside wall
if (TryComp<WallMountComponent>(ent, out var wallMountComponent))
{
var offset = (wallMountComponent.Direction + xform.LocalRotation - Math.PI / 2).ToVec() * GenpopIDEjectDistanceFromWall;
spawnCoordinates = spawnCoordinates.Offset(offset);
}
var uid = Spawn(ent.Comp.IdCardProto, spawnCoordinates);
ent.Comp.LinkedId = uid;
IdCard.TryChangeFullName(uid, name);
if (TryComp<GenpopIdCardComponent>(uid, out var id))
{
id.Crime = crime;
id.SentenceDuration = TimeSpan.FromMinutes(sentence);
Dirty(uid, id);
}
if (sentence > 0)
IdCard.SetExpireTime(uid, TimeSpan.FromMinutes(sentence) + Timing.CurTime);
var metaData = MetaData(ent);
MetaDataSystem.SetEntityName(ent, Loc.GetString("genpop-locker-name-used", ("name", name)), metaData);
MetaDataSystem.SetEntityDescription(ent, Loc.GetString("genpop-locker-desc-used", ("name", name)), metaData);
Dirty(ent);
}
}