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

Cancel pick up items activity if player moves during it #34537

Merged
merged 3 commits into from
Oct 9, 2019

Conversation

mrkybe
Copy link
Contributor

@mrkybe mrkybe commented Oct 7, 2019

Summary

SUMMARY: Bugfixes "Cancel pick up items activity if player moves during it"

Purpose of change

Fixes #34528, Picking up multiple items while in a moving vehicle item loss / duplication.

Describe the solution

Populate coords for activity ACT_PICKUP with player position at the start of the activity, then bail out of the activity if player pos is different at the start of activity_on_turn_pickup().

I'm not super confident in this solution and it doesn't fix drive-by-moving stuff between two vehicles.

…tart of the activity, then bail out of the activity if player pos is different at the start of activity_on_turn_pickup()
@ZhilkinSerg ZhilkinSerg added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Vehicles Vehicles, parts, mechanics & interactions labels Oct 7, 2019
@mrkybe mrkybe changed the title Populate coords for activity ACT_PICKUP with player position at the s… Cancel pick up items activity if player moves during it Oct 7, 2019
@Qrox
Copy link
Contributor

Qrox commented Oct 7, 2019

Perhaps also add a message to let the player know that the activity has canceled?

@mrkybe
Copy link
Contributor Author

mrkybe commented Oct 7, 2019

So currently, the way I fixed it, autopickup will be interrupted if you move at all. So if you have a stack of rags in a cargo carrier next you, and you're driving at some speed, even though they are not moving relative to you, it will interrupt. I think this is fine, since letting go of the steering wheel causes the vehicle to turn wildly anyway and probably the player didn't actually mean "Jesus take the wheel I'm picking up rags for the next minute.".

@kevingranade kevingranade merged commit dd9d9ec into CleverRaven:master Oct 9, 2019
@@ -668,6 +668,15 @@ void activity_on_turn_pickup()
return;
}

// If the player moves while picking up (ie: in a moving vehicle) cancel the activity, only populate coords when grabbing from the ground
if( g->u.activity.coords.size() > 0 && g->u.activity.coords.at( 0 ) != g->u.pos() ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

g->u.activity.coords.size() > 0

should be

!g->u.activity.coords.empty()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Picking up multiple items while in a moving vehicle item loss / duplication
4 participants