Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mattieFM committed Feb 19, 2024
1 parent aefba1e commit 0fba986
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 15 additions & 1 deletion www/mods/_multiplayer/netControllerV2/commandInterpreter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var MATTIE = MATTIE || {};
MATTIE.multiplayer = MATTIE.multiplayer || {};


/** the commands that should be sent over the net controller */
MATTIE.multiplayer.enabledNetCommands = [
205, // set movement route
Expand All @@ -21,6 +22,12 @@ MATTIE.multiplayer.enabledNetCommands = [

];

MATTIE.multiplayer.last10Cmds = [];

setInterval(() => {
MATTIE.multiplayer.last10Cmds = [];
}, 2500);

MATTIE.RPG.Game_InterpreterExecuteCommand = Game_Interpreter.prototype.executeCommand;

Game_Interpreter.prototype.executeCommand = function (skip = false) {
Expand All @@ -41,7 +48,14 @@ Game_Interpreter.prototype.executeCommand = function (skip = false) {
console.debug('set movement route emitted');
}

if (MATTIE.multiplayer.isActive) netController.emitCommandEvent(cmd);
//console.log(cmd);
if (MATTIE.multiplayer.isActive) {
if(!MATTIE.multiplayer.last10Cmds.includes(cmd)){
MATTIE.multiplayer.last10Cmds.push(cmd);
netController.emitCommandEvent(cmd);
}

}
}
break;

Expand Down
2 changes: 2 additions & 0 deletions www/mods/_multiplayer/netControllerV2/eventMovementEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Game_Event.prototype.forceMoveRoute = function (moveRoute) {
* @param {*} moveRoute
*/
Game_Character.prototype.getValidMove = function (moveRoute) {
//this might be causing mehabre lag
if(Graphics._fpsMeter.fps < 30) return true;
if (moveRoute.list.every((obj) => obj.code === 0)) return true;

if (!this.last20Commands) this.last20Commands = [];
Expand Down

0 comments on commit 0fba986

Please sign in to comment.