extend("tgheroes:superman");
loadTextures({
	"layer1": "tgheroes:superman/red_son1",
	"layer2": "tgheroes:superman/red_son2",
	"cape": "tgheroes:superman/sups_cape"
});

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

function initEffects(renderer) {
	var physics = renderer.createResource("CAPE_PHYSICS", null);
    physics.weight = 1.3;
    physics.maxFlare = 0.6;
    physics.flareDegree = 1.5;
    physics.flareFactor = 1.2;
    physics.flareElasticity = 5;
    cape = capes.createDefault(renderer, 24, "fiskheroes:cape_default.mesh.json", physics);
    cape.effect.texture.set("cape");
    cape.effect.width = 16;

    utils.bindBeam(renderer, "fiskheroes:heat_vision", "fiskheroes:heat_vision", "head", 0xFF0000, [
        { "firstPerson": [2.2, 0.0, 2.0], "offset": [2.2, -3.3, -4.0], "size": [1.0, 0.5] },
        { "firstPerson": [-2.2, 0.0, 2.0], "offset": [-2.2, -3.3, -4.0], "size": [1.0, 0.5] }
    ]).setParticles(renderer.createResource("PARTICLE_EMITTER", "fiskheroes:impact_heat_vision"));
	utils.bindTrail(renderer, "tgheroes:ussr_trail");
	utils.bindBeam(renderer, "fiskheroes:charged_beam", "fiskheroes:cold_beam", "body", 0x87cefa, [
        { "firstPerson": [0.0, 3.0, 0.0], "offset": [0.0, -1.0, 0.0], "size": [1.0, 1.0], "anchor": "Head" }
    ]);
	
}

function initAnimations(renderer) {
    parent.initAnimations(renderer);
    renderer.removeCustomAnimation("basic.CHARGED_BEAM");

    utils.addFlightAnimation(renderer, "thor.FLIGHT", "tgheroes:flight/thor.anim.json");
    utils.addHoverAnimation(renderer, "thor.HOVER", "fiskheroes:flight/idle/martian_comics");
}

function render(entity, renderLayer, isFirstPersonArm) {
	if (renderLayer == "CHESTPLATE") {
            cape.render(entity)
	}
}