diff --git a/src/game/game.js b/src/game/game.js index f9506004..579a2b49 100644 --- a/src/game/game.js +++ b/src/game/game.js @@ -6,7 +6,8 @@ C = driver.constants, map = require('./map'), market = require('./market'), - customPrototypes = require('./custom-prototypes'); + customPrototypes = require('./custom-prototypes'), + system = { Function: { bind: Function.bind } }; var findCacheFn = { [C.FIND_CREEPS]: (i) => !i.spawning, @@ -505,7 +506,7 @@ !_.isObject(runCodeCache[userId].globals.require.cache.main) || !_.isFunction( runCodeCache[userId].globals.require.cache.main.loop)) { - runCodeCache[userId].globals.require = requireFn.bind(runCodeCache[userId]); + runCodeCache[userId].globals.require = system.Function.bind.call(requireFn, runCodeCache[userId]); runCodeCache[userId].globals.require.cache = {lodash: runCodeCache[userId].globals._}; runCodeCache[userId].globals.require.timestamp = runCodeCache[userId].runtimeData.userCodeTimestamp; }