extend("fiskheroes:hero_basic");
loadTextures({
    "layer1": "skarredheroes:wolverine/wolverine_layer1",
    "layer2": "skarredheroes:wolverine/wolverine_layer2",
    "claws": "skarredheroes:wolverine/wolverine_claws"
});

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

function initEffects(renderer) {
	var model_claws = renderer.createResource("MODEL", "skarredheroes:claws");
    model_claws.texture.set("claws");
    model_claws.generateMirror();

    claws = renderer.createEffect("fiskheroes:model").setModel(model_claws);
    claws.anchor.set("rightArm");
    claws.mirror = true;
	
    ears = renderer.createEffect("fiskheroes:ears");
    ears.anchor.set("head");
    ears.angle = 18;
    ears.inset = 0.005;
}

function render(entity, renderLayer, isFirstPersonArm) {
    if (renderLayer == "CHESTPLATE") {
        var unfold = entity.getInterpolatedData("fiskheroes:blade_timer");
        claws.setOffset(1.5, -12.0 + 1.35 * Math.min(unfold * 5, 3.5), -1.0);
        claws.render();
	}
    if (!isFirstPersonArm && renderLayer == "HELMET") {
        ears.render();
    }
}
