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

Fix: the items created from the loot pool are now being added to the ItemManager. #2

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

Conversation

markscho
Copy link

Creating an item in the game seems to be a 3-step process:

  • item = ItemFactory.create()
  • item.hydrate()
  • ItemManager.add(item)
    However, that last step was left out. The other thing to note is that the corpse created is an item that is also being added to the ItemManager, but the add() method is not recursive, adding anything from the corpse's inventory. Perhaps that could be a future failsafe.

@markscho
Copy link
Author

After further review, it looks like corpse.hydrate() would call Inventory.hydrate() which WOULD have added these items to the ItemManager. However, hydrate() was being called before these items were created. So I suppose you could reject this if you preferred calling corpse.hydrate() just prior to ItemManager.add(corpse).

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