Visual popup addendum (#9570)

This commit is contained in:
Kara
2022-07-09 02:32:06 -07:00
committed by GitHub
parent 860db2bd14
commit 50fc190f7f
19 changed files with 61 additions and 46 deletions

View File

@@ -147,9 +147,11 @@ namespace Content.Client.Popups
type switch
{
PopupType.Small => StyleNano.StyleClassPopupMessageSmall,
PopupType.SmallCaution => StyleNano.StyleClassPopupMessageSmallCaution,
PopupType.Medium => StyleNano.StyleClassPopupMessageMedium,
PopupType.MediumCaution => StyleNano.StyleClassPopupMessageMediumCaution,
PopupType.Large => StyleNano.StyleClassPopupMessageLarge,
PopupType.Critical => StyleNano.StyleClassPopupMessageCritical,
PopupType.LargeCaution => StyleNano.StyleClassPopupMessageLargeCaution,
_ => StyleNano.StyleClassPopupMessageSmall
};

View File

@@ -76,9 +76,11 @@ namespace Content.Client.Stylesheets
public const string StyleClassButtonBig = "ButtonBig";
public const string StyleClassPopupMessageSmall = "PopupMessageSmall";
public const string StyleClassPopupMessageSmallCaution = "PopupMessageSmallCaution";
public const string StyleClassPopupMessageMedium = "PopupMessageMedium";
public const string StyleClassPopupMessageMediumCaution = "PopupMessageMediumCaution";
public const string StyleClassPopupMessageLarge = "PopupMessageLarge";
public const string StyleClassPopupMessageCritical = "PopupMessageCritical";
public const string StyleClassPopupMessageLargeCaution = "PopupMessageLargeCaution";
public static readonly Color NanoGold = Color.FromHex("#A88B5E");
public static readonly Color GoodGreenFore = Color.FromHex("#31843E");
@@ -1046,6 +1048,13 @@ namespace Content.Client.Stylesheets
new StyleProperty("font-color", Color.White),
}),
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassPopupMessageSmallCaution}, null, null),
new[]
{
new StyleProperty("font", notoSansItalic10),
new StyleProperty("font-color", Color.Red),
}),
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassPopupMessageMedium}, null, null),
new[]
{
@@ -1053,6 +1062,13 @@ namespace Content.Client.Stylesheets
new StyleProperty("font-color", Color.LightGray),
}),
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassPopupMessageMediumCaution}, null, null),
new[]
{
new StyleProperty("font", notoSansItalic12),
new StyleProperty("font-color", Color.Red),
}),
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassPopupMessageLarge}, null, null),
new[]
{
@@ -1060,10 +1076,10 @@ namespace Content.Client.Stylesheets
new StyleProperty("font-color", Color.LightGray),
}),
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassPopupMessageCritical}, null, null),
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassPopupMessageLargeCaution}, null, null),
new[]
{
new StyleProperty("font", notoSansBoldItalic16),
new StyleProperty("font", notoSansBoldItalic14),
new StyleProperty("font-color", Color.Red),
}),

View File

