+ToggleIcon.bottleController = ctrl => ({
+ getActive: (state, icons) => state[ctrl] ? icons[state[ctrl] - 1] : null,
+ getDefault: () => 'bottle',
+ handlePrimary: (state, setState, icons) => {
+ if (state[ctrl] === 0) {
+ // skip over mushroom
+ setState(s => ({ ...s, [ctrl]: 2 }));
+ } else {
+ setState(increment(ctrl, icons.length));
+ }
+ },
+ handleSecondary: (state, setState, icons) => {
+ if (state[ctrl] === 2) {
+ // skip over mushroom
+ setState(s => ({ ...s, [ctrl]: 0 }));
+ } else {
+ setState(decrement(ctrl, icons.length));
+ }
+ },
+});
+