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

Дворфы больше не бесполезны. #144

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 15 additions & 3 deletions Content.Shared/Mining/MiningScannerSystem.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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!;
Expand All @@ -22,6 +23,8 @@ public override void Initialize()
SubscribeLocalEvent<MiningScannerComponent, EntGotInsertedIntoContainerMessage>(OnInserted);
SubscribeLocalEvent<MiningScannerComponent, EntGotRemovedFromContainerMessage>(OnRemoved);
SubscribeLocalEvent<MiningScannerComponent, ItemToggledEvent>(OnToggled);

CNInitialize(); // Corvax-Next-Dwarf
}

private void OnInserted(Entity<MiningScannerComponent> ent, ref EntGotInsertedIntoContainerMessage args)
Expand Down Expand Up @@ -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<InnateMiningScannerViewerComponent>(uid, out var innateViewer))
{
SetupInnateMiningViewerComponent((uid, innateViewer));
}
else
{
RemCompDeferred(uid, viewer);
continue;
}
// Corvax-Next-Dwarf-End: innate mining scanner
}

if (_timing.CurTime < viewer.NextPingTime)
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

}
33 changes: 33 additions & 0 deletions Content.Shared/_CorvaxNext/Mining/MiningScannerSystem.Innate.cs
Original file line number Diff line number Diff line change
@@ -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
{

/// <inheritdoc/>
public void CNInitialize()
{
SubscribeLocalEvent<InnateMiningScannerViewerComponent, ComponentStartup>(OnStartup);
}

private void OnStartup(Entity<InnateMiningScannerViewerComponent> ent, ref ComponentStartup args)
{
if (!HasComp<MiningScannerViewerComponent>(ent))
{
SetupInnateMiningViewerComponent(ent);
}
}

private void SetupInnateMiningViewerComponent(Entity<InnateMiningScannerViewerComponent> ent)
{
var comp = EnsureComp<MiningScannerViewerComponent>(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);
}
}
3 changes: 3 additions & 0 deletions Resources/Prototypes/Entities/Mobs/Species/dwarf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 3

- type: entity
parent: BaseSpeciesDummy
Expand Down
3 changes: 2 additions & 1 deletion Resources/ServerInfo/Guidebook/Mobs/Dwarf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
- Не может быть вызвана рвота от алкоголя.
- Дышат чаще в 2 раза, следовательно без воздуха получают по [color=red]2[/color] урона удушьем.
- Этанол лечит дворфов на [color=green]0.66[/color] уколов и ушибов и на [color=green]0.68[/color] порезов при наличии менее 5 единиц в организме.
- Обладают врождённой чувствительностью к наличию рудоносных жил в радиусе [color=yellow]3[/color] метров.

</Document>
</Document>
Loading