-
Notifications
You must be signed in to change notification settings - Fork 120
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
ClashStrategy::PrioritizeLongest
changed its behavior and no longer clears actions
#471
Comments
Thanks for the report! There was a number of complex refactors and our test coverage must have been lacking. |
#466 should not changing those behaviors, could this issue was originated from older commits? |
This issue seems to have been caused by #450, but it was actually committed by #452, which replaced the use of Relevant Code// Before
pub fn get_pressed(&self) -> Vec<A> {
A::variants().filter(|a| self.pressed(a)).collect()
}
// After
pub fn get_pressed(&self) -> Vec<A> {
self.action_data
.iter()
.filter(|(_action, data)| data.state.pressed())
.map(|(action, _data)| action.clone())
.collect()
} |
I've pinpointed the actual issue: it seems that the Relevant Code// Before
pub fn handle_clashes(
&self,
action_data: &mut [ActionData],
input_streams: &InputStreams,
clash_strategy: ClashStrategy,
) {
for clash in self.get_clashes(action_data, input_streams) {
// Remove the action in the pair that was overruled, if any
if let Some(culled_action) = resolve_clash(&clash, clash_strategy, input_streams) {
action_data[culled_action.index()] = ActionData::default();
}
}
}
// After
pub fn handle_clashes(
&self,
action_data: &mut HashMap<A, ActionData>,
input_streams: &InputStreams,
clash_strategy: ClashStrategy,
) {
for clash in self.get_clashes(action_data, input_streams) {
// Remove the action in the pair that was overruled, if any
if let Some(culled_action) = resolve_clash(&clash, clash_strategy, input_streams) {
action_data.remove(&culled_action);
}
}
} |
Version
0.12.0
What you did
I query the
ActionState
resource with:controls: Res<ActionState<GlobalAction>>
.Simplified, my
GlobalAction
looks like this:In prior version,
controls.get_pressed().last()
would returnMoveUpLeft
if I help both Up and Left. After upgrading, thecontrols.get_pressed()
vector contains two actions: theMoveUpLeft
and eitherMoveLeft
orMoveUp
. SometimesMoveUp
/MoveLeft
is on index 0, sometimes on index 1.I'd expect that when I press the combination of
MoveUpLeft
,MoveUp
norMoveLeft
would be emitted.Some additional info about how I map the inputs:
The text was updated successfully, but these errors were encountered: