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

[Port] Experimental Teleporter / Экспериментальный Телепортатор #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Spatison
Copy link
Member

Описание PR

Порт экспериментального телепорта синдиката


Медиа

Видео


Изменения

🆑 Spatison

  • add: Added experimental syndicate teleporter / Добавлен экспериментальный телепортатор синдиката

@Spatison Spatison self-assigned this Sep 21, 2024
Copy link

coderabbitai bot commented Sep 21, 2024

Walkthrough

This pull request introduces the ExperimentalTeleporterComponent and ExperimentalTeleporterSystem, which facilitate teleportation mechanics in the game. It includes new audio and visual effects for the teleportation process, a new item called "Experimental Syndicate Teleporter" with specific functionality and charge limits, and localization entries for both English and Russian. Additionally, metadata files for textures and audio attributions have been added to support these features.

Changes

File Path Change Summary
Content.Server/_White/Teleporter/ExperimentalTeleporterComponent.cs Added ExperimentalTeleporterComponent with properties for teleportation functionality.
Content.Server/_White/Teleporter/ExperimentalTeleporterSystem.cs Introduced ExperimentalTeleporterSystem to manage teleportation based on user interactions.
Resources/Audio/_White/Object/Devices/attributions.yml Added metadata for audio file experimentalsyndicateteleport.ogg.
Resources/Locale/en-US/_white/store/uplink-catalog.ftl Modified item descriptions; added "Experimental syndicate teleporter" with teleportation details.
Resources/Locale/ru-RU/_white/prototypes/entities/objects/device/syndicate_gadgets/experimental-teleporter.ftl Added Russian localization for the "Experimental Syndicate Teleporter".
Resources/Locale/ru-RU/_white/store/uplink-catalog.ftl Added Russian entries for the experimental teleporter in the uplink catalog.
Resources/Prototypes/_White/Catalog/uplink_catalog.yml Added listing for UplinkExperimentalSyndicateTeleporter in the catalog.
Resources/Prototypes/_White/Entities/Effects/effects.yml Introduced effects ExperimentalTeleporterInEffect and ExperimentalTeleporterOutEffect.
Resources/Prototypes/_White/Entities/Objects/Devices/Syndicate_Gadgets/experimental_teleporter.yml Added entity ExperimentalSyndicateTeleporter with teleportation functionality.
Resources/Textures/_White/Objects/Devices/experimentalsyndicateteleporter.rsi/meta.json Created metadata file for teleportation texture resource.

Possibly related PRs

  • [Port] Custom Ghost's #21: The introduction of the ExperimentalTeleporterComponent and ExperimentalTeleporterSystem relates to the addition of the "Experimental syndicate teleporter" item in the localization files, which describes similar teleportation functionality.

Suggested labels

Changes: C#, Changes: Sprite, Changes: YML, Status: Needs Review

Suggested reviewers

  • Remuchi

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

RSI Diff Bot; head commit 7b52ecd merging into 6fb8e63
This PR makes changes to 1 or more RSIs. Here is a summary of all changes:

Resources/Textures/_White/Objects/Devices/experimentalsyndicateteleporter.rsi

State Old New Status
icon Added
in Added
inhand-left Added
inhand-right Added
out Added

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

Outside diff range and nitpick comments (3)
Resources/Audio/_White/Object/Devices/attributions.yml (1)

4-4: Add a newline at the end of the file.

The YAML file is missing a newline character at the end. While this does not affect the functionality, it is considered a best practice to include a newline at the end of files.

To fix this, simply add a newline at the end of the file.

Tools
yamllint

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

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

Resources/Prototypes/_White/Entities/Objects/Devices/Syndicate_Gadgets/experimental_teleporter.yml (1)

16-16: Add a newline at the end of the file.

To address the static analysis hint and maintain consistency with coding standards, please add a newline character at the end of the file.

  rechargeDuration: 10
+
Tools
yamllint

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

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

Content.Server/_White/Teleporter/ExperimentalTeleporterSystem.cs (1)

103-103: Use constants for tag names instead of string literals

Hardcoding tag names like "Wall" as string literals can lead to errors if the tag name changes.

Define a constant or use an existing enumeration for the "Wall" tag to improve maintainability.

// For example:
private const string WallTag = "Wall";

// Then use:
return anchoredEntities.Any(x => _tag.HasTag(x, WallTag));
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6fb8e63 and 7b52ecd.

Files ignored due to path filters (6)
  • Resources/Audio/_White/Object/Devices/experimentalsyndicateteleport.ogg is excluded by !**/*.ogg
  • Resources/Textures/_White/Objects/Devices/experimentalsyndicateteleporter.rsi/icon.png is excluded by !**/*.png
  • Resources/Textures/_White/Objects/Devices/experimentalsyndicateteleporter.rsi/in.png is excluded by !**/*.png
  • Resources/Textures/_White/Objects/Devices/experimentalsyndicateteleporter.rsi/inhand-left.png is excluded by !**/*.png
  • Resources/Textures/_White/Objects/Devices/experimentalsyndicateteleporter.rsi/inhand-right.png is excluded by !**/*.png
  • Resources/Textures/_White/Objects/Devices/experimentalsyndicateteleporter.rsi/out.png is excluded by !**/*.png
Files selected for processing (10)
  • Content.Server/_White/Teleporter/ExperimentalTeleporterComponent.cs (1 hunks)
  • Content.Server/_White/Teleporter/ExperimentalTeleporterSystem.cs (1 hunks)
  • Resources/Audio/_White/Object/Devices/attributions.yml (1 hunks)
  • Resources/Locale/en-US/_white/store/uplink-catalog.ftl (1 hunks)
  • Resources/Locale/ru-RU/_white/prototypes/entities/objects/device/syndicate_gadgets/experimental-teleporter.ftl (1 hunks)
  • Resources/Locale/ru-RU/_white/store/uplink-catalog.ftl (1 hunks)
  • Resources/Prototypes/_White/Catalog/uplink_catalog.yml (1 hunks)
  • Resources/Prototypes/_White/Entities/Effects/effects.yml (1 hunks)
  • Resources/Prototypes/_White/Entities/Objects/Devices/Syndicate_Gadgets/experimental_teleporter.yml (1 hunks)
  • Resources/Textures/_White/Objects/Devices/experimentalsyndicateteleporter.rsi/meta.json (1 hunks)
Additional context used
yamllint
Resources/Audio/_White/Object/Devices/attributions.yml

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

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

Resources/Prototypes/_White/Entities/Effects/effects.yml

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

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

Resources/Prototypes/_White/Entities/Objects/Devices/Syndicate_Gadgets/experimental_teleporter.yml

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

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

Additional comments not posted (13)
Resources/Audio/_White/Object/Devices/attributions.yml (1)

1-4: LGTM!

The attribution metadata fields provide the necessary information for the audio file, including the file name, license, copyright, and source URL.

Tools
yamllint

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

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

Resources/Locale/ru-RU/_white/prototypes/entities/objects/device/syndicate_gadgets/experimental-teleporter.ftl (1)

1-2: LGTM!

The Russian localization entries for the experimental teleporter look good. The translations are clear and accurately describe the functionality of the device.

Resources/Prototypes/_White/Entities/Objects/Devices/Syndicate_Gadgets/experimental_teleporter.yml (1)

1-16: LGTM! The experimental teleporter prototype is well-defined.

The entity prototype for the experimental syndicate teleporter is structured correctly and includes all the necessary components for its functionality. The name and description provide clear information about the item's purpose and mechanics. The sprite, experimental teleporter, limited charges, and auto recharge components work together to create a balanced and engaging gameplay feature.

Tools
yamllint

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

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

Resources/Locale/en-US/_white/store/uplink-catalog.ftl (1)

7-8: LGTM!

The addition of the "Experimental syndicate teleporter" item and its description are consistent with the PR objectives and the AI-generated summary. The description provides clear details about the item's functionality.

Resources/Locale/ru-RU/_white/store/uplink-catalog.ftl (2)

5-5: LGTM!

Adding a newline at the end of the file is a good practice for consistency and to avoid potential issues with file parsing.


7-8: LGTM!

The new entries for the experimental teleporter are consistent with the format of other entries in the file. The name and description provide relevant information about the teleporter and are localized in Russian, which is consistent with the purpose of the file.

Resources/Prototypes/_White/Catalog/uplink_catalog.yml (1)

11-20: LGTM!

The new listing entry for the UplinkExperimentalSyndicateTeleporter is properly structured and includes all the necessary attributes. The cost and categorization seem appropriate for a utility item.

Note: The actual functionality and balance of the item will depend on the implementation of the ExperimentalSyndicateTeleporter entity, which should be reviewed separately.

Resources/Prototypes/_White/Entities/Effects/effects.yml (1)

1-20: LGTM!

The ExperimentalTeleporterInEffect entity is well-structured and aligns with the PR objective of introducing teleportation mechanics. The combination of components effectively creates a short-lived visual effect for the teleportation entry point.

Resources/Textures/_White/Objects/Devices/experimentalsyndicateteleporter.rsi/meta.json (5)

2-2: LGTM!

The version property is set to a valid integer.


3-4: LGTM!

The license and copyright properties are correctly specified. The chosen CC-BY-SA-3.0 license allows using the texture with proper attribution, which is provided.


5-8: LGTM!

The size property specifies valid dimensions for the texture.


9-121: LGTM!

