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] Small Energy Crossbow / Маленький Энергетический Арбалет #60

Merged
merged 5 commits into from
Sep 26, 2024

Conversation

Spatison
Copy link
Member

Описание PR

Порт маленького энерго арбалета.


Медиа

Видео


Изменения

🆑 Spatison

  • add: Added small energy crossbow / Добавлен маленький энерго арбалет

Copy link
Contributor

coderabbitai bot commented Sep 17, 2024

Walkthrough

This pull request introduces several new components and systems related to visual effects and collision mechanics in the game. Key additions include the BlurOnCollideComponent and BlurOnCollideSystem, which apply a blur effect upon collisions, and the KnockdownOnCollideComponent and KnockdownOnCollideSystem, which handle knockdown behavior during collisions. Additionally, new weapon entities, including a small energy crossbow and its projectiles, are added, along with corresponding localization entries. Default values for existing components are also established to enhance usability.

Changes

File Path Change Summary
Content.Shared/Eye/Blinding/Components/BlurryVisionComponent.cs Default values for Magnitude (4f) and CorrectionPower (2f) fields are added.
Content.Shared/_White/Collision/Blur/BlurOnCollideComponent.cs Introduces BlurOnCollideComponent with a public field BlurTime set to 10 seconds.
Content.Shared/_White/Collision/Blur/BlurOnCollideSystem.cs Introduces BlurOnCollideSystem that applies blurring effects upon ProjectileHitEvent and ThrowDoHitEvent.
Content.Shared/_White/Collision/Knockdown/KnockdownOnCollideComponent.cs Introduces KnockdownOnCollideComponent with a Behavior field set to NoDrop.
Content.Shared/_White/Collision/Knockdown/KnockdownOnCollideSystem.cs Introduces KnockdownOnCollideSystem that applies knockdown effects upon collisions.
Resources/Locale/en-US/_white/store/uplink-catalog.ftl Adds a new weapon entry for "Small energy crossbow" with a description.
Resources/Locale/ru-RU/_white/prototypes/entities/objects/weapons/guns/battery/ebow.ftl Adds localized entry for "Energy Crossbow Mini" in Russian.
Resources/Locale/ru-RU/_white/store/uplink-catalog.ftl Adds Russian localization for "small energy crossbow" and "betrayal dagger."
Resources/Prototypes/_White/Catalog/uplink_catalog.yml Adds a new listing for "UplinkMiniEbow" with various attributes.
Resources/Prototypes/_White/Entities/Objects/Weapons/Guns/Battery/mini_ebow.yml Defines a new entity for "small energy crossbow" with specific components.
Resources/Prototypes/_White/Entities/Objects/Weapons/Guns/Projectiles/bolts..yml Defines an entity for "energy crossbow bolt" with damage mechanics.
Resources/Prototypes/status_effects.yml Introduces new status effects: RecentlyBlocked and BlurryVision.
Resources/Textures/_White/Objects/Weapons/Guns/Battery/mini-ebow.rsi/meta.json Adds metadata for the mini electronic bow asset.
Resources/Textures/_White/Objects/Weapons/Guns/Projectiles/ebolt.rsi/meta.json Adds metadata for the energy crossbow bolt asset.

Possibly related PRs

Suggested labels

Changes: Audio

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

github-actions bot commented Sep 17, 2024

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

Resources/Textures/_White/Objects/Weapons/Guns/Battery/mini-ebow.rsi

State Old New Status
bolt Added
empty Added
icon Added
inhand-left Added
inhand-right Added

Resources/Textures/_White/Objects/Weapons/Guns/Projectiles/ebolt.rsi

State Old New Status
bullet Added

Edit: diff updated after 2f488ed

@Spatison Spatison changed the title add: ebow [Port] Small Energy Crossbow / Маленький Энергетический Арбалет Sep 17, 2024
Copy link
Contributor

@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: 1

Outside diff range and nitpick comments (3)
Resources/Locale/ru-RU/_white/prototypes/entities/objects/weapons/guns/battery/ebow.ftl (1)

1-2: LGTM! The localized entries for the new weapon entity are clear and descriptive.

The addition of the "Energy Crossbow Mini" weapon entity and its corresponding localized entries in Russian is a great enhancement to the game's weapon variety. The name and description effectively convey the weapon's functionality and its impact on gameplay.

A few suggestions for improvement:

  • Consider adding localized entries for any additional properties or attributes specific to this weapon entity, such as ammo type, reload speed, or unique visual effects.
  • Ensure that the localized entries are consistent with the naming conventions and writing style used for other weapon entities in the game.
  • Double-check the accuracy of the Russian translation to ensure that it effectively communicates the intended meaning to Russian-speaking players.
