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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Server.IdentityManagement;
|
||||
using Content.Server.Players;
|
||||
using Content.Server.Roles;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Administration.Events;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Enums;
|
||||
@@ -25,6 +27,7 @@ namespace Content.Server.Administration.Systems
|
||||
|
||||
_playerManager.PlayerStatusChanged += OnPlayerStatusChanged;
|
||||
_adminManager.OnPermsChanged += OnAdminPermsChanged;
|
||||
SubscribeLocalEvent<IdentityChangedEvent>(OnIdentityChanged);
|
||||
SubscribeLocalEvent<PlayerAttachedEvent>(OnPlayerAttached);
|
||||
SubscribeLocalEvent<PlayerDetachedEvent>(OnPlayerDetached);
|
||||
SubscribeLocalEvent<RoleAddedEvent>(OnRoleEvent);
|
||||
@@ -46,6 +49,14 @@ namespace Content.Server.Administration.Systems
|
||||
}
|
||||
}
|
||||
|
||||
private void OnIdentityChanged(IdentityChangedEvent ev)
|
||||
{
|
||||
if (!TryComp<ActorComponent>(ev.CharacterEntity, out var actor))
|
||||
return;
|
||||
|
||||
UpdatePlayerList(actor.PlayerSession);
|
||||
}
|
||||
|
||||
private void OnRoleEvent(RoleEvent ev)
|
||||
{
|
||||
if (!ev.Role.Antagonist || ev.Role.Mind.Session == null)
|
||||
@@ -106,9 +117,13 @@ namespace Content.Server.Administration.Systems
|
||||
{
|
||||
var name = session.Name;
|
||||
var username = string.Empty;
|
||||
var identityName = string.Empty;
|
||||
|
||||
if (session.AttachedEntity != null)
|
||||
{
|
||||
username = EntityManager.GetComponent<MetaDataComponent>(session.AttachedEntity.Value).EntityName;
|
||||
identityName = Identity.Name(session.AttachedEntity.Value, EntityManager);
|
||||
}
|
||||
|
||||
var mind = session.ContentData()?.Mind;
|
||||
|
||||
@@ -119,7 +134,7 @@ namespace Content.Server.Administration.Systems
|
||||
|
||||
var connected = session.Status is SessionStatus.Connected or SessionStatus.InGame;
|
||||
|
||||
return new PlayerInfo(name, username, startingRole, antag, session.AttachedEntity.GetValueOrDefault(), session.UserId,
|
||||
return new PlayerInfo(name, username, identityName, startingRole, antag, session.AttachedEntity.GetValueOrDefault(), session.UserId,
|
||||
connected);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Chemistry.EntitySystems;
|
||||
using Content.Server.DoAfter;
|
||||
using Content.Server.Nutrition.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Verbs;
|
||||
@@ -110,7 +111,7 @@ namespace Content.Server.Animals.Systems
|
||||
var split = _solutionContainerSystem.SplitSolution(uid, solution, quantity);
|
||||
_solutionContainerSystem.TryAddSolution(ev.ContainerUid, targetSolution, split);
|
||||
|
||||
_popupSystem.PopupEntity(Loc.GetString("udder-system-success", ("amount", quantity), ("target", ev.ContainerUid)), uid,
|
||||
_popupSystem.PopupEntity(Loc.GetString("udder-system-success", ("amount", quantity), ("target", Identity.Entity(ev.ContainerUid, EntityManager))), uid,
|
||||
Filter.Entities(ev.UserUid), PopupType.Medium);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ using Content.Server.Cooldown;
|
||||
using Content.Server.Bible.Components;
|
||||
using Content.Server.MobState;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Audio;
|
||||
@@ -121,10 +122,10 @@ namespace Content.Server.Bible
|
||||
{
|
||||
if (_random.Prob(component.FailChance))
|
||||
{
|
||||
var othersFailMessage = Loc.GetString(component.LocPrefix + "-heal-fail-others", ("user", args.User),("target", args.Target),("bible", uid));
|
||||
var othersFailMessage = Loc.GetString(component.LocPrefix + "-heal-fail-others", ("user", Identity.Entity(args.User, EntityManager)),("target", Identity.Entity(args.Target.Value, EntityManager)),("bible", uid));
|
||||
_popupSystem.PopupEntity(othersFailMessage, args.User, Filter.PvsExcept(args.User), PopupType.SmallCaution);
|
||||
|
||||
var selfFailMessage = Loc.GetString(component.LocPrefix + "-heal-fail-self", ("target", args.Target),("bible", uid));
|
||||
var selfFailMessage = Loc.GetString(component.LocPrefix + "-heal-fail-self", ("target", Identity.Entity(args.Target.Value, EntityManager)),("bible", uid));
|
||||
_popupSystem.PopupEntity(selfFailMessage, args.User, Filter.Entities(args.User), PopupType.MediumCaution);
|
||||
|
||||
SoundSystem.Play("/Audio/Effects/hit_kick.ogg", Filter.Pvs(args.Target.Value), args.User);
|
||||
@@ -133,10 +134,10 @@ namespace Content.Server.Bible
|
||||
}
|
||||
}
|
||||
|
||||
var othersMessage = Loc.GetString(component.LocPrefix + "-heal-success-others", ("user", args.User),("target", args.Target),("bible", uid));
|
||||
var othersMessage = Loc.GetString(component.LocPrefix + "-heal-success-others", ("user", Identity.Entity(args.User, EntityManager)),("target", Identity.Entity(args.Target.Value, EntityManager)),("bible", uid));
|
||||
_popupSystem.PopupEntity(othersMessage, args.User, Filter.PvsExcept(args.User), PopupType.Medium);
|
||||
|
||||
var selfMessage = Loc.GetString(component.LocPrefix + "-heal-success-self", ("target", args.Target),("bible", uid));
|
||||
var selfMessage = Loc.GetString(component.LocPrefix + "-heal-success-self", ("target", Identity.Entity(args.Target.Value, EntityManager)),("bible", uid));
|
||||
_popupSystem.PopupEntity(selfMessage, args.User, Filter.Entities(args.User), PopupType.Large);
|
||||
|
||||
SoundSystem.Play(component.HealSoundPath.GetSound(), Filter.Pvs(args.Target.Value), args.User);
|
||||
|
||||
@@ -9,6 +9,7 @@ using Content.Shared.Chemistry.Reaction;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Audio;
|
||||
@@ -174,18 +175,18 @@ public sealed class BloodstreamSystem : EntitySystem
|
||||
if (component.BleedAmount > 10)
|
||||
{
|
||||
args.Message.PushNewline();
|
||||
args.Message.AddMarkup(Loc.GetString("bloodstream-component-profusely-bleeding", ("target", uid)));
|
||||
args.Message.AddMarkup(Loc.GetString("bloodstream-component-profusely-bleeding", ("target", Identity.Entity(uid, EntityManager))));
|
||||
}
|
||||
else if (component.BleedAmount > 0)
|
||||
{
|
||||
args.Message.PushNewline();
|
||||
args.Message.AddMarkup(Loc.GetString("bloodstream-component-bleeding", ("target", uid)));
|
||||
args.Message.AddMarkup(Loc.GetString("bloodstream-component-bleeding", ("target", Identity.Entity(uid, EntityManager))));
|
||||
}
|
||||
|
||||
if (GetBloodLevelPercentage(uid, component) < component.BloodlossThreshold)
|
||||
{
|
||||
args.Message.PushNewline();
|
||||
args.Message.AddMarkup(Loc.GetString("bloodstream-component-looks-pale", ("target", uid)));
|
||||
args.Message.AddMarkup(Loc.GetString("bloodstream-component-looks-pale", ("target", Identity.Entity(uid, EntityManager))));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using Content.Server.Popups;
|
||||
using Content.Server.Preferences.Managers;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.CharacterAppearance.Systems;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Species;
|
||||
using Content.Shared.Verbs;
|
||||
@@ -176,7 +177,7 @@ namespace Content.Server.Body.Systems
|
||||
EntityManager.DeleteEntity(entity);
|
||||
}
|
||||
|
||||
_popupSystem.PopupEntity(Loc.GetString("reassemble-success", ("user", mob)), mob, Filter.Entities(mob));
|
||||
_popupSystem.PopupEntity(Loc.GetString("reassemble-success", ("user", Identity.Entity(mob, EntityManager))), mob, Filter.Entities(mob));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -8,6 +8,7 @@ using Content.Shared.Examine;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Robust.Shared.Player;
|
||||
@@ -241,7 +242,7 @@ namespace Content.Server.Botany.Systems
|
||||
("owner", uid),
|
||||
("usingItem", args.Used)), Filter.Entities(args.User), PopupType.Medium);
|
||||
_popupSystem.PopupEntity(Loc.GetString("plant-holder-component-compost-others-message",
|
||||
("user", args.User),
|
||||
("user", Identity.Entity(args.User, EntityManager)),
|
||||
("usingItem", args.Used),
|
||||
("owner", uid)), uid, Filter.PvsExcept(args.User));
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Server.Weapon.Melee;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Sound;
|
||||
@@ -66,7 +67,7 @@ namespace Content.Server.Chemistry.Components
|
||||
if (!solutionsSys.TryGetInjectableSolution(target.Value, out var targetSolution))
|
||||
{
|
||||
user.PopupMessage(user,
|
||||
Loc.GetString("hypospray-cant-inject", ("target", target)));
|
||||
Loc.GetString("hypospray-cant-inject", ("target", Identity.Entity(target.Value, _entMan))));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.MobState.Components;
|
||||
@@ -63,7 +64,7 @@ public sealed partial class ChemistrySystem
|
||||
else
|
||||
{
|
||||
_popup.PopupEntity(Loc.GetString("injector-component-cannot-transfer-message",
|
||||
("target", target)), component.Owner, Filter.Entities(user));
|
||||
("target", Identity.Entity(target, EntityManager))), component.Owner, Filter.Entities(user));
|
||||
}
|
||||
}
|
||||
else if (component.ToggleState == SharedInjectorComponent.InjectorToggleMode.Draw)
|
||||
@@ -82,7 +83,7 @@ public sealed partial class ChemistrySystem
|
||||
else
|
||||
{
|
||||
_popup.PopupEntity(Loc.GetString("injector-component-cannot-draw-message",
|
||||
("target", target)), component.Owner, Filter.Entities(user));
|
||||
("target", Identity.Entity(target, EntityManager))), component.Owner, Filter.Entities(user));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -194,7 +195,7 @@ public sealed partial class ChemistrySystem
|
||||
if (user != target)
|
||||
{
|
||||
// Create a pop-up for the target
|
||||
var userName = MetaData(user).EntityName;
|
||||
var userName = Identity.Name(user, EntityManager);
|
||||
_popup.PopupEntity(Loc.GetString("injector-component-injecting-target",
|
||||
("user", userName)), user, Filter.Entities(target));
|
||||
|
||||
@@ -256,7 +257,7 @@ public sealed partial class ChemistrySystem
|
||||
|
||||
if (realTransferAmount <= 0)
|
||||
{
|
||||
_popup.PopupEntity(Loc.GetString("injector-component-cannot-inject-message", ("target", targetBloodstream.Owner)),
|
||||
_popup.PopupEntity(Loc.GetString("injector-component-cannot-inject-message", ("target", Identity.Entity(targetBloodstream.Owner, EntityManager))),
|
||||
component.Owner, Filter.Entities(user));
|
||||
return;
|
||||
}
|
||||
@@ -270,7 +271,7 @@ public sealed partial class ChemistrySystem
|
||||
|
||||
_popup.PopupEntity(Loc.GetString("injector-component-inject-success-message",
|
||||
("amount", removedSolution.TotalVolume),
|
||||
("target", targetBloodstream.Owner)), component.Owner, Filter.Entities(user));
|
||||
("target", Identity.Entity(targetBloodstream.Owner, EntityManager))), component.Owner, Filter.Entities(user));
|
||||
|
||||
Dirty(component);
|
||||
AfterInject(component);
|
||||
@@ -289,7 +290,7 @@ public sealed partial class ChemistrySystem
|
||||
|
||||
if (realTransferAmount <= 0)
|
||||
{
|
||||
_popup.PopupEntity(Loc.GetString("injector-component-target-already-full-message", ("target", targetEntity)),
|
||||
_popup.PopupEntity(Loc.GetString("injector-component-target-already-full-message", ("target", Identity.Entity(targetEntity, EntityManager))),
|
||||
component.Owner, Filter.Entities(user));
|
||||
return;
|
||||
}
|
||||
@@ -310,7 +311,7 @@ public sealed partial class ChemistrySystem
|
||||
|
||||
_popup.PopupEntity(Loc.GetString("injector-component-transfer-success-message",
|
||||
("amount", removedSolution.TotalVolume),
|
||||
("target", targetEntity)), component.Owner, Filter.Entities(user));
|
||||
("target", Identity.Entity(targetEntity, EntityManager))), component.Owner, Filter.Entities(user));
|
||||
|
||||
Dirty(component);
|
||||
AfterInject(component);
|
||||
@@ -349,7 +350,7 @@ public sealed partial class ChemistrySystem
|
||||
|
||||
if (realTransferAmount <= 0)
|
||||
{
|
||||
_popup.PopupEntity(Loc.GetString("injector-component-target-is-empty-message", ("target", targetEntity)),
|
||||
_popup.PopupEntity(Loc.GetString("injector-component-target-is-empty-message", ("target", Identity.Entity(targetEntity, EntityManager))),
|
||||
component.Owner, Filter.Entities(user));
|
||||
return;
|
||||
}
|
||||
@@ -371,7 +372,7 @@ public sealed partial class ChemistrySystem
|
||||
|
||||
_popup.PopupEntity(Loc.GetString("injector-component-draw-success-message",
|
||||
("amount", removedSolution.TotalVolume),
|
||||
("target", targetEntity)), component.Owner, Filter.Entities(user));
|
||||
("target", Identity.Entity(targetEntity, EntityManager))), component.Owner, Filter.Entities(user));
|
||||
|
||||
Dirty(component);
|
||||
AfterDraw(component);
|
||||
@@ -395,7 +396,7 @@ public sealed partial class ChemistrySystem
|
||||
|
||||
_popup.PopupEntity(Loc.GetString("injector-component-draw-success-message",
|
||||
("amount", drawAmount),
|
||||
("target", target)), component.Owner, Filter.Entities(user));
|
||||
("target", Identity.Entity(target, EntityManager))), component.Owner, Filter.Entities(user));
|
||||
|
||||
Dirty(component);
|
||||
AfterDraw(component);
|
||||
|
||||
@@ -10,6 +10,7 @@ using Content.Shared.Climbing;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Popups;
|
||||
@@ -138,7 +139,7 @@ public sealed class ClimbSystem : SharedClimbSystem
|
||||
return;
|
||||
if (user == uid)
|
||||
{
|
||||
var othersMessage = Loc.GetString("comp-climbable-user-climbs-other", ("user", uid),
|
||||
var othersMessage = Loc.GetString("comp-climbable-user-climbs-other", ("user", Identity.Entity(uid, EntityManager)),
|
||||
("climbable", climbable));
|
||||
uid.PopupMessageOtherClients(othersMessage);
|
||||
|
||||
@@ -147,11 +148,11 @@ public sealed class ClimbSystem : SharedClimbSystem
|
||||
}
|
||||
else
|
||||
{
|
||||
var othersMessage = Loc.GetString("comp-climbable-user-climbs-force-other", ("user", user),
|
||||
("moved-user", uid), ("climbable", climbable));
|
||||
var othersMessage = Loc.GetString("comp-climbable-user-climbs-force-other", ("user", Identity.Entity(user, EntityManager)),
|
||||
("moved-user", Identity.Entity(uid, EntityManager)), ("climbable", climbable));
|
||||
user.PopupMessageOtherClients(othersMessage);
|
||||
|
||||
var selfMessage = Loc.GetString("comp-climbable-user-climbs-force", ("moved-user", uid),
|
||||
var selfMessage = Loc.GetString("comp-climbable-user-climbs-force", ("moved-user", Identity.Entity(uid, EntityManager)),
|
||||
("climbable", climbable));
|
||||
user.PopupMessage(selfMessage);
|
||||
}
|
||||
@@ -428,4 +429,4 @@ public sealed class StartClimbEvent : EntityEventArgs
|
||||
{
|
||||
Climbable = climbable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ using Content.Shared.Audio;
|
||||
using Content.Shared.CombatMode;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Stunnable;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
@@ -81,14 +82,12 @@ namespace Content.Server.CombatMode
|
||||
{
|
||||
SoundSystem.Play(component.DisarmFailSound.GetSound(), Filter.Pvs(args.Performer), args.Performer, AudioHelpers.WithVariation(0.025f));
|
||||
|
||||
var targetName = Name(args.Target);
|
||||
|
||||
var msgOther = Loc.GetString(
|
||||
"disarm-action-popup-message-other-clients",
|
||||
("performerName", Name(args.Performer)),
|
||||
("targetName", targetName));
|
||||
("performerName", Identity.Entity(args.Performer, EntityManager)),
|
||||
("targetName", Identity.Entity(args.Target, EntityManager)));
|
||||
|
||||
var msgUser = Loc.GetString("disarm-action-popup-message-cursor", ("targetName", targetName ));
|
||||
var msgUser = Loc.GetString("disarm-action-popup-message-cursor", ("targetName", Identity.Entity(args.Target, EntityManager)));
|
||||
|
||||
_popupSystem.PopupEntity(msgOther, args.Performer, filterOther);
|
||||
_popupSystem.PopupEntity(msgUser, args.Performer, Filter.Entities(args.Performer));
|
||||
|
||||
@@ -17,6 +17,7 @@ using Robust.Shared.Audio;
|
||||
using Robust.Shared.Utility;
|
||||
using Content.Shared.Tools.Components;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Shared.IdentityManagement;
|
||||
|
||||
namespace Content.Server.Disease
|
||||
{
|
||||
@@ -120,7 +121,7 @@ namespace Content.Server.Disease
|
||||
EntityManager.TryGetComponent<IngestionBlockerComponent>(maskUid, out var blocker) &&
|
||||
blocker.Enabled)
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString("swab-mask-blocked", ("target", args.Target), ("mask", maskUid)), args.User, Filter.Entities(args.User));
|
||||
_popupSystem.PopupEntity(Loc.GetString("swab-mask-blocked", ("target", Identity.Entity(args.Target.Value, EntityManager)), ("mask", maskUid)), args.User, Filter.Entities(args.User));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -320,7 +321,7 @@ namespace Content.Server.Disease
|
||||
return;
|
||||
|
||||
args.Swab.Used = true;
|
||||
_popupSystem.PopupEntity(Loc.GetString("swab-swabbed", ("target", args.Target)), args.Target.Value, Filter.Entities(args.User));
|
||||
_popupSystem.PopupEntity(Loc.GetString("swab-swabbed", ("target", Identity.Entity(args.Target.Value, EntityManager))), args.Target.Value, Filter.Entities(args.User));
|
||||
|
||||
if (args.Swab.Disease != null || args.Carrier.Diseases.Count == 0)
|
||||
return;
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Emag.Components;
|
||||
using Content.Shared.Emag.Systems;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Tag;
|
||||
@@ -65,7 +66,7 @@ namespace Content.Server.Emag
|
||||
RaiseLocalEvent(args.Target.Value, emaggedEvent, false);
|
||||
if (emaggedEvent.Handled)
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString("emag-success", ("target", args.Target)), args.User,
|
||||
_popupSystem.PopupEntity(Loc.GetString("emag-success", ("target", Identity.Entity(args.Target.Value, EntityManager))), args.User,
|
||||
Filter.Entities(args.User), PopupType.Medium);
|
||||
_adminLogger.Add(LogType.Emag, LogImpact.High, $"{ToPrettyString(args.User):player} emagged {ToPrettyString(args.Target.Value):target}");
|
||||
component.Charges--;
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Stunnable;
|
||||
using Content.Server.Weapon.Melee;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Flash;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Inventory;
|
||||
@@ -130,7 +131,7 @@ namespace Content.Server.Flash
|
||||
if (displayPopup && user != null && target != user && EntityManager.EntityExists(user.Value))
|
||||
{
|
||||
user.Value.PopupMessage(target, Loc.GetString("flash-component-user-blinds-you",
|
||||
("user", user.Value)));
|
||||
("user", Identity.Entity(user.Value, EntityManager))));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Server.DoAfter;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Forensics
|
||||
@@ -59,7 +60,7 @@ namespace Content.Server.Forensics
|
||||
|
||||
if (_inventory.TryGetSlotEntity(args.Target.Value, "gloves", out var gloves))
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString("forensic-pad-gloves", ("target", args.Target.Value)), args.Target.Value, Filter.Entities(args.User));
|
||||
_popupSystem.PopupEntity(Loc.GetString("forensic-pad-gloves", ("target", Identity.Entity(args.Target.Value, EntityManager))), args.Target.Value, Filter.Entities(args.User));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -67,8 +68,8 @@ namespace Content.Server.Forensics
|
||||
{
|
||||
if (args.User != args.Target)
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString("forensic-pad-start-scan-user", ("target", args.Target.Value)), args.Target.Value, Filter.Entities(args.User));
|
||||
_popupSystem.PopupEntity(Loc.GetString("forensic-pad-start-scan-target", ("user", args.User)), args.Target.Value, Filter.Entities(args.Target.Value));
|
||||
_popupSystem.PopupEntity(Loc.GetString("forensic-pad-start-scan-user", ("target", Identity.Entity(args.Target.Value, EntityManager))), args.Target.Value, Filter.Entities(args.User));
|
||||
_popupSystem.PopupEntity(Loc.GetString("forensic-pad-start-scan-target", ("user", Identity.Entity(args.User, EntityManager))), args.Target.Value, Filter.Entities(args.Target.Value));
|
||||
}
|
||||
StartScan(args.User, args.Target.Value, component, fingerprint.Fingerprint);
|
||||
return;
|
||||
|
||||
@@ -13,6 +13,7 @@ using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Physics.Pull;
|
||||
@@ -92,10 +93,10 @@ namespace Content.Server.Hands.Systems
|
||||
if (!_handsSystem.TryDrop(uid, component.ActiveHand!, null, checkActionBlocker: false))
|
||||
return;
|
||||
|
||||
var targetName = Name(args.Target);
|
||||
|
||||
var msgOther = Loc.GetString("hands-component-disarm-success-others-message", ("disarmer", Name(args.Source)), ("disarmed", targetName));
|
||||
var msgUser = Loc.GetString("hands-component-disarm-success-message", ("disarmed", targetName));
|
||||
var targEnt = Identity.Entity(args.Target, EntityManager);
|
||||
var msgOther = Loc.GetString("hands-component-disarm-success-others-message",
|
||||
("disarmer", Identity.Entity(args.Source, EntityManager)), ("disarmed", targEnt));
|
||||
var msgUser = Loc.GetString("hands-component-disarm-success-message", ("disarmed", targEnt));
|
||||
|
||||
var filter = Filter.Pvs(args.Source).RemoveWhereAttachedEntity(e => e == args.Source);
|
||||
_popupSystem.PopupEntity(msgOther, args.Source, filter);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -60,7 +61,7 @@ public sealed class HealthExaminableSystem : EntitySystem
|
||||
foreach (var threshold in component.Thresholds)
|
||||
{
|
||||
var str = $"health-examinable-{component.LocPrefix}-{type}-{threshold}";
|
||||
var tempLocStr = Loc.GetString($"health-examinable-{component.LocPrefix}-{type}-{threshold}", ("target", uid));
|
||||
var tempLocStr = Loc.GetString($"health-examinable-{component.LocPrefix}-{type}-{threshold}", ("target", Identity.Entity(uid, EntityManager)));
|
||||
|
||||
// i.e., this string doesn't exist, because theres nothing for that threshold
|
||||
if (tempLocStr == str)
|
||||
|
||||
163
Content.Server/IdentityManagement/IdentitySystem.cs
Normal file
163
Content.Server/IdentityManagement/IdentitySystem.cs
Normal file
@@ -0,0 +1,163 @@
|
||||
using Content.Server.Access.Systems;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Shared.CharacterAppearance.Components;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.IdentityManagement.Components;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Content.Shared.Preferences;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.GameObjects.Components.Localization;
|
||||
|
||||
namespace Content.Server.IdentityManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Responsible for updating the identity of an entity on init or clothing equip/unequip.
|
||||
/// </summary>
|
||||
public class IdentitySystem : SharedIdentitySystem
|
||||
{
|
||||
[Dependency] private readonly IdCardSystem _idCard = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLog = default!;
|
||||
|
||||
private Queue<EntityUid> _queuedIdentityUpdates = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<IdentityComponent, DidEquipEvent>((uid, _, _) => QueueIdentityUpdate(uid));
|
||||
SubscribeLocalEvent<IdentityComponent, DidEquipHandEvent>((uid, _, _) => QueueIdentityUpdate(uid));
|
||||
SubscribeLocalEvent<IdentityComponent, DidUnequipEvent>((uid, _, _) => QueueIdentityUpdate(uid));
|
||||
SubscribeLocalEvent<IdentityComponent, DidUnequipHandEvent>((uid, _, _) => QueueIdentityUpdate(uid));
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
while (_queuedIdentityUpdates.TryDequeue(out var ent))
|
||||
{
|
||||
if (!TryComp<IdentityComponent>(ent, out var identity))
|
||||
continue;
|
||||
|
||||
UpdateIdentityInfo(ent, identity);
|
||||
}
|
||||
}
|
||||
|
||||
// This is where the magic happens
|
||||
protected override void OnComponentInit(EntityUid uid, IdentityComponent component, ComponentInit args)
|
||||
{
|
||||
base.OnComponentInit(uid, component, args);
|
||||
|
||||
var ident = Spawn(null, Transform(uid).Coordinates);
|
||||
|
||||
QueueIdentityUpdate(uid);
|
||||
component.IdentityEntitySlot.Insert(ident);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Queues an identity update to the start of the next tick.
|
||||
/// </summary>
|
||||
public void QueueIdentityUpdate(EntityUid uid)
|
||||
{
|
||||
_queuedIdentityUpdates.Enqueue(uid);
|
||||
}
|
||||
|
||||
#region Private API
|
||||
|
||||
/// <summary>
|
||||
/// Updates the metadata name for the id(entity) from the current state of the character.
|
||||
/// </summary>
|
||||
private void UpdateIdentityInfo(EntityUid uid, IdentityComponent identity)
|
||||
{
|
||||
if (identity.IdentityEntitySlot.ContainedEntity is not { } ident)
|
||||
return;
|
||||
|
||||
var representation = GetIdentityRepresentation(uid);
|
||||
var name = GetIdentityName(uid, representation);
|
||||
|
||||
// Clone the old entity's grammar to the identity entity, for loc purposes.
|
||||
if (TryComp<GrammarComponent>(uid, out var grammar))
|
||||
{
|
||||
var identityGrammar = EnsureComp<GrammarComponent>(ident);
|
||||
identityGrammar.Attributes.Clear();
|
||||
|
||||
foreach (var (k, v) in grammar.Attributes)
|
||||
{
|
||||
identityGrammar.Attributes.Add(k, v);
|
||||
}
|
||||
|
||||
// If presumed name is null and we're using that, we set proper noun to be false ("the old woman")
|
||||
if (name != representation.TrueName && representation.PresumedName == null)
|
||||
identityGrammar.ProperNoun = false;
|
||||
}
|
||||
|
||||
if (name == Name(ident))
|
||||
return;
|
||||
|
||||
MetaData(ident).EntityName = name;
|
||||
|
||||
_adminLog.Add(LogType.Identity, LogImpact.Medium, $"{ToPrettyString(uid)} changed identity to {name}");
|
||||
RaiseLocalEvent(new IdentityChangedEvent(uid, ident));
|
||||
}
|
||||
|
||||
private string GetIdentityName(EntityUid target, IdentityRepresentation representation)
|
||||
{
|
||||
var ev = new SeeIdentityAttemptEvent();
|
||||
|
||||
RaiseLocalEvent(target, ev);
|
||||
return representation.ToStringKnown(!ev.Cancelled);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an 'identity representation' of an entity, with their true name being the entity name
|
||||
/// and their 'presumed name' and 'presumed job' being the name/job on their ID card, if they have one.
|
||||
/// </summary>
|
||||
private IdentityRepresentation GetIdentityRepresentation(EntityUid target,
|
||||
InventoryComponent? inventory=null,
|
||||
HumanoidAppearanceComponent? appearance=null)
|
||||
{
|
||||
int age = HumanoidCharacterProfile.MinimumAge;
|
||||
Gender gender = Gender.Neuter;
|
||||
|
||||
// Always use their actual age and gender, since that can't really be changed by an ID.
|
||||
if (Resolve(target, ref appearance, false))
|
||||
{
|
||||
gender = appearance.Gender;
|
||||
age = appearance.Age;
|
||||
}
|
||||
|
||||
var trueName = Name(target);
|
||||
if (!Resolve(target, ref inventory, false))
|
||||
return new(trueName, age, gender, string.Empty);
|
||||
|
||||
string? presumedJob = null;
|
||||
string? presumedName = null;
|
||||
|
||||
// Get their name and job from their ID for their presumed name.
|
||||
if (_idCard.TryFindIdCard(target, out var id))
|
||||
{
|
||||
presumedName = id.FullName;
|
||||
presumedJob = id.JobTitle?.ToLowerInvariant();
|
||||
}
|
||||
|
||||
// If it didn't find a job, that's fine.
|
||||
return new(trueName, age, gender, presumedName, presumedJob);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public sealed class IdentityChangedEvent : EntityEventArgs
|
||||
{
|
||||
public EntityUid CharacterEntity;
|
||||
public EntityUid IdentityEntity;
|
||||
|
||||
public IdentityChangedEvent(EntityUid characterEntity, EntityUid identityEntity)
|
||||
{
|
||||
CharacterEntity = characterEntity;
|
||||
IdentityEntity = identityEntity;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Interaction.Components;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Robust.Shared.Audio;
|
||||
@@ -42,7 +43,7 @@ public sealed class InteractionPopupSystem : EntitySystem
|
||||
if (_random.Prob(component.SuccessChance))
|
||||
{
|
||||
if (component.InteractSuccessString != null)
|
||||
msg = Loc.GetString(component.InteractSuccessString, ("target", uid)); // Success message (localized).
|
||||
msg = Loc.GetString(component.InteractSuccessString, ("target", Identity.Entity(uid, EntityManager))); // Success message (localized).
|
||||
|
||||
if (component.InteractSuccessSound != null)
|
||||
sfx = component.InteractSuccessSound.GetSound();
|
||||
@@ -50,7 +51,7 @@ public sealed class InteractionPopupSystem : EntitySystem
|
||||
else
|
||||
{
|
||||
if (component.InteractFailureString != null)
|
||||
msg = Loc.GetString(component.InteractFailureString, ("target", uid)); // Failure message (localized).
|
||||
msg = Loc.GetString(component.InteractFailureString, ("target", Identity.Entity(uid, EntityManager))); // Failure message (localized).
|
||||
|
||||
if (component.InteractFailureSound != null)
|
||||
sfx = component.InteractFailureSound.GetSound();
|
||||
@@ -58,7 +59,8 @@ public sealed class InteractionPopupSystem : EntitySystem
|
||||
|
||||
if (component.MessagePerceivedByOthers != null)
|
||||
{
|
||||
string msgOthers = Loc.GetString(component.MessagePerceivedByOthers,("user", args.User), ("target", uid));
|
||||
string msgOthers = Loc.GetString(component.MessagePerceivedByOthers,
|
||||
("user", Identity.Entity(args.User, EntityManager)), ("target", Identity.Entity(uid, EntityManager)));
|
||||
_popupSystem.PopupEntity(msg, uid, Filter.Entities(args.User));
|
||||
_popupSystem.PopupEntity(msgOthers, uid, Filter.Pvs(uid, 2F, EntityManager).RemoveWhereAttachedEntity(puid => puid == args.User));
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Server.Popups;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
@@ -123,7 +124,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
|
||||
UpdateAppearance(uid, null, component);
|
||||
|
||||
_popupSystem.PopupEntity(Loc.GetString("comp-kitchen-spike-kill", ("user", userUid), ("victim", victimUid)), uid,
|
||||
_popupSystem.PopupEntity(Loc.GetString("comp-kitchen-spike-kill", ("user", Identity.Entity(userUid, EntityManager)), ("victim", victimUid)), uid,
|
||||
Filter.Pvs(userUid), PopupType.LargeCaution);
|
||||
|
||||
// THE WHAT?
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Medical.Components;
|
||||
using Content.Server.Disease;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -83,7 +84,7 @@ namespace Content.Server.Medical
|
||||
args.User, Filter.Entities(args.User));
|
||||
return;
|
||||
}
|
||||
_popupSystem.PopupEntity(Loc.GetString("disease-scanner-gave-other", ("target", args.Target), ("disease", args.Component.Disease)),
|
||||
_popupSystem.PopupEntity(Loc.GetString("disease-scanner-gave-other", ("target", Identity.Entity(args.Target.Value, EntityManager)), ("disease", args.Component.Disease)),
|
||||
args.User, Filter.Entities(args.User));
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.MobState.Components;
|
||||
@@ -249,8 +250,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
|
||||
if (forceDrink)
|
||||
{
|
||||
EntityManager.TryGetComponent(user, out MetaDataComponent? meta);
|
||||
var userName = meta?.EntityName ?? string.Empty;
|
||||
var userName = Identity.Name(user, EntityManager);
|
||||
|
||||
_popupSystem.PopupEntity(Loc.GetString("drink-component-force-feed", ("user", userName)),
|
||||
user, Filter.Entities(target));
|
||||
@@ -334,11 +334,8 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
|
||||
if (forceDrink)
|
||||
{
|
||||
EntityManager.TryGetComponent(uid, out MetaDataComponent? targetMeta);
|
||||
var targetName = targetMeta?.EntityName ?? string.Empty;
|
||||
|
||||
EntityManager.TryGetComponent(args.User, out MetaDataComponent? userMeta);
|
||||
var userName = userMeta?.EntityName ?? string.Empty;
|
||||
var targetName = Identity.Name(uid, EntityManager);
|
||||
var userName = Identity.Name(args.User, EntityManager);
|
||||
|
||||
_popupSystem.PopupEntity(
|
||||
Loc.GetString("drink-component-force-feed-success", ("user", userName)), uid, Filter.Entities(uid));
|
||||
|
||||
@@ -19,6 +19,7 @@ using Robust.Shared.Player;
|
||||
using Robust.Shared.Utility;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Interaction.Events;
|
||||
|
||||
namespace Content.Server.Nutrition.EntitySystems
|
||||
@@ -114,9 +115,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
|
||||
if (forceFeed)
|
||||
{
|
||||
EntityManager.TryGetComponent(user, out MetaDataComponent? meta);
|
||||
var userName = meta?.EntityName ?? string.Empty;
|
||||
|
||||
var userName = Identity.Name(user, EntityManager);
|
||||
_popupSystem.PopupEntity(Loc.GetString("food-system-force-feed", ("user", userName)),
|
||||
user, Filter.Entities(target));
|
||||
|
||||
@@ -180,12 +179,8 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
|
||||
if (forceFeed)
|
||||
{
|
||||
EntityManager.TryGetComponent(uid, out MetaDataComponent? targetMeta);
|
||||
var targetName = targetMeta?.EntityName ?? string.Empty;
|
||||
|
||||
EntityManager.TryGetComponent(args.User, out MetaDataComponent? userMeta);
|
||||
var userName = userMeta?.EntityName ?? string.Empty;
|
||||
|
||||
var targetName = Identity.Name(uid, EntityManager);
|
||||
var userName = Identity.Name(args.User, EntityManager);
|
||||
_popupSystem.PopupEntity(Loc.GetString("food-system-force-feed-success", ("user", userName)),
|
||||
uid, Filter.Entities(uid));
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Server.GameObjects;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
using static Content.Shared.Paper.SharedPaperComponent;
|
||||
@@ -89,9 +90,9 @@ namespace Content.Server.Paper
|
||||
if (TryComp<StampComponent>(args.Used, out var stampComp) && TryStamp(uid, stampComp.StampedName, stampComp.StampState, paperComp))
|
||||
{
|
||||
// successfully stamped, play popup
|
||||
var stampPaperOtherMessage = Loc.GetString("paper-component-action-stamp-paper-other", ("user", args.User),("target", args.Target),("stamp", args.Used));
|
||||
var stampPaperOtherMessage = Loc.GetString("paper-component-action-stamp-paper-other", ("user", Identity.Entity(args.User, EntityManager)),("target", Identity.Entity(args.Target, EntityManager)),("stamp", args.Used));
|
||||
_popupSystem.PopupEntity(stampPaperOtherMessage, args.User, Filter.Pvs(args.User, entityManager: EntityManager).RemoveWhereAttachedEntity(puid => puid == args.User));
|
||||
var stampPaperSelfMessage = Loc.GetString("paper-component-action-stamp-paper-self", ("target", args.Target),("stamp", args.Used));
|
||||
var stampPaperSelfMessage = Loc.GetString("paper-component-action-stamp-paper-self", ("target", Identity.Entity(args.Target, EntityManager)),("stamp", args.Used));
|
||||
_popupSystem.PopupEntity(stampPaperSelfMessage, args.User, Filter.Entities(args.User));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Ghost.Components;
|
||||
using Content.Server.Players;
|
||||
using Content.Server.Pointing.Components;
|
||||
using Content.Server.Visible;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
@@ -155,11 +156,11 @@ namespace Content.Server.Pointing.EntitySystems
|
||||
string selfMessage;
|
||||
string viewerMessage;
|
||||
string? viewerPointedAtMessage = null;
|
||||
var playerName = Name(player);
|
||||
var playerName = Identity.Entity(player, EntityManager);
|
||||
|
||||
if (Exists(pointed))
|
||||
{
|
||||
var pointedName = Name(pointed);
|
||||
var pointedName = Identity.Entity(pointed, EntityManager);
|
||||
|
||||
selfMessage = player == pointed
|
||||
? Loc.GetString("pointing-system-point-at-self")
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.CharacterAppearance.Systems;
|
||||
using Content.Server.DetailExaminable;
|
||||
using Content.Server.Hands.Components;
|
||||
using Content.Server.Hands.Systems;
|
||||
using Content.Server.IdentityManagement;
|
||||
using Content.Server.PDA;
|
||||
using Content.Server.Roles;
|
||||
using Content.Server.Station.Components;
|
||||
@@ -38,6 +39,7 @@ public sealed class StationSpawningSystem : EntitySystem
|
||||
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
||||
[Dependency] private readonly PDASystem _pdaSystem = default!;
|
||||
[Dependency] private readonly AccessSystem _accessSystem = default!;
|
||||
[Dependency] private readonly IdentitySystem _identity = default!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
@@ -99,6 +101,7 @@ public sealed class StationSpawningSystem : EntitySystem
|
||||
var jobEntity = EntityManager.SpawnEntity(job.JobEntity, coordinates);
|
||||
MakeSentientCommand.MakeSentient(jobEntity, EntityManager);
|
||||
DoJobSpecials(job, jobEntity);
|
||||
_identity.QueueIdentityUpdate(jobEntity);
|
||||
return jobEntity;
|
||||
}
|
||||
|
||||
@@ -125,7 +128,7 @@ public sealed class StationSpawningSystem : EntitySystem
|
||||
}
|
||||
|
||||
DoJobSpecials(job, entity);
|
||||
|
||||
_identity.QueueIdentityUpdate(entity);
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ public sealed class StorageFillVisualizerSystem : EntitySystem
|
||||
if (!Resolve(uid, ref storage, ref appearance, ref component, false))
|
||||
return;
|
||||
|
||||
if (component.MaxFillLevels < 1)
|
||||
return;
|
||||
|
||||
var level = ContentHelpers.RoundToEqualLevels(storage.StorageUsed, storage.StorageCapacityMax, component.MaxFillLevels);
|
||||
appearance.SetData(StorageFillVisuals.FillLevel, level);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Server.Inventory;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Inventory.Events;
|
||||
@@ -306,7 +307,7 @@ namespace Content.Server.Strip
|
||||
{
|
||||
if (userHands.ActiveHandEntity != null)
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner-insert", ("user", user), ("item", userHands.ActiveHandEntity)), component.Owner,
|
||||
_popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner-insert", ("user", Identity.Entity(user, EntityManager)), ("item", userHands.ActiveHandEntity)), component.Owner,
|
||||
Filter.Entities(component.Owner), PopupType.Large);
|
||||
}
|
||||
}
|
||||
@@ -369,7 +370,7 @@ namespace Content.Server.Strip
|
||||
{
|
||||
if (handSlot.HeldEntity != null)
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner-insert", ("user", user), ("item", handSlot.HeldEntity)), component.Owner,
|
||||
_popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner-insert", ("user", Identity.Entity(user, EntityManager)), ("item", handSlot.HeldEntity)), component.Owner,
|
||||
Filter.Entities(component.Owner), PopupType.Large);
|
||||
}
|
||||
}
|
||||
@@ -437,7 +438,7 @@ namespace Content.Server.Strip
|
||||
else
|
||||
{
|
||||
if (_inventorySystem.TryGetSlotEntity(component.Owner, slot, out var slotItem))
|
||||
_popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner", ("user", user), ("item", slotItem)), component.Owner,
|
||||
_popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner", ("user", Identity.Entity(user, EntityManager)), ("item", slotItem)), component.Owner,
|
||||
Filter.Entities(component.Owner), PopupType.Large);
|
||||
}
|
||||
}
|
||||
@@ -501,7 +502,7 @@ namespace Content.Server.Strip
|
||||
{
|
||||
if (handSlot.HeldEntity != null)
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner", ("user", user), ("item", handSlot.HeldEntity)), component.Owner, Filter.Entities(component.Owner));
|
||||
_popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner", ("user", Identity.Entity(user, EntityManager)), ("item", handSlot.HeldEntity)), component.Owner, Filter.Entities(component.Owner));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.CombatMode;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.StatusEffect;
|
||||
using Content.Shared.Stunnable;
|
||||
@@ -38,9 +39,11 @@ namespace Content.Server.Stunnable
|
||||
var knock = EntityManager.GetComponent<KnockedDownComponent>(uid);
|
||||
SoundSystem.Play(knock.StunAttemptSound.GetSound(), Filter.Pvs(source), source, AudioHelpers.WithVariation(0.025f));
|
||||
|
||||
var targetEnt = Identity.Entity(target, EntityManager);
|
||||
var sourceEnt = Identity.Entity(source, EntityManager);
|
||||
// TODO: Use PopupSystem
|
||||
source.PopupMessageOtherClients(Loc.GetString("stunned-component-disarm-success-others", ("source", Name(source)), ("target", Name(target))));
|
||||
source.PopupMessageCursor(Loc.GetString("stunned-component-disarm-success", ("target", Name(target))));
|
||||
source.PopupMessageOtherClients(Loc.GetString("stunned-component-disarm-success-others", ("source", sourceEnt), ("target", targetEnt)));
|
||||
source.PopupMessageCursor(Loc.GetString("stunned-component-disarm-success", ("target", targetEnt)));
|
||||
|
||||
_adminLogger.Add(LogType.DisarmedKnockdown, LogImpact.Medium, $"{ToPrettyString(args.Source):user} knocked down {ToPrettyString(args.Target):target}");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user