-
Notifications
You must be signed in to change notification settings - Fork 32
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
Add items picking logic #126
Conversation
d7cdbbf
to
412bf2f
Compare
Rebased. |
src/item.rs
Outdated
#[derive(Component)] | ||
pub struct Item; | ||
|
||
#[derive(Component)] | ||
pub struct CarriedBy(pub Entity); | ||
|
||
/// Represents an item, that is either on the map (waiting to be picked up), or carried. | ||
/// If an item is on the map, it has a TransformBundle; if it's carried, it instead has a | ||
/// CarriedBy. |
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.
Im wondering if instead of ridding the item of its TransformBundle
we might consider pushing it as a child of the Fighter who picks it up?
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.
Make sense!
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 might be awkward at first before we figure out how to integrate it with animations/what offset/rotation and whatnot it should have, but for now we could always toggle the visibility of the item off when its picked up as well.
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.
There you go! Done. It actually made the code a little bit simpler 😄
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.
Ok. There have been several conflicts, that I had to fix. I've verified the rebase, hopefully, there have been no subtle breakages 😅.
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'm lacking bandwidth to do a total review right now, but looks fine after a quick sanity check and it seemed to work after testing it out real quick.
…r certain conditions
…cking functionality
78e2c6c
to
43c2f3f
Compare
if player_item_distance <= PICK_ITEM_RADIUS { | ||
commands.entity(item_id).remove_bundle::<TransformBundle>(); |
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 meant just to keep the transform bundle when both picked and not picked and toggle visibility, but we can always change it later if we need to use the transform for animations in the future. Probably unnecessary for now 👍
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.
ok. if we put it in the animations or something, then it will certainly go back 😄 it is unnecessary now, since if we put it in the HUD (there is a tracking issue), the HUD uses different semnantics/types anyway.
Base version: Multiple items can be picked; items are never released.
WATCH OUT! This may allow throwing and shooting a bottle in the same frame. See [related discussion](fishfolk#83 (comment)).
43c2f3f
to
39818cd
Compare
Ok. Ready for review and hopefully merge. Implemented the change requested in one comment, and resolved the other comment without change. |
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.
👍
bors merge |
Build succeeded: |
Add items picking logic:
A minor but subtle bug is also fixes see 7e22c45.
Also note the side effect described in d7cdbbf.
Closes #83.