Improved Hint()

This commit is contained in:
Devine Lu Linvega 2017-03-27 23:53:56 -07:00
parent 3844a79de9
commit 86310ae73f
3 changed files with 36 additions and 15 deletions

View File

@ -17,19 +17,19 @@ function Ronin()
this.terminal = new Terminal(">");
this.magnet = new Magnet("^");
this.modules[this.surface.rune] = this.surface;
this.modules[this.fileload.rune] = this.fileload;
this.modules[this.filesave.rune] = this.filesave;
this.modules[this.render.rune] = this.render;
this.modules[this.brush.rune] = this.brush;
this.modules[this.eye.rune] = this.eye;
this.modules[this.type.rune] = this.type;
this.modules[this.path.rune] = this.path;
this.modules[this.terminal.rune] = this.terminal;
this.modules[this.overlay.rune] = this.overlay;
this.modules[this.magnet.rune] = this.magnet;
this.modules[this.surface.constructor.name] = this.surface;
this.modules[this.fileload.constructor.name] = this.fileload;
this.modules[this.filesave.constructor.name] = this.filesave;
this.modules[this.render.constructor.name] = this.render;
this.modules[this.brush.constructor.name] = this.brush;
this.modules[this.eye.constructor.name] = this.eye;
this.modules[this.type.constructor.name] = this.type;
this.modules[this.path.constructor.name] = this.path;
this.modules[this.terminal.constructor.name] = this.terminal;
this.modules[this.overlay.constructor.name] = this.overlay;
this.modules[this.magnet.constructor.name] = this.magnet;
this.modules[this.cursor.rune] = this.cursor;
this.modules[this.cursor.constructor.name] = this.cursor;
//

View File

@ -4,11 +4,32 @@ function Default(rune)
this.hint = function()
{
var s = "";
if(ronin.terminal.input_element.value == ""){
var s = "";
for(module in ronin.modules){
s += ronin.modules[module].constructor.name+" ";
}
return s;
}
//
var candidates = [];
for(module in ronin.modules){
s += ronin.modules[module].constructor.name+" ";
for(method in ronin.modules[module].methods){
candidates.push(module.toLowerCase()+"."+method);
}
}
var s = "";
for(candidate in candidates){
if(candidates[candidate].indexOf(ronin.terminal.input_element.value) > -1){
s += candidates[candidate]+" ";
}
}
return s;
}

View File

@ -10,7 +10,7 @@ function Module(rune)
this.install = function()
{
console.log("Installing "+ronin.modules[this.rune].constructor.name);
// console.log("Installing "+ronin.modules[this.rune].constructor.name);
}
this.context = function()