extend("skarlet:gwenpool_base");
loadTextures({
    "layer1": "skarlet:gwenpool/gwenpool_layer1",
    "layer2": "skarlet:gwenpool/gwenpool_layer2",
    "scabbard": "skarlet:gwenpool/gwenpool_scabbard",
    "katana": "skarlet:gwenpool/gwenpool_katana",
	"guns": "skarlet:gwenpool/gwenpool_gun"
});
var utils = implement("fiskheroes:external/utils");

var chest;
var scabbard;

function init(renderer) {
    parent.init(renderer);
    renderer.setTexture((entity, renderLayer) => renderLayer == "BOOTS" ? "layer2" : "layer1");

    renderer.showModel("CHESTPLATE", "body", "rightArm", "leftArm", "rightLeg", "leftLeg");
}

function initEffects(renderer) {
	parent.initEffects(renderer);
    var model = renderer.createResource("MODEL", "fiskheroes:deadpool_scabbard");
    model.texture.set("scabbard");
    scabbard = renderer.createEffect("fiskheroes:model").setModel(model);
    scabbard.anchor.set("body");
	
    chest = renderer.createEffect("fiskheroes:chest");
    chest.setExtrude(1.25).setYOffset(1);
	
    utils.addLivery(renderer, "KATANA", "katana");
    utils.addLivery(renderer, "DESERT_EAGLE", "guns");
	
    renderer.bindProperty("fiskheroes:equipped_item").setItems([
        { "anchor": "body", "scale": 0.535, "offset": [-3.05, 0.52, 3.0], "rotation": [-148.0, 90.0, 0.0] },
        { "anchor": "body", "scale": 0.535, "offset": [3.05, 0.52, 3.0], "rotation": [-148.0, -90.0, 0.0] }
    ]).slotIndex = 0;
    renderer.bindProperty("fiskheroes:equipped_item").setItems([
        { "anchor": "rightLeg", "scale": 0.7, "offset": [-2.0, 0.5, 1.0], "rotation": [90.0, 0.0, -7.0] },
        { "anchor": "leftLeg", "scale": 0.7, "offset": [2.0, 0.5, 1.0], "rotation": [90.0, 0.0, 7.0] }
    ]).slotIndex = 1;
}

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