Explicitly separate rigidly definite player interaction actions#552
Open
BenCheung0422 wants to merge 16 commits into
Open
Explicitly separate rigidly definite player interaction actions#552BenCheung0422 wants to merge 16 commits into
BenCheung0422 wants to merge 16 commits into
Conversation
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
Member
Author
|
Update to this pull request is completed, quite a kind of major change. |
Member
Author
|
Power glove part would be further resolved by #567. |
# 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #435
There are several changes to player interaction system, mainly as follow:
Key bindings:
DROP-ONE,DROP-STACK,SEARCHER-BAR, etc.)QUICKSAVE->QUICK-SAVEPOTIONEFFECTS->POTION-EFFECTSSIMPPOTIONEFFECTS->SIMPLIFY-POTION-EFFECTSEXPANDQUESTDISPLAY->EXPAND-QUEST-DISPLAYTOGGLEHUD->TOGGLE-HUDATTACK-C|SPACE|ENTERMENU-X|EATTACK-C|SPACEUSE-X|ENTERINVENTORY-EATTACK- Some functionalities are removed and moved toUSE, and functionalities are streamlined and complemented, designed for attackingMENU- Functionalities are separated intoUSEandINVENTORYwith some confusing and redundant parts being removedMany 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