/*
██╗  ██╗ █████╗ ██╗   ██╗███████╗███╗   ██╗    ███╗   ███╗ ██████╗ ██████╗ ██████╗  █████╗  ██████╗██╗  ██╗███████╗
██║  ██║██╔══██╗██║   ██║██╔════╝████╗  ██║    ████╗ ████║██╔═══██╗██╔══██╗██╔══██╗██╔══██╗██╔════╝██║ ██╔╝██╔════╝
███████║███████║██║   ██║█████╗  ██╔██╗ ██║    ██╔████╔██║██║   ██║██║  ██║██████╔╝███████║██║     █████╔╝ ███████╗
██╔══██║██╔══██║╚██╗ ██╔╝██╔══╝  ██║╚██╗██║    ██║╚██╔╝██║██║   ██║██║  ██║██╔═══╝ ██╔══██║██║     ██╔═██╗ ╚════██║
██║  ██║██║  ██║ ╚████╔╝ ███████╗██║ ╚████║    ██║ ╚═╝ ██║╚██████╔╝██████╔╝██║     ██║  ██║╚██████╗██║  ██╗███████║
╚═╝  ╚═╝╚═╝  ╚═╝  ╚═══╝  ╚══════╝╚═╝  ╚═══╝    ╚═╝     ╚═╝ ╚═════╝ ╚═════╝ ╚═╝     ╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝╚══════╝
*/
Ponder.registry((event) => {
    event.create([
        'mekanismgenerators:turbine_casing',
        'mekanismgenerators:turbine_valve',
        'mekanismgenerators:turbine_vent',
        'mekanismgenerators:turbine_rotor',
        'mekanismgenerators:turbine_blade',
        'mekanismgenerators:rotational_complex',
        'mekanismgenerators:saturating_condenser',
        'mekanism:pressure_disperser',
        'mekanismgenerators:electromagnetic_coil',
    ])
    .scene('mekanism_turbine', 'Constructing the Industrial Turbine', 'kubejs:mekanism_turbine', (scene, util) => {
        scene.showStructure();
        scene.idle(10);

        scene.overlay.showText(65).text("The Industrial Turbine uses heated coolant to generate power.").placeNearTarget().attachKeyFrame();
        scene.idle(70);

        scene.overlay.showText(65).text("The edges must be built with Turbine Casings.").placeNearTarget().attachKeyFrame();
        scene.idle(70);

        scene.overlay.showText(65).text("The faces can be Casings, Structural Glass, Valves, or Vents.").placeNearTarget().attachKeyFrame();
        scene.idle(70);

        scene.overlay.showText(65).text("Turbine Valves allow steam input and power output.").placeNearTarget().attachKeyFrame();
        scene.idle(70);

        scene.world.hideSection([0, 4, 0, 4, 6, 4], Facing.UP);
        scene.idle(10);

        scene.world.hideSection([0, 4, 0, 4, 6, 4], Facing.UP);
        scene.world.hideSection([0, 1, 0, 3, 6, 0], Facing.UP);
        scene.world.hideSection([0, 1, 0, 0, 6, 3], Facing.UP);
        scene.idle(15);

        scene.overlay.showText(85).text("Place Turbine Rotors in the center, with 2 Blades each.").placeNearTarget().attachKeyFrame();
        scene.idle(90);

        scene.world.showSection([2, 4, 2], Facing.UP);
        scene.idle(15);

        scene.overlay.showText(85).text("Place a Rotational Complex atop the Turbine Rotor.").placeNearTarget().attachKeyFrame();
        scene.idle(90);

        scene.world.showSection([1, 4, 1, 3, 4, 1], Facing.UP);
        scene.world.showSection([3, 4, 2], Facing.UP);
        scene.world.showSection([1, 4, 2], Facing.UP);
        scene.world.showSection([1, 4, 3, 3, 4, 3], Facing.UP);
        scene.idle(15);

        scene.overlay.showText(85).text("Surround the Rotational Complex with Pressure Dispersers.").placeNearTarget().attachKeyFrame();
        scene.idle(90);

        scene.world.showSection([0, 4, 0, 4, 4, 0], Facing.UP);
        scene.world.showSection([0, 4, 4, 4, 4, 4], Facing.UP);
        scene.world.showSection([0, 4, 1, 0, 4, 3], Facing.UP);
        scene.world.showSection([4, 4, 0, 4, 4, 4], Facing.UP);
        scene.world.showSection([0, 1, 0, 3, 3, 0], Facing.UP);
        scene.world.showSection([0, 1, 1, 0, 3, 3], Facing.UP);

        scene.overlay.showText(125).text("Use Turbine Vents for the outer faces from this layer onwards. These export water from the turbine.").placeNearTarget().attachKeyFrame();
        scene.idle(130);

        scene.world.showSection([2, 5, 2], Facing.UP);
        scene.idle(10);

        scene.overlay.showText(65).text("Place Electromagnetic Coils atop the Rotational Complex.").placeNearTarget().attachKeyFrame();
        scene.idle(70);

        scene.world.setBlock([2, 5, 1], 'mekanismgenerators:electromagnetic_coil', true);
        scene.world.setBlock([1, 5, 2], 'mekanismgenerators:electromagnetic_coil', true);
        scene.world.setBlock([2, 5, 3], 'mekanismgenerators:electromagnetic_coil', true);
        scene.world.setBlock([3, 5, 2], 'mekanismgenerators:electromagnetic_coil', true);
        scene.world.showSection([2, 5, 1], Facing.UP);
        scene.world.showSection([1, 5, 2], Facing.UP);
        scene.world.showSection([2, 5, 3], Facing.UP);
        scene.world.showSection([3, 5, 2], Facing.UP);
        scene.idle(15);

        scene.overlay.showText(105).text("A maximum of 5 Coils can be placed. They must connect to each other or the Rotational Complex.").placeNearTarget().attachKeyFrame();
        scene.idle(110);

        scene.world.showSection([3, 5, 3], Facing.UP);
        scene.world.showSection([1, 5, 1], Facing.UP);
        scene.world.showSection([1, 5, 3], Facing.UP);
        scene.world.showSection([3, 5, 1], Facing.UP);

        scene.overlay.showText(130).text("Saturating Condensers convert steam back into water. Place them on or above the Coil Layer.").placeNearTarget().attachKeyFrame();
        scene.idle(135);

        scene.world.showSection([0, 5, 0, 4, 5, 0], Facing.UP);
        scene.world.showSection([0, 5, 4, 4, 5, 4], Facing.UP);
        scene.world.showSection([0, 5, 1, 0, 5, 3], Facing.UP);
        scene.world.showSection([4, 5, 0, 4, 5, 3], Facing.UP);
        scene.idle(10);

        scene.world.showSection([0, 6, 0, 4, 6, 4], Facing.UP);
        scene.idle(25);

        scene.world.hideSection([1, 6, 1, 3, 6, 3], Facing.UP);
        scene.idle(20);
        scene.world.setBlock([1, 6, 1], 'mekanismgenerators:turbine_vent', false);
        scene.world.setBlock([2, 6, 1], 'mekanismgenerators:turbine_vent', false);
        scene.world.setBlock([3, 6, 1], 'mekanismgenerators:turbine_vent', false);
        scene.world.setBlock([1, 6, 2], 'mekanismgenerators:turbine_vent', false);
        scene.world.setBlock([2, 6, 2], 'mekanismgenerators:turbine_vent', false);
        scene.world.setBlock([3, 6, 2], 'mekanismgenerators:turbine_vent', false);
        scene.world.setBlock([1, 6, 3], 'mekanismgenerators:turbine_vent', false);
        scene.world.setBlock([2, 6, 3], 'mekanismgenerators:turbine_vent', false);
        scene.world.setBlock([3, 6, 3], 'mekanismgenerators:turbine_vent', false);
        scene.idle(15);

        scene.world.showSection([1, 6, 1, 3, 6, 3], Facing.DOWN);
        scene.idle(15);

        scene.overlay.showText(85).text("The top face can be replaced with Turbine Vents if needed.").placeNearTarget().attachKeyFrame();
        scene.idle(90);
    });
});