Content.Shared/_White/Collision/Blur/BlurOnCollideComponent.cs (1)

1-8: LGTM! Minor suggestions for improvement.

The BlurOnCollideComponent class is well-structured and follows good practices like using the [RegisterComponent] attribute and being marked as sealed.

A few suggestions for improvement:

  • Consider adding XML documentation comments to describe the purpose and usage of the class and its properties. This can help other developers understand how to use the component correctly.
  • If the class definition is not expected to be split across multiple files, consider removing the partial keyword to keep the code simpler.
Resources/Prototypes/_White/Entities/Objects/Weapons/Guns/Projectiles/bolts..yml (1)

31-31: Add a newline character at the end of the file.

The static analysis tool yamllint has flagged an issue with a missing newline character at the end of the file. While this is a minor formatting issue and does not affect the functionality of the YAML configuration, it is generally considered good practice to include a newline character at the end of files for consistency and to comply with common coding style guidelines.

Please add a newline character at the end of the file to resolve this issue.

Tools
yamllint

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

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6fb8e63 and 622f08d.

Files ignored due to path filters (6)
  • Resources/Textures/_White/Objects/Weapons/Guns/Battery/mini-ebow.rsi/bolt.png is excluded by !**/*.png
  • Resources/Textures/_White/Objects/Weapons/Guns/Battery/mini-ebow.rsi/empty.png is excluded by !**/*.png
  • Resources/Textures/_White/Objects/Weapons/Guns/Battery/mini-ebow.rsi/icon.png is excluded by !**/*.png
  • Resources/Textures/_White/Objects/Weapons/Guns/Battery/mini-ebow.rsi/inhand-left.png is excluded by !**/*.png
  • Resources/Textures/_White/Objects/Weapons/Guns/Battery/mini-ebow.rsi/inhand-right.png is excluded by !**/*.png
  • Resources/Textures/_White/Objects/Weapons/Guns/Projectiles/ebolt.rsi/bullet.png is excluded by !**/*.png
Files selected for processing (14)
  • Content.Shared/Eye/Blinding/Components/BlurryVisionComponent.cs (1 hunks)
  • Content.Shared/_White/Collision/Blur/BlurOnCollideComponent.cs (1 hunks)
  • Content.Shared/_White/Collision/Blur/BlurOnCollideSystem.cs (1 hunks)
  • Content.Shared/_White/Collision/Knockdown/KnockdownOnCollideComponent.cs (1 hunks)
  • Content.Shared/_White/Collision/Knockdown/KnockdownOnCollideSystem.cs (1 hunks)
  • Resources/Locale/en-US/_white/store/uplink-catalog.ftl (1 hunks)
  • Resources/Locale/ru-RU/_white/prototypes/entities/objects/weapons/guns/battery/ebow.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/Objects/Weapons/Guns/Battery/mini_ebow.yml (1 hunks)
  • Resources/Prototypes/_White/Entities/Objects/Weapons/Guns/Projectiles/bolts..yml (1 hunks)
  • Resources/Prototypes/status_effects.yml (1 hunks)
  • Resources/Textures/_White/Objects/Weapons/Guns/Battery/mini-ebow.rsi/meta.json (1 hunks)
  • Resources/Textures/_White/Objects/Weapons/Guns/Projectiles/ebolt.rsi/meta.json (1 hunks)
Files skipped from review due to trivial changes (2)
  • Content.Shared/Eye/Blinding/Components/BlurryVisionComponent.cs
  • Resources/Textures/_White/Objects/Weapons/Guns/Projectiles/ebolt.rsi/meta.json
Additional context used
yamllint
Resources/Prototypes/_White/Entities/Objects/Weapons/Guns/Projectiles/bolts..yml

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

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

Resources/Prototypes/_White/Catalog/uplink_catalog.yml

[warning] 32-32: too many spaces after colon

(colons)


[warning] 37-37: wrong indentation: expected 4 but found 2

(indentation)


[warning] 39-39: wrong indentation: expected 4 but found 2

(indentation)


[warning] 42-42: wrong indentation: expected 8 but found 6

(indentation)


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

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

Additional comments not posted (29)
Content.Shared/_White/Collision/Blur/BlurOnCollideComponent.cs (1)

6-7: Verify the default BlurTime value and its impact on gameplay.

The default value of 20 seconds for the BlurTime field seems reasonable, but it's important to ensure that this value provides the desired visual effect and doesn't negatively impact gameplay.

Consider testing different values for BlurTime to find the optimal duration for the blur effect. Also, think about whether this value should be configurable for different use cases or entities.

To verify the impact of the BlurTime value, you can use the following script to search for any other references to the BlurOnCollideComponent and analyze how the BlurTime value is used:

