extend("fiskheroes:hero_basic");
loadTextures({
    "layer1": "soulhp:batman_beyond_layer1",
    "layer2": "soulhp:batman_beyond_layer2",
    "wings": "soulhp:batman_beyond_wings",
	"lights": "soulhp:batman_beyond_lights",
});

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

var wings;
var spell;
var boots;


function init(renderer) {
parent.init(renderer);
// icon = renderer.createResource("ICON", icon);
renderer.showModel("HELMET", "head", "headwear");
renderer.showModel("CHESTPLATE", "body", "rightArm", "leftArm");
renderer.showModel("LEGGINGS", "rightLeg", "leftLeg");
renderer.showModel("BOOTS", "rightLeg", "leftLeg");


renderer.setLights((entity, renderLayer) => renderLayer == "HELMET" ? "lights" : null);

// renderer.showModel("LEGGINGS", "head", "headwear", "body", "rightArm", "leftArm", "rightLeg", "leftLeg");


var red_fire = renderer.createResource("ICON", "fiskheroes:red_fire_layer_%s");

boots = renderer.createEffect("fiskheroes:booster");
boots.setIcon(red_fire).setOffset(0.0, 12.0, 0.0).setSize(2.0, 1.5);
boots.anchor.set("rightLeg");
boots.mirror = true;
boots.opacity = 0.7;


}

function initEffects(renderer) {
    wings = renderer.createEffect("fiskheroes:wings");
    wings.texture.set("wings");
    wings.anchor.set("body");

    renderer.bindProperty("fiskheroes:equipment_wheel").color.set(0x000000);

    var equipped = renderer.bindProperty("fiskheroes:equipped_item");
equipped.setItems([
    { "anchor": "body", "scale": 0.7, "offset": [-4.5, 10.5, 0.5], "rotation": [100.0, 5.0, 0.0] }
]);

utils.bindParticles(renderer, "soulhp:test3").setCondition(entity => entity.getData("soulhp:dyn/cloaking_cooldown") == 1);
}

function render(entity, renderLayer, isFirstPersonArm) {
    if (renderLayer == "CHESTPLATE") {
        renderWingpack(entity, isFirstPersonArm);
    }

    if (!isFirstPersonArm) {

     (renderLayer == "BOOTS") 
        boots.progress = entity.getInterpolatedData("fiskheroes:jetpacking_timer");
        boots.render();

    
}

}

function renderWingpack(entity) {
    wings.unfold = entity.getInterpolatedData("fiskheroes:wing_animation_timer");
    wings.render();


    
}