diff --git a/Content.Client/_Sunrise/HyperLink/HyperLinkSystem.cs b/Content.Client/_Sunrise/HyperLink/HyperLinkSystem.cs new file mode 100644 index 0000000000..48e1fa4032 --- /dev/null +++ b/Content.Client/_Sunrise/HyperLink/HyperLinkSystem.cs @@ -0,0 +1,21 @@ +// Inspired by Nyanotrasen + +using Content.Shared.HyperLink; +using Robust.Client.UserInterface; + +namespace Content.Client.HyperLink; + +public sealed class HyperLinkSystem : EntitySystem +{ + public override void Initialize() + { + base.Initialize(); + SubscribeNetworkEvent(OnOpenURL); + } + + private void OnOpenURL(OpenURLEvent args) + { + var uriOpener = IoCManager.Resolve(); + uriOpener.OpenUri(args.URL); + } +} \ No newline at end of file diff --git a/Content.Server/_Sunrise/HyperLink/HyperLinkComponent.cs b/Content.Server/_Sunrise/HyperLink/HyperLinkComponent.cs new file mode 100644 index 0000000000..21e827dce6 --- /dev/null +++ b/Content.Server/_Sunrise/HyperLink/HyperLinkComponent.cs @@ -0,0 +1,11 @@ +// Inspired by Nyanotrasen + +namespace Content.Server.HyperLink; + +[RegisterComponent] +public sealed partial class HyperLinkComponent : Component +{ + [DataField("url")] + [ViewVariables(VVAccess.ReadWrite)] + public string URL = string.Empty; +} \ No newline at end of file diff --git a/Content.Server/_Sunrise/HyperLink/HyperLinkSystem.cs b/Content.Server/_Sunrise/HyperLink/HyperLinkSystem.cs new file mode 100644 index 0000000000..6ef56d88a5 --- /dev/null +++ b/Content.Server/_Sunrise/HyperLink/HyperLinkSystem.cs @@ -0,0 +1,30 @@ +// Inspired by Nyanotrasen + +using Robust.Shared.Player; +using Content.Shared.Interaction; +using Content.Shared.HyperLink; + +namespace Content.Server.HyperLink; + +public sealed class HyperLinkSystem : EntitySystem +{ + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnActivate); + } + + private void OnActivate(EntityUid uid, HyperLinkComponent component, ActivateInWorldEvent args) + { + if (!TryComp(args.User, out var actor)) + return; + + OpenURL(actor.PlayerSession, component.URL); + } + + public void OpenURL(ICommonSession session, string url) + { + var ev = new OpenURLEvent(url); + RaiseNetworkEvent(ev, session.Channel); + } +} diff --git a/Content.Shared/_Sunrise/HyperLink/SharedHyperLinkSystem.cs b/Content.Shared/_Sunrise/HyperLink/SharedHyperLinkSystem.cs new file mode 100644 index 0000000000..8c171cae59 --- /dev/null +++ b/Content.Shared/_Sunrise/HyperLink/SharedHyperLinkSystem.cs @@ -0,0 +1,15 @@ +// Inspired by Nyanotrasen + +using Robust.Shared.Serialization; + +namespace Content.Shared.HyperLink; + +[Serializable, NetSerializable] +public sealed class OpenURLEvent : EntityEventArgs +{ + public string URL { get; } + public OpenURLEvent(string url) + { + URL = url; + } +} \ No newline at end of file diff --git a/Resources/Locale/ru-RU/ss14-ru/prototypes/entities/objects/misc/books.ftl b/Resources/Locale/ru-RU/ss14-ru/prototypes/entities/objects/misc/books.ftl index 997819a514..40809c00ad 100644 --- a/Resources/Locale/ru-RU/ss14-ru/prototypes/entities/objects/misc/books.ftl +++ b/Resources/Locale/ru-RU/ss14-ru/prototypes/entities/objects/misc/books.ftl @@ -16,6 +16,8 @@ ent-BookScientistsGuidebook = Справочник учёного .desc = Путеводитель по миру науки, подготовленный Nanotrasen. ent-BookSecurity = Безопасность 101 .desc = Книга о безопасности на станции, подготовленная Nanotrasen. Книга испачкана кровью. Похоже, что её больше использовали как оружие, чем как учебное пособие. +ent-HyperLinkBookCorporateLaw = Корпоративный Закон + .desc = Корпоративный закон (КЗ) — свод требований корпорации NanoTrasen ко всем разумным существам на территории объектов корпорации. ent-BookHowToKeepStationClean = Как поддерживать чистоту на станции .desc = Эта книга очень аккуратная. ent-BookHowToRockAndStone = Пособие по камням и скалам diff --git a/Resources/Prototypes/Catalog/Fills/Books/bookshelf.yml b/Resources/Prototypes/Catalog/Fills/Books/bookshelf.yml index b52e853008..30a371137d 100644 --- a/Resources/Prototypes/Catalog/Fills/Books/bookshelf.yml +++ b/Resources/Prototypes/Catalog/Fills/Books/bookshelf.yml @@ -23,6 +23,8 @@ orGroup: BookPool - id: BookScientistsGuidebook orGroup: BookPool + - id: HyperLinkBookCorporateLaw # Sunrise-edit + orGroup: BookPool - id: BookSecurity orGroup: BookPool - id: BookHowToKeepStationClean diff --git a/Resources/Prototypes/Loadouts/Miscellaneous/trinkets.yml b/Resources/Prototypes/Loadouts/Miscellaneous/trinkets.yml index fe826a8334..a4e913a20a 100644 --- a/Resources/Prototypes/Loadouts/Miscellaneous/trinkets.yml +++ b/Resources/Prototypes/Loadouts/Miscellaneous/trinkets.yml @@ -18,7 +18,7 @@ storage: back: - PlushieLizard - + - type: loadout id: PlushieSpaceLizard equipment: PlushieSpaceLizard diff --git a/Resources/Prototypes/Loadouts/loadout_groups.yml b/Resources/Prototypes/Loadouts/loadout_groups.yml index d889514a33..ab89b8d019 100644 --- a/Resources/Prototypes/Loadouts/loadout_groups.yml +++ b/Resources/Prototypes/Loadouts/loadout_groups.yml @@ -5,6 +5,7 @@ minLimit: 0 maxLimit: 3 loadouts: + - CorporateLaw # Sunrise-edit - PlushieLizard - PlushieSpaceLizard - Lighter diff --git a/Resources/Prototypes/Roles/Jobs/Security/security_cadet.yml b/Resources/Prototypes/Roles/Jobs/Security/security_cadet.yml index 286989b535..4c68e73ede 100644 --- a/Resources/Prototypes/Roles/Jobs/Security/security_cadet.yml +++ b/Resources/Prototypes/Roles/Jobs/Security/security_cadet.yml @@ -36,4 +36,4 @@ ears: ClothingHeadsetSecurity belt: ClothingBeltSecurityFilled pocket1: WeaponPistolMk58 - pocket2: BookSecurity + pocket2: HyperLinkBookCorporateLaw # Sunrise-edit diff --git a/Resources/Prototypes/_Sunrise/Entities/Objects/Books/hyperlinkbooks.yml b/Resources/Prototypes/_Sunrise/Entities/Objects/Books/hyperlinkbooks.yml new file mode 100644 index 0000000000..9115af69b4 --- /dev/null +++ b/Resources/Prototypes/_Sunrise/Entities/Objects/Books/hyperlinkbooks.yml @@ -0,0 +1,34 @@ +# Inspired by Nyanotrasen + +- type: entity + parent: BaseItem + id: BaseHyperLinkBook + abstract: true + components: + - type: Sprite + sprite: Objects/Misc/books.rsi + - type: Tag + tags: + - Book + - type: StaticPrice + price: 35 + +- type: entity + parent: BaseHyperLinkBook + id: HyperLinkBookCorporateLaw + name: corporate law + description: A book of complicated laws for shitsec on station. + components: + - type: Sprite + sprite: Objects/Misc/books.rsi + layers: + - state: paper + - state: cover_base + color: "#ab1515" + - state: icon_law + color: "#fff300" + - type: HyperLink + url: https://sunrise14.top/wiki/index.php?title=%D0%9A%D0%BE%D1%80%D0%BF%D0%BE%D1%80%D0%B0%D1%82%D0%B8%D0%B2%D0%BD%D1%8B%D0%B9_%D0%97%D0%B0%D0%BA%D0%BE%D0%BD&oldid=6988#%D0%A1%D1%82%D0%B5%D0%BF%D0%B5%D0%BD%D0%B8_%D1%82%D1%8F%D0%B6%D0%B5%D1%81%D1%82%D0%B8_%D0%BD%D0%B0%D1%80%D1%83%D1%88%D0%B5%D0%BD%D0%B8%D1%8F_%D0%B8_%D1%81%D0%BE%D0%BE%D1%82%D0%B2%D0%B5%D1%82%D1%81%D1%82%D0%B2%D1%83%D1%8E%D1%89%D0%B8%D0%B5_%D0%BD%D0%B0%D0%BA%D0%B0%D0%B7%D0%B0%D0%BD%D0%B8%D1%8F + - type: Tag + tags: + - Book diff --git a/Resources/Prototypes/_Sunrise/Loadouts/Miscellaneous/corporate_law.yml b/Resources/Prototypes/_Sunrise/Loadouts/Miscellaneous/corporate_law.yml new file mode 100644 index 0000000000..c520edb0d5 --- /dev/null +++ b/Resources/Prototypes/_Sunrise/Loadouts/Miscellaneous/corporate_law.yml @@ -0,0 +1,9 @@ +- type: loadout + id: CorporateLaw + equipment: CorporateLaw + +- type: startingGear + id: CorporateLaw + storage: + pocket2: + - HyperLinkBookCorporateLaw diff --git a/Resources/Prototypes/_Sunrise/Roles/Jobs/Command/iaa.yml b/Resources/Prototypes/_Sunrise/Roles/Jobs/Command/iaa.yml index 8323084757..2f85db0906 100644 --- a/Resources/Prototypes/_Sunrise/Roles/Jobs/Command/iaa.yml +++ b/Resources/Prototypes/_Sunrise/Roles/Jobs/Command/iaa.yml @@ -33,5 +33,6 @@ id: IAAPDA eyes: ClothingEyesGlassesSunglasses ears: ClothingHeadsetIAA + pocket2: HyperLinkBookCorporateLaw inhand: - BriefcaseIAAFilled