mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
added a small bot script and the possibility to trigger Nc from Chuck.inspector
This commit is contained in:
parent
6149b6c47b
commit
6f5c24dd9c
2 changed files with 34 additions and 1 deletions
|
|
@ -21,10 +21,11 @@ requirejs([
|
||||||
"Lib/Vendor/SocketIO",
|
"Lib/Vendor/SocketIO",
|
||||||
"Game/Config/Settings",
|
"Game/Config/Settings",
|
||||||
"Lib/Utilities/Exception",
|
"Lib/Utilities/Exception",
|
||||||
|
"Lib/Utilities/NotificationCenter",
|
||||||
"Menu/Menu"
|
"Menu/Menu"
|
||||||
],
|
],
|
||||||
|
|
||||||
function (Networker, SocketIO, Settings, Exception, Menu) {
|
function (Networker, SocketIO, Settings, Exception, Nc, Menu) {
|
||||||
|
|
||||||
var menu = new Menu();
|
var menu = new Menu();
|
||||||
menu.onRun = function(channelName, nickname) {
|
menu.onRun = function(channelName, nickname) {
|
||||||
|
|
@ -41,6 +42,7 @@ function (Networker, SocketIO, Settings, Exception, Menu) {
|
||||||
var networker = new Networker(socket, channelName, nickname);
|
var networker = new Networker(socket, channelName, nickname);
|
||||||
Chuck.inspector.networker = networker;
|
Chuck.inspector.networker = networker;
|
||||||
Chuck.inspector.settings = Settings;
|
Chuck.inspector.settings = Settings;
|
||||||
|
Chuck.inspector.nc = Nc;
|
||||||
Chuck.inspector.resetLevel = function() { networker.sendGameCommand("resetLevel"); }
|
Chuck.inspector.resetLevel = function() { networker.sendGameCommand("resetLevel"); }
|
||||||
}
|
}
|
||||||
menu.init();
|
menu.init();
|
||||||
|
|
|
||||||
31
snippets/cheats/leftRightBot.js
Normal file
31
snippets/cheats/leftRightBot.js
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
var runFor = 5000;
|
||||||
|
var jumpEvery = 1300;
|
||||||
|
|
||||||
|
var runBot = setInterval(function(){
|
||||||
|
|
||||||
|
Chuck.inspector.nc.trigger(Chuck.inspector.nc.ns.client.to.server.gameCommand.send, 'stop');
|
||||||
|
Chuck.inspector.nc.trigger(Chuck.inspector.nc.ns.client.to.server.gameCommand.send, 'lookAt', {x:-0.5, y:0});
|
||||||
|
Chuck.inspector.nc.trigger(Chuck.inspector.nc.ns.client.to.server.gameCommand.send, 'moveLeft');
|
||||||
|
|
||||||
|
setTimeout(function(){
|
||||||
|
Chuck.inspector.nc.trigger(Chuck.inspector.nc.ns.client.to.server.gameCommand.send, 'stop');
|
||||||
|
Chuck.inspector.nc.trigger(Chuck.inspector.nc.ns.client.to.server.gameCommand.send, 'lookAt', {x:0.5, y:0});
|
||||||
|
Chuck.inspector.nc.trigger(Chuck.inspector.nc.ns.client.to.server.gameCommand.send, 'moveRight');
|
||||||
|
}, runFor);
|
||||||
|
|
||||||
|
}, runFor * 2);
|
||||||
|
|
||||||
|
var jumpBot = setInterval(function(){
|
||||||
|
|
||||||
|
Chuck.inspector.nc.trigger(Chuck.inspector.nc.ns.client.to.server.gameCommand.send, 'jump');
|
||||||
|
|
||||||
|
setTimeout(function(){
|
||||||
|
Chuck.inspector.nc.trigger(Chuck.inspector.nc.ns.client.to.server.gameCommand.send, 'jumpStop');
|
||||||
|
}, (jumpEvery - 100));
|
||||||
|
|
||||||
|
}, jumpEvery);
|
||||||
|
|
||||||
|
function stop () {
|
||||||
|
clearInterval(runBot);
|
||||||
|
clearInterval(jumpBot);
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue