Skip to content

Commit

Permalink
Merge pull request #1255 from Darkmajia/stamp-icons
Browse files Browse the repository at this point in the history
stamp icons
  • Loading branch information
formlessnameless authored Jan 8, 2025
2 parents ec861db + 7297bfb commit 5dcabf5
Show file tree
Hide file tree
Showing 22 changed files with 77 additions and 12 deletions.
40 changes: 30 additions & 10 deletions Content.Client/Paper/UI/StampWidget.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Content.Client.Paper.UI;
[GenerateTypedNameReferences]
public sealed partial class StampWidget : PanelContainer
{
private StyleBoxTexture _borderTexture;
private StyleBoxTexture? _borderTexture;
private ShaderInstance? _stampShader;

public float Orientation
Expand All @@ -23,26 +23,46 @@ public float Orientation

public StampDisplayInfo StampInfo {
set {
StampedByLabel.Text = Loc.GetString(value.StampedName);
StampedByLabel.FontColorOverride = value.StampedColor;
ModulateSelfOverride = value.StampedColor;
var icon = value.StampLargeIcon;
if (icon != null)
{
var resCache = IoCManager.Resolve<IResourceCache>();
var borderImage = resCache.GetResource<TextureResource>(
"/Textures/_Impstation/Interface/Paper/Stamps/" + icon + ".png");

_borderTexture = new StyleBoxTexture { Texture = borderImage };
PanelOverride = _borderTexture;

// make stamps 50% larger to better match the original stamp sizes
var width = (int)(borderImage.Texture.Width * 1.5);
var height = (int)(borderImage.Texture.Height * 1.5);
SetSize = new Vector2(width, height);
}

else
{
StampedByLabel.Text = Loc.GetString(value.StampedName);
StampedByLabel.FontColorOverride = value.StampedColor;
ModulateSelfOverride = value.StampedColor;
}
}
}

public StampWidget()
{
RobustXamlLoader.Load(this);
var prototypes = IoCManager.Resolve<IPrototypeManager>();
_stampShader = prototypes.Index<ShaderPrototype>("PaperStamp").InstanceUnique();

if (PanelOverride != null)
return;

var resCache = IoCManager.Resolve<IResourceCache>();
var borderImage = resCache.GetResource<TextureResource>(
"/Textures/Interface/Paper/paper_stamp_border.svg.96dpi.png");
_borderTexture = new StyleBoxTexture {
Texture = borderImage,
};
_borderTexture = new StyleBoxTexture { Texture = borderImage };
_borderTexture.SetPatchMargin(StyleBoxTexture.Margin.All, 7.0f);
PanelOverride = _borderTexture;

var prototypes = IoCManager.Resolve<IPrototypeManager>();
_stampShader = prototypes.Index<ShaderPrototype>("PaperStamp").InstanceUnique();
}

protected override void Draw(DrawingHandleScreen handle)
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Nuke/NukeCodePaperSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public bool SendNukeCodes(EntityUid station)
"paper_stamp-centcom",
new List<StampDisplayInfo>
{
new StampDisplayInfo { StampedName = Loc.GetString("stamp-component-stamped-name-centcom"), StampedColor = Color.FromHex("#BB3232") },
new StampDisplayInfo { StampedName = Loc.GetString("stamp-component-stamped-name-centcom"), StampedColor = Color.FromHex("#BB3232"), StampLargeIcon = "large_stamp-centcom" },
}
);
_faxSystem.Receive(faxEnt, printout, null, fax);
Expand Down
3 changes: 2 additions & 1 deletion Content.Shared/Paper/PaperSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ private static StampDisplayInfo GetStampInfo(StampComponent stamp)
return new StampDisplayInfo
{
StampedName = stamp.StampedName,
StampedColor = stamp.StampedColor
StampedColor = stamp.StampedColor,
StampLargeIcon = stamp.StampLargeIcon
};
}

Expand Down
9 changes: 9 additions & 0 deletions Content.Shared/Paper/StampComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public partial struct StampDisplayInfo

[DataField("stampedColor")]
public Color StampedColor;

[DataField("stampLargeIcon")]
public string? StampLargeIcon;
};

[RegisterComponent]
Expand All @@ -39,6 +42,12 @@ public sealed partial class StampComponent : Component
[DataField("stampState")]
public string StampState { get; set; } = "paper_stamp-generic";

/// <summary>
/// The sprite state of the stamp to display on the paper when read from stamp Sprite path.
/// </summary>
[DataField("stampLargeIcon")]
public string? StampLargeIcon = null;

/// <summary>
/// The color of the ink used by the stamp in UIs
/// </summary>
Expand Down
15 changes: 15 additions & 0 deletions Resources/Prototypes/Entities/Objects/Misc/rubber_stamp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
stampedName: stamp-component-stamped-name-captain
stampedColor: "#3681bb"
stampState: "paper_stamp-cap"
stampLargeIcon: "large_stamp-cap" # imp
- type: Sprite
state: stamp-cap

