Skip to content

Conversation

IExploitableMan
Copy link
Contributor

Type of change

  • Bug fix
  • New feature

Description

The DropCommand now supports an optional amount argument, allowing players to drop a specific number of items instead of entire stacks. The dropping logic was refactored into a dedicated dropItem method for cleaner structure, and InvUtils gained a dropOne helper to handle single-item drops.

Related issues

Closes #4222

How Has This Been Tested?

out.mp4

Checklist:

  • My code follows the style guidelines of this project.
  • I have added comments to my code in more complex areas.
  • I have tested the code in both development and production environments.

@IExploitableMan
Copy link
Contributor Author

I'm not sure how to handle cases where amount is greater than items in inventory

@I-No-oNe
Copy link

I'm not sure how to handle cases where amount is greater than items in inventory

Just send a message using error() that says that you can only drop the amount u have on the inv

@IExploitableMan
Copy link
Contributor Author

I'm not sure how to handle cases where amount is greater than items in inventory

Just send a message using error() that says that you can only drop the amount u have on the inv

I've thought about it, but maybe it's better to warn that fewer items were dropped than were specified

@I-No-oNe
Copy link

I don't think that will be a good implantation
You want the user to have as much as possible control, so making the inv-drop happen even when the right amount hasn't been specified isn't a good idea

@Wide-Cat
Copy link
Collaborator

I'm not sure about the command erroring if you don't have enough items. Even ignoring a bug it created, I feel like it would create more frustration if you want to drop so many items and the command fails because you are slightly underneath it - it would be smoother if it executed anyway and dropped what it could. I am happy to hear arguments against this though.

@IExploitableMan
Copy link
Contributor Author

I'm not sure about the command erroring if you don't have enough items. Even ignoring a bug it created, I feel like it would create more frustration if you want to drop so many items and the command fails because you are slightly underneath it - it would be smoother if it executed anyway and dropped what it could. I am happy to hear arguments against this though.

I agree with giving warnings, but could you clarify which bug you're talking about?

@Wide-Cat
Copy link
Collaborator

if you wanted to drop all of an item it would always fail, because the command passed in Integer.MAX_VALUE to the drop method and you always have less than that of an item

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.

.drop
3 participants