extend("fiskheroes:hero_basic");
loadTextures({
   "layer1": "pack:sentry_layer1",
    "layer2": "pack:sentry_layer2",
    "cape": "pack:sentry_cape",
	"lights": "pack:sentry_glow"
});

var utils = implement("fiskheroes:external/utils");
var capes = implement("fiskheroes:external/capes");

var speedster = implement("fiskheroes:external/speedster_utils");

var cape;


function init(renderer) {
    parent.init(renderer);

	 renderer.setLights((entity, renderLayer) => {
       
         return "lights";
    });
	
}


function initEffects(renderer) {
	    speedster.init(renderer, "pack:sentry");
    var physics = renderer.createResource("CAPE_PHYSICS", null);
    physics.maxFlare = 0.4;
    cape = capes.createDefault(renderer, 24, "fiskheroes:cape_default.mesh.json", physics);
    cape.effect.texture.set("cape");
    cape.effect.width = 14;   
	    utils.bindCloud(renderer, "fiskheroes:telekinesis", "pack:tk_sentry");
	 utils.bindBeam(renderer, "fiskheroes:heat_vision", "fiskheroes:heat_vision", "head", 0xfffa9c, [
	    { "firstPerson": [2.2, 0.0, 2.0], "offset": [2.2, -3.3, -4.0], "size": [1.0, 0.5] },
        { "firstPerson": [-2.2, 0.0, 2.0], "offset": [-2.2, -3.3, -4.0], "size": [1.0, 0.5] }
    ]).setParticles(renderer.createResource("PARTICLE_EMITTER", "fiskheroes:impact_heat_vision"));
	
}

function initAnimations(renderer) {
    parent.initAnimations(renderer);
    utils.addFlightAnimation(renderer, "mmcw.FLIGHT", "fiskheroes:flight/default.anim.json");
    utils.addHoverAnimation(renderer, "mmcw.HOVER", "fiskheroes:flight/idle/neutral");
}

function render(entity, renderLayer, isFirstPersonArm) {
    if (!isFirstPersonArm && renderLayer == "CHESTPLATE") {
        cape.render(entity);
    }
}
