From e5a29aabaa54fc1b613d29fc7fa3f7a776adc727 Mon Sep 17 00:00:00 2001 From: Vonsant Date: Mon, 9 Dec 2024 21:16:20 +0300 Subject: [PATCH 1/3] innate mineral scanner --- Content.Shared/Mining/MiningScannerSystem.cs | 18 ++++++++-- .../InnateMiningScannerViewerComponent.cs | 22 +++++++++++++ .../Mining/MiningScannerSystem.Innate.cs | 33 +++++++++++++++++++ .../Entities/Mobs/Species/dwarf.yml | 3 ++ Resources/ServerInfo/Guidebook/Mobs/Dwarf.xml | 1 + 5 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 Content.Shared/_CorvaxNext/Mining/Components/InnateMiningScannerViewerComponent.cs create mode 100644 Content.Shared/_CorvaxNext/Mining/MiningScannerSystem.Innate.cs diff --git a/Content.Shared/Mining/MiningScannerSystem.cs b/Content.Shared/Mining/MiningScannerSystem.cs index 22e9061b09e..70a846f3821 100644 --- a/Content.Shared/Mining/MiningScannerSystem.cs +++ b/Content.Shared/Mining/MiningScannerSystem.cs @@ -1,3 +1,4 @@ +using Content.Shared._CorvaxNext.Mining.Components; using Content.Shared.Inventory; using Content.Shared.Item.ItemToggle.Components; using Content.Shared.Mining.Components; @@ -8,7 +9,7 @@ namespace Content.Shared.Mining; -public sealed class MiningScannerSystem : EntitySystem +public sealed partial class MiningScannerSystem : EntitySystem // Corvax-Next-Dwarf { [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly INetManager _net = default!; @@ -22,6 +23,8 @@ public override void Initialize() SubscribeLocalEvent(OnInserted); SubscribeLocalEvent(OnRemoved); SubscribeLocalEvent(OnToggled); + + CNInitialize(); // Corvax-Next-Dwarf } private void OnInserted(Entity ent, ref EntGotInsertedIntoContainerMessage args) @@ -85,8 +88,17 @@ public override void Update(float frameTime) { if (viewer.QueueRemoval) { - RemCompDeferred(uid, viewer); - continue; + // Corvax-Next-Dwarf-Start: innate mining scanner + if (TryComp(uid, out var innateViewer)) + { + SetupInnateMiningViewerComponent((uid, innateViewer)); + } + else + { + RemCompDeferred(uid, viewer); + continue; + } + // Corvax-Next-Dwarf-End: innate mining scanner } if (_timing.CurTime < viewer.NextPingTime) diff --git a/Content.Shared/_CorvaxNext/Mining/Components/InnateMiningScannerViewerComponent.cs b/Content.Shared/_CorvaxNext/Mining/Components/InnateMiningScannerViewerComponent.cs new file mode 100644 index 00000000000..66335e3b614 --- /dev/null +++ b/Content.Shared/_CorvaxNext/Mining/Components/InnateMiningScannerViewerComponent.cs @@ -0,0 +1,22 @@ +using Robust.Shared.Audio; +using Robust.Shared.GameStates; +using Content.Shared.Mining; + +namespace Content.Shared._CorvaxNext.Mining.Components; + +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(MiningScannerSystem))] +public sealed partial class InnateMiningScannerViewerComponent : Component +{ + [DataField, ViewVariables(VVAccess.ReadOnly), AutoNetworkedField] + public float ViewRange; + + [DataField, AutoNetworkedField] + public float AnimationDuration = 1.5f; + + [DataField, AutoNetworkedField] + public TimeSpan PingDelay = TimeSpan.FromSeconds(5); + + [DataField, AutoNetworkedField] + public SoundSpecifier? PingSound = null; + +} \ No newline at end of file diff --git a/Content.Shared/_CorvaxNext/Mining/MiningScannerSystem.Innate.cs b/Content.Shared/_CorvaxNext/Mining/MiningScannerSystem.Innate.cs new file mode 100644 index 00000000000..d0b95137125 --- /dev/null +++ b/Content.Shared/_CorvaxNext/Mining/MiningScannerSystem.Innate.cs @@ -0,0 +1,33 @@ +using Content.Shared.Mining.Components; +using Content.Shared._CorvaxNext.Mining.Components; + +namespace Content.Shared.Mining; + +public sealed partial class MiningScannerSystem : EntitySystem +{ + + /// + public void CNInitialize() + { + SubscribeLocalEvent(OnStartup); + } + + private void OnStartup(Entity ent, ref ComponentStartup args) + { + if (!HasComp(ent)) + { + SetupInnateMiningViewerComponent(ent); + } + } + + private void SetupInnateMiningViewerComponent(Entity ent) + { + var comp = EnsureComp(ent); + comp.ViewRange = ent.Comp.ViewRange; + comp.PingDelay = ent.Comp.PingDelay; + comp.PingSound = ent.Comp.PingSound; + comp.QueueRemoval = false; + comp.NextPingTime = _timing.CurTime + ent.Comp.PingDelay; + Dirty(ent.Owner, comp); + } +} \ No newline at end of file diff --git a/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml b/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml index 64262958c34..8ce2e5013e8 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml @@ -66,6 +66,9 @@ - type: FootprintVisualizer # Corvax-Next-Footprints leftBarePrint: "footprint-left-bare-dwarf" rightBarePrint: "footprint-right-bare-dwarf" + - type: InnateMiningScannerViewer # Corvax-Next-Dwarfs + pingSound: null + viewRange: 5 - type: entity parent: BaseSpeciesDummy diff --git a/Resources/ServerInfo/Guidebook/Mobs/Dwarf.xml b/Resources/ServerInfo/Guidebook/Mobs/Dwarf.xml index afc1ba43263..1d01497d281 100644 --- a/Resources/ServerInfo/Guidebook/Mobs/Dwarf.xml +++ b/Resources/ServerInfo/Guidebook/Mobs/Dwarf.xml @@ -19,5 +19,6 @@ - Не может быть вызвана рвота от алкоголя. - Дышат чаще в 2 раза, следовательно без воздуха получают по [color=red]2[/color] урона удушьем. - Этанол лечит дворфов на [color=green]0.66[/color] уколов и ушибов и на [color=green]0.68[/color] порезов при наличии менее 5 единиц в организме. + - Обладают врождённой чувствительностью к наличию рудоносных жил в радиусе [color=yellow]5[/color] метров. \ No newline at end of file From 55a73d38f79790035ee6ba36df8891edba502815 Mon Sep 17 00:00:00 2001 From: Kill_Me_I_Noobs <118206719+Vonsant@users.noreply.github.com> Date: Mon, 9 Dec 2024 21:23:40 +0300 Subject: [PATCH 2/3] Update Resources/Prototypes/Entities/Mobs/Species/dwarf.yml Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com> --- Resources/Prototypes/Entities/Mobs/Species/dwarf.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml b/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml index 8ce2e5013e8..37070f0304d 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml @@ -68,7 +68,7 @@ rightBarePrint: "footprint-right-bare-dwarf" - type: InnateMiningScannerViewer # Corvax-Next-Dwarfs pingSound: null - viewRange: 5 + viewRange: 3 - type: entity parent: BaseSpeciesDummy From 18fc9940d6cc8084e3908a34b650881574be43c6 Mon Sep 17 00:00:00 2001 From: Kill_Me_I_Noobs <118206719+Vonsant@users.noreply.github.com> Date: Mon, 9 Dec 2024 21:55:20 +0300 Subject: [PATCH 3/3] Update Dwarf.xml --- Resources/ServerInfo/Guidebook/Mobs/Dwarf.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Resources/ServerInfo/Guidebook/Mobs/Dwarf.xml b/Resources/ServerInfo/Guidebook/Mobs/Dwarf.xml index 1d01497d281..bee07e7fd48 100644 --- a/Resources/ServerInfo/Guidebook/Mobs/Dwarf.xml +++ b/Resources/ServerInfo/Guidebook/Mobs/Dwarf.xml @@ -19,6 +19,6 @@ - Не может быть вызвана рвота от алкоголя. - Дышат чаще в 2 раза, следовательно без воздуха получают по [color=red]2[/color] урона удушьем. - Этанол лечит дворфов на [color=green]0.66[/color] уколов и ушибов и на [color=green]0.68[/color] порезов при наличии менее 5 единиц в организме. - - Обладают врождённой чувствительностью к наличию рудоносных жил в радиусе [color=yellow]5[/color] метров. + - Обладают врождённой чувствительностью к наличию рудоносных жил в радиусе [color=yellow]3[/color] метров. - \ No newline at end of file +