From 3b48051e335bec0c5dff396c609e45e75eb8e1b4 Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Mon, 19 Dec 2022 22:53:54 -0500 Subject: [PATCH] Node Scanner (#12889) * node scanners + new tech * Sue me for making my shit copyright free --- .../Components/NodeScannerComponent.cs | 7 ++++ .../Equipment/Systems/NodeScannerSystem.cs | 38 ++++++++++++++++++ .../XenoArtifacts/ArtifactSystem.Nodes.cs | 3 +- .../en-US/xenoarchaeology/node-scanner.ftl | 1 + .../Catalog/Research/technologies.yml | 1 + .../Specific/Xenoarchaeology/node_scanner.yml | 15 +++++++ .../Entities/Structures/Machines/lathe.yml | 1 + Resources/Prototypes/Recipes/Lathes/misc.yml | 11 +++++ .../Xenoarchaeology/node_scanner.rsi/icon.png | Bin 0 -> 536 bytes .../node_scanner.rsi/inhand-left.png | Bin 0 -> 431 bytes .../node_scanner.rsi/inhand-right.png | Bin 0 -> 407 bytes .../node_scanner.rsi/meta.json | 22 ++++++++++ 12 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 Content.Server/Xenoarchaeology/Equipment/Components/NodeScannerComponent.cs create mode 100644 Content.Server/Xenoarchaeology/Equipment/Systems/NodeScannerSystem.cs create mode 100644 Resources/Locale/en-US/xenoarchaeology/node-scanner.ftl create mode 100644 Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/node_scanner.yml create mode 100644 Resources/Textures/Objects/Specific/Xenoarchaeology/node_scanner.rsi/icon.png create mode 100644 Resources/Textures/Objects/Specific/Xenoarchaeology/node_scanner.rsi/inhand-left.png create mode 100644 Resources/Textures/Objects/Specific/Xenoarchaeology/node_scanner.rsi/inhand-right.png create mode 100644 Resources/Textures/Objects/Specific/Xenoarchaeology/node_scanner.rsi/meta.json diff --git a/Content.Server/Xenoarchaeology/Equipment/Components/NodeScannerComponent.cs b/Content.Server/Xenoarchaeology/Equipment/Components/NodeScannerComponent.cs new file mode 100644 index 0000000000..c625ced209 --- /dev/null +++ b/Content.Server/Xenoarchaeology/Equipment/Components/NodeScannerComponent.cs @@ -0,0 +1,7 @@ +namespace Content.Server.Xenoarchaeology.Equipment.Components; + +[RegisterComponent] +public sealed class NodeScannerComponent : Component +{ + +} diff --git a/Content.Server/Xenoarchaeology/Equipment/Systems/NodeScannerSystem.cs b/Content.Server/Xenoarchaeology/Equipment/Systems/NodeScannerSystem.cs new file mode 100644 index 0000000000..ee1d7f8edf --- /dev/null +++ b/Content.Server/Xenoarchaeology/Equipment/Systems/NodeScannerSystem.cs @@ -0,0 +1,38 @@ +using Content.Server.Popups; +using Content.Server.Xenoarchaeology.Equipment.Components; +using Content.Server.Xenoarchaeology.XenoArtifacts; +using Content.Shared.Interaction; +using Content.Shared.Timing; +using Robust.Shared.Player; + +namespace Content.Server.Xenoarchaeology.Equipment.Systems; + +public sealed class NodeScannerSystem : EntitySystem +{ + [Dependency] private readonly UseDelaySystem _useDelay = default!; + [Dependency] private readonly PopupSystem _popupSystem = default!; + + /// + public override void Initialize() + { + SubscribeLocalEvent(OnAfterInteract); + } + + private void OnAfterInteract(EntityUid uid, NodeScannerComponent component, AfterInteractEvent args) + { + if (!args.CanReach || args.Target == null) + return; + + if (!TryComp(args.Target, out var artifact) || artifact.CurrentNode == null) + return; + + if (args.Handled) + return; + args.Handled = true; + + var target = args.Target.Value; + _useDelay.BeginDelay(uid); + _popupSystem.PopupEntity(Loc.GetString("node-scan-popup", + ("id", $"{artifact.CurrentNode.Id}")), target, Filter.Pvs(target)); + } +} diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.Nodes.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.Nodes.cs index 5b7664313e..45ff20ac80 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.Nodes.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.Nodes.cs @@ -48,7 +48,8 @@ public sealed partial class ArtifactSystem var node = uninitializedNodes.First(); uninitializedNodes.Remove(node); - node.Id = _random.Next(0, 10000); + //random 5-digit number + node.Id = _random.Next(10000, 100000); //Generate the connected nodes var maxEdges = Math.Max(1, targetNodeAmount - tree.AllNodes.Count - uninitializedNodes.Count - 1); diff --git a/Resources/Locale/en-US/xenoarchaeology/node-scanner.ftl b/Resources/Locale/en-US/xenoarchaeology/node-scanner.ftl new file mode 100644 index 0000000000..14b07941a6 --- /dev/null +++ b/Resources/Locale/en-US/xenoarchaeology/node-scanner.ftl @@ -0,0 +1 @@ +node-scan-popup = The node ID is {$id} \ No newline at end of file diff --git a/Resources/Prototypes/Catalog/Research/technologies.yml b/Resources/Prototypes/Catalog/Research/technologies.yml index ebdbf76959..213ca87a89 100644 --- a/Resources/Prototypes/Catalog/Research/technologies.yml +++ b/Resources/Prototypes/Catalog/Research/technologies.yml @@ -484,6 +484,7 @@ - MicroLaserStockPart - MicroManipulatorStockPart - ScanningModuleStockPart + - NodeScanner - type: technology name: technologies-robotics-technology diff --git a/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/node_scanner.yml b/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/node_scanner.yml new file mode 100644 index 0000000000..8f0a704a54 --- /dev/null +++ b/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/node_scanner.yml @@ -0,0 +1,15 @@ +- type: entity + parent: BaseItem + id: NodeScanner + name: node scanner + description: The archeologist's friend, able to identify the node of an artifact with only a single scan. + components: + - type: Sprite + sprite: Objects/Specific/Xenoarchaeology/node_scanner.rsi + state: icon + netsync: false + - type: Item + sprite: Objects/Specific/Xenoarchaeology/node_scanner.rsi + - type: NodeScanner + - type: UseDelay + delay: 3 diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index 73632991c4..fd30b6f033 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -228,6 +228,7 @@ - PowerCellHigh - SynthesizerInstrument - RPED + - NodeScanner - HolofanProjector - type: entity diff --git a/Resources/Prototypes/Recipes/Lathes/misc.yml b/Resources/Prototypes/Recipes/Lathes/misc.yml index c023913afa..119c844b71 100644 --- a/Resources/Prototypes/Recipes/Lathes/misc.yml +++ b/Resources/Prototypes/Recipes/Lathes/misc.yml @@ -85,3 +85,14 @@ Steel: 300 Plastic: 300 Glass: 100 + +- type: latheRecipe + id: NodeScanner + icon: + sprite: Objects/Specific/Xenoarchaeology/node_scanner.rsi + state: icon + result: NodeScanner + completetime: 2 + materials: + Steel: 100 + Plastic: 50 diff --git a/Resources/Textures/Objects/Specific/Xenoarchaeology/node_scanner.rsi/icon.png b/Resources/Textures/Objects/Specific/Xenoarchaeology/node_scanner.rsi/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..919f7d2856ba226822f2ff3d057ac6110dc9b359 GIT binary patch literal 536 zcmV+z0_XjSP)Px$(n&-?R9J=WmAy;DKpckOlt7i1GcGEEB61WQMcs-*(NV$0p{Nuc3IPXk^AB(n z2ch5~2!ey7;#8;z9h556L4=y22!bC&(=U%qK( z#Hf(2wB-K#^vSPF*%=y+KWA6Ixoz!BwwhQQh9AD-muuEY|L%Qku_{C>(vtDD+Tj)f zh6V$kUfbGeZvV{r4Cg-=Id$ZG+f*teNm{hK-8lD2g7XhvSk)O)nMpRHwIe& zE;W{M{@sNu-)!l8SIREopLXNcoeSr#=(#`l{cLFUR?O<{w3jb@mWHt~9C_tyefkHR zhh|}2X|7e7Px$QAtEWRCt{2*`ZFuP!z`TZv-((f+vJ53kj1q2n1qFCgu<|TLnQN2qXv;s_y`g zK(4@`YWD(D*kVw)B})kb)J1g}Vd*Z=u>${}Y;RA`Ice1=0RR91007{lpcT5H6}rw& z;1=D>EI}*$RF4&(L)qZr@!t4ax7+o4w(ORC4!u-|?}nEoYi%jN24jqCHk;nPc`cyd z?^lu}QIaHI@9c*eW4xA-yMW0eYjG?|$`(=9U!c*eD@{{LQms~-xrF7so1@W4#u(S= z)pZfC>m-hKFc_3_@XW5g)9p%IkN4M$ZUq1U00000007{R$)fY$`kvfq%-7TNt2#S@ z%M#=wbHm9L`s(tgsIp_0F1; z>>nPDQ{RQji<_e;a#0i&{*PK~=Ta8{008*s-T*Y1Y3G;XDcS%4002ovPDHLkV1g+d BxHA9% literal 0 HcmV?d00001 diff --git a/Resources/Textures/Objects/Specific/Xenoarchaeology/node_scanner.rsi/meta.json b/Resources/Textures/Objects/Specific/Xenoarchaeology/node_scanner.rsi/meta.json new file mode 100644 index 0000000000..7c0fc9d9e8 --- /dev/null +++ b/Resources/Textures/Objects/Specific/Xenoarchaeology/node_scanner.rsi/meta.json @@ -0,0 +1,22 @@ +{ + "version": 1, + "license": "CC0-1.0", + "copyright": "Created by EmoGarbage404", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "inhand-left", + "directions": 4 + }, + { + "name": "inhand-right", + "directions": 4 + } + ] +}