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

teleporter-WWDP #969

Merged
merged 12 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Robust.Shared.Audio;

namespace Content.Server._White.Teleporter;

[RegisterComponent]
public sealed partial class ExperimentalTeleporterComponent : Component
{
[DataField]
public int MinTeleportRange = 3;

[DataField]
public int MaxTeleportRange = 8;

[DataField]
public int EmergencyLength = 4;

[DataField]
public List<int> RandomRotations = new() {90, -90};

[DataField]
public string? TeleportInEffect = "ExperimentalTeleporterInEffect";

[DataField]
public string? TeleportOutEffect = "ExperimentalTeleporterOutEffect";

[DataField]
public SoundSpecifier TeleportSound = new SoundPathSpecifier("/Audio/Backman/Object/Devices/experimentalsyndicateteleport.ogg");
}
114 changes: 114 additions & 0 deletions Content.Server/Backmen/Teleporter/ExperimentalTeleporterSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
using System.Linq;
using System.Numerics;
using Content.Server.Body.Systems;
using Content.Server.Standing;
using Content.Shared.Charges.Systems;
using Content.Shared.Coordinates.Helpers;
using Content.Shared.Interaction.Events;
using Content.Shared.Maps;
using Content.Shared.Tag;
using Robust.Server.Audio;
using Robust.Server.Containers;
using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Random;

namespace Content.Server._White.Teleporter;

public sealed class ExperimentalTeleporterSystem : EntitySystem
{
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly BodySystem _bodySystem = default!;
[Dependency] private readonly MapSystem _mapSystem = default!;
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly AudioSystem _audio = default!;
[Dependency] private readonly ContainerSystem _containerSystem = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedLayingDownSystem _layingDown = default!;
[Dependency] private readonly SharedChargesSystem _charges = default!;
[Dependency] private readonly TagSystem _tag = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ExperimentalTeleporterComponent, UseInHandEvent>(OnUse);
}

private void OnUse(EntityUid uid, ExperimentalTeleporterComponent component, UseInHandEvent args)
{
if (_charges.IsEmpty(uid)
|| !TryComp<TransformComponent>(args.User, out var xform)
|| (_containerSystem.IsEntityInContainer(args.User)
&& !_containerSystem.TryRemoveFromContainer(args.User)))
return;

var oldCoords = xform.Coordinates;
var range = _random.Next(component.MinTeleportRange, component.MaxTeleportRange);
var offset = xform.LocalRotation.ToWorldVec().Normalized();
var direction = xform.LocalRotation.GetDir().ToVec();
var newOffset = offset + direction * range;

var coords = xform.Coordinates.Offset(newOffset).SnapToGrid(EntityManager);

Teleport(args.User, uid, component, coords, oldCoords);

if (!TryCheckWall(coords)
|| EmergencyTeleportation(args.User, uid, component, xform, oldCoords, newOffset))
return;

_bodySystem.GibBody(args.User, true, splatModifier: 3F);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Добавьте дополнительные проверки безопасности

  1. Отсутствуют проверки на null для компонентов и зависимостей
  2. Нет обработки ошибок при неудачном телепортировании
  3. Жёсткое значение множителя разброса (3F) лучше вынести в константу

Предлагаю следующие изменения:

 private void OnUse(EntityUid uid, ExperimentalTeleporterComponent component, UseInHandEvent args)
 {
+    if (!Resolve(args.User, ref xform))
+        return;
+
     if (_charges.IsEmpty(uid)
-        || !TryComp<TransformComponent>(args.User, out var xform)
         || (_containerSystem.IsEntityInContainer(args.User)
             && !_containerSystem.TryRemoveFromContainer(args.User)))
         return;

+    const float GibSplatModifier = 3f;
     // ... rest of the method ...
-    _bodySystem.GibBody(args.User, true, splatModifier: 3F);
+    _bodySystem.GibBody(args.User, true, splatModifier: GibSplatModifier);
 }

Committable suggestion skipped: line range outside the PR's diff.


private bool EmergencyTeleportation(EntityUid uid, EntityUid teleporterUid, ExperimentalTeleporterComponent component, TransformComponent xform, EntityCoordinates oldCoords, Vector2 offset)
{
var newOffset = offset + VectorRandomDirection(component, offset, component.EmergencyLength);
var coords = xform.Coordinates.Offset(newOffset).SnapToGrid(EntityManager);

if (_charges.IsEmpty(teleporterUid))
return false;

Teleport(uid, teleporterUid, component, coords, oldCoords);

return !TryCheckWall(coords);
}
Comment on lines +66 to +77
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Предотвратите возможность бесконечной рекурсии

Метод EmergencyTeleportation может вызвать бесконечную рекурсию через Teleport, который может снова вызвать EmergencyTeleportation. Рекомендуется:

  1. Добавить максимальное количество попыток телепортации
  2. Передавать счётчик попыток через параметры
  3. Добавить проверку на максимальное количество попыток

Предлагаемые изменения:

+ private const int MaxEmergencyAttempts = 3;

- private bool EmergencyTeleportation(EntityUid uid, EntityUid teleporterUid, ExperimentalTeleporterComponent component, TransformComponent xform, EntityCoordinates oldCoords, Vector2 offset)
+ private bool EmergencyTeleportation(EntityUid uid, EntityUid teleporterUid, ExperimentalTeleporterComponent component, TransformComponent xform, EntityCoordinates oldCoords, Vector2 offset, int attempts = 0)
 {
+    if (attempts >= MaxEmergencyAttempts)
+        return false;
+
     var newOffset = offset + VectorRandomDirection(component, offset, component.EmergencyLength);
     // ... rest of the method
 }

Committable suggestion skipped: line range outside the PR's diff.


private void Teleport(EntityUid uid, EntityUid teleporterUid, ExperimentalTeleporterComponent component, EntityCoordinates coords, EntityCoordinates oldCoords)
{
PlaySoundAndEffects(component, coords, oldCoords);

_layingDown.LieDownInRange(uid, coords);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Исправьте ошибку: метод 'LieDownInRange' отсутствует в 'LayingDownSystem'

Статический анализ выявил, что метод LieDownInRange не определён в LayingDownSystem. Проверьте правильность вызова метода или замените его на существующий метод для укладывания персонажа.

🧰 Tools
🪛 GitHub Check: YAML Linter

[failure] 80-80:
'LayingDownSystem' does not contain a definition for 'LieDownInRange' and no accessible extension method 'LieDownInRange' accepting a first argument of type 'LayingDownSystem' could be found (are you missing a using directive or an assembly reference?)


[failure] 80-80:
'LayingDownSystem' does not contain a definition for 'LieDownInRange' and no accessible extension method 'LieDownInRange' accepting a first argument of type 'LayingDownSystem' could be found (are you missing a using directive or an assembly reference?)

🪛 GitHub Check: build (ubuntu-latest)

[failure] 80-80:
'LayingDownSystem' does not contain a definition for 'LieDownInRange' and no accessible extension method 'LieDownInRange' accepting a first argument of type 'LayingDownSystem' could be found (are you missing a using directive or an assembly reference?)


[failure] 80-80:
'LayingDownSystem' does not contain a definition for 'LieDownInRange' and no accessible extension method 'LieDownInRange' accepting a first argument of type 'LayingDownSystem' could be found (are you missing a using directive or an assembly reference?)

🪛 GitHub Check: Test Packaging

[failure] 80-80:
'LayingDownSystem' does not contain a definition for 'LieDownInRange' and no accessible extension method 'LieDownInRange' accepting a first argument of type 'LayingDownSystem' could be found (are you missing a using directive or an assembly reference?)


[failure] 80-80:
'LayingDownSystem' does not contain a definition for 'LieDownInRange' and no accessible extension method 'LieDownInRange' accepting a first argument of type 'LayingDownSystem' could be found (are you missing a using directive or an assembly reference?)

_transform.SetCoordinates(uid, coords);

_charges.UseCharge(teleporterUid);
}

private void PlaySoundAndEffects(ExperimentalTeleporterComponent component, EntityCoordinates coords, EntityCoordinates oldCoords)
{
_audio.PlayPvs(component.TeleportSound, coords);
_audio.PlayPvs(component.TeleportSound, oldCoords);

_entManager.SpawnEntity(component.TeleportInEffect, coords);
_entManager.SpawnEntity(component.TeleportOutEffect, oldCoords);
}

private bool TryCheckWall(EntityCoordinates coords)
{
if (!coords.TryGetTileRef(out var tile)
|| !TryComp<MapGridComponent>(tile.Value.GridUid, out var mapGridComponent))
return false;

var anchoredEntities = _mapSystem.GetAnchoredEntities(tile.Value.GridUid, mapGridComponent, coords);

return anchoredEntities.Any(x => _tag.HasTag(x, "Wall"));
}

private Vector2 VectorRandomDirection(ExperimentalTeleporterComponent component, Vector2 offset, int length)
{
if (component.RandomRotations.Count == 0)
return Vector2.Zero;

var randomRotation = _random.Next(0, component.RandomRotations.Count);
return Angle.FromDegrees(component.RandomRotations[randomRotation]).RotateVec(offset.Normalized() * length);
}
}
216 changes: 216 additions & 0 deletions Content.Shared/Standing/SharedLayingDownSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
using System.Linq;
using Content.Shared.ActionBlocker;
using Content.Shared.CCVar;
using Content.Shared.DoAfter;
using Content.Shared.Gravity;
using Content.Shared.Input;
using Content.Shared.Mobs.Systems;
using Content.Shared.Movement.Systems;
using Content.Shared.Body.Components;
using Content.Shared.Standing;
using Content.Shared.Popups;
using Content.Shared.Stunnable;
using Robust.Shared.Configuration;
using Robust.Shared.Input.Binding;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Serialization;

namespace Content.Shared.Standing;

public abstract class SharedLayingDownSystem : EntitySystem
{
[Dependency] private readonly IConfigurationManager _config = default!;

[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!; // WWDP
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly MovementSpeedModifierSystem _speed = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly SharedGravitySystem _gravity = default!;
[Dependency] private readonly SharedPopupSystem _popups = default!;
[Dependency] private readonly StandingStateSystem _standing = default!;

public override void Initialize()
{
CommandBinds.Builder
.Bind(ContentKeyFunctions.ToggleStanding, InputCmdHandler.FromDelegate(ToggleStanding))
.Bind(ContentKeyFunctions.ToggleCrawlingUnder,
InputCmdHandler.FromDelegate(HandleCrawlUnderRequest, handle: false))
.Register<SharedLayingDownSystem>();

SubscribeNetworkEvent<ChangeLayingDownEvent>(OnChangeState);

SubscribeLocalEvent<StandingStateComponent, StandingUpDoAfterEvent>(OnStandingUpDoAfter);
SubscribeLocalEvent<LayingDownComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovementSpeed);
SubscribeLocalEvent<LayingDownComponent, EntParentChangedMessage>(OnParentChanged);
}

public override void Shutdown()
{
base.Shutdown();

CommandBinds.Unregister<SharedLayingDownSystem>();
}

private void ToggleStanding(ICommonSession? session)
{
if (session is not { AttachedEntity: { Valid: true } uid } _
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Исправьте синтаксическую ошибку в условии 'if'

В строке 58 в условии if присутствует лишний символ _ в конце, что приводит к синтаксической ошибке. Удалите символ _ для корректной компиляции.

Примените следующий дифф для исправления:

-if (session is not { AttachedEntity: { Valid: true } uid } _
+if (session is not { AttachedEntity: { Valid: true } uid })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (session is not { AttachedEntity: { Valid: true } uid } _
if (session is not { AttachedEntity: { Valid: true } uid })

|| !Exists(uid)
|| !HasComp<LayingDownComponent>(session.AttachedEntity)
|| _gravity.IsWeightless(session.AttachedEntity.Value))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Добавьте определение или using-директиву для 'LayingDownComponent'

Тип LayingDownComponent не найден во многих местах кода. Убедитесь, что этот тип определён в проекте и добавлена необходимая using-директива для соответствующего пространства имён.

Примените следующий дифф для добавления using-директивы:

+using Content.Shared.Standing.Components;

Also applies to: 72-74, 99-100, 126-127, 137-138, 149-150, 176-177

return;

RaiseNetworkEvent(new ChangeLayingDownEvent());
}

private void HandleCrawlUnderRequest(ICommonSession? session)
{
if (session == null
|| session.AttachedEntity is not { } uid
|| !TryComp<StandingStateComponent>(uid, out var standingState)
|| !TryComp<LayingDownComponent>(uid, out var layingDown)
|| !_actionBlocker.CanInteract(uid, null))
return;

var newState = !layingDown.IsCrawlingUnder;
if (standingState.CurrentState is StandingState.Standing)
newState = false; // If the entity is already standing, this function only serves a fallback method to fix its draw depth

// Do not allow to begin crawling under if it's disabled in config. We still, however, allow to stop it, as a failsafe.
if (newState && !_config.GetCVar(CCVars.CrawlUnderTables))
{
_popups.PopupEntity(Loc.GetString("crawling-under-tables-disabled-popup"), uid, session);
return;
}

layingDown.IsCrawlingUnder = newState;
_speed.RefreshMovementSpeedModifiers(uid);
Dirty(uid, layingDown);
}

private void OnChangeState(ChangeLayingDownEvent ev, EntitySessionEventArgs args)

Check failure on line 92 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

The type or namespace name 'ChangeLayingDownEvent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 92 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

The type or namespace name 'ChangeLayingDownEvent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 92 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'ChangeLayingDownEvent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 92 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'ChangeLayingDownEvent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 92 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

The type or namespace name 'ChangeLayingDownEvent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 92 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

The type or namespace name 'ChangeLayingDownEvent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 92 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'ChangeLayingDownEvent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 92 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'ChangeLayingDownEvent' could not be found (are you missing a using directive or an assembly reference?)
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Добавьте определение или using-директиву для 'ChangeLayingDownEvent'

Тип ChangeLayingDownEvent не найден. Убедитесь, что этот тип определён в проекте и добавлена необходимая using-директива для соответствующего пространства имён.

Примените следующий дифф для добавления using-директивы:

+using Content.Shared.Standing;

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 GitHub Check: build (ubuntu-latest)

[failure] 92-92:
The type or namespace name 'ChangeLayingDownEvent' could not be found (are you missing a using directive or an assembly reference?)


[failure] 92-92:
The type or namespace name 'ChangeLayingDownEvent' could not be found (are you missing a using directive or an assembly reference?)

🪛 GitHub Check: YAML Linter

[failure] 92-92:
The type or namespace name 'ChangeLayingDownEvent' could not be found (are you missing a using directive or an assembly reference?)


[failure] 92-92:
The type or namespace name 'ChangeLayingDownEvent' could not be found (are you missing a using directive or an assembly reference?)

🪛 GitHub Check: Test Packaging

[failure] 92-92:
The type or namespace name 'ChangeLayingDownEvent' could not be found (are you missing a using directive or an assembly reference?)


[failure] 92-92:
The type or namespace name 'ChangeLayingDownEvent' could not be found (are you missing a using directive or an assembly reference?)

if (!args.SenderSession.AttachedEntity.HasValue)
return;

var uid = args.SenderSession.AttachedEntity.Value;
if (!TryComp(uid, out StandingStateComponent? standing)
|| !TryComp(uid, out LayingDownComponent? layingDown))
return;

RaiseNetworkEvent(new CheckAutoGetUpEvent(GetNetEntity(uid)));

if (HasComp<KnockedDownComponent>(uid)
|| !_mobState.IsAlive(uid))
return;

if (_standing.IsDown(uid, standing))
TryStandUp(uid, layingDown, standing);
else
TryLieDown(uid, layingDown, standing);
}

private void OnStandingUpDoAfter(EntityUid uid, StandingStateComponent component, StandingUpDoAfterEvent args)
{
if (args.Handled || args.Cancelled
|| HasComp<KnockedDownComponent>(uid)
|| _mobState.IsIncapacitated(uid)
|| !_standing.Stand(uid))
component.CurrentState = StandingState.Lying;

component.CurrentState = StandingState.Standing;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Проверьте логическую ошибку при установке 'CurrentState'

В строке 120 устанавливается component.CurrentState = StandingState.Lying;, а сразу после этого в строке 122 устанавливается component.CurrentState = StandingState.Standing;. Это приводит к тому, что предыдущее значение перезаписывается. Убедитесь, что состояние устанавливается корректно и отсутствуют лишние присвоения.

Примените следующий дифф для исправления:

component.CurrentState = StandingState.Lying;

- component.CurrentState = StandingState.Standing;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
component.CurrentState = StandingState.Lying;
component.CurrentState = StandingState.Standing;
}
component.CurrentState = StandingState.Lying;
}


private void OnRefreshMovementSpeed(EntityUid uid,
LayingDownComponent component,

Check failure on line 126 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 126 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 126 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 126 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 126 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 126 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 126 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 126 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)
RefreshMovementSpeedModifiersEvent args)
{
if (!_standing.IsDown(uid))
return;

var modifier = component.LyingSpeedModifier *
(component.IsCrawlingUnder ? component.CrawlingUnderSpeedModifier : 1);
args.ModifySpeed(modifier, modifier);
}

private void OnParentChanged(EntityUid uid, LayingDownComponent component, EntParentChangedMessage args)

Check failure on line 137 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 137 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 137 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 137 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 137 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 137 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 137 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 137 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)
{
// If the entity is not on a grid, try to make it stand up to avoid issues
if (!TryComp<StandingStateComponent>(uid, out var standingState)
|| standingState.CurrentState is StandingState.Standing
|| Transform(uid).GridUid != null)
return;

_standing.Stand(uid, standingState);
}

public bool TryStandUp(EntityUid uid,
LayingDownComponent? layingDown = null,

Check failure on line 149 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 149 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 149 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 149 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 149 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 149 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 149 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)
StandingStateComponent? standingState = null)
{
if (!Resolve(uid, ref standingState, false)
|| !Resolve(uid, ref layingDown, false)
|| standingState.CurrentState is not StandingState.Lying
|| !_mobState.IsAlive(uid)
|| TerminatingOrDeleted(uid)
|| !TryComp<BodyComponent>(uid, out var body)
|| body.LegEntities.Count == 0)
return false;

var args = new DoAfterArgs(EntityManager, uid, layingDown.StandingUpTime, new StandingUpDoAfterEvent(), uid)
{
BreakOnHandChange = false,
RequireCanInteract = false
};

if (!_doAfter.TryStartDoAfter(args))
return false;

standingState.CurrentState = StandingState.GettingUp;
layingDown.IsCrawlingUnder = false;
return true;
}

public bool TryLieDown(EntityUid uid,
LayingDownComponent? layingDown = null,

Check failure on line 176 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 176 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 176 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 176 in Content.Shared/Standing/SharedLayingDownSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'LayingDownComponent' could not be found (are you missing a using directive or an assembly reference?)
StandingStateComponent? standingState = null,
DropHeldItemsBehavior behavior = DropHeldItemsBehavior.NoDrop)
{
if (!Resolve(uid, ref standingState, false)
|| !Resolve(uid, ref layingDown, false)
|| standingState.CurrentState is not StandingState.Standing)
{
if (behavior == DropHeldItemsBehavior.AlwaysDrop)
RaiseLocalEvent(uid, new DropHandItemsEvent());

return false;
}

_standing.Down(uid, true, behavior != DropHeldItemsBehavior.NoDrop, standingState);
return true;
}

// WWDP
public void LieDownInRange(EntityUid uid, EntityCoordinates coords, float range = 0.4f)
{
var ents = new HashSet<Entity<LayingDownComponent>>();
_lookup.GetEntitiesInRange(coords, range, ents);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Проверьте использование типа в коллекции 'ents'

Использование HashSet<Entity<LayingDownComponent>> может быть некорректным. Возможно, следует использовать HashSet<EntityUid> или другую подходящую коллекцию. Также убедитесь, что метод _lookup.GetEntitiesInRange правильно заполняет коллекцию и типы совпадают.

Примените следующий дифф для исправления:

-public void LieDownInRange(EntityUid uid, EntityCoordinates coords, float range = 0.4f)
-{
-    var ents = new HashSet<Entity<LayingDownComponent>>();
+public void LieDownInRange(EntityUid uid, EntityCoordinates coords, float range = 0.4f)
+{
+    var ents = new HashSet<EntityUid>();

Committable suggestion skipped: line range outside the PR's diff.


foreach (var ent in ents.Where(ent => ent.Owner != uid))
{
TryLieDown(ent, behavior: DropHeldItemsBehavior.DropIfStanding);
}
}
}

[Serializable, NetSerializable]
public sealed partial class StandingUpDoAfterEvent : SimpleDoAfterEvent;

[Serializable, NetSerializable]
public enum DropHeldItemsBehavior : byte
{
NoDrop,
DropIfStanding,
AlwaysDrop
}
4 changes: 4 additions & 0 deletions Resources/Audio/Backmen/Object/Devices/attributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- files: ["experimentalsyndicateteleport.ogg"]
license: "CC-BY-NC-SA-4.0"
copyright: "Taken from White Dream"
source: "https://github.com/frosty-dev/ss14-core/blob/master/Resources/Audio/White/Devices/expsyndicateteleport.ogg"
Comment on lines +1 to +4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Источник звукового файла недоступен!

Ссылка на исходный файл возвращает ошибку 404, что указывает на его отсутствие в указанном репозитории. Необходимо:

  • Обновить ссылку на актуальный источник файла
  • Убедиться, что использование файла соответствует условиям лицензии CC-BY-NC-SA-4.0
  • Рассмотреть возможность поиска файла в архивных версиях репозитория или связаться с авторами White Dream для получения корректной ссылки
🔗 Analysis chain

Проверить доступность источника звукового файла!

Атрибуция корректно указана, но необходимо убедиться в актуальности ссылки на исходный файл и соответствии условиям лицензии CC-BY-NC-SA-4.0.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify source file availability and license compliance

# Check if source URL is accessible
curl -I "https://github.com/frosty-dev/ss14-core/blob/master/Resources/Audio/White/Devices/expsyndicateteleport.ogg"

# Verify local file exists
fd "experimentalsyndicateteleport.ogg" Resources/Audio/Backmen/Object/Devices/

Length of output: 5069

🧰 Tools
🪛 yamllint (1.35.1)

[error] 4-4: no new line character at the end of file

(new-line-at-end-of-file)

Binary file not shown.
11 changes: 11 additions & 0 deletions Resources/Locale/en-US/_backmen/store/uplink-catalog.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
uplink-emp-flashlight-name = Emp Flashlight
uplink-emp-flashlight-desc = A rechargeable device disguised as a flashlight designed to disrupt electronic systems. Useful for disrupting communications, security's energy weapons, and APCs when you're in a tight spot.

uplink-betrayal-knife-name = Betrayal dagger
uplink-betrayal-knife-desc = The betrayal dagger allows the user to teleport a short distance, and also causes significant damage when stabbed in the back.

uplink-betrayal-knife-name = Experimental syndicate teleporter
uplink-betrayal-knife-desc = Syndicate teleporter, when used, moves 3-8 meters forward. In case of teleportation into a wall, uses emergency teleportation. Has 4 charge.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Исправьте дублирующиеся ключи для локализации

Ключи uplink-betrayal-knife-name и uplink-betrayal-knife-desc на строках 7-8 дублируются с предыдущими записями и относятся к другому предмету. Это может привести к конфликтам в локализации.

Предлагаю изменить ключи на уникальные для экспериментального телепортера:

- uplink-betrayal-knife-name = Experimental syndicate teleporter
- uplink-betrayal-knife-desc = Syndicate teleporter, when used, moves 3-8 meters forward. In case of teleportation into a wall, uses emergency teleportation. Has 4 charge.
+ uplink-experimental-syndicate-teleporter-name = Experimental syndicate teleporter
+ uplink-experimental-syndicate-teleporter-desc = Syndicate teleporter, when used, moves 3-8 meters forward. In case of teleportation into a wall, uses emergency teleportation. Has 4 charges.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uplink-betrayal-knife-name = Experimental syndicate teleporter
uplink-betrayal-knife-desc = Syndicate teleporter, when used, moves 3-8 meters forward. In case of teleportation into a wall, uses emergency teleportation. Has 4 charge.
uplink-experimental-syndicate-teleporter-name = Experimental syndicate teleporter
uplink-experimental-syndicate-teleporter-desc = Syndicate teleporter, when used, moves 3-8 meters forward. In case of teleportation into a wall, uses emergency teleportation. Has 4 charges.


uplink-ebow-name = Small energy crossbow
uplink-ebow-desc = A fairly quiet weapon that automatically reloads and stuns. It goes well with other types of weapons.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-ExperimentalSyndicateTeleporter = экспериментальный телепортер синдиката
.desc = Телепортер синдиката, при использовании перемещает на 3-8 метров вперед. В случае телепортации в стену, использует экстренную телепортацию. Имеет 4 заряда и автоматически заряжается.
5 changes: 5 additions & 0 deletions Resources/Locale/ru-RU/_backmen/store/uplink-catalog.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
uplink-experimental-syndicate-teleporter-name = Экспериментальный телепортер синдиката
uplink-experimental-syndicate-teleporter-desc = Телепортер синдиката, при использовании перемещает на 3-8 метров вперед. В случае телепортации в стену, использует экстренную телепортацию. Имеет 4 заряда и автоматически заряжается.

uplink-ebow-name = Маленький энергетический арбалет
uplink-ebow-desc = Довольно тихое оружие, которое автоматически перезаряжается и оглушает. Хорошо сочетается с другими видами оружия.
Loading
Loading