Identity popup fixes (#9743)

This commit is contained in:
Leon Friedrich
2022-07-15 20:10:52 +12:00
committed by GitHub
parent 5ad604a76b
commit e17c89eac4
14 changed files with 43 additions and 35 deletions

View File

@@ -17,6 +17,7 @@ using Robust.Shared.Audio;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.Player; using Robust.Shared.Player;
using Robust.Shared.Timing; using Robust.Shared.Timing;
using Content.Shared.IdentityManagement;
namespace Content.Server.Buckle.Components namespace Content.Server.Buckle.Components
{ {
@@ -169,7 +170,7 @@ namespace Content.Server.Buckle.Components
{ {
var message = Loc.GetString(Owner == user var message = Loc.GetString(Owner == user
? "buckle-component-already-buckled-message" ? "buckle-component-already-buckled-message"
: "buckle-component-other-already-buckled-message", ("owner", Owner)); : "buckle-component-other-already-buckled-message", ("owner", Identity.Entity(Owner, _entMan)));
popupSystem.PopupEntity(message, user, Filter.Entities(user)); popupSystem.PopupEntity(message, user, Filter.Entities(user));
return false; return false;
@@ -182,7 +183,7 @@ namespace Content.Server.Buckle.Components
{ {
var message = Loc.GetString(Owner == user var message = Loc.GetString(Owner == user
? "buckle-component-cannot-buckle-message" ? "buckle-component-cannot-buckle-message"
: "buckle-component-other-cannot-buckle-message", ("owner", Owner)); : "buckle-component-other-cannot-buckle-message", ("owner", Identity.Entity(Owner, _entMan)));
popupSystem.PopupEntity(message, user, Filter.Entities(user)); popupSystem.PopupEntity(message, user, Filter.Entities(user));
return false; return false;
@@ -195,7 +196,7 @@ namespace Content.Server.Buckle.Components
{ {
var message = Loc.GetString(Owner == user var message = Loc.GetString(Owner == user
? "buckle-component-cannot-fit-message" ? "buckle-component-cannot-fit-message"
: "buckle-component-other-cannot-fit-message", ("owner", Owner)); : "buckle-component-other-cannot-fit-message", ("owner", Identity.Entity(Owner, _entMan)));
popupSystem.PopupEntity(message, user, Filter.Entities(user)); popupSystem.PopupEntity(message, user, Filter.Entities(user));
return false; return false;
@@ -218,7 +219,7 @@ namespace Content.Server.Buckle.Components
{ {
var message = Loc.GetString(Owner == user var message = Loc.GetString(Owner == user
? "buckle-component-cannot-buckle-message" ? "buckle-component-cannot-buckle-message"
: "buckle-component-other-cannot-buckle-message", ("owner", Owner)); : "buckle-component-other-cannot-buckle-message", ("owner", Identity.Entity(Owner, _entMan)));
popupSystem.PopupEntity(message, user, Filter.Entities(user)); popupSystem.PopupEntity(message, user, Filter.Entities(user));
return false; return false;
} }

View File

@@ -1,5 +1,6 @@
using Content.Server.Cargo.Components; using Content.Server.Cargo.Components;
using Content.Server.Popups; using Content.Server.Popups;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.Timing; using Content.Shared.Timing;
using Robust.Shared.Player; using Robust.Shared.Player;
@@ -31,7 +32,7 @@ public sealed class PriceGunSystem : EntitySystem
var price = _pricingSystem.GetPrice(args.Target.Value); var price = _pricingSystem.GetPrice(args.Target.Value);
_popupSystem.PopupEntity(Loc.GetString("price-gun-pricing-result", ("object", args.Target.Value), ("price", $"{price:F2}")), args.User, Filter.Entities(args.User)); _popupSystem.PopupEntity(Loc.GetString("price-gun-pricing-result", ("object", Identity.Entity(args.Target.Value, EntityManager)), ("price", $"{price:F2}")), args.User, Filter.Entities(args.User));
_useDelay.BeginDelay(uid, useDelay); _useDelay.BeginDelay(uid, useDelay);
} }
} }

View File

@@ -328,7 +328,7 @@ public sealed class ClimbSystem : SharedClimbSystem
// Not shown to the user, since they already get a 'you climb on the glass table' popup // Not shown to the user, since they already get a 'you climb on the glass table' popup
_popupSystem.PopupEntity( _popupSystem.PopupEntity(
Loc.GetString("glass-table-shattered-others", ("table", uid), ("climber", args.Climber)), args.Climber, Loc.GetString("glass-table-shattered-others", ("table", uid), ("climber", Identity.Entity(args.Climber, EntityManager))), args.Climber,
Filter.Pvs(uid).RemoveWhereAttachedEntity(puid => puid == args.Climber)); Filter.Pvs(uid).RemoveWhereAttachedEntity(puid => puid == args.Climber));
} }

View File

@@ -19,6 +19,7 @@ using Robust.Shared.Serialization.Manager;
using Content.Shared.Inventory.Events; using Content.Shared.Inventory.Events;
using Content.Server.Nutrition.EntitySystems; using Content.Server.Nutrition.EntitySystems;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using Content.Shared.IdentityManagement;
namespace Content.Server.Disease namespace Content.Server.Disease
{ {
@@ -441,7 +442,7 @@ namespace Content.Server.Disease
if (!Resolve(uid, ref xform)) return; if (!Resolve(uid, ref xform)) return;
if (!string.IsNullOrEmpty(snoughMessage)) if (!string.IsNullOrEmpty(snoughMessage))
_popupSystem.PopupEntity(Loc.GetString(snoughMessage, ("person", uid)), uid, Filter.Pvs(uid)); _popupSystem.PopupEntity(Loc.GetString(snoughMessage, ("person", Identity.Entity(uid, EntityManager))), uid, Filter.Pvs(uid));
if (disease is not { Infectious: true } || !airTransmit) if (disease is not { Infectious: true } || !airTransmit)
return; return;

View File

@@ -2,6 +2,7 @@ using Content.Shared.Disease;
using Content.Shared.Popups; using Content.Shared.Popups;
using Robust.Shared.Player; using Robust.Shared.Player;
using JetBrains.Annotations; using JetBrains.Annotations;
using Content.Shared.IdentityManagement;
namespace Content.Server.Disease.Effects namespace Content.Server.Disease.Effects
{ {
@@ -24,12 +25,12 @@ namespace Content.Server.Disease.Effects
public override void Effect(DiseaseEffectArgs args) public override void Effect(DiseaseEffectArgs args)
{ {
var popupSys = EntitySystem.Get<SharedPopupSystem>(); var popupSys = args.EntityManager.EntitySysManager.GetEntitySystem<SharedPopupSystem>();
if (Type == PopupRecipients.Local) if (Type == PopupRecipients.Local)
popupSys.PopupEntity(Loc.GetString(Message), args.DiseasedEntity, Filter.Entities(args.DiseasedEntity), VisualType); popupSys.PopupEntity(Loc.GetString(Message), args.DiseasedEntity, Filter.Entities(args.DiseasedEntity), VisualType);
else if (Type == PopupRecipients.Pvs) else if (Type == PopupRecipients.Pvs)
popupSys.PopupEntity(Loc.GetString(Message, ("person", args.DiseasedEntity)), args.DiseasedEntity, Filter.Pvs(args.DiseasedEntity), VisualType); popupSys.PopupEntity(Loc.GetString(Message, ("person", Identity.Entity(args.DiseasedEntity, args.EntityManager))), args.DiseasedEntity, Filter.Pvs(args.DiseasedEntity), VisualType);
} }
} }

View File

@@ -24,6 +24,7 @@ using Content.Shared.Popups;
using Content.Shared.Storage; using Content.Shared.Storage;
using Robust.Shared.Random; using Robust.Shared.Random;
using Robust.Shared.Timing; using Robust.Shared.Timing;
using Content.Shared.IdentityManagement;
namespace Content.Server.Drone namespace Content.Server.Drone
{ {
@@ -184,7 +185,7 @@ namespace Content.Server.Drone
if ((TryComp<MobStateComponent>(entity, out var entityMobState) && HasComp<GhostTakeoverAvailableComponent>(entity) && entityMobState.IsDead())) if ((TryComp<MobStateComponent>(entity, out var entityMobState) && HasComp<GhostTakeoverAvailableComponent>(entity) && entityMobState.IsDead()))
continue; continue;
if (_gameTiming.IsFirstTimePredicted) if (_gameTiming.IsFirstTimePredicted)
_popupSystem.PopupEntity(Loc.GetString("drone-too-close", ("being", entity)), uid, Filter.Entities(uid)); _popupSystem.PopupEntity(Loc.GetString("drone-too-close", ("being", Identity.Entity(entity, EntityManager))), uid, Filter.Entities(uid));
return true; return true;
} }
} }

View File

@@ -187,7 +187,7 @@ namespace Content.Server.Kitchen.EntitySystems
if (!Resolve(victimUid, ref butcherable, false)) if (!Resolve(victimUid, ref butcherable, false))
{ {
_popupSystem.PopupEntity(Loc.GetString("comp-kitchen-spike-deny-butcher", ("victim", victimUid), ("this", uid)), victimUid, Filter.Entities(userUid)); _popupSystem.PopupEntity(Loc.GetString("comp-kitchen-spike-deny-butcher", ("victim", Identity.Entity(victimUid, EntityManager)), ("this", uid)), victimUid, Filter.Entities(userUid));
return false; return false;
} }
@@ -196,10 +196,10 @@ namespace Content.Server.Kitchen.EntitySystems
case ButcheringType.Spike: case ButcheringType.Spike:
return true; return true;
case ButcheringType.Knife: case ButcheringType.Knife:
_popupSystem.PopupEntity(Loc.GetString("comp-kitchen-spike-deny-butcher-knife", ("victim", victimUid), ("this", uid)), victimUid, Filter.Entities(userUid)); _popupSystem.PopupEntity(Loc.GetString("comp-kitchen-spike-deny-butcher-knife", ("victim", Identity.Entity(victimUid, EntityManager)), ("this", uid)), victimUid, Filter.Entities(userUid));
return false; return false;
default: default:
_popupSystem.PopupEntity(Loc.GetString("comp-kitchen-spike-deny-butcher", ("victim", victimUid), ("this", uid)), victimUid, Filter.Entities(userUid)); _popupSystem.PopupEntity(Loc.GetString("comp-kitchen-spike-deny-butcher", ("victim", Identity.Entity(victimUid, EntityManager)), ("this", uid)), victimUid, Filter.Entities(userUid));
return false; return false;
} }
} }
@@ -216,14 +216,14 @@ namespace Content.Server.Kitchen.EntitySystems
if (Resolve(victimUid, ref mobState, false) && if (Resolve(victimUid, ref mobState, false) &&
!mobState.IsDead()) !mobState.IsDead())
{ {
_popupSystem.PopupEntity(Loc.GetString("comp-kitchen-spike-deny-not-dead", ("victim", victimUid)), _popupSystem.PopupEntity(Loc.GetString("comp-kitchen-spike-deny-not-dead", ("victim", Identity.Entity(victimUid, EntityManager))),
victimUid, Filter.Entities(userUid)); victimUid, Filter.Entities(userUid));
return true; return true;
} }
if (userUid != victimUid) if (userUid != victimUid)
{ {
_popupSystem.PopupEntity(Loc.GetString("comp-kitchen-spike-begin-hook-victim", ("user", userUid), ("this", uid)), victimUid, _popupSystem.PopupEntity(Loc.GetString("comp-kitchen-spike-begin-hook-victim", ("user", Identity.Entity(userUid, EntityManager)), ("this", uid)), victimUid,
Filter.Entities(victimUid), PopupType.LargeCaution); Filter.Entities(victimUid), PopupType.LargeCaution);
} }
// TODO: make it work when SuicideEvent is implemented // TODO: make it work when SuicideEvent is implemented