The states property correctly defines the animation states for the texture:

  • The icon state has a simple animation.
  • The inhand-left and inhand-right states have directional sprites for holding the item.
  • The in and out states have directional animations for the item entering and exiting, likely for the teleportation effect.

The chosen frame counts and durations seem appropriate.


1-122: LGTM!

The JSON file is well-structured and valid:

  • The syntax and formatting are correct.
  • All required properties for a texture metadata file are present.
  • The chosen values for each property seem appropriate and consistent.

The file should parse without issues and correctly serve its purpose of providing metadata for the texture resource.

Comment on lines +21 to +39
- type: entity
id: ExperimentalTeleporterOutEffect
name: experimental syndicate teleporter out effect
components:
- type: TimedDespawn
lifetime: 0.6
- type: EvaporationSparkle
- type: Transform
noRot: true
anchored: true
- type: Sprite
layers:
- sprite: /Textures/_White/Objects/Devices/experimentalsyndicateteleporter.rsi
state: out
shader: unshaded
netsync: false
drawdepth: Effects
- type: PointLight
color: "#008DFE"
Copy link

Choose a reason for hiding this comment

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

LGTM, but please add a newline at the end of the file.

The ExperimentalTeleporterOutEffect entity is well-structured and complements the ExperimentalTeleporterInEffect entity to create the visual effects for the teleportation exit point. The code aligns with the PR objective.

However, please add a newline at the end of the file to adhere to the POSIX standard and avoid potential issues with some tools.

Apply this diff to fix the missing newline:

     - type: PointLight
       color: "#008DFE"
+
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
- type: entity
id: ExperimentalTeleporterOutEffect
name: experimental syndicate teleporter out effect
components:
- type: TimedDespawn
lifetime: 0.6
- type: EvaporationSparkle
- type: Transform
noRot: true
anchored: true
- type: Sprite
layers:
- sprite: /Textures/_White/Objects/Devices/experimentalsyndicateteleporter.rsi
state: out
shader: unshaded
netsync: false
drawdepth: Effects
- type: PointLight
color: "#008DFE"
- type: entity
id: ExperimentalTeleporterOutEffect
name: experimental syndicate teleporter out effect
components:
- type: TimedDespawn
lifetime: 0.6
- type: EvaporationSparkle
- type: Transform
noRot: true
anchored: true
- type: Sprite
layers:
- sprite: /Textures/_White/Objects/Devices/experimentalsyndicateteleporter.rsi
state: out
shader: unshaded
netsync: false
drawdepth: Effects
- type: PointLight
color: "#008DFE"
Tools
yamllint

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

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

Comment on lines +40 to +44
if (_charges.IsEmpty(uid)
|| !TryComp<TransformComponent>(args.User, out var xform)
|| _containerSystem.IsEntityInContainer(args.User)
&& !_containerSystem.TryRemoveFromContainer(args.User))
return;
Copy link

Choose a reason for hiding this comment

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

Clarify logical conditions to ensure correct behavior

The logical condition in the if statement might not execute as intended due to operator precedence. Specifically, the combination of || and && operators without explicit parentheses can lead to unexpected results.

Apply this diff to clarify the condition:

-if (_charges.IsEmpty(uid)
-    || !TryComp<TransformComponent>(args.User, out var xform)
-    || _containerSystem.IsEntityInContainer(args.User)
-    && !_containerSystem.TryRemoveFromContainer(args.User))
+if (_charges.IsEmpty(uid)
+    || !TryComp<TransformComponent>(args.User, out var xform)
+    || (_containerSystem.IsEntityInContainer(args.User)
+        && !_containerSystem.TryRemoveFromContainer(args.User)))
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 (_charges.IsEmpty(uid)
|| !TryComp<TransformComponent>(args.User, out var xform)
|| _containerSystem.IsEntityInContainer(args.User)
&& !_containerSystem.TryRemoveFromContainer(args.User))
return;
if (_charges.IsEmpty(uid)
|| !TryComp<TransformComponent>(args.User, out var xform)
|| (_containerSystem.IsEntityInContainer(args.User)
&& !_containerSystem.TryRemoveFromContainer(args.User)))
return;

Comment on lines +108 to +109
var randomRotation = _random.Next(0, component.RandomRotations.Count);
return Angle.FromDegrees(component.RandomRotations[randomRotation]).RotateVec(offset.Normalized() * length);
Copy link

Choose a reason for hiding this comment

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

Prevent possible IndexOutOfRangeException with RandomRotations

If component.RandomRotations is empty, accessing it will cause an IndexOutOfRangeException.

Add a check to ensure RandomRotations is not empty before accessing it:

+if (component.RandomRotations.Count == 0)
+{
+    // Handle the case where there are no rotations defined
+    return Vector2.Zero;
+}
 var randomRotation = _random.Next(0, component.RandomRotations.Count);

Committable suggestion was skipped due to low confidence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant