-
Notifications
You must be signed in to change notification settings - Fork 3
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
Issues/234 player item interaction #252
Issues/234 player item interaction #252
Conversation
223e02b
to
4b88145
Compare
…-truth' into issues/234-player-item-interaction
6deb0a1
to
65a06f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this! The separation of the grid items into its own class that manages the position mapping is a nice improvement. I think there are a couple of small inconsistencies in how you're using gridItems.remove()
, but otherwise this looks great.
(state) => settings.item_config[state] | ||
); | ||
|
||
return `✋${aStartItem.name} + ${tStartItem.name} = ✋${aEndItem.name} + ${tEndItem.name}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd rather see a ➡️ or a →
than a =
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Natalia's mockup used the =
, so I went with that, but I also prefer the arrow. I'm going to go with that. I think there's likely to be a lot more change in this presentation anyway.
$square.html(inspectedItem.name); | ||
} | ||
|
||
if (_.isUndefined(transition)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
player.getTransition()
should return null
not undefined
. I think it would be more semantically appropriate if gridItems.atPosition(...)
returned null
as well.
} | ||
|
||
remove(item) { | ||
this._itemsByPosition.delete(JSON.stringify(item.position)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like we're not setting position
on Item
anymore, won't that be a problem here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in related PR
@@ -871,8 +795,7 @@ function bindGameKeys(socket) { | |||
} else if (!player_item && item_at_pos && item_at_pos.portable) { | |||
// If there's a portable item here and we don't something in hand, pick it up. | |||
msg_type = "item_pick_up"; | |||
item_at_pos.position = null; | |||
delete itemPositions[position[0] + '_' + position[1]]; | |||
gridItems.remove(position); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gridItems.remove()
seems to take an item, not a position, though perhaps this would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like I passed an Item in one case and a position in another. I agree position
is better.
|
||
atPosition(position) { | ||
const key = JSON.stringify(position); | ||
return this._itemsByPosition.get(key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should explicitly return a null
(e.g. || null
) if nothing is found, if only because undefined
seems like kind of a weird value for this to return.
…s-jms PR review fixes
Description
Features added here
crossable
cannot be crossed over by playersNon-public changes
GridItems
wrapper as the single point of truth on grid position for items (avoids possibility ofItem.position
and position registered in position map conflicting)Demo
https://app.screencast.com/wrJQmlLXDFutN