View File

@@ -10,6 +10,7 @@ using Content.Shared.StatusEffect;
using Content.Shared.Audio; using Content.Shared.Audio;
using Robust.Shared.Audio; using Robust.Shared.Audio;
using Robust.Shared.Player; using Robust.Shared.Player;
using Content.Shared.IdentityManagement;
namespace Content.Server.Medical namespace Content.Server.Medical
{ {
@@ -52,7 +53,7 @@ namespace Content.Server.Medical
SoundSystem.Play("/Audio/Effects/Diseases/vomiting.ogg", Filter.Pvs(uid), uid, AudioHelpers.WithVariation(0.2f).WithVolume(-4f)); SoundSystem.Play("/Audio/Effects/Diseases/vomiting.ogg", Filter.Pvs(uid), uid, AudioHelpers.WithVariation(0.2f).WithVolume(-4f));
_popupSystem.PopupEntity(Loc.GetString("disease-vomit", ("person", uid)), uid, Filter.Pvs(uid)); _popupSystem.PopupEntity(Loc.GetString("disease-vomit", ("person", Identity.Entity(uid, EntityManager))), uid, Filter.Pvs(uid));
// Get the solution of the puddle we spawned // Get the solution of the puddle we spawned
if (!_solutionSystem.TryGetSolution(puddle, puddleComp.SolutionName, out var puddleSolution)) if (!_solutionSystem.TryGetSolution(puddle, puddleComp.SolutionName, out var puddleSolution))
return; return;

View File

@@ -15,6 +15,7 @@ using Content.Server.Storage.EntitySystems;
using Content.Shared.Examine; using Content.Shared.Examine;
using Content.Shared.Standing; using Content.Shared.Standing;
using Content.Shared.Storage; using Content.Shared.Storage;
using Content.Shared.IdentityManagement;
namespace Content.Server.Morgue; namespace Content.Server.Morgue;
@@ -143,7 +144,8 @@ public sealed class CrematoriumSystem : EntitySystem
} }
} }
_popup.PopupEntity(Loc.GetString("crematorium-entity-storage-component-suicide-message-others", ("victim", victim)), _popup.PopupEntity(Loc.GetString("crematorium-entity-storage-component-suicide-message-others",
("victim", Identity.Entity(victim, EntityManager))),
victim, Filter.PvsExcept(victim), PopupType.LargeCaution); victim, Filter.PvsExcept(victim), PopupType.LargeCaution);
if (_entityStorage.CanInsert(uid)) if (_entityStorage.CanInsert(uid))

View File

@@ -70,6 +70,12 @@ namespace Content.Server.PAI
// Ownership tag // Ownership tag
string val = Loc.GetString("pai-system-pai-name", ("owner", args.User)); string val = Loc.GetString("pai-system-pai-name", ("owner", args.User));
// TODO Identity? People shouldn't dox-themselves by carrying around a PAI.
// But having the pda's name permanently be "old lady's PAI" is weird.
// Changing the PAI's identity in a way that ties it to the owner's identity also seems weird.
// Cause then you could remotely figure out information about the owner's equipped items.
EntityManager.GetComponent<MetaDataComponent>(component.Owner).EntityName = val; EntityManager.GetComponent<MetaDataComponent>(component.Owner).EntityName = val;
var ghostFinder = EntityManager.EnsureComponent<GhostTakeoverAvailableComponent>(uid); var ghostFinder = EntityManager.EnsureComponent<GhostTakeoverAvailableComponent>(uid);

View File

@@ -7,6 +7,7 @@ using Content.Shared.Actions;
using Content.Shared.Actions.ActionTypes; using Content.Shared.Actions.ActionTypes;
using Content.Shared.Damage; using Content.Shared.Damage;
using Content.Shared.Hands.EntitySystems; using Content.Shared.Hands.EntitySystems;
using Content.Shared.IdentityManagement;
using Content.Shared.MobState.Components; using Content.Shared.MobState.Components;
using Content.Shared.Polymorph; using Content.Shared.Polymorph;
using Robust.Server.Containers; using Robust.Server.Containers;
@@ -96,7 +97,11 @@ namespace Content.Server.Polymorph.Systems
mind.Mind.TransferTo(component.Parent); mind.Mind.TransferTo(component.Parent);
} }
_popup.PopupEntity(Loc.GetString("polymorph-revert-popup-generic", ("parent", uid), ("child", component.Parent)), component.Parent, Filter.Pvs(component.Parent)); _popup.PopupEntity(Loc.GetString("polymorph-revert-popup-generic",
("parent", Identity.Entity(uid, EntityManager)),
("child", Identity.Entity(component.Parent, EntityManager))),
component.Parent,
Filter.Pvs(component.Parent));
QueueDel(uid); QueueDel(uid);
} }

View File

@@ -8,6 +8,7 @@ using Content.Server.Recycling.Components;
using Content.Shared.Audio; using Content.Shared.Audio;
using Content.Shared.Body.Components; using Content.Shared.Body.Components;
using Content.Shared.Emag.Systems; using Content.Shared.Emag.Systems;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction.Events; using Content.Shared.Interaction.Events;
using Content.Shared.Recycling; using Content.Shared.Recycling;
using Content.Shared.Tag; using Content.Shared.Tag;
@@ -51,7 +52,7 @@ namespace Content.Server.Recycling
} }
} }
_popup.PopupEntity(Loc.GetString("recycler-component-suicide-message-others", ("victim", victim)), _popup.PopupEntity(Loc.GetString("recycler-component-suicide-message-others", ("victim", Identity.Entity(victim, EntityManager))),
victim, victim,
Filter.Pvs(victim, entityManager: EntityManager).RemoveWhereAttachedEntity(e => e == victim)); Filter.Pvs(victim, entityManager: EntityManager).RemoveWhereAttachedEntity(e => e == victim));

View File

@@ -8,6 +8,7 @@ using Content.Shared.Audio;
using Content.Shared.Body.Components; using Content.Shared.Body.Components;
using Content.Shared.Body.Part; using Content.Shared.Body.Part;
using Content.Shared.Examine; using Content.Shared.Examine;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.Interaction.Events; using Content.Shared.Interaction.Events;
using Content.Shared.Popups; using Content.Shared.Popups;
@@ -48,7 +49,7 @@ namespace Content.Server.Toilet
body.HasPartOfType(BodyPartType.Head)) body.HasPartOfType(BodyPartType.Head))
{ {
var othersMessage = Loc.GetString("toilet-component-suicide-head-message-others", var othersMessage = Loc.GetString("toilet-component-suicide-head-message-others",
("victim", args.Victim), ("owner", uid)); ("victim", Identity.Entity(args.Victim, EntityManager)), ("owner", uid));
_popupSystem.PopupEntity(othersMessage, uid, Filter.PvsExcept(args.Victim), PopupType.MediumCaution); _popupSystem.PopupEntity(othersMessage, uid, Filter.PvsExcept(args.Victim), PopupType.MediumCaution);
var selfMessage = Loc.GetString("toilet-component-suicide-head-message", var selfMessage = Loc.GetString("toilet-component-suicide-head-message",
@@ -60,7 +61,7 @@ namespace Content.Server.Toilet
else else
{ {
var othersMessage = Loc.GetString("toilet-component-suicide-message-others", var othersMessage = Loc.GetString("toilet-component-suicide-message-others",
("victim", args.Victim), ("owner", uid)); ("victim", Identity.Entity(args.Victim, EntityManager)), ("owner", uid));
_popupSystem.PopupEntity(othersMessage, uid, Filter.PvsExcept(uid), PopupType.MediumCaution); _popupSystem.PopupEntity(othersMessage, uid, Filter.PvsExcept(uid), PopupType.MediumCaution);
var selfMessage = Loc.GetString("toilet-component-suicide-message", var selfMessage = Loc.GetString("toilet-component-suicide-message",

View File

@@ -31,19 +31,6 @@ namespace Content.Shared.Popups
viewer.PopupMessage(viewer, message); viewer.PopupMessage(viewer, message);
} }
/// <summary>
/// Makes a string of text float up from a location on a grid.
/// </summary>
/// <param name="coordinates">Location on a grid that the message floats up from.</param>
/// <param name="viewer">The client attached entity that the message is being sent to.</param>
/// <param name="message">Text contents of the message.</param>
[Obsolete("Use PopupSystem.PopupCoordinates instead.")]
public static void PopupMessage(this EntityCoordinates coordinates, EntityUid viewer, string message)
{
var popupSystem = EntitySystem.Get<SharedPopupSystem>();
popupSystem.PopupCoordinates(message, coordinates, Filter.Entities(viewer));
}
/// <summary> /// <summary>
/// Makes a string of text float up from a client's cursor. /// Makes a string of text float up from a client's cursor.
/// </summary> /// </summary>