Skip to content

Commit

Permalink
Add protected stamps and a weaker cyberpen (#2698)
Browse files Browse the repository at this point in the history
  • Loading branch information
whatston3 authored Jan 16, 2025
1 parent 8b707fd commit 5ca4890
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 8 deletions.
16 changes: 12 additions & 4 deletions Content.Shared/Paper/PaperSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
using Content.Shared.Timing; // Frontier
using Content.Shared.Access.Systems; // Frontier
using Content.Shared.Verbs; // Frontier
using Content.Shared.Ghost; // Frontier
using Content.Shared.Ghost;
using Content.Shared.Mobs; // Frontier

namespace Content.Shared.Paper;

Expand Down Expand Up @@ -134,7 +135,8 @@ private void OnExamined(Entity<PaperComponent> entity, ref ExaminedEvent args)
private void OnInteractUsing(Entity<PaperComponent> entity, ref InteractUsingEvent args)
{
// only allow editing if there are no stamps or when using a cyberpen
var editable = entity.Comp.StampedBy.Count == 0 || _tagSystem.HasTag(args.Used, "WriteIgnoreStamps");
var editable = entity.Comp.StampedBy.Count == 0 || _tagSystem.HasTag(args.Used, "WriteIgnoreStamps")
|| _tagSystem.HasTag(args.Used, "NFWriteIgnoreUnprotectedStamps") && !_tagSystem.HasTag(entity, "NFPaperStampProtected"); // Frontier: protected stamps
if (_tagSystem.HasTag(args.Used, "Write") && editable)
{
if (entity.Comp.EditingDisabled)
Expand Down Expand Up @@ -184,9 +186,15 @@ private void OnInteractUsing(Entity<PaperComponent> entity, ref InteractUsingEve

_audio.PlayPredicted(stampComp.Sound, entity, args.User);

UpdateUserInterface(entity);
// Frontier: stamp delay and protection
DelayStamp(args.Used);

// Note: mode is not changed here, anyone with an open paper may still save changes.
if (stampComp.Protected)
_tagSystem.AddTag(entity, "NFPaperStampProtected");
// End Frontier

DelayStamp(args.Used); // Frontier: prevent stamp spam
UpdateUserInterface(entity);
} // Frontier: added an indent level
}
}
Expand Down
11 changes: 9 additions & 2 deletions Content.Shared/Paper/StampComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,18 @@ public sealed partial class StampComponent : Component
[DataField("sound")]
public SoundSpecifier? Sound = null;

// Frontier: allow reapplying stamps
// Frontier: allow reapplying stamps, protected stamps
/// <summary>
/// Whether or not a stamp can be reapplied
/// </summary>
[DataField("reapply")]
public bool Reapply { get; set; } = false;
// End Frontier: allow reapplying stamps

/// <summary>
/// When true, stamped papers are marked as protected
/// </summary>

[DataField]
public bool Protected = false;
// End Frontier
}
5 changes: 3 additions & 2 deletions Resources/Prototypes/Entities/Objects/Misc/pen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

- type: entity
id: BaseAdvancedPen
parent: [PenEmbeddable, BaseC3SyndicateContraband] # Frontier: add BaseC3SyndicateContraband
parent: PenEmbeddable
abstract: true
components:
- type: Tag
Expand All @@ -93,7 +93,8 @@

- type: entity
name: Cybersun pen
parent: [BaseAdvancedPen, BaseC3SyndicateContraband] # Frontier: BaseSyndicateContraband<BaseC3SyndicateContraband
# parent: [BaseAdvancedPen, BaseSyndicateContraband] # Frontier
parent: [NFBaseUnprotectedAdvancedPen, BaseC3SyndicateContraband] # Frontier
id: CyberPen
description: A high-tech pen straight from Cybersun's legal department, capable of refracting hard-light at impossible angles through its diamond tip in order to write. So powerful, it's even able to rewrite officially stamped documents should the need arise.
components:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
stampedName: stamp-component-stamped-name-centcom
stampedColor: "#006600"
stampState: "paper_stamp-centcom"
protected: True # Frontier
- type: Sprite
state: stamp-centcom

Expand Down
12 changes: 12 additions & 0 deletions Resources/Prototypes/_NF/Entities/Objects/Misc/pen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,15 @@
- type: Item
sprite: _NF/Objects/Misc/pens.rsi
heldPrefix: pen_pal

- type: entity
id: NFBaseUnprotectedAdvancedPen
parent: BaseAdvancedPen
abstract: true
components:
- type: Tag
tags:
- Write
- NFWriteIgnoreUnprotectedStamps # Weaker version of WriteIgnoreStamps
- Pickaxe
- Pen
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
stampedName: stamp-component-stamped-name-sr
stampedColor: "#6ec0ea"
stampState: "paper_stamp-hop"
protected: True
- type: Sprite
state: stamp-hop

Expand Down Expand Up @@ -34,6 +35,7 @@
stampedName: stamp-component-stamped-name-hos
stampedColor: "#4c653a"
stampState: "paper_stamp-nf-sheriff"
protected: True
- type: Sprite
sprite: _NF/Objects/Misc/stamps.rsi
state: stamp-sheriff
Expand Down
6 changes: 6 additions & 0 deletions Resources/Prototypes/_NF/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,9 @@

- type: Tag
id: NFFoamRPG

- type: Tag
id: NFWriteIgnoreUnprotectedStamps

- type: Tag
id: NFPaperStampProtected

0 comments on commit 5ca4890

Please sign in to comment.