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

Explicitly separate rigidly definite player interaction actions #552

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

BenCheung0422
Copy link
Member

@BenCheung0422 BenCheung0422 commented Aug 4, 2023

Resolves #435

There are several changes to player interaction system, mainly as follow:

Key bindings:

  • Generally all keymap names are updated to "separate" words (originally there exist DROP-ONE, DROP-STACK, SEARCHER-BAR, etc.)
    • QUICKSAVE -> QUICK-SAVE
    • POTIONEFFECTS -> POTION-EFFECTS
    • SIMPPOTIONEFFECTS -> SIMPLIFY-POTION-EFFECTS
    • EXPANDQUESTDISPLAY -> EXPAND-QUEST-DISPLAY
    • TOGGLEHUD -> TOGGLE-HUD
  • Menu and in-game interaction keys (default values)
    • Originally:
      • ATTACK - C|SPACE|ENTER
      • MENU - X|E
    • Result:
      • ATTACK - C|SPACE
      • USE - X|ENTER
      • INVENTORY - E
    • Changes:
      • ATTACK - Some functionalities are removed and moved to USE, and functionalities are streamlined and complemented, designed for attacking
      • MENU - Functionalities are separated into USE and INVENTORY with some confusing and redundant parts being removed

Many of the methods combine attack and interact when handling interactions and damage dealing, causing the combination complexity. This issue is kind of reorganized.
Originally, "menu" is used to interact/"use" most of the furniture, including beds and chests, as well as closing some menus (not specified to what menus) and "attack" is used to handle most of the interactions with the world, including placing, attacking and destroying.

"Inventory" now only opens player inventory menus or closes some in-game menus (usually furniture-related); "attack" now only handles direct damage and tile destroys with bare hand (fists) or any item on tiles or entities; "use" is now used for interacting with furniture, placing tile and furniture, item interactions, etc.
This can allow more kinds of interactions to be implemented, without necessarily having being limited to items holding on hands. It is also allowed to use any items to attack mobs and/or tiles most of the time (also knocking back mobs).
Most applications in-code for power glove are removed and integrated to "pick up" to simplify and organize the code better.

Attack/hurt methods in code are reorganized to standardize the usages and purposes of the methods. Attack methods are now targeting to be used by others and hurt methods are designed to be used internally to handle very basic damage handling, including knocking back reaction and sound playing (also HP value updating).
At the moment, I am quite unsure about how other entities should handle damage and attack.

In code, there are some important classes added to aid the interaction system: damage source and damage type. Since a target can be hurt by several sources, like mobs and tiles, a damage source type can help integrate the handles into one, reduce redundancy. It uses comments to definitely declare what is null and what is not null, all cases must match for the "correct" usage.

Although attack method instead of hurt method should include stamina and durability paying parts, for simplicity, they are kept at the moment to keep the stamina system as is. There might be an update to the stamina system (may refer to the Discord post).

Due to the difficulties to organize the tile damage handling code, I kept this part as complete as possible at the moment. A change to this would require a rewrite of the tile (or more general) damage system, which I would put afterwards. So now, ineffective damages are temporarily regarded as "zero" (zero damage policy), instead of having real damage to target tiles unexpectedly, and at the same time as prove of completion of attack action.

Also, creative mode can now break most of the tiles by just bare hand, without using any tool. Creative mode should now allow player to break most solid tiles with bare hand.

For further damage system update, creative mode feature reviews, and power glove item review, these will be discussed afterwards

@BenCheung0422 BenCheung0422 marked this pull request as ready for review August 4, 2023 11:33
# Conflicts:
#	src/client/java/minicraft/entity/furniture/Bed.java
#	src/client/java/minicraft/entity/furniture/Chest.java
#	src/client/java/minicraft/entity/furniture/DeathChest.java
#	src/client/java/minicraft/entity/furniture/DungeonChest.java
#	src/client/java/minicraft/entity/furniture/Furniture.java
#	src/client/java/minicraft/entity/furniture/Tnt.java
#	src/client/java/minicraft/entity/mob/Player.java
#	src/client/java/minicraft/item/FishingRodItem.java
#	src/client/java/minicraft/item/FurnitureItem.java
#	src/client/java/minicraft/item/Item.java
#	src/client/java/minicraft/item/ToolItem.java
#	src/client/java/minicraft/level/tile/HardRockTile.java
#	src/client/java/minicraft/level/tile/OreTile.java
#	src/client/java/minicraft/level/tile/PathTile.java
#	src/client/java/minicraft/level/tile/TorchTile.java
#	src/client/java/minicraft/level/tile/TreeTile.java
#	src/client/java/minicraft/level/tile/farming/FarmTile.java
#	src/client/java/minicraft/screen/ContainerDisplay.java
#	src/client/java/minicraft/screen/CraftingDisplay.java
#	src/client/java/minicraft/screen/PauseDisplay.java
#	src/client/java/minicraft/screen/PlayerInvDisplay.java
#	src/client/java/minicraft/screen/TutorialDisplayHandler.java
@BenCheung0422 BenCheung0422 changed the title Separate attack action and interact action Separate interaction actions Aug 5, 2024
@BenCheung0422 BenCheung0422 changed the title Separate interaction actions Explicitly separate interaction actions Aug 5, 2024
@BenCheung0422 BenCheung0422 changed the title Explicitly separate interaction actions Explicitly separate rigid and definite interaction actions Aug 5, 2024
@BenCheung0422 BenCheung0422 changed the title Explicitly separate rigid and definite interaction actions Explicitly separate rigidly definite interaction actions Aug 5, 2024
@BenCheung0422 BenCheung0422 changed the title Explicitly separate rigidly definite interaction actions Explicitly separate rigidly definite player interaction actions Aug 5, 2024
@BenCheung0422
Copy link
Member Author

Update to this pull request is completed, quite a kind of major change.

@BenCheung0422
Copy link
Member Author

Power glove part would be further resolved by #567.

@BenCheung0422 BenCheung0422 added UX/QoL Issue related to user experience or quality of life. Code Quality Issue related to code quality/coding standard. F-Update Issue related to update(s) of feature, changing particular functionalities and systems. Controls Issue related to user controls. labels Aug 28, 2024
# Conflicts:
#	src/client/java/minicraft/entity/furniture/Bed.java
#	src/client/java/minicraft/entity/furniture/Crafter.java
#	src/client/java/minicraft/entity/mob/Sheep.java
#	src/client/java/minicraft/level/tile/FlowerTile.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Quality Issue related to code quality/coding standard. Controls Issue related to user controls. F-Update Issue related to update(s) of feature, changing particular functionalities and systems. UX/QoL Issue related to user experience or quality of life.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improving the activation of interaction and damaging of tiles
1 participant