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
// modloader.js | |
load (module: constructor) { | |
try { | |
let mod = new module(this.game) | |
this.registerMod(mod) | |
this.log(`loaded mod: '${mod.name}'`) | |
} catch (e) { | |
this.log('Failed to load: ' + module.name) |
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
let Logger = require('./logger.ts') | |
class Game { | |
name: string | |
logger: any | |
constructor (name: string) { | |
this.name = name | |
this.logger = new Logger({name: this.name}) |
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
let winston = require('winston') | |
class Logger { | |
name: string | |
logger: any | |
constructor(opts: { name: string }) { | |
this.name = name |
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
let Logger = require('./m_log.js') | |
class Game { | |
name: string | |
logger: any | |
constructor (name: string) { | |
this.name = name | |
this.logger = new Logger({this.name}) |
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
// app.ts | |
// by Rafi Khan | |
// Entry point for haxel server | |
// Modules | |
let ModLoader = require('./mod_loader.js') | |
let GameConstructor = require('./game.ts') | |
// Load systems |
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
// app.ts | |
// by Rafi Khan | |
// Entry point for haxel server | |
// Modules | |
let ModLoader = require('./mod_loader.js') | |
let Logger = require('./m_log.js') | |
var game = {name: 'Haxel'} |
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
// Modules | |
let ModLoader = require('./mod_loader.js') | |
let Logger = require('./m_log.js') | |
var game = {name: 'Haxel'} | |
// Load systems | |
game.logger = new Logger(game) | |
let modLoader = new ModLoader(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
class modLoader { | |
constructor (game) { | |
this.game = game | |
this.mods = [] | |
} | |
registerMod (mod) { | |
this.mods.push(mod) | |
mod.init(this.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
/* global describe it */ | |
let chai = require('chai') | |
let assert = chai.assert | |
let sinon = require('sinon') | |
var ModLoader = require('../mod_loader.js') | |
describe('modLoader', function () { | |
var game = {empty: ''} // fake object |
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
C-u runs the command evil-scroll-up (found in evil-motion-state-map), which is | |
an interactive compiled Lisp function in ‘evil-commands.el’. | |
It is bound to C-u. | |
(evil-scroll-up COUNT) | |
Scrolls the window and the cursor COUNT lines upwards. | |
If COUNT is not specified the function scrolls down | |
‘evil-scroll-count’, which is the last used count. |