-
Notifications
You must be signed in to change notification settings - Fork 584
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port Dogtags from CD and fix some minor issues with it. ( DeltaV #2301)…
… (#2628) * Port Dogtags from CD and fix some minor issues with it. (#2301) * Port Dogtags from CD and fix some minor issues with it. * Addressing reviews * more engraveable items, system "fixes" * PDA next to cartridges, cadet/deputy badges * Reorder dogtags * Comment success localization change * "let's fix the badges" biggest mistake of my life * fix detective PDA order * bailiff neck fallbacks * fix sheriff fallbacks --------- Co-authored-by: Kr8art <[email protected]> Co-authored-by: Whatstone <[email protected]>
- Loading branch information
1 parent
ec47b70
commit f3108cb
Showing
31 changed files
with
261 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
namespace Content.Server._CD.Engraving; | ||
|
||
/// <summary> | ||
/// Allows an items' description to be modified with an engraving | ||
/// </summary> | ||
[RegisterComponent, Access(typeof(EngraveableSystem))] | ||
public sealed partial class EngraveableComponent : Component | ||
{ | ||
/// <summary> | ||
/// Message given to user to notify them a message was sent | ||
/// </summary> | ||
[DataField] | ||
public string EngravedMessage = string.Empty; | ||
|
||
/// <summary> | ||
/// The inspect text to use when there is no engraving | ||
/// </summary> | ||
[DataField] | ||
public LocId NoEngravingText = "engraving-generic-no-message"; // Frontier: "dogtags"<"generic" | ||
|
||
/// <summary> | ||
/// The message to use when successfully engraving the item | ||
/// </summary> | ||
[DataField] | ||
public LocId EngraveSuccessMessage = "engraving-generic-succeed"; // Frontier: "dogtags"<"generic" | ||
|
||
/// <summary> | ||
/// The inspect text to use when there is an engraving. The message will be shown seperately afterwards. | ||
/// </summary> | ||
[DataField] | ||
public LocId HasEngravingText = "engraving-generic-has-message"; // Frontier: "dogtags"<"generic" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
using Content.Server.Administration; | ||
using Content.Server.Administration.Logs; | ||
using Content.Server.Popups; | ||
using Content.Shared.Database; | ||
using Content.Shared.Popups; | ||
using Content.Shared.Examine; | ||
using Content.Shared.Verbs; | ||
using Robust.Shared.Player; | ||
using Robust.Shared.Utility; | ||
|
||
namespace Content.Server._CD.Engraving; | ||
|
||
public sealed class EngraveableSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IAdminLogManager _adminLogger = default!; | ||
[Dependency] private readonly PopupSystem _popup = default!; | ||
[Dependency] private readonly QuickDialogSystem _dialog = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<EngraveableComponent, ExaminedEvent>(OnExamined); | ||
SubscribeLocalEvent<EngraveableComponent, GetVerbsEvent<ActivationVerb>>(AddEngraveVerb); | ||
} | ||
|
||
private void OnExamined(Entity<EngraveableComponent> ent, ref ExaminedEvent args) | ||
{ | ||
var msg = new FormattedMessage(); | ||
// Frontier: don't localize the message, use args in fluent entries | ||
if (ent.Comp.EngravedMessage == string.Empty) | ||
msg.AddMarkupOrThrow(Loc.GetString(ent.Comp.NoEngravingText, ("object", ent))); | ||
else | ||
msg.AddMarkupOrThrow(Loc.GetString(ent.Comp.HasEngravingText, ("object", ent), ("message", ent.Comp.EngravedMessage))); | ||
// End Frontier | ||
|
||
args.PushMessage(msg, 1); | ||
} | ||
|
||
private void AddEngraveVerb(Entity<EngraveableComponent> ent, ref GetVerbsEvent<ActivationVerb> args) | ||
{ | ||
// First check if it's already been engraved. If it has, don't let them do it again. | ||
if (ent.Comp.EngravedMessage != string.Empty) | ||
return; | ||
|
||
// We need an actor to give the verb. | ||
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) | ||
return; | ||
|
||
// Make sure ghosts can't engrave stuff. | ||
if (!args.CanInteract) | ||
return; | ||
|
||
var engraveVerb = new ActivationVerb | ||
{ | ||
Text = Loc.GetString("engraving-verb-engrave"), | ||
Act = () => | ||
{ | ||
_dialog.OpenDialog(actor.PlayerSession, | ||
Loc.GetString("engraving-verb-engrave"), | ||
Loc.GetString("engraving-popup-ui-message"), | ||
(string message) => | ||
{ | ||
// If either the actor or comp have magically vanished | ||
if (actor.PlayerSession.AttachedEntity == null || !HasComp<EngraveableComponent>(ent)) | ||
return; | ||
|
||
ent.Comp.EngravedMessage = message; | ||
_popup.PopupEntity(Loc.GetString(ent.Comp.EngraveSuccessMessage, ("object", ent)), // Frontier: add object argument | ||
actor.PlayerSession.AttachedEntity.Value, | ||
actor.PlayerSession, | ||
PopupType.Medium); | ||
_adminLogger.Add(LogType.Action, | ||
LogImpact.Low, | ||
$"{ToPrettyString(actor.PlayerSession.AttachedEntity):player} engraved an item with message: {message}"); | ||
}); | ||
}, | ||
Impact = LogImpact.Low, | ||
}; | ||
engraveVerb.Impact = LogImpact.Low; | ||
args.Verbs.Add(engraveVerb); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
engraving-verb-engrave = Engrave | ||
engraving-popup-ui-message = Description | ||
# Frontier: generic engraving messages | ||
engraving-generic-no-message = There isn't anything engraved on {THE($object)}. | ||
engraving-generic-has-message = There's a message engraved on {THE($object)}. It reads: {$message} | ||
engraving-generic-succeed = You successfully engrave {THE($object)} with your message. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
Resources/Prototypes/_CD/Entities/Objects/Misc/dogtags.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
- type: entity | ||
id: CDDogtags | ||
parent: ClothingNeckBase | ||
name: dogtags | ||
description: A set of dogtags, hanging from a small piece of cord for wearing and carrying. | ||
components: | ||
- type: Sprite | ||
sprite: _CD/Objects/Misc/dogtags.rsi | ||
layers: | ||
- state: dogtag | ||
- type: Clothing | ||
sprite: _CD/Objects/Misc/dogtags.rsi | ||
- type: Appearance | ||
- type: Engraveable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- type: loadout | ||
id: CDDogtags | ||
storage: | ||
back: | ||
- CDDogtags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
- type: loadout | ||
id: BrigmedicClothingNeckMantleBrigmedic | ||
id: BrigmedicClothingNeckNfsdBadgeSecurityBrigmedic | ||
equipment: | ||
neck: ClothingNeckNfsdBadgeSecurityBrigmedic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#T0 | ||
- type: loadout | ||
id: NFDetectiveClothingNeckBadgeNFDetective | ||
id: NFDetectiveClothingNeckNfsdBadgeDetective | ||
equipment: | ||
neck: ClothingNeckNfsdBadgeSecurity | ||
neck: ClothingNeckNfsdBadgeDetective |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#T0 | ||
- type: loadout | ||
id: PalClothingNeckPublicAffairsLiaisonBadge | ||
equipment: | ||
neck: ClothingNeckPublicAffairsLiaisonBadge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.