-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into SusVend-Restock
- Loading branch information
Showing
13 changed files
with
177 additions
and
14 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-dogtags-no-message"; | ||
|
||
/// <summary> | ||
/// The message to use when successfully engraving the item | ||
/// </summary> | ||
[DataField] | ||
public LocId EngraveSuccessMessage = "engraving-dogtags-succeed"; | ||
|
||
/// <summary> | ||
/// The inspect text to use when there is an engraving. The message will be shown seperately afterwards. | ||
/// </summary> | ||
[DataField] | ||
public LocId HasEngravingText = "engraving-dogtags-has-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
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(); | ||
msg.AddMarkupOrThrow(Loc.GetString(ent.Comp.EngravedMessage == string.Empty | ||
? ent.Comp.NoEngravingText | ||
: ent.Comp.HasEngravingText)); | ||
|
||
if (ent.Comp.EngravedMessage != string.Empty) | ||
msg.AddMarkupPermissive(Loc.GetString(ent.Comp.EngravedMessage)); | ||
|
||
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), | ||
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
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
engraving-verb-engrave = Engrave | ||
engraving-popup-ui-message = Description | ||
engraving-dogtags-no-message = The dogtags don't seem to have any kind of engraving. | ||
engraving-dogtags-has-message = The dogtags are engraved with a message that reads:{" "} | ||
engraving-dogtags-succeed = You successfully engrave the dogtags 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
nuke-core-container-whitelist-fail-popup = That doesn't fit into the container. | ||
nuke-core-container-sealed-popup = The {$container} is sealed shut! | ||
nuke-core-container-closed-fail-popup = You need to open the container first! |
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 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,18 @@ | ||
{ | ||
"version": 1, | ||
"license": "CC-BY-SA-3.0", | ||
"copyright": "Taken from cmss13 at https://github.com/cmss13-devs/cmss13/blob/a2d5ca6e69725341f0fa261a4a3f89c737e843b3/icons/obj/items/card.dmi", | ||
"size": { | ||
"x": 32, | ||
"y": 32 | ||
}, | ||
"states": [ | ||
{ | ||
"name": "dogtag" | ||
}, | ||
{ | ||
"name": "equipped-NECK", | ||
"directions": 4 | ||
} | ||
] | ||
} |