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

Added Right Click Melee Attack to Guns #24

Merged
merged 9 commits into from
Sep 13, 2024

Conversation

Vaaankas
Copy link
Contributor

@Vaaankas Vaaankas commented Aug 28, 2024

Описание PR

Огнестрельное оружие теперь совместимо с компонентом MeleeWeapon, атаки производятся по нажатию ПКМ в боевом режиме.

Обновлённые характеристики оружия:

Пистолеты - 7 урона, частота атак 1,
ПП - 8 урона, частота атак 0.8,
Дробовики и винтовки - 10 урона, частота атак 0.7.
Винтовка мосина наконец получила свой штык - 10 колющего и 5 режущего урона, частота атак 0.5,
Протокинетик - 7 урона / 10 урона в двух руках. частота атак 0.7.

Медиа

2024-08-28.16-18-49.mp4
_.-.mp4

Изменения

🆑 vanx

  • add: Огнестрельное оружие теперь может атаковать вблизи на ПКМ

Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@riddleridou riddleridou changed the title Added right click melee attack to guns Added Right Click Melee Attack to Guns Aug 28, 2024
Copy link
Member

@Spatison Spatison left a comment

Choose a reason for hiding this comment

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

К строчкам кода изменённым не в папках вайта следует добавлять комментарий.

Одна строчка кода // WD EDIT
// WD EDIT START
Три и более строчки 
// WD EDIT END
В прототипе # WD EDIT

Новые файлы стоит добавлять в папку _White.

@Spatison
Copy link
Member

Ошибка в Build & Test Debug не связана с ПРом

@DVOniksWyvern
Copy link
Collaborator

С этим есть некоторые геймдизайнеровые загвоздки, пусть идея очень даже хорошая.

В частности, там идёт расчет на то, что ПКМ будет в будущем использован для системы прицеливания, то есть, это имеет некоторый приоритет.

Можно ли добавить, что вместо ПКМ - условный ALT + ЛКМ?

vanx added 3 commits August 28, 2024 23:53
# Conflicts:
#	Content.Client/Weapons/Melee/MeleeWeaponSystem.cs
#	Content.Server/Weapons/Melee/MeleeWeaponSystem.cs
#	Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs
#	Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/pka.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/Battery/battery_guns.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/LMGs/lmgs.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/Pistols/pistols.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/Revolvers/revolvers.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/Rifles/rifles.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/SMGs/smgs.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/Shotguns/shotguns.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/Snipers/snipers.yml
Co-authored-by: Spatison <[email protected]>
Copy link

coderabbitai bot commented Sep 8, 2024

Walkthrough

The changes involve updates to the melee and ranged weapon systems across multiple files, focusing on enhancing the handling of weapon actions based on user input. Key modifications include the introduction of a new event for melee attempts, restructuring of attack logic, and the addition of new melee weapon types in YAML configurations. The updates aim to clarify control flow and improve the functionality of melee combat mechanics while ensuring that ranged weapons are excluded from melee-specific logic.

Changes

Files Change Summary
Content.Client/Weapons/Melee/MeleeWeaponSystem.cs Updated the Update method to streamline attack logic for heavy and light attacks, clarified disarm actions, and improved comments for better understanding.
Content.Server/Weapons/Melee/MeleeWeaponSystem.cs Modified OnMeleeExamineDamage to exclude GunComponent from heavy damage calculations, ensuring heavy damage is only applied to melee weapons.
Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs Replaced ShotAttemptedEvent with MeleeAttemptedEvent, renaming the handling method accordingly to reflect the new event-driven logic for melee actions.
Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs Removed OnGunMelee method to eliminate melee interaction logic from the gun's behavior, focusing solely on shooting mechanics.
Content.Shared/_White/Weapons/Melee/Events/MeleeAttemptedEvent.cs Introduced a new record struct MeleeAttemptedEvent to manage melee attack attempts, including properties for user, weapon used, and cancellation methods.
Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/pka.yml Added new melee weapon and damage-increasing weapon entries with specified attributes.
Resources/Prototypes/Entities/Objects/Weapons/Guns/Battery/battery_guns.yml Introduced three melee weapon entries with distinct attributes, enhancing weapon diversity.
Resources/Prototypes/Entities/Objects/Weapons/Guns/LMGs/lmgs.yml Added a melee weapon entry with specified attributes, expanding weapon types.
Resources/Prototypes/Entities/Objects/Weapons/Guns/Pistols/pistols.yml Introduced a melee weapon entry with defined damage and sound attributes.
Resources/Prototypes/Entities/Objects/Weapons/Guns/Revolvers/revolvers.yml Added a melee weapon entry with defined damage and sound attributes.
Resources/Prototypes/Entities/Objects/Weapons/Guns/Rifles/rifles.yml Added two melee weapon entries with distinct attributes, enhancing weapon capabilities.
Resources/Prototypes/Entities/Objects/Weapons/Guns/SMGs/smgs.yml Introduced a melee weapon entry with defined attributes and made minor formatting adjustments.
Resources/Prototypes/Entities/Objects/Weapons/Guns/Shotguns/shotguns.yml Added a melee weapon entry with specified attributes, diversifying weapon types.
Resources/Prototypes/Entities/Objects/Weapons/Guns/Snipers/snipers.yml Introduced two melee weapon entries with distinct attributes, expanding weapon configurations.