Verification successful

To gather more information and fully verify the impact of the BlurTime value, I'll run additional scripts to search for related information in the codebase.


BlurTime value is consistent, but lacks configurability and documentation

The default BlurTime value of 20 seconds is consistently used throughout the codebase. However, there are a few points to consider:

  1. The value is not configurable through external files, which may limit flexibility in adjusting the gameplay experience.
  2. There's no documentation explaining the reasoning behind the 20-second duration or its intended impact on gameplay.

To improve this:

  • Consider making BlurTime configurable through a settings file for easier tuning.
  • Add comments or documentation explaining the intended effect of the 20-second blur duration on gameplay.
  • Conduct manual testing to ensure the 20-second duration provides the desired gameplay experience across different scenarios.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for references to BlurOnCollideComponent and analyze BlurTime usage.

# Test: Search for BlurOnCollideComponent usage. Expect: Relevant code snippets.
rg --type cs -A 5 $'BlurOnCollideComponent'

Length of output: 2423


Script:

#!/bin/bash
# Search for other references to BlurTime
rg --type cs -i 'blurtime'

# Search for configuration files that might override BlurTime
fd -e yaml -e json | xargs rg -i 'blurtime'

# Search for documentation or comments related to blur effect or BlurTime
rg -i 'blur.*effect|blurtime' -g '*.md' -g '*.txt'

Length of output: 333

Content.Shared/_White/Collision/Knockdown/KnockdownOnCollideComponent.cs (1)

5-10: LGTM!

The KnockdownOnCollideComponent class is well-structured and introduces a useful mechanic for handling knockdowns upon collision. The Behavior field provides flexibility in defining how held items are handled during knockdowns, with a sensible default value.

Some additional insights:

  • The DropHeldItemsBehavior enum is imported from another namespace, ensuring proper encapsulation and reusability of the behavior definitions.
  • Declaring the class as sealed prevents unintended inheritance, which can help maintain the integrity of the component's behavior.
  • The partial declaration allows for potential extension of the class in other files, promoting modularity and maintainability.

Overall, this component adds value to the game's collision system and enhances gameplay interactions.

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

5-6: LGTM!

The description accurately conveys the functionality of the betrayal knife weapon. The translation seems appropriate.


7-8: LGTM!

The name and description accurately convey the characteristics of the small energy crossbow weapon. The translations seem appropriate.

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

7-8: LGTM!

The addition of the "Small energy crossbow" weapon and its description aligns with the PR objectives and enhances the game's weapon catalog. The description provides relevant details about the weapon's characteristics and suggests tactical options for players.

Resources/Textures/_White/Objects/Weapons/Guns/Battery/mini-ebow.rsi/meta.json (1)

1-28: LGTM!

The meta.json file follows a well-structured format for defining metadata related to the mini electronic bow weapon asset. The inclusion of licensing and copyright information ensures proper attribution. The specified asset states and directions provide flexibility for rendering the asset in different contexts within the game.

The metadata structure is clear, concise, and follows best practices.

Resources/Prototypes/_White/Entities/Objects/Weapons/Guns/Projectiles/bolts..yml (7)

1-5: LGTM!

The entity type and metadata are configured correctly. Deriving from the BaseBullet parent entity is a good practice for reusing common functionality, and the unique id allows the entity to be referenced and spawned programmatically. Setting noSpawn to true is appropriate for a projectile entity that should only be spawned when fired from a weapon.


7-9: Verify the "bullet" state in the sprite file.

The Sprite component is correctly defined and specifies the visual representation of the energy crossbow bolt. The file path for the sprite resource follows the expected convention.

Please verify that the "bullet" state exists in the _White/Objects/Weapons/Guns/Projectiles/ebolt.rsi sprite file to ensure the correct animation is displayed.


10-11: LGTM!

The Ammo component is correctly defined for the energy crossbow bolt entity. Setting the muzzleFlash property to null is a valid configuration option to disable the muzzle flash effect, which makes sense for a crossbow bolt as it is not a typical visual effect associated with this type of projectile.


12-16: Ensure the damage amount is balanced with other weapons.

The Projectile component is correctly defined for the energy crossbow bolt entity. Setting the impactEffect to null is a valid configuration option to disable any visual effects upon impact.

The damage configuration specifies that the bolt deals Poison damage, which aligns with the concept of an energy weapon. The damage amount of 15 points seems reasonable, but please ensure that it is properly balanced with other weapons in the game to maintain fair gameplay.


17-19: LGTM!

The Reflective component is correctly defined for the energy crossbow bolt entity. Setting the reflective property to an array allows specifying multiple types of projectiles that the bolt can reflect.

