Id[entity] 2.0 (real) (#9612)
* starter API * network ID cards * Port more stuff from old identity * Re-implement identity representation + name updating * move * proper name returning for `IdentityName` * move everything important to server, give in to temptation * shared / server / client split sadly. move ensure to shared and spawn to server * identity update queueing + identityblocker * fixes * and just like that it's usable for admins * huge identity pass * pass dos * jesus christ * figs :D * fuck u * fix bad merge. Co-authored-by: Moony <moonheart08@users.noreply.github.com>
This commit is contained in:
@@ -83,6 +83,7 @@ namespace Content.Server.Access.Systems
|
||||
jobTitle = jobTitle[..SharedIdCardConsoleComponent.MaxJobTitleLength];
|
||||
|
||||
id.JobTitle = jobTitle;
|
||||
Dirty(id);
|
||||
UpdateEntityName(uid, id);
|
||||
return true;
|
||||
}
|
||||
@@ -96,6 +97,7 @@ namespace Content.Server.Access.Systems
|
||||
fullName = fullName[..SharedIdCardConsoleComponent.MaxFullNameLength];
|
||||
|
||||
id.FullName = fullName;
|
||||
Dirty(id);
|
||||
UpdateEntityName(uid, id);
|
||||
return true;
|
||||
}
|
||||
@@ -129,50 +131,5 @@ namespace Content.Server.Access.Systems
|
||||
("jobSuffix", jobSuffix));
|
||||
EntityManager.GetComponent<MetaDataComponent>(id.Owner).EntityName = val;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to find an ID card on an entity. This will look in the entity itself, in the entity's hands, and
|
||||
/// in the entity's inventory.
|
||||
/// </summary>
|
||||
public bool TryFindIdCard(EntityUid uid, [NotNullWhen(true)] out IdCardComponent? idCard)
|
||||
{
|
||||
// check held item?
|
||||
if (EntityManager.TryGetComponent(uid, out SharedHandsComponent? hands) &&
|
||||
hands.ActiveHandEntity is EntityUid heldItem &&
|
||||
TryGetIdCard(heldItem, out idCard))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// check entity itself
|
||||
if (TryGetIdCard(uid, out idCard))
|
||||
return true;
|
||||
|
||||
// check inventory slot?
|
||||
if (_inventorySystem.TryGetSlotEntity(uid, "id", out var idUid) && TryGetIdCard(idUid.Value, out idCard))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to get an id card component from an entity, either by getting it directly from the entity, or by
|
||||
/// getting the contained id from a <see cref="PDAComponent"/>.
|
||||
/// </summary>
|
||||
public bool TryGetIdCard(EntityUid uid, [NotNullWhen(true)] out IdCardComponent? idCard)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(uid, out idCard))
|
||||
return true;
|
||||
|
||||
if (EntityManager.TryGetComponent(uid, out PDAComponent? pda) && pda.ContainedID != null)
|
||||
{
|
||||
idCard = pda.ContainedID;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user