fix stop sim binding not working when bound to the same thing as start

This commit is contained in:
Crispy 2025-04-13 22:34:42 +02:00
parent 44494f4d01
commit 31783cc10f
2 changed files with 13 additions and 9 deletions

View file

@ -7,6 +7,7 @@ Game store page: https://crispypin.itch.io/marble-machinations
- click to collapse chapters in level list
- input bindings for eraser (X), selection (B), blueprint list (Ctrl B), no tool (no default binding)
### fixed
- when start and stop are bound to the same thing (as by default), only start works
- When two input bindings had the same trigger but one has a strict subset of the others modifiers, both would activate when the one with more modifiers was pressed. For example (Ctrl+S -> Save) would also trigger (S -> Wire Tool). Now, Shift+S will still trigger Wire Tool, unless Shift+S (or eg. Shift+Ctrl+S) is bound to something else.
## v0.3.1 - 2025-04-05

View file

@ -478,22 +478,25 @@ impl Editor {
if globals.is_pressed(ActionId::StepSim) {
self.step_pressed()
}
if globals.is_pressed(ActionId::StartSim) {
match self.sim_state {
SimState::Editing => {
if globals.is_pressed(ActionId::StartSim) {
self.init_sim();
self.sim_state = SimState::Running;
}
SimState::Stepping => self.sim_state = SimState::Running,
SimState::Running => (),
}
SimState::Stepping => {
if globals.is_pressed(ActionId::StartSim) {
self.sim_state = SimState::Running
} else if globals.is_pressed(ActionId::StopSim) {
match self.sim_state {
SimState::Running | SimState::Stepping => {
self.sim_state = SimState::Editing;
self.popup = Popup::None;
}
SimState::Editing => (),
}
SimState::Running => {
if globals.is_pressed(ActionId::StopSim) {
self.sim_state = SimState::Editing;
}
}
}