Including "Energy" in the reflective array is an interesting gameplay mechanic that enables the bolt to potentially deflect incoming energy attacks. This adds a unique strategic element to the weapon's usage.


20-28: Verify the AABB bounds match the bolt sprite.

The Fixtures component is correctly defined for the energy crossbow bolt entity. The "projectile" fixture uses an axis-aligned bounding box (AABB) shape, which is a common choice for simple projectile collisions.

Please ensure that the bounds of the AABB shape ("-0.1,-0.2,0.1,0.2") accurately match the visual representation of the bolt sprite. This will help maintain consistency between the visual and collision aspects of the bolt.

Setting the hard property to false and specifying the mask property to only collide with "Opaque" objects are appropriate configurations for a projectile that should pass through non-solid obstacles.


29-31: Provide more information about the BlurOnCollide component.

The KnockdownOnCollide component is correctly defined for the energy crossbow bolt entity. Setting the behavior property to "AlwaysDrop" ensures that the bolt consistently causes the target to be knocked down upon collision, which can be a useful gameplay mechanic.

Regarding the BlurOnCollide component, while it is correctly defined, there are no additional properties specified. It would be helpful to provide more information or documentation on the expected behavior and purpose of this component. What kind of blur effect does it apply, and how does it enhance the gameplay experience?

Tools
yamllint

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

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

Resources/Prototypes/_White/Entities/Objects/Weapons/Guns/Battery/mini_ebow.yml (9)

7-9: LGTM!

The Sprite component is correctly defined with the appropriate sprite file and default state.


10-12: LGTM!

The Item component is correctly defined with the appropriate size and sprite file.


13-15: LGTM!

The Clothing component is correctly defined, allowing the item to be equipped in the "Belt" slot.


16-20: LGTM!

The Gun component is correctly defined with the appropriate properties such as fire rate and gunshot sound.


21-24: LGTM!

The RechargeBasicEntityAmmo component is correctly defined with the appropriate recharge cooldown and sound.


25-28: LGTM!

The BasicEntityAmmoProvider component is correctly defined with the appropriate ammo type, capacity, and initial count.


29-29: LGTM!

The AmmoCounter component is correctly defined to track the ammo count for the gun.


30-35: LGTM!

The GenericVisualizer component is correctly defined with the appropriate visual states based on the ammo status.


36-36: LGTM!

The Appearance component is correctly defined to handle the overall appearance of the entity.

Resources/Prototypes/status_effects.yml (2)

63-68: LGTM!

The RecentlyBlocked status effect is defined correctly and follows the established conventions. The alwaysAllowed property and matching alert identifier are used appropriately.


69-72: LGTM!

The BlurryVision status effect is defined correctly and uses the alwaysAllowed property appropriately. The absence of an alert identifier is acceptable, as it may not require direct player notification.

Content.Shared/_White/Collision/Knockdown/KnockdownOnCollideSystem.cs (4)

11-17: LGTM!

The Initialize method correctly subscribes to the required events for handling knockdown on collide functionality. The event handlers are appropriately named and associated with the KnockdownOnCollideComponent.


19-22: LGTM!

The OnEntityHit method correctly handles the ThrowDoHitEvent event by invoking the ApplyEffects method with the appropriate arguments.


24-27: LGTM!

The OnProjectileHit method correctly handles the ProjectileHitEvent event by invoking the ApplyEffects method with the appropriate arguments.


29-32: LGTM!

The ApplyEffects method correctly uses the SharedLayingDownSystem to attempt to make the target entity lie down based on the provided KnockdownOnCollideComponent. The arguments passed to the TryLieDown method are appropriate.

Content.Shared/_White/Collision/Blur/BlurOnCollideSystem.cs (1)

8-37: LGTM!

The BlurOnCollideSystem class is well-structured and follows the expected pattern for an ECS system. It correctly subscribes to the relevant events and applies the blur effect on the target entity upon collision.

Some key observations:

  • The class is correctly subscribing to the ProjectileHitEvent and ThrowDoHitEvent events in the Initialize method.
  • The event handlers OnEntityHit and OnProjectileHit are invoking the ApplyEffects method with the correct arguments.
  • The ApplyEffects method is using the StatusEffectsSystem to add the BlurryVisionComponent status effect with the correct duration.

The class introduces a new gameplay mechanic where entities can be blurred upon collision. While this could potentially impact the balance and difficulty of the game, the class itself is self-contained and does not seem to have any external dependencies or side effects.

Overall, the implementation looks good and can be approved.

@Remuchi Remuchi merged commit a7990bc into master Sep 26, 2024
12 checks passed
@Remuchi Remuchi deleted the ebow branch September 26, 2024 01:56
riddleridou added a commit that referenced this pull request Sep 26, 2024
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.

2 participants