@@ -111,10 +111,10 @@ public sealed partial class AdminVerbSystem
RemComp<PhysicsComponent>(args.Target); // So they can be dragged around.
var xform = Transform(args.Target);
_popupSystem.PopupEntity(Loc.GetString("admin-smite-chess-self"), args.Target,
Filter.Entities(args.Target), PopupType.Critical);
Filter.Entities(args.Target), PopupType.LargeCaution);
_popupSystem.PopupCoordinates(
Loc.GetString("admin-smite-chess-others", ("name", args.Target)), xform.Coordinates,
Filter.PvsExcept(args.Target), PopupType.Critical);
Filter.PvsExcept(args.Target), PopupType.MediumCaution);
var board = Spawn("ChessBoard", xform.Coordinates);
var session = _tabletopSystem.EnsureSession(Comp<TabletopGameComponent>(board));
xform.Coordinates = EntityCoordinates.FromMap(_mapManager, session.Position);
@@ -139,9 +139,9 @@ public sealed partial class AdminVerbSystem
_flammableSystem.Ignite(args.Target);
var xform = Transform(args.Target);
_popupSystem.PopupEntity(Loc.GetString("admin-smite-set-alight-self"), args.Target,
Filter.Entities(args.Target), PopupType.Critical);
Filter.Entities(args.Target), PopupType.LargeCaution);
_popupSystem.PopupCoordinates(Loc.GetString("admin-smite-set-alight-others", ("name", args.Target)), xform.Coordinates,
Filter.PvsExcept(args.Target), PopupType.Critical);
Filter.PvsExcept(args.Target), PopupType.MediumCaution);
},
Impact = LogImpact.Extreme,
Message = "Makes them burn.",
@@ -259,9 +259,9 @@ public sealed partial class AdminVerbSystem
_bloodstreamSystem.SpillAllSolutions(args.Target, bloodstream);
var xform = Transform(args.Target);
_popupSystem.PopupEntity(Loc.GetString("admin-smite-remove-blood-self"), args.Target,
Filter.Entities(args.Target), PopupType.Critical);
Filter.Entities(args.Target), PopupType.LargeCaution);
_popupSystem.PopupCoordinates(Loc.GetString("admin-smite-remove-blood-others", ("name", args.Target)), xform.Coordinates,
Filter.PvsExcept(args.Target), PopupType.Critical);
Filter.PvsExcept(args.Target), PopupType.MediumCaution);
},
Impact = LogImpact.Extreme,
Message = "Removes their blood. All of it.",
@@ -292,9 +292,9 @@ public sealed partial class AdminVerbSystem
}
_popupSystem.PopupEntity(Loc.GetString("admin-smite-vomit-organs-self"), args.Target,
Filter.Entities(args.Target), PopupType.Critical);
Filter.Entities(args.Target), PopupType.LargeCaution);
_popupSystem.PopupCoordinates(Loc.GetString("admin-smite-vomit-organs-others", ("name", args.Target)), baseXform.Coordinates,
Filter.PvsExcept(args.Target), PopupType.Critical);
Filter.PvsExcept(args.Target), PopupType.MediumCaution);
},
Impact = LogImpact.Extreme,
Message = "Causes them to vomit, including their internal organs.",
@@ -315,7 +315,7 @@ public sealed partial class AdminVerbSystem
Transform(part.Owner).Coordinates = baseXform.Coordinates;
}
_popupSystem.PopupEntity(Loc.GetString("admin-smite-remove-hands-self"), args.Target,
Filter.Entities(args.Target), PopupType.Critical);
Filter.Entities(args.Target), PopupType.LargeCaution);
_popupSystem.PopupCoordinates(Loc.GetString("admin-smite-remove-hands-others", ("name", args.Target)), baseXform.Coordinates,
Filter.PvsExcept(args.Target), PopupType.Medium);
},
@@ -495,7 +495,7 @@ public sealed partial class AdminVerbSystem
EntityManager.QueueDeleteEntity(args.Target);
Spawn("Ash", Transform(args.Target).Coordinates);
_popupSystem.PopupEntity(Loc.GetString("admin-smite-turned-ash-other", ("name", args.Target)), args.Target,
Filter.Pvs(args.Target), PopupType.Critical);
Filter.Pvs(args.Target), PopupType.LargeCaution);
},
Impact = LogImpact.Extreme,
Message = "Reduces the target to a small pile of ash.",

View File

@@ -39,7 +39,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
{
args.Delay += 1.5f;
_popupSystem.PopupCursor(Loc.GetString("comp-atmos-unsafe-unanchor-warning"),
Filter.Entities(args.User), PopupType.Large);
Filter.Entities(args.User), PopupType.MediumCaution);
return; // Show the warning only once.
}
}

View File

@@ -122,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));
_popupSystem.PopupEntity(othersFailMessage, args.User, Filter.PvsExcept(args.User));
_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));
_popupSystem.PopupEntity(selfFailMessage, args.User, Filter.Entities(args.User), PopupType.Medium);
_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);
_damageableSystem.TryChangeDamage(args.Target.Value, component.DamageOnFail, true);

View File

@@ -99,7 +99,7 @@ namespace Content.Server.Guardian
if (args.Cancelled || args.Target != component.Host)
return;
_popupSystem.PopupCursor(Loc.GetString("guardian-attack-host"), Filter.Entities(uid), PopupType.Large);
_popupSystem.PopupCursor(Loc.GetString("guardian-attack-host"), Filter.Entities(uid), PopupType.LargeCaution);
args.Cancel();
}

