1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-22 22:07:31 +03:00
Mindustry/core/assets/scripts/base.js
Anuken 89a5c957fd
add mod name to js print() (#1677)
* add mod name to js print()

* add mod name to errors
2020-03-05 15:58:10 -05:00

26 lines
867 B
JavaScript
Executable File

const log = function(context, obj){
Vars.mods.getScripts().log(context, obj ? String(obj) : "null")
}
var scriptName = "base.js"
var modName = "none"
const print = text => log(modName + "/" + scriptName, text);
const extendContent = function(classType, name, params){
return new JavaAdapter(classType, params, name)
}
const extend = function(classType, params){
return new JavaAdapter(classType, params)
}
const run = method => new java.lang.Runnable(){run: method}
const boolf = method => new Boolf(){get: method}
const boolp = method => new Boolp(){get: method}
const cons = method => new Cons(){get: method}
const prov = method => new Prov(){get: method}
const newEffect = (lifetime, renderer) => new Effects.Effect(lifetime, new Effects.EffectRenderer({render: renderer}))
Call = Packages.mindustry.gen.Call
const Calls = Call //backwards compat