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

feat: Implement inventory logic for dropping items #330

Merged
merged 1 commit into from
Feb 2, 2025

Conversation

meyfa
Copy link
Owner

@meyfa meyfa commented Feb 2, 2025

Adds a to-be-implemented program World-DropItem that will spawn item entities (not part of this patch). The program is called from all of the following:

  • Player presses Q to drop the selected hotbar item ("player action")
  • Player has an open inventory window and presses Q while hovering a slot
  • Player has an open inventory and has picked up an item with the cursor, then clicks outside the window bounds
  • Player closes an inventory while there are items inside the crafting grid, but there is not enough space in their inventory to move the grid items back, so some have to be dropped.

Adds a to-be-implemented program `World-DropItem` that will spawn item
entities (not part of this patch). The program is called from all of the following:

* Player presses Q to drop the selected hotbar item ("player action")
* Player has an open inventory window and presses Q while hovering a slot
* Player has an open inventory and has picked up an item with the cursor,
    then clicks outside the window bounds
* Player closes an inventory while there are items inside the crafting grid,
    but there is not enough space in their inventory to move the grid items
    back, so some have to be dropped.
@meyfa meyfa merged commit a218836 into main Feb 2, 2025
3 checks passed
@meyfa meyfa deleted the feat/inventory-drop branch February 2, 2025 22:12
meyfa added a commit that referenced this pull request Feb 2, 2025
Chunks now have a linked list of entities they contain, and those entities are
sent to clients when the rest of the chunk data is sent. Entities can be created
and removed (item entities despawn automatically after 5 minutes), which
updates the linked list, and notifies players. A random UUID generator and
entity ticking as part of the gameloop are also implemented.

Together with #330, it is now possible to drop items into the world from
the player inventory or container windows! :)
@meyfa meyfa mentioned this pull request Feb 2, 2025
meyfa added a commit that referenced this pull request Feb 2, 2025
Chunks now have a linked list of entities they contain, and those entities are
sent to clients when the rest of the chunk data is sent. Entities can be created
and removed (item entities despawn automatically after 5 minutes), which
updates the linked list, and notifies players. A random UUID generator and
entity ticking as part of the gameloop are also implemented.

Together with #330, it is now possible to drop items into the world from
the player inventory or container windows! :)
meyfa added a commit that referenced this pull request Feb 2, 2025
Chunks now have a linked list of entities they contain, and those entities are
sent to clients when the rest of the chunk data is sent. Entities can be created
and removed (item entities despawn automatically after 5 minutes), which
updates the linked list, and notifies players. A random UUID generator and
entity ticking as part of the gameloop are also implemented.

Together with #330, it is now possible to drop items into the world from
the player inventory or container windows! :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant