deltanedas/entity-lib

"Cannot call method 'extendUnit' of undefined"

Qix- opened this issue · 2 comments

Qix- commented

Following the examples in all of the Readme, example repo and vbucks, I can't get a simple script to run:

const entityLib = this.global.entityLib;
const ancientOctus = entityLib.extendUnit(UnitType, 'ancient-octus', [{
	drawUnder(parent, rot) {
		Draw.color(Color.red);
		Lines.stroke(4);
		Lines.circle(parent.x, parent.y, 50);
		Lines.circle(parent.x, parent.y, 100);
		Lines.circle(parent.x, parent.y, 150);
	}
}]);

It appears this.global.entityLib is not populated early enough? I don't really understand how mindustry's inclusion system works.

I do have a main.js in the root /scripts/ folder that includes this one (which is located at /scripts/units/ancient-octus.js).

I really doesn't help that all of the examples are mechs and none of them are units...