-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1dec9cd
Showing
8 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# cc-speedrun-utilities | ||
CrossCode mod containing various utilities and features for speedrunning and debugging the game. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* CrossCode Speedrun Utilities - freeSP.js | ||
* | ||
* Hotkey for giving SP, gives points past the regular cap. | ||
*/ | ||
|
||
sc.OPTIONS_DEFINITION["keys-free-sp"] = { | ||
type: "CONTROLS", | ||
init: { | ||
key1: ig.KEY.U, | ||
key2: undefined | ||
}, | ||
cat: sc.OPTION_CATEGORY.CONTROLS, | ||
hasDivider: true, | ||
header: "cc-speedrun-utilities", | ||
}; | ||
|
||
let giveSPAmount = 12; | ||
|
||
/** | ||
* @inject | ||
* Detect when Save and Load Position/Map binds are pressed | ||
*/ | ||
sc.Control.inject({ | ||
freeSPPress: function () { | ||
return ig.input.pressed("free-sp"); | ||
} | ||
}); | ||
|
||
/** | ||
* @inject | ||
* Handle execution of Save and Load Position/Map keybinds | ||
*/ | ||
ig.ENTITY.Player.inject({ | ||
gatherInput(...args) { | ||
if (ig.game.isControlBlocked()) { | ||
return this.parent(...args); | ||
} | ||
|
||
if (!ig.interact.isBlocked()) { | ||
if (sc.control.freeSPPress()) { | ||
this.params.currentSp += giveSPAmount; | ||
} | ||
} | ||
|
||
return this.parent(...args); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/** | ||
* CrossCode Speedrun Utilities - saveHotkeys.js | ||
* | ||
* Hotkeys for loading your latest autosave and making quicksaves | ||
* for quickly practicing segments repeatedly | ||
*/ | ||
|
||
sc.OPTIONS_DEFINITION["keys-autosave-load"] = { | ||
type: "CONTROLS", | ||
init: { | ||
key1: ig.KEY.I, | ||
key2: undefined | ||
}, | ||
cat: sc.OPTION_CATEGORY.CONTROLS, | ||
hasDivider: false, | ||
header: "cc-speedrun-utilities", | ||
}; | ||
|
||
sc.OPTIONS_DEFINITION["keys-quick-save"] = { | ||
type: "CONTROLS", | ||
init: { | ||
key1: ig.KEY.O, | ||
key2: undefined | ||
}, | ||
cat: sc.OPTION_CATEGORY.CONTROLS, | ||
hasDivider: false, | ||
header: "cc-speedrun-utilities", | ||
}; | ||
|
||
sc.OPTIONS_DEFINITION["keys-quick-load"] = { | ||
type: "CONTROLS", | ||
init: { | ||
key1: ig.KEY.P, | ||
key2: undefined | ||
}, | ||
cat: sc.OPTION_CATEGORY.CONTROLS, | ||
hasDivider: false, | ||
header: "cc-speedrun-utilities", | ||
}; | ||
|
||
let currQuickSave = null; | ||
|
||
/** | ||
* @inject | ||
* Inject hotkeys. | ||
*/ | ||
sc.Control.inject({ | ||
autosaveLoadPress: function () { | ||
return ig.input.pressed("autosave-load"); | ||
}, | ||
|
||
quickSavePress: function() { | ||
return ig.input.pressed("quick-save"); | ||
}, | ||
|
||
quickLoadPress: function() { | ||
return ig.input.pressed("quick-load"); | ||
} | ||
}); | ||
|
||
/** | ||
* @inject | ||
* Handle execution of hotkeys. | ||
*/ | ||
ig.ENTITY.Player.inject({ | ||
gatherInput(...args) { | ||
if (ig.game.isControlBlocked()) { | ||
return this.parent(...args); | ||
} | ||
|
||
if (!ig.interact.isBlocked()) { | ||
if (sc.control.autosaveLoadPress()) { | ||
ig.storage.loadSlot(-1); | ||
} | ||
|
||
if (sc.control.quickSavePress()) { | ||
currQuickSave = {}; | ||
ig.storage._saveState(currQuickSave); | ||
currQuickSave = new ig.SaveSlot(currQuickSave); | ||
} | ||
|
||
if (sc.control.quickLoadPress()) { | ||
if(currQuickSave) { | ||
ig.storage.loadSlot(currQuickSave); | ||
} | ||
} | ||
} | ||
|
||
return this.parent(...args); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"labels": { | ||
"options": { | ||
"headers": { | ||
"cc-speedrun-utilities": "Speedrun Utilities" | ||
}, | ||
|
||
"controls": { | ||
"keys": { | ||
"free-sp": "Give SP", | ||
"autosave-load": "Load Autosave", | ||
"quick-save": "Quick Save", | ||
"quick-load": "Quick Load" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"id": "yoshi-speedrun-utilities", | ||
"version": "1.0.0", | ||
"module": true, | ||
"title": "Speedrun Utilities", | ||
"description": "Various useful features for speedrunning and debugging.", | ||
"prestart": "prestart.js", | ||
"dependencies": { | ||
"input-api": "^1.0.0" | ||
}, | ||
"icons": { | ||
"24": "icon.png" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* CrossCode Speedrun Utilities | ||
* | ||
* A growing collection of useful features for speedrunning and debugging the game. | ||
*/ | ||
|
||
import './Utilities/freeSP.js' | ||
import './Utilities/saveHotkeys.js' |