Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Том Корпоративного Закона #2172

Merged
merged 13 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Content.Client/Corvax/HyperLinkBook/HyperLinkBookSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Inspired by Nyanotrasen

using Content.Shared.HyperLinkBook;
using Robust.Client.UserInterface;

namespace Content.Client.HyperLinkBook;

public sealed class HyperLinkBookSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeNetworkEvent<OpenURLEvent>(OnOpenURL);
}

private void OnOpenURL(OpenURLEvent args)
{
var uriOpener = IoCManager.Resolve<IUriOpener>();
uriOpener.OpenUri(args.URL);
}
}
11 changes: 11 additions & 0 deletions Content.Server/Corvax/HyperLinkBook/HyperLinkBookComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Inspired by Nyanotrasen

namespace Content.Server.HyperLinkBook;

[RegisterComponent]
public sealed partial class HyperLinkBookComponent : Component
{
[DataField("url")]
[ViewVariables(VVAccess.ReadWrite)]
public string URL = string.Empty;
}
52 changes: 52 additions & 0 deletions Content.Server/Corvax/HyperLinkBook/HyperLinkBookSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Inspired by Nyanotrasen

using Robust.Shared.Player;
using Content.Shared.Interaction;
using Content.Shared.Verbs;
using Content.Shared.HyperLinkBook;

namespace Content.Server.HyperLinkBook;

public sealed class HyperLinkBookSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<HyperLinkBookComponent, ActivateInWorldEvent>(OnActivate);
SubscribeLocalEvent<HyperLinkBookComponent, GetVerbsEvent<AlternativeVerb>>(AddAltVerb);
}

private void OnActivate(EntityUid uid, HyperLinkBookComponent component, ActivateInWorldEvent args)
{
if (!TryComp<ActorComponent>(args.User, out var actor))
return;

OpenURL(actor.PlayerSession, component.URL);
}

private void AddAltVerb(EntityUid uid, HyperLinkBookComponent component, GetVerbsEvent<AlternativeVerb> args)
{
if (!args.CanAccess || !args.CanInteract)
return;

if (!TryComp<ActorComponent>(args.User, out var actor))
return;

AlternativeVerb verb = new()
{
Act = () =>
{
OpenURL(actor.PlayerSession, component.URL);
},
Text = Loc.GetString("book-read-verb"),
Priority = -2
};
args.Verbs.Add(verb);
}

public void OpenURL(ICommonSession session, string url)
{
var ev = new OpenURLEvent(url);
RaiseNetworkEvent(ev, session.ConnectedClient);
}
}
15 changes: 15 additions & 0 deletions Content.Shared/Corvax/HyperLinkBook/SharedHyperLinkBookSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Inspired by Nyanotrasen

using Robust.Shared.Serialization;

namespace Content.Shared.HyperLinkBook;

[Serializable, NetSerializable]
public sealed class OpenURLEvent : EntityEventArgs
{
public string URL { get; }
public OpenURLEvent(string url)
{
URL = url;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ ent-BookScientistsGuidebook = Справочник учёного
.desc = Путеводитель по миру науки, подготовленный Nanotrasen.
ent-BookSecurity = Безопасность 101
.desc = Книга о безопасности на станции, подготовленная Nanotrasen. Книга испачкана кровью. Похоже, что её больше использовали как оружие, чем как учебное пособие.
ent-HyperLinkBookCorporateLaw = Корпоративный Закон
.desc = Корпоративный закон (КЗ) — свод требований корпорации NanoTrasen ко всем разумным существам на территории объектов корпорации. Данные регуляции категорически запрещено игнорировать, нарушать или пытаться видоизменить. Попадая на объект корпорации, все разумные существа обязуются соблюдать Корпоративный Закон.
ent-BookHowToKeepStationClean = Как поддерживать чистоту на станции
.desc = Эта книга очень аккуратная.
ent-BookHowToRockAndStone = Пособие по камням и скалам
Expand Down
2 changes: 2 additions & 0 deletions Resources/Prototypes/Catalog/Fills/Books/bookshelf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
orGroup: BookPool
- id: BookScientistsGuidebook
orGroup: BookPool
- id: HyperLinkBookCorporateLaw # Corvax-Books
pxc1984 marked this conversation as resolved.
Show resolved Hide resolved
orGroup: BookPool
- id: BookSecurity
orGroup: BookPool
- id: BookHowToKeepStationClean
Expand Down
pxc1984 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -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: HyperLinkBook
url: https://station14.ru/wiki/%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
- type: Tag
tags:
- Book
1 change: 1 addition & 0 deletions Resources/Prototypes/Corvax/Roles/Jobs/Command/iaa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@
id: IAAPDA
eyes: ClothingEyesGlassesSunglasses
ears: ClothingHeadsetIAA
pocket2: HyperLinkBookCorporateLaw
inhand:
- BriefcaseIAAFilled
11 changes: 11 additions & 0 deletions Resources/Prototypes/Loadouts/Miscellaneous/trinkets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,14 @@
storage:
back:
- ClothingNeckGoldAutismPin

# Corporate Law
- type: loadout
id: CorporateLaw
equipment: CorporateLaw

- type: startingGear
id: CorporateLaw
storage:
pocket2:
- HyperLinkBookCorporateLaw
pxc1984 marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions Resources/Prototypes/Loadouts/loadout_groups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
minLimit: 0
maxLimit: 3
loadouts:
- CorporateLaw
pxc1984 marked this conversation as resolved.
Show resolved Hide resolved
- PlushieLizard
- PlushieSpaceLizard
- Lighter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
ears: ClothingHeadsetSecurity
belt: ClothingBeltSecurityFilled
pocket1: WeaponPistolMk58
pocket2: BookSecurity
pocket2: HyperLinkBookCorporateLaw # Corvax
pxc1984 marked this conversation as resolved.
Show resolved Hide resolved
Loading