Expand All @@ -63,6 +64,7 @@
stampedName: stamp-component-stamped-name-centcom
stampedColor: "#006600"
stampState: "paper_stamp-centcom"
stampLargeIcon: "large_stamp-centcom" # imp
- type: Sprite
state: stamp-centcom

Expand All @@ -76,6 +78,7 @@
stampedName: stamp-component-stamped-name-chaplain
stampedColor: "#d70601"
stampState: "paper_stamp-chaplain"
stampLargeIcon: "large_stamp-chap" # imp
- type: Sprite
state: stamp-chaplain

Expand All @@ -89,6 +92,7 @@
stampedName: stamp-component-stamped-name-lawyer
stampedColor: "#233D57"
stampState: "paper_stamp-lawyer"
stampLargeIcon: "large_stamp-law" # imp
- type: Sprite
state: stamp-lawyer

Expand All @@ -102,6 +106,7 @@
stampedName: stamp-component-stamped-name-clown
stampedColor: "#ff33cc"
stampState: "paper_stamp-clown"
stampLargeIcon: "large_stamp-clown" # imp
- type: Sprite
state: stamp-clown
- type: Tag
Expand All @@ -118,6 +123,7 @@
stampedName: stamp-component-stamped-name-ce
stampedColor: "#c69b17"
stampState: "paper_stamp-ce"
stampLargeIcon: "large_stamp-ce" # imp
- type: Sprite
state: stamp-ce

Expand All @@ -131,6 +137,7 @@
stampedName: stamp-component-stamped-name-cmo
stampedColor: "#33ccff"
stampState: "paper_stamp-cmo"
stampLargeIcon: "large_stamp-cmo" # imp
- type: Sprite
state: stamp-cmo

Expand All @@ -144,6 +151,7 @@
stampedName: stamp-component-stamped-name-hop
stampedColor: "#6ec0ea"
stampState: "paper_stamp-hop"
stampLargeIcon: "large_stamp-hop" # imp
- type: Sprite
state: stamp-hop

Expand All @@ -157,6 +165,7 @@
stampedName: stamp-component-stamped-name-hos
stampedColor: "#cc0000"
stampState: "paper_stamp-hos"
stampLargeIcon: "large_stamp-hos" # imp
- type: Sprite
state: stamp-hos

Expand All @@ -170,6 +179,7 @@
stampedName: stamp-component-stamped-name-mime
stampedColor: "#777777"
stampState: "paper_stamp-mime"
stampLargeIcon: "large_stamp-mime" # imp
sound: null
- type: Sprite
state: stamp-mime
Expand All @@ -184,6 +194,7 @@
stampedName: stamp-component-stamped-name-qm
stampedColor: "#a23e3e"
stampState: "paper_stamp-qm"
stampLargeIcon: "large_stamp-qm" # imp
- type: Sprite
state: stamp-qm

Expand All @@ -197,6 +208,7 @@
stampedName: stamp-component-stamped-name-rd
stampedColor: "#1f66a0"
stampState: "paper_stamp-rd"
stampLargeIcon: "large_stamp-rd" # imp
- type: Sprite
state: stamp-rd

Expand All @@ -222,6 +234,7 @@
stampedName: stamp-component-stamped-name-syndicate
stampedColor: "#850000"
stampState: "paper_stamp-syndicate"
stampLargeIcon: "large_stamp-syndicate" # imp
- type: Sprite
state: stamp-syndicate

Expand All @@ -247,6 +260,7 @@
stampedName: stamp-component-stamped-name-approved
stampedColor: "#00be00"
stampState: "paper_stamp-ok"
stampLargeIcon: "large_stamp-ok" # imp
- type: Sprite
state: stamp-ok

Expand All @@ -259,6 +273,7 @@
stampedName: stamp-component-stamped-name-denied
stampedColor: "#a23e3e"
stampState: "paper_stamp-deny"
stampLargeIcon: "large_stamp-deny" # imp
- type: Sprite
state: stamp-deny

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- files:
- large_stamp-cap.png
- large_stamp-ce.png
- large_stamp-centcom.png
- large_stamp-chap.png
- large_stamp-clown.png
- large_stamp-cmo.png
- large_stamp-deny.png
- large_stamp-hop.png
- large_stamp-hos.png
- large_stamp-law.png
- large_stamp-mime.png
- large_stamp-ok.png
- large_stamp-qm.png
- large_stamp-rd.png
- large_stamp-syndicate.png
- large_stamp-void.png
license: "CC-BY-SA-3.0"
copyright: "Stamp icons taken from tgstation"
source: "https://github.com/tgstation/tgstation/commit/9a9b428b61f388a0f6d7a20bbba05147e61023d0"
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.
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.
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.
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.
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.
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.
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.
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.

0 comments on commit 5dcabf5

Please sign in to comment.