Skip to content

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