extend("fiskheroes:hero_basic");
loadTextures({
	"layer1": "tgheroes:galactus/galactus_layer1",
	"layer2": "tgheroes:galactus/galactus_layer2",
	"helmet": "tgheroes:galactus/galactus_helmet"
});

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

function initEffects(renderer) {
	helmet = renderer.createEffect("fiskheroes:model");
    helmet.setModel(utils.createModel(renderer, "tgheroes:galactus_helmet", null, "helmet"));
    helmet.anchor.set("head");
	helmet.setScale(1.0);
	helmet.setOffset(0.0, 0.0, 0.0);

    var forcefield = renderer.bindProperty("fiskheroes:forcefield");
    forcefield.color.set(0xffffff);
    forcefield.setShape(36, 18).setOffset(0.0, 6.0, 0.0).setScale(1.75);
    forcefield.setCondition(entity => {
		forcefield.opacity = entity.getInterpolatedData("fiskheroes:shield_blocking_timer") * 0.15;
		return true;
    });

	utils.bindCloud(renderer, "fiskheroes:telekinesis", "tgheroes:doom_2099_telekinesis");
    utils.bindCloud(renderer, "fiskheroes:teleportation", "tgheroes:doom_2099_teleport");

    utils.bindBeam(renderer, "fiskheroes:charged_beam", "tgheroes:kang_beam", "rightArm", 0xdb1ecb, [
        { "firstPerson": [-3.75, 3.0, -8.0], "offset": [0.5, 12.0, 0.0], "size": [3.0, 3.0],}
    ]);
}

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

    utils.addFlightAnimation(renderer, "mmcw.FLIGHT", "fiskheroes:flight/default_arms_forward.anim.json");
    addAnimationWithData(renderer, "antimonitor.ANTIBLAST", "fiskheroes:aiming", "fiskheroes:beam_charge");
}

function render(entity, renderLayer, isFirstPersonArm) {
    if (renderLayer == "HELMET") {
        helmet.render();
    }
}