-
Notifications
You must be signed in to change notification settings - Fork 40
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
Adds missing spawn events for items #74
Conversation
Code-wise it looks good to me, design-wise I have a question/scenario: I don't think this would break anyone's code and it definitely makes sense to emit an event in those spots. But I wonder if someone would still be able to differentiate whether the item was spawning for the first time or being rehydrated or something? If not, I could see that causing bugs. Maybe the container it is spawned into could be passed as an argument? (the room, npc, item container, etc.) |
That is a very good point @seanohue; this pattern could cause multiple A workaround would be to detect if an item has been spawned already before emitting the event... but that seems kind of, inelegant. I'll think about it |
Maybe something like |
Has this been tested in the wild yet? |
I've tested this and I'm not encountering duplicate
An item won't be spawned/hydrated in multiple places and the event won't be emitted multiple times per item, as each spawn/hydrate creates a unique item. Separately, there's no way to differentiate between an item that's spawned for the first time and an item that was simply rehydrated. If a player possesses an item (either in their inventory or equipped) that later respawns back in its original area (thus creating a second copy of the item), a These changes look good to me! |
- improve docstrings - use RanvierMUD#74, RanvierMUD#93, RanvierMUD#98, RanvierMUD#100, RanvierMUD#103, RanvierMUD#106, RanvierMUD#109, RanvierMUD#117, RanvierMUD#104, RanvierMUD#119, RanvierMUD#105
Came across this again while going through open, public PRs that I'm mentioned in. Hoping to draw attention to it with a comment. |
To be consistent with the
@event Item#spawn
event that is fired inRoom#spawnItem
Addresses #73