From 73b4060c651fbf9caaf1741bb7697aed276191e2 Mon Sep 17 00:00:00 2001
From: Ed <96445749+TheShuEd@users.noreply.github.com>
Date: Wed, 12 Feb 2025 17:20:50 +0300
Subject: [PATCH] passport (#886)
---
.../_CP14/MagicSpell/CP14MagicSystem.cs | 1 -
.../_CP14/Passport/CP14PassportComponent.cs | 9 +++
.../_CP14/Passport/CP14PassportSystem.cs | 63 ++++++++++++++++++
.../Locale/en-US/_CP14/passport/passport.ftl | 6 ++
.../Locale/ru-RU/_CP14/passport/passport.ftl | 6 ++
.../Entities/Objects/Bureaucracy/passport.yml | 37 ++++++++++
.../_CP14/Interface/Paper/paper_passport.png | Bin 0 -> 2134 bytes
.../_CP14/Interface/Paper/paper_passport.yml | 2 +
.../Bureaucracy/paper.rsi/inhand-left.png | Bin 275 -> 0 bytes
.../Bureaucracy/paper.rsi/inhand-right.png | Bin 283 -> 0 bytes
.../Objects/Bureaucracy/paper.rsi/meta.json | 13 ++--
.../Bureaucracy/paper.rsi/passport.png | Bin 0 -> 333 bytes
12 files changed, 127 insertions(+), 10 deletions(-)
create mode 100644 Content.Server/_CP14/Passport/CP14PassportComponent.cs
create mode 100644 Content.Server/_CP14/Passport/CP14PassportSystem.cs
create mode 100644 Resources/Locale/en-US/_CP14/passport/passport.ftl
create mode 100644 Resources/Locale/ru-RU/_CP14/passport/passport.ftl
create mode 100644 Resources/Prototypes/_CP14/Entities/Objects/Bureaucracy/passport.yml
create mode 100644 Resources/Textures/_CP14/Interface/Paper/paper_passport.png
create mode 100644 Resources/Textures/_CP14/Interface/Paper/paper_passport.yml
delete mode 100644 Resources/Textures/_CP14/Objects/Bureaucracy/paper.rsi/inhand-left.png
delete mode 100644 Resources/Textures/_CP14/Objects/Bureaucracy/paper.rsi/inhand-right.png
create mode 100644 Resources/Textures/_CP14/Objects/Bureaucracy/paper.rsi/passport.png
diff --git a/Content.Server/_CP14/MagicSpell/CP14MagicSystem.cs b/Content.Server/_CP14/MagicSpell/CP14MagicSystem.cs
index fd4d598323..8cb4a6f084 100644
--- a/Content.Server/_CP14/MagicSpell/CP14MagicSystem.cs
+++ b/Content.Server/_CP14/MagicSpell/CP14MagicSystem.cs
@@ -5,7 +5,6 @@ using Content.Shared._CP14.MagicSpell;
using Content.Shared._CP14.MagicSpell.Components;
using Content.Shared._CP14.MagicSpell.Events;
using Content.Shared._CP14.MagicSpell.Spells;
-using Content.Shared.EntityEffects;
using Content.Shared.Whitelist;
using Robust.Server.GameObjects;
diff --git a/Content.Server/_CP14/Passport/CP14PassportComponent.cs b/Content.Server/_CP14/Passport/CP14PassportComponent.cs
new file mode 100644
index 0000000000..e69083395b
--- /dev/null
+++ b/Content.Server/_CP14/Passport/CP14PassportComponent.cs
@@ -0,0 +1,9 @@
+namespace Content.Server._CP14.Passport;
+
+///
+/// Generates a paper text confirming the identity of the player and stamps it.
+///
+[RegisterComponent]
+public sealed partial class CP14PassportComponent : Component
+{
+}
diff --git a/Content.Server/_CP14/Passport/CP14PassportSystem.cs b/Content.Server/_CP14/Passport/CP14PassportSystem.cs
new file mode 100644
index 0000000000..51d81200af
--- /dev/null
+++ b/Content.Server/_CP14/Passport/CP14PassportSystem.cs
@@ -0,0 +1,63 @@
+using System.Text;
+using Content.Shared.GameTicking;
+using Content.Shared.Hands.EntitySystems;
+using Content.Shared.Paper;
+using Content.Shared.Roles;
+using Robust.Shared.Prototypes;
+using Robust.Shared.Random;
+
+namespace Content.Server._CP14.Passport;
+
+public sealed partial class CP14PassportSystem : EntitySystem
+{
+ [Dependency] private readonly IPrototypeManager _proto = default!;
+ [Dependency] private readonly PaperSystem _paper = default!;
+ [Dependency] private readonly SharedHandsSystem _hands = default!;
+ [Dependency] private readonly IRobustRandom _random = default!;
+
+ public readonly EntProtoId PassportProto = "CP14Passport";
+ public override void Initialize()
+ {
+ base.Initialize();
+
+ SubscribeLocalEvent(OnPlayerSpawning);
+ }
+
+ private void OnPlayerSpawning(PlayerSpawnCompleteEvent ev)
+ {
+ var passport = Spawn(PassportProto, Transform(ev.Mob).Coordinates);
+
+ if (!TryComp(passport, out var paper))
+ return;
+
+ var text = GeneratePassportText(ev);
+ _paper.SetContent((passport, paper), text);
+ _paper.TryStamp((passport, paper),
+ new StampDisplayInfo
+ {
+ StampedColor = Color.FromHex("#0a332a"),
+ StampedName = Loc.GetString("cp14-passport-stamp")
+ },
+ "");
+ _hands.TryPickupAnyHand(ev.Mob, passport);
+ }
+
+ private string GeneratePassportText(PlayerSpawnCompleteEvent ev)
+ {
+ var sb = new StringBuilder();
+
+ //Name
+ sb.AppendLine(Loc.GetString("cp14-passport-name", ("name", ev.Profile.Name)));
+ //Species
+ if (_proto.TryIndex(ev.Profile.Species, out var indexedSpecies))
+ sb.AppendLine(Loc.GetString("cp14-passport-species", ("species", Loc.GetString(indexedSpecies.Name))));
+ //Birthday
+ var birthday = $"{_random.Next(40)}.{_random.Next(12)}.{225 - ev.Profile.Age}";
+ sb.AppendLine(Loc.GetString("cp14-passport-birth-date", ("birthday", birthday)));
+ //Job
+ if (ev.JobId is not null && _proto.TryIndex(ev.JobId, out var indexedJob))
+ sb.AppendLine(Loc.GetString("cp14-passport-job", ("job", Loc.GetString(indexedJob.Name))));
+
+ return sb.ToString();
+ }
+}
diff --git a/Resources/Locale/en-US/_CP14/passport/passport.ftl b/Resources/Locale/en-US/_CP14/passport/passport.ftl
new file mode 100644
index 0000000000..264f0c69f4
--- /dev/null
+++ b/Resources/Locale/en-US/_CP14/passport/passport.ftl
@@ -0,0 +1,6 @@
+cp14-passport-name = Name: {$name}
+cp14-passport-species = Race: {$species}
+cp14-passport-birth-date = Date of Birth: {$birthday}
+cp14-passport-job = Job: {$job}
+
+cp14-passport-stamp = Passport approved
\ No newline at end of file
diff --git a/Resources/Locale/ru-RU/_CP14/passport/passport.ftl b/Resources/Locale/ru-RU/_CP14/passport/passport.ftl
new file mode 100644
index 0000000000..e3c712455e
--- /dev/null
+++ b/Resources/Locale/ru-RU/_CP14/passport/passport.ftl
@@ -0,0 +1,6 @@
+cp14-passport-name = Имя: {$name}
+cp14-passport-species = Раса: {$species}
+cp14-passport-birth-date = Дата рождения: {$birthday}
+cp14-passport-job = Профессия: {$job}
+
+cp14-passport-stamp = Паспорт утвержден
\ No newline at end of file
diff --git a/Resources/Prototypes/_CP14/Entities/Objects/Bureaucracy/passport.yml b/Resources/Prototypes/_CP14/Entities/Objects/Bureaucracy/passport.yml
new file mode 100644
index 0000000000..4919e88658
--- /dev/null
+++ b/Resources/Prototypes/_CP14/Entities/Objects/Bureaucracy/passport.yml
@@ -0,0 +1,37 @@
+- type: entity
+ parent: BaseItem
+ id: CP14Passport
+ categories: [ ForkFiltered ]
+ name: passport
+ description: Identification document.
+ components:
+ - type: Paper
+ - type: PaperLabelType
+ - type: ActivatableUI
+ key: enum.PaperUiKey.Key
+ requiresComplex: false
+ - type: UserInterface
+ interfaces:
+ enum.PaperUiKey.Key:
+ type: PaperBoundUserInterface
+ - type: Item
+ size: Tiny
+ - type: Tag
+ tags:
+ - Document
+ - type: Sprite
+ sprite: _CP14/Objects/Bureaucracy/paper.rsi
+ layers:
+ - state: passport
+ - type: PaperVisuals
+ backgroundImagePath: "/Textures/Interface/Paper/paper_background_book.svg.96dpi.png"
+ headerImagePath: "/Textures/_CP14/Interface/Paper/paper_passport.png"
+ headerMargin: 0.0, 0.0, 0.0, 4.0
+ backgroundImageTile: false
+ backgroundPatchMargin: 23.0, 16.0, 14.0, 15.0
+ contentMargin: 12.0, 0.0, 6.0, 0.0
+ maxWritableArea: 300.0, 246.0
+ backgroundModulate: "#baa580"
+ backgroundScale: 2, 2
+ contentImagePath: "/Textures/Interface/Paper/paper_content_lined.svg.96dpi.png"
+ contentImageModulate: "#998665"
\ No newline at end of file
diff --git a/Resources/Textures/_CP14/Interface/Paper/paper_passport.png b/Resources/Textures/_CP14/Interface/Paper/paper_passport.png
new file mode 100644
index 0000000000000000000000000000000000000000..77306e199bca423e6c14412e007ae4c61232c06c
GIT binary patch
literal 2134
zcma)7X*ipS8vRnSR;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b@Z#1-)qfS!MI
zDhmvIxWcNOAY-JmW^(GZ4*eDzvke1!=c}G!cQo7k*{7k)7
z9KvA@QHKMdiBvtTci6GvGTIzHc}cB-eVb$=Ih-FSt(MjZ%FzLg(uXKsD^=bv4J(Z^
z%jo2@4dYr~qRs1T9@33B`at%27T5TXYpV-8gjSexYZa!X2*sj0^?_K8?h7sC?|Vn?
zEk;DK@+OdJQ>huN4Ib3-ncLv5;aB^gUbwsJbWxIR#@f~m{Ft%$DnOWJuC5dzPc2lqtGIo@pZ%NiRFFl#Hf
zs~%u_&+g9@n=ue9x0^W+7Exg>D-{DNT0vKG#-Birj5%ZxWxq%71G@RN9@{4dK(PV|d=W48l-$8c<&;T1J1+
zoTi^N>}f#gzT`D)Pa=grpMTI9>7-_v^yM#5c9};UWEhih71ZL
z_>4A0YI5c08MOCSp1JwY$L4zseCAvh&s@EWLpd%o@^Px)P@0yZ%uKe4&f+O=9qp*d
zb5%Q+A-DmSJ88BLFcYtNdn!kf4}}D
zs22zlrY<`bi)Eg7rz9~7LjG2OWaq6kRV1qG+-O<_EFRLP`o
zT~N}*H}k*WOo$eD{PUB4J*&p&E54ssWXhdAcJu!I=-G*%>=L@qdS9~Lxz?^wJ-+*<
zGf;2ex=Blpf8Ls*-(D$y;o8wf=aMh6Zo5=|_*I^838TvH?amAge;Umfue4oT%HZ4y
Ove(nq&t;ucLK6TaU26LP
diff --git a/Resources/Textures/_CP14/Objects/Bureaucracy/paper.rsi/inhand-right.png b/Resources/Textures/_CP14/Objects/Bureaucracy/paper.rsi/inhand-right.png
deleted file mode 100644
index 1df4f5591d67e4adbfeaa57b20a584ac95cea4f3..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 283
zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|u6nvShE&XX
zd&`io$w1`T$K{0=W@OxX60~mKq2vN4aWyeD_ZUlwD5Nb3A0OIArF=efs}aH$Gl2
zHqI5O9S9ow=k@=dV0BoexOiPM>&2uZ#$DU`XDZLwY5B6@3geX(T`@;hIUq_I7#2i@
zK5<_2a!c368y`z1+%1z&%@<{rFfEnb!!0KMK;HQ9y0=HIl&{TvaR0VWQq*?&D=!&YgH#_4%Iq)|;{cqCX4HZIXzb^x+rlz1wl8FVD>1!?ob=1)yJD
ZT;k?6I~-YartlodT2EI$mvv4FO#q4!bngHF
diff --git a/Resources/Textures/_CP14/Objects/Bureaucracy/paper.rsi/meta.json b/Resources/Textures/_CP14/Objects/Bureaucracy/paper.rsi/meta.json
index 7436e63dd1..0e3f39b154 100644
--- a/Resources/Textures/_CP14/Objects/Bureaucracy/paper.rsi/meta.json
+++ b/Resources/Textures/_CP14/Objects/Bureaucracy/paper.rsi/meta.json
@@ -1,7 +1,7 @@
{
"version": 1,
"license": "CC-BY-SA-4.0",
- "copyright": "Created by Max Gab, folders by TheShuEd, stamps on paper by viator1748",
+ "copyright": "Created by Max Gab, folders and passport by TheShuEd, stamps on paper by viator1748",
"size": {
"x": 32,
"y": 32
@@ -19,14 +19,6 @@
{
"name": "paper_filled"
},
- {
- "name": "inhand-left",
- "directions": 4
- },
- {
- "name": "inhand-right",
- "directions": 4
- },
{
"name": "approved_on_paper"
},
@@ -50,6 +42,9 @@
},
{
"name": "magic"
+ },
+ {
+ "name": "passport"
}
]
}
diff --git a/Resources/Textures/_CP14/Objects/Bureaucracy/paper.rsi/passport.png b/Resources/Textures/_CP14/Objects/Bureaucracy/paper.rsi/passport.png
new file mode 100644
index 0000000000000000000000000000000000000000..b5d93701d7d4c2ab4e7ad57c5c1f71b048e65a28
GIT binary patch
literal 333
zcmV-T0kZyyP)Px$2T4RhR9J=Wl)q}iP!xy17XK7O9o$MMq1i=zh-@8-lZy{fCm+Q=fO~1dMI4KmgWrVrF-_v)xSr+3Z0B;|6X9