Files
Mindustry/core/assets/scripts/base.js

37 lines
1.3 KiB
JavaScript
Raw Normal View History

"use strict";
2019-12-07 14:10:39 -05:00
const log = function(context, obj){
2020-04-01 14:44:17 -04:00
Vars.mods.getScripts().log(context, String(obj))
2019-12-03 17:16:23 -05:00
}
2020-07-27 20:18:07 -04:00
const readString = path => Vars.mods.getScripts().readString(path)
const readBytes = path => Vars.mods.getScripts().readBytes(path)
2020-08-22 14:05:41 -04:00
const loadMusic = path => Vars.mods.getScripts().loadMusic(path)
const loadSound = path => Vars.mods.getScripts().loadSound(path)
2020-07-27 20:18:07 -04:00
2020-02-11 17:50:16 -05:00
var scriptName = "base.js"
var modName = "none"
const print = text => log(modName + "/" + scriptName, text);
2020-02-11 17:50:16 -05:00
2019-12-06 22:24:32 -05:00
const extendContent = function(classType, name, params){
2019-12-07 15:41:52 -05:00
return new JavaAdapter(classType, params, name)
}
2019-12-06 22:24:32 -05:00
const extend = function(classType, params){
return new JavaAdapter(classType, params)
2019-12-08 18:34:23 -05:00
}
2020-08-16 18:51:17 -04:00
//these are not sctrictly necessary, but are kept for edge cases
const run = method => new java.lang.Runnable(){run: method}
const boolf = method => new Boolf(){get: method}
const boolp = method => new Boolp(){get: method}
const floatf = method => new Floatf(){get: method}
const floatp = method => new Floatp(){get: method}
const cons = method => new Cons(){get: method}
const prov = method => new Prov(){get: method}
const func = method => new Func(){get: method}
2019-12-08 18:34:23 -05:00
const newEffect = (lifetime, renderer) => new Effects.Effect(lifetime, new Effects.EffectRenderer({render: renderer}))
2019-12-29 17:56:10 -05:00
Call = Packages.mindustry.gen.Call