extend("fiskheroes:hero_basic");
loadTextures({
    "layer1": "tgheroes:quake/quake_layer1",
    "layer2": "tgheroes:quake/quake_layer2"
});

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

var chest;

function initEffects(renderer) {
    chest = renderer.createEffect("fiskheroes:chest");
    chest.setExtrude(1).setYOffset(1);

    utils.bindBeam(renderer, "fiskheroes:energy_projection", "tgheroes:shout_effect", "body", 0xe6e6e6, [
        { "firstPerson": [0.0, 6.0, 0.0], "offset": [0.0, 5.0, -4.0], "size": [2.0, 2.0] }
    ])

    renderer.bindProperty("fiskheroes:gravity_manipulation").color.set(0xe6e6e6);
	
	var forcefield = renderer.bindProperty("fiskheroes:forcefield");
    forcefield.color.set(0xe6e6e6);
    forcefield.setShape(36, 18).setOffset(0.0, 6.0, 0.0).setScale(1.25);
    forcefield.setCondition(entity => {
        forcefield.opacity = entity.getInterpolatedData("fiskheroes:shield_blocking_timer") * 0.15;
        return true;
    });
}

function initAnimations(renderer) {
    parent.initAnimations(renderer);
    renderer.removeCustomAnimation("basic.BLOCKING");
    addAnimationWithData(renderer, "basic.BLOCKING", "fiskheroes:dual_aiming", "fiskheroes:shield_blocking_timer")
        .priority = -5;
}

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