extend("fiskheroes:hero_basic");
loadTextures({
	"hair": "tgheroes:misty/misty_wig",
	"suit": "tgheroes:misty/misty_body_ns",
    "leggings": "tgheroes:misty/misty_legs",
    "boots": "tgheroes:misty/misty_boots",
	"suit_legs": "tgheroes:misty/misty_body_ns"
});

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


function init(renderer) {
    parent.init(renderer);
    renderer.setTexture((entity, renderLayer) => {
        if (renderLayer == "CHESTPLATE") {
            return entity.getWornLeggings().suitType() == $SUIT_NAME ? "suit_legs" : "suit";
        }
	    else if (renderLayer == "LEGGINGS") {
            return entity.getWornChestplate().suitType() == $SUIT_NAME ? "leggings" : "leggings";
		}
        return renderLayer == "HELMET" ? "hair" : "boots" 
    });

    renderer.showModel("LEGGINGS", "body", "rightLeg", "leftLeg");
}

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

function initEquipped(renderer) {
    renderer.bindProperty("fiskheroes:equipped_item").setItems([
        { "anchor": "rightLeg", "scale": 0.7, "offset": [-2.4, 0.5, 1.25], "rotation": [90.0, 0.0, 0.0] }
    ]);
}

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