Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ _Always enabled_
Allows binding the 4th and 5th mouse buttons (sometimes called "side buttons") to any action in the
Controls settings. **Be aware that those buttons don't have an icon for now!**

### Right mouse rebind [QoL]

[_Previous location_](https://github.com/ilyabodo/crosscode-tweak-pack)

Allows the right mouse button functionality to be changed. Currently the right mouse button can be set to: melee, dash only, or guard only.

### Render hitboxes [debug]

[_Previous location_](https://github.com/dmitmel/crosscode-render-hitboxes)
Expand Down
6 changes: 6 additions & 0 deletions assets/data/lang/sc/gui.en_US.json.patch
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
"name": "Skip title screen intro",
"description": "Skip the intro sequence with logos which plays before the title screen. \\c[2][debug]"
}
},
"right-mouse-rebind": {
"right-mouse": {
"name": "Right mouse button rebind",
"description": "Rebind right mouse button. 1: Default/normal, 2: Melee, 3: Dash only, 4: Guard only. \\c[2][QoL]"
}
}
},
"controls": {
Expand Down
6 changes: 6 additions & 0 deletions assets/data/lang/sc/gui.ru_RU.json.patch
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
"name": "Пропускать интро перед экраном старта",
"description": "Пропускает интро с логотипами, которое показывается перед главным экраном игры. \\c[2][debug]"
}
},
"right-mouse-rebind": {
"right-mouse": {
"name": "Переназначение правой кнопки мыши",
"description": "1: Стандартный/нормальный, 2: Ближний бой, 3: Только рывок, 4: Только защита. \\c[2][QoL]"
}
}
},
"controls": {
Expand Down
2 changes: 2 additions & 0 deletions src/_prestart.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ import './chest-radar.js';
import './open-map-menu-shortcut.js';
import './autoaim.js';
import './skip-title-screen-intro.js';
import './right-mouse-rebind.js';

56 changes: 56 additions & 0 deletions src/right-mouse-rebind.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import * as core from './_core.js';

let module = new core.Module('right-mouse-rebind');

sc.RIGHT_MOUSE_REBIND = {
NORMAL: 0, // Default game behavior
MELEE: 1, // Replace dash/guard with melee
DASH: 2, // Dash only on right mouse button
GUARD: 3 // Guard only on right mouse button
};

let myOptionKey = module.getRawOptionName('right-mouse');
let myOptionDef = {
type: 'OBJECT_SLIDER',
data: sc.RIGHT_MOUSE_REBIND,
init: sc.RIGHT_MOUSE_REBIND.NORMAL,
cat: sc.OPTION_CATEGORY.GENERAL,
fill: true
};

sc.OPTIONS_DEFINITION[myOptionKey] = myOptionDef;

// Rebind mouse2 (left mouse button)
sc.CrossCode.inject({
update() {
this.parent()
var opt = sc.options.get(myOptionKey);

if (opt == sc.RIGHT_MOUSE_REBIND.MELEE){
ig.input.bind(ig.KEY.MOUSE2,"melee");
}
else if (opt == sc.RIGHT_MOUSE_REBIND.GUARD){
ig.input.bind(ig.KEY.MOUSE2,"guard");
}
else{ // Covers if NORMAL or DASH is selected
ig.input.bind(ig.KEY.MOUSE2,"dash"); // This is what the game defaults to
}

}
});

// If right mouse button is set to dashing only, remove the ability to guard using dash buttons
// By default, performing a dash will also guard if standing still
sc.Control.inject({
guarding() {
var opt = sc.options.get(myOptionKey);
if (opt == sc.RIGHT_MOUSE_REBIND.DASH){ // ig.input.state("dash") has been removed from default logic
return this.autoControl ? this.autoControl.get("guarding") :
(ig.input.state("guard") || ig.gamepad.isButtonDown(ig.BUTTONS.FACE1) || ig.gamepad.isButtonDown(this._getDashButton())) && !ig.interact.isBlocked()
}
else { // This logic is the default game logic
return this.autoControl ? this.autoControl.get("guarding") :
(ig.input.state("dash") || ig.input.state("guard") || ig.gamepad.isButtonDown(ig.BUTTONS.FACE1) || ig.gamepad.isButtonDown(this._getDashButton())) && !ig.interact.isBlocked()
}
}
});