Tip

OpenAI O1 model for chat
  • We have deployed OpenAI's latest O1 model for chat.
  • OpenAI claims that this model has superior reasoning capabilities than their GPT-4o model.
  • Please share any feedback with us in the discussions post.

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 972df6b and 42724f5.

Files selected for processing (1)
  • Content.Shared/_White/Weapons/Melee/Events/MeleeAttemptedEvent.cs (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • Content.Shared/_White/Weapons/Melee/Events/MeleeAttemptedEvent.cs

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 419edd6 and 972df6b.

Files selected for processing (14)
  • Content.Client/Weapons/Melee/MeleeWeaponSystem.cs (3 hunks)
  • Content.Server/Weapons/Melee/MeleeWeaponSystem.cs (2 hunks)
  • Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs (3 hunks)
  • Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs (3 hunks)
  • Content.Shared/_White/Weapons/Melee/Events/MeleeAttemptedEvent.cs (1 hunks)
  • Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/pka.yml (1 hunks)
  • Resources/Prototypes/Entities/Objects/Weapons/Guns/Battery/battery_guns.yml (3 hunks)
  • Resources/Prototypes/Entities/Objects/Weapons/Guns/LMGs/lmgs.yml (1 hunks)
  • Resources/Prototypes/Entities/Objects/Weapons/Guns/Pistols/pistols.yml (1 hunks)
  • Resources/Prototypes/Entities/Objects/Weapons/Guns/Revolvers/revolvers.yml (1 hunks)
  • Resources/Prototypes/Entities/Objects/Weapons/Guns/Rifles/rifles.yml (2 hunks)
  • Resources/Prototypes/Entities/Objects/Weapons/Guns/SMGs/smgs.yml (3 hunks)
  • Resources/Prototypes/Entities/Objects/Weapons/Guns/Shotguns/shotguns.yml (1 hunks)
  • Resources/Prototypes/Entities/Objects/Weapons/Guns/Snipers/snipers.yml (2 hunks)
Files skipped from review due to trivial changes (1)
  • Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs
Additional comments not posted (18)
Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/pka.yml (2)

14-21: New MeleeWeapon Component Added

The addition of the MeleeWeapon component with an attack rate of 0.7 and blunt damage of 7 aligns with the PR's objectives to integrate melee capabilities into firearms. This change should enhance gameplay by allowing the proto-kinetic accelerator to be used in close combat scenarios.


21-24: New IncreaseDamageOnWield Component Added

The introduction of the IncreaseDamageOnWield component, which increases blunt damage by 3 when the weapon is wielded, introduces a new dynamic to weapon handling. This change could encourage players to engage more with melee combat, enhancing the strategic depth of the game.

Resources/Prototypes/Entities/Objects/Weapons/Guns/LMGs/lmgs.yml (1)

63-69: New MeleeWeapon Component for LMGs

The addition of the MeleeWeapon component with an attack rate of 0.5 and blunt damage of 8 to the light machine guns enhances their versatility in combat. This change allows for both ranged and melee combat, providing players with more tactical options.

Resources/Prototypes/Entities/Objects/Weapons/Guns/Snipers/snipers.yml (2)

40-46: Review of Melee Weapon Configuration for Base Sniper

The configuration for the melee weapon on the base sniper rifle is correctly implemented with an attackRate of 0.5 and Blunt damage of 8. However, ensure that the damage values and attack rate are balanced according to the game's overall weapon mechanics.

Please verify the balance of the attack rate and damage values with the game design team.


64-70: Review of Melee Weapon Configuration for Kardashev-Mosin Sniper

The melee weapon configuration for the Kardashev-Mosin sniper is well-implemented, featuring Piercing and Slash damage types, which add depth to the weapon's capabilities. The specific sound path /Audio/Weapons/bladeslice.ogg is a good touch, enhancing the audio feedback during melee attacks.

Resources/Prototypes/Entities/Objects/Weapons/Guns/Revolvers/revolvers.yml (1)

53-58: Review of Melee Weapon Configuration for Base Revolver

The configuration for the melee weapon on the base revolver is correctly implemented with Blunt damage of 7. The use of a generic hit sound collection is appropriate for the weapon type. However, ensure that the damage value is balanced according to the game's overall weapon mechanics.

Please verify the balance of the damage value with the game design team.

Resources/Prototypes/Entities/Objects/Weapons/Guns/Rifles/rifles.yml (1)

52-58: Review of Melee Weapon Configuration for Base Rifle

The configuration for the melee weapon on the base rifle is correctly implemented with an attackRate of 0.7 and Blunt damage of 10. However, ensure that the damage values and attack rate are balanced according to the game's overall weapon mechanics.

Please verify the balance of the attack rate and damage values with the game design team.

Resources/Prototypes/Entities/Objects/Weapons/Guns/Pistols/pistols.yml (1)

68-73: Approved: Melee weapon configuration for pistols.

The addition of the melee weapon component with a damage type of "Blunt" and a value of 7 is correctly implemented. The sound effect for hits is also appropriately configured.

Please ensure the sound collection GenericHit is correctly integrated and available in the game's audio assets.

Resources/Prototypes/Entities/Objects/Weapons/Guns/Shotguns/shotguns.yml (1)

46-52: Approved: Melee weapon configuration for shotguns.

The addition of the melee weapon component with an attack rate of 0.7 and a damage type of "Blunt" with a value of 10 is correctly implemented. The sound effect for hits is also appropriately configured.

Please ensure the sound collection GenericHit is correctly integrated and available in the game's audio assets.

Resources/Prototypes/Entities/Objects/Weapons/Guns/SMGs/smgs.yml (1)

57-63: Approved: Melee weapon configuration for SMGs.

The addition of the melee weapon component with an attack rate of 0.8 and a damage type of "Blunt" with a value of 8 is correctly implemented. The sound effect for hits is also appropriately configured.

Please ensure the sound collection GenericHit is correctly integrated and available in the game's audio assets.

Content.Client/Weapons/Melee/MeleeWeaponSystem.cs (1)

164-171: Approved changes for left-click functionality on guns.

The logic to prevent left-click attacks when a gun is set to shoot with the left click is correctly implemented. This ensures that guns do not perform unintended melee attacks.

Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs (3)

4-4: Update import to reflect new event usage.

The import statement has been updated to include the new MeleeAttemptedEvent. This change is necessary to support the new event handling logic introduced in this PR.


66-66: Subscription to new MeleeAttemptedEvent.

The subscription change from ShotAttemptedEvent to MeleeAttemptedEvent is crucial for the new melee attack functionality. This ensures that the system listens for the correct events when melee attacks are attempted.


90-90: Method update to handle MeleeAttemptedEvent.

The method OnMeleeAttempted has been updated to handle the new MeleeAttemptedEvent. This change is aligned with the PR's objective to enhance melee attack functionality by integrating it with the right-click action. The method currently checks if the next attack is allowed based on the timing, which is a simple yet effective way to manage attack rates.

Content.Server/Weapons/Melee/MeleeWeaponSystem.cs (1)

28-28: Import addition approved.

The new import is necessary for the logic that checks for the presence of a GunComponent in the OnMeleeExamineDamage method.

Resources/Prototypes/Entities/Objects/Weapons/Guns/Battery/battery_guns.yml (3)

35-41: MeleeWeapon component addition approved.

The specified attackRate and Blunt damage align with the PR's objectives for integrating melee attacks with firearms. The choice of GenericHit for the sound effect is appropriate.


78-84: Consistent MeleeWeapon component addition approved.

The properties of this MeleeWeapon component are consistent with the first addition, ensuring uniform behavior across different entities.


105-109: MeleeWeapon component addition approved with noted variation.

The attackRate and Blunt damage are slightly different from the previous additions, which may reflect the specific characteristics of this weapon. This variation is acceptable as long as it aligns with the intended gameplay balance.

Copy link
Member

@Spatison Spatison left a comment

Choose a reason for hiding this comment

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

👍

@PuroSlavKing
Copy link
Member

С этим есть некоторые геймдизайнеровые загвоздки, пусть идея очень даже хорошая.

В частности, там идёт расчет на то, что ПКМ будет в будущем использован для системы прицеливания, то есть, это имеет некоторый приоритет.

Можно ли добавить, что вместо ПКМ - условный ALT + ЛКМ?

Или ввести разницу между зажатым и просто нажатым ПКМ 💅

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.

5 participants