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

make usable object unique #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ratacat
Copy link

@ratacat ratacat commented Nov 30, 2019

otherwise when you decrement an object on line 90, you're decrementing ALL instances of this object.

otherwise when you decrement an object on line 90, you're decrementing ALL instances of this object.
Copy link
Contributor

@seanohue seanohue left a comment

Choose a reason for hiding this comment

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

This is a good catch but I think the proper solution may be to use the item metadata to store the uses rather than the behavior config. The behavior config could still be used to determine the initial number of uses. This will prevent the decrement from happening on every instance but I think it will also prevent it from happening on the instance being used.

@ratacat
Copy link
Author

ratacat commented Dec 2, 2019

So we'd want to set the initial number of charges in the behavior config? And then in the use behavior, we want to check for presence of charge data in metadata? And if present, use that, if not present, then check for charge data in behavior config, and copy that to metadata?

Basically, the initial count is set in the config, but all of the 'live data' lives in metadata?

@seanohue
Copy link
Contributor

seanohue commented Dec 4, 2019

I think that would be ideal @ratacat, one major reason why being that the PR currently doesn't seem to "save" the decremented usages anywhere. It just clones the object from the behavior. Each time an item is used, the usages will be the same (as opposed to before where the usages were decremented globally for all instances).

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.

2 participants