View File

@@ -86,7 +86,7 @@ public sealed class ImmovableRodSystem : EntitySystem
// oh god.
var coords = Transform(uid).Coordinates;
_popup.PopupCoordinates(Loc.GetString("immovable-rod-collided-rod-not-good"), coords,
Filter.Pvs(uid), PopupType.Critical);
Filter.Pvs(uid), PopupType.LargeCaution);
Del(uid);
Del(ent);
@@ -101,7 +101,7 @@ public sealed class ImmovableRodSystem : EntitySystem
component.MobCount++;
_popup.PopupEntity(Loc.GetString("immovable-rod-penetrated-mob", ("rod", uid), ("mob", ent)), uid,
Filter.Pvs(uid), PopupType.Critical);
Filter.Pvs(uid), PopupType.LargeCaution);
body.Gib();
}

View File

@@ -124,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,
Filter.Pvs(userUid), PopupType.Critical);
Filter.Pvs(userUid), PopupType.LargeCaution);
// THE WHAT?
// TODO: Need to be able to leave them on the spike to do DoT, see ss13.
@@ -153,12 +153,12 @@ namespace Content.Server.Kitchen.EntitySystems
if (component.PrototypesToSpawn.Count != 0)
{
_popupSystem.PopupEntity(component.MeatSource1p, uid, Filter.Entities(user), PopupType.Medium);
_popupSystem.PopupEntity(component.MeatSource1p, uid, Filter.Entities(user), PopupType.MediumCaution);
}
else
{
UpdateAppearance(uid, null, component);
_popupSystem.PopupEntity(component.MeatSource0, uid, Filter.Entities(user), PopupType.Medium);
_popupSystem.PopupEntity(component.MeatSource0, uid, Filter.Entities(user), PopupType.MediumCaution);
}
return true;
@@ -223,7 +223,7 @@ namespace Content.Server.Kitchen.EntitySystems
if (userUid != victimUid)
{
_popupSystem.PopupEntity(Loc.GetString("comp-kitchen-spike-begin-hook-victim", ("user", userUid), ("this", uid)), victimUid,
Filter.Entities(victimUid), PopupType.Large);
Filter.Entities(victimUid), PopupType.LargeCaution);
}
// TODO: make it work when SuicideEvent is implemented
// else

View File

@@ -88,7 +88,7 @@ public sealed class SharpSystem : EntitySystem
}
_popupSystem.PopupEntity(Loc.GetString("butcherable-knife-butchered-success", ("target", ev.Entity), ("knife", ev.Sharp)),
popupEnt, Filter.Entities(ev.User), PopupType.Large);
popupEnt, Filter.Entities(ev.User), PopupType.LargeCaution);
if (TryComp<SharedBodyComponent>(ev.Entity, out var body))
{

View File

@@ -33,7 +33,7 @@ public sealed class LandMineSystem : EntitySystem
Loc.GetString("land-mine-triggered", ("mine", uid)),
Transform(uid).Coordinates,
Filter.Entities(args.Tripper),
PopupType.Critical);
PopupType.LargeCaution);
}
if (component.DeleteOnActivate)

View File

@@ -46,7 +46,7 @@ namespace Content.Server.Morgue
if (mind.OwnedEntity is { Valid: true } entity)
{
_popup.PopupEntity(Loc.GetString("crematorium-entity-storage-component-suicide-message"), entity,
Filter.Pvs(entity, entityManager: EntityManager), PopupType.Critical);
Filter.Pvs(entity, entityManager: EntityManager), PopupType.MediumCaution);
}
}

View File

@@ -542,7 +542,7 @@ namespace Content.Server.Nuke
_doAfterSystem.DoAfter(doafter);
_popups.PopupEntity(Loc.GetString("nuke-component-doafter-warning"), user,
Filter.Entities(user), PopupType.Large);
Filter.Entities(user), PopupType.LargeCaution);
}
private void NukeArmedAudio(NukeComponent component)

View File

@@ -48,11 +48,11 @@ namespace Content.Server.Toilet
{
var othersMessage = Loc.GetString("toilet-component-suicide-head-message-others",
("victim", args.Victim), ("owner", uid));
_popupSystem.PopupEntity(othersMessage, uid, Filter.PvsExcept(args.Victim), PopupType.Critical);
_popupSystem.PopupEntity(othersMessage, uid, Filter.PvsExcept(args.Victim), PopupType.MediumCaution);
var selfMessage = Loc.GetString("toilet-component-suicide-head-message",
("owner", uid));
_popupSystem.PopupEntity(selfMessage, uid, Filter.Entities(args.Victim), PopupType.Critical);
_popupSystem.PopupEntity(selfMessage, uid, Filter.Entities(args.Victim), PopupType.LargeCaution);
args.SetHandled(SuicideKind.Asphyxiation);
}
@@ -60,11 +60,11 @@ namespace Content.Server.Toilet
{
var othersMessage = Loc.GetString("toilet-component-suicide-message-others",
("victim", args.Victim), ("owner", uid));
_popupSystem.PopupEntity(othersMessage, uid, Filter.PvsExcept(uid), PopupType.Critical);
_popupSystem.PopupEntity(othersMessage, uid, Filter.PvsExcept(uid), PopupType.MediumCaution);
var selfMessage = Loc.GetString("toilet-component-suicide-message",
("owner", uid));
_popupSystem.PopupEntity(selfMessage, uid, Filter.Entities(args.Victim), PopupType.Critical);
_popupSystem.PopupEntity(selfMessage, uid, Filter.Entities(args.Victim), PopupType.LargeCaution);
args.SetHandled(SuicideKind.Blunt);
}

View File

@@ -93,12 +93,12 @@ namespace Content.Shared.Popups
}
/// <summary>
/// Used to determine how a popup should appear visually to the client.
/// Used to determine how a popup should appear visually to the client. Caution variants simply have a red color.
/// </summary>
/// <remarks>
/// Actions which can fail or succeed should use a smaller popup for failure and a larger popup for success.
/// Actions which have different popups for the user vs. others should use a larger popup for the user and a smaller popup for others.
/// Actions which result in immediate death for a user should almost always show as critical to all parties, such as suicides or smites.
/// Actions which result in harm or are otherwise dangerous should always show as the caution variant.
/// </remarks>
[Serializable, NetSerializable]
public enum PopupType : byte
@@ -107,20 +107,17 @@ namespace Content.Shared.Popups
/// Small popups are the default, and denote actions that may be spammable or are otherwise unimportant.
/// </summary>
Small,
SmallCaution,
/// <summary>
/// Medium popups should be used for actions which are not spammable but may not be particularly important.
/// </summary>
Medium,
MediumCaution,
/// <summary>
/// Large popups should be used for actions which may be important or very important to one or more users,
/// but is not life-threatening.
/// </summary>
Large,
/// <summary>
/// Critical popups should be used very sparingly, should not be used on anything that is spammable,
/// and should primarily be used when showing popups to one user. Critical popups denote actions which
/// may be directly life-threatening.
/// </summary>
Critical
LargeCaution
}
}

View File

@@ -15,7 +15,7 @@
Poison: 3
- !type:PopupMessage
type: Local
visualType: Critical
visualType: MediumCaution
messages: [ "generic-reagent-effect-burning-insides" ]
probability: 0.33

View File

@@ -55,7 +55,7 @@
effects:
- !type:PopupMessage
type: Local
visualType: Critical
visualType: MediumCaution
messages:
- "buzzochloricbees-effect-oh-god-bees"
- "buzzochloricbees-effect-its-the-bees"

View File

@@ -116,7 +116,7 @@
probability: 0.2
- !type:PopupMessage
messages: [ "clf3-it-burns", "clf3-get-away" ]
visualType: Critical
visualType: MediumCaution
probability: 0.3
type: Local

View File

@@ -39,7 +39,7 @@
Poison: 4
- !type:PopupMessage
type: Local
visualType: Critical
visualType: MediumCaution
messages: [ "generic-reagent-effect-burning-insides" ]
probability: 0.33

View File

@@ -23,7 +23,7 @@
- !type:CreateGas
gas: Plasma
- !type:PopupMessage
visualType: Critical
visualType: LargeCaution
messages: [ "phlogiston-plasma-created" ]
type: Pvs
products:
@@ -48,6 +48,6 @@
- !type:PopupMessage
messages: [ "clf3-explosion" ]
type: Pvs
visualType: Critical
visualType: LargeCaution
products:
ChlorineTrifluoride: 4