-
Notifications
You must be signed in to change notification settings - Fork 622
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
128 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<OpenURLEvent>(OnOpenURL); | ||
} | ||
|
||
private void OnOpenURL(OpenURLEvent args) | ||
{ | ||
var uriOpener = IoCManager.Resolve<IUriOpener>(); | ||
uriOpener.OpenUri(args.URL); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<HyperLinkComponent, ActivateInWorldEvent>(OnActivate); | ||
} | ||
|
||
private void OnActivate(EntityUid uid, HyperLinkComponent component, ActivateInWorldEvent args) | ||
{ | ||
if (!TryComp<ActorComponent>(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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
Resources/Prototypes/Corvax/Entities/Objects/Books/hyperlinkbooks.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: HyperLink | ||
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 |
9 changes: 9 additions & 0 deletions
9
Resources/Prototypes/Corvax/Loadouts/Miscellaneous/corporate_law.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
- type: loadout | ||
id: CorporateLaw | ||
equipment: CorporateLaw | ||
|
||
- type: startingGear | ||
id: CorporateLaw | ||
storage: | ||
pocket2: | ||
- HyperLinkBookCorporateLaw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
storage: | ||
back: | ||
- PlushieLizard | ||
|
||
- type: loadout | ||
id: PlushieSpaceLizard | ||
equipment: PlushieSpaceLizard | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters