PopupSystem public methods rejig (#12830)

This commit is contained in:
Leon Friedrich
2022-12-19 10:41:47 +13:00
committed by GitHub
parent e459452333
commit 881a2b2ece
164 changed files with 721 additions and 631 deletions

View File

@@ -288,17 +288,18 @@ namespace Content.Server.Chemistry.EntitySystems
return false;
}
var filter = user.HasValue ? Filter.Entities(user.Value) : Filter.Empty();
if (solution.TotalVolume == 0)
{
_popupSystem.PopupCursor(Loc.GetString("chem-master-window-buffer-empty-text"), filter);
if (user.HasValue)
_popupSystem.PopupCursor(Loc.GetString("chem-master-window-buffer-empty-text"), user.Value);
return false;
}
// ReSharper disable once InvertIf
if (neededVolume > solution.CurrentVolume)
{
_popupSystem.PopupCursor(Loc.GetString("chem-master-window-buffer-low-text"), filter);
if (user.HasValue)
_popupSystem.PopupCursor(Loc.GetString("chem-master-window-buffer-low-text"), user.Value);
return false;
}

View File

@@ -105,7 +105,7 @@ public sealed partial class ChemistrySystem
else
{
_popup.PopupEntity(Loc.GetString("injector-component-cannot-transfer-message",
("target", Identity.Entity(target, EntityManager))), component.Owner, Filter.Entities(user));
("target", Identity.Entity(target, EntityManager))), component.Owner, user);
}
}
else if (component.ToggleState == SharedInjectorComponent.InjectorToggleMode.Draw)
@@ -125,7 +125,7 @@ public sealed partial class ChemistrySystem
else
{
_popup.PopupEntity(Loc.GetString("injector-component-cannot-draw-message",
("target", Identity.Entity(target, EntityManager))), component.Owner, Filter.Entities(user));
("target", Identity.Entity(target, EntityManager))), component.Owner, user);
}
}
}
@@ -226,7 +226,7 @@ public sealed partial class ChemistrySystem
throw new ArgumentOutOfRangeException();
}
_popup.PopupEntity(Loc.GetString(msg), component.Owner, Filter.Entities(user));
_popup.PopupEntity(Loc.GetString(msg), component.Owner, user);
}
/// <summary>
@@ -235,7 +235,7 @@ public sealed partial class ChemistrySystem
private void InjectDoAfter(InjectorComponent component, EntityUid user, EntityUid target)
{
// Create a pop-up for the user
_popup.PopupEntity(Loc.GetString("injector-component-injecting-user"), target, Filter.Entities(user));
_popup.PopupEntity(Loc.GetString("injector-component-injecting-user"), target, user);
if (!_solutions.TryGetSolution(component.Owner, InjectorComponent.SolutionName, out var solution))
return;
@@ -250,7 +250,7 @@ public sealed partial class ChemistrySystem
// Create a pop-up for the target
var userName = Identity.Entity(user, EntityManager);
_popup.PopupEntity(Loc.GetString("injector-component-injecting-target",
("user", userName)), user, Filter.Entities(target));
("user", userName)), user, target);
// Check if the target is incapacitated or in combat mode and modify time accordingly.
if (_mobState.IsIncapacitated(target))
@@ -311,7 +311,7 @@ public sealed partial class ChemistrySystem
if (realTransferAmount <= 0)
{
_popup.PopupEntity(Loc.GetString("injector-component-cannot-inject-message", ("target", Identity.Entity(targetBloodstream.Owner, EntityManager))),
component.Owner, Filter.Entities(user));
component.Owner, user);
return;
}
@@ -324,7 +324,7 @@ public sealed partial class ChemistrySystem
_popup.PopupEntity(Loc.GetString("injector-component-inject-success-message",
("amount", removedSolution.TotalVolume),
("target", Identity.Entity(targetBloodstream.Owner, EntityManager))), component.Owner, Filter.Entities(user));
("target", Identity.Entity(targetBloodstream.Owner, EntityManager))), component.Owner, user);
Dirty(component);
AfterInject(component);
@@ -344,7 +344,7 @@ public sealed partial class ChemistrySystem
if (realTransferAmount <= 0)
{
_popup.PopupEntity(Loc.GetString("injector-component-target-already-full-message", ("target", Identity.Entity(targetEntity, EntityManager))),
component.Owner, Filter.Entities(user));
component.Owner, user);
return;
}
@@ -364,7 +364,7 @@ public sealed partial class ChemistrySystem
_popup.PopupEntity(Loc.GetString("injector-component-transfer-success-message",
("amount", removedSolution.TotalVolume),
("target", Identity.Entity(targetEntity, EntityManager))), component.Owner, Filter.Entities(user));
("target", Identity.Entity(targetEntity, EntityManager))), component.Owner, user);
Dirty(component);
AfterInject(component);
@@ -404,7 +404,7 @@ public sealed partial class ChemistrySystem
if (realTransferAmount <= 0)
{
_popup.PopupEntity(Loc.GetString("injector-component-target-is-empty-message", ("target", Identity.Entity(targetEntity, EntityManager))),
component.Owner, Filter.Entities(user));
component.Owner, user);
return;
}
@@ -425,7 +425,7 @@ public sealed partial class ChemistrySystem
_popup.PopupEntity(Loc.GetString("injector-component-draw-success-message",
("amount", removedSolution.TotalVolume),
("target", Identity.Entity(targetEntity, EntityManager))), component.Owner, Filter.Entities(user));
("target", Identity.Entity(targetEntity, EntityManager))), component.Owner, user);
Dirty(component);
AfterDraw(component);
@@ -450,7 +450,7 @@ public sealed partial class ChemistrySystem
_popup.PopupEntity(Loc.GetString("injector-component-draw-success-message",
("amount", transferAmount),
("target", Identity.Entity(target, EntityManager))), component.Owner, Filter.Entities(user));
("target", Identity.Entity(target, EntityManager))), component.Owner, user);
Dirty(component);
AfterDraw(component);

View File

@@ -79,21 +79,21 @@ namespace Content.Server.Chemistry.EntitySystems
if (hypoSpraySolution == null || hypoSpraySolution.CurrentVolume == 0)
{
_popup.PopupCursor(Loc.GetString("hypospray-component-empty-message"), Filter.Entities(user));
_popup.PopupCursor(Loc.GetString("hypospray-component-empty-message"), user);
return true;
}
if (!_solutions.TryGetInjectableSolution(target.Value, out var targetSolution))
{
_popup.PopupCursor(Loc.GetString("hypospray-cant-inject", ("target", Identity.Entity(target.Value, _entMan))), Filter.Entities(user));
_popup.PopupCursor(Loc.GetString("hypospray-cant-inject", ("target", Identity.Entity(target.Value, _entMan))), user);
return false;
}
_popup.PopupCursor(Loc.GetString(msgFormat ?? "hypospray-component-inject-other-message", ("other", target)), Filter.Entities(user));
_popup.PopupCursor(Loc.GetString(msgFormat ?? "hypospray-component-inject-other-message", ("other", target)), user);
if (target != user)
{
_popup.PopupCursor(Loc.GetString("hypospray-component-feel-prick-message"), Filter.Entities(target.Value));
_popup.PopupCursor(Loc.GetString("hypospray-component-feel-prick-message"), target.Value);
var meleeSys = EntitySystem.Get<MeleeWeaponSystem>();
var angle = Angle.FromWorldVec(_entMan.GetComponent<TransformComponent>(target.Value).WorldPosition - _entMan.GetComponent<TransformComponent>(user).WorldPosition);
// TODO: This should just be using melee attacks...
@@ -107,7 +107,7 @@ namespace Content.Server.Chemistry.EntitySystems
if (realTransferAmount <= 0)
{
_popup.PopupCursor(Loc.GetString("hypospray-component-transfer-already-full-message",("owner", target)), Filter.Entities(user));
_popup.PopupCursor(Loc.GetString("hypospray-component-transfer-already-full-message",("owner", target)), user);
return true;
}

View File

@@ -56,7 +56,7 @@ public sealed class SolutionSpikableSystem : EntitySystem
if (targetSolution.CurrentVolume == 0 && !spikableSource.IgnoreEmpty)
{
_popupSystem.PopupEntity(Loc.GetString(spikableSource.PopupEmpty, ("spiked-entity", target), ("spike-entity", source)), user, Filter.Entities(user));
_popupSystem.PopupEntity(Loc.GetString(spikableSource.PopupEmpty, ("spiked-entity", target), ("spike-entity", source)), user, user);
return;
}
@@ -71,7 +71,7 @@ public sealed class SolutionSpikableSystem : EntitySystem
RaiseLocalEvent(target, new SolutionSpikeOverflowEvent(overflow));
}
_popupSystem.PopupEntity(Loc.GetString(spikableSource.Popup, ("spiked-entity", target), ("spike-entity", source)), user, Filter.Entities(user));
_popupSystem.PopupEntity(Loc.GetString(spikableSource.Popup, ("spiked-entity", target), ("spike-entity", source)), user, user);
sourceSolution.RemoveAllSolution();