Genpop wall lockers (#38102)
* sprites * genpop wall lockers * number 5 alive * slight boilerplate code, thank you slarti
This commit is contained in:
@@ -1,14 +1,24 @@
|
||||
using Content.Shared.Security.Components;
|
||||
using Content.Shared.Security.Systems;
|
||||
using Content.Shared.Wall;
|
||||
|
||||
namespace Content.Server.Security;
|
||||
|
||||
public sealed 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 uid = Spawn(ent.Comp.IdCardProto, xform.Coordinates);
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user