cod

mail@pastecode.io avatar
unknown
ejs
2 years ago
3.8 kB
1
Indexable
Never
extend("fiskheroes:spider_man_base");
loadTextures({
    "layer1": "legends:hero_layer1",
    "layer2": "legends:hero_layer2",
    "model": "legends:venom/venom_model",
    "segment": "legends:venom/venom_model",
    "claw": "legends:venom/venom_model"
});

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

var tongue_model;

function initEffects(renderer) {
    legends.initEffects(renderer);
    tongue_model = renderer.createEffect("fiskheroes:model");
    tongue_model.anchor.set("head");
    var tongue = utils.createModel(renderer, "legends:venom/venom_tongue", "model");
    tongue.bindAnimation("legends:tongue_movement").setData((entity,data) => data.load(entity.loop(25)));
    tongue_model.setModel(tongue);
    
    var ock_arm = utils.createModel(renderer, "legends:venom/ock_arm", "segment");
    var ock_claw = utils.createModel(renderer, "legends:venom/ock_claw", "claw");
    ock_claw.bindAnimation("fiskheroes:ock_claw").setData((entity, data) => {
        var t = entity.as("TENTACLE");
        data.load(0, 1 - Math.min(t.getCaster().getInterpolatedData("fiskheroes:tentacle_extend_timer") * 2, 1));
        data.load(1, t.getIndex());
        data.load(2, t.getGrabTimer());
        data.load(3, t.getStrikeTimer());
    });

    var tentacles = renderer.bindProperty("fiskheroes:tentacles").setTentacles([
        { "offset": [2.0, -3.0, -2.0], "direction": [13.0, 10.0, -10.0] },
        { "offset": [-2.0, -3.0, -2.0], "direction": [-13.0, 10.0, -10.0] },
        { "offset": [2.0, -7.5, -2.0], "direction": [13.0, -10.0, -10.0] },
        { "offset": [-2.0, -7.5, -2.0], "direction": [-13.0, -10.0, -10.0] }
    ]);
    tentacles.anchor.set("body");
    tentacles.setSegmentModel(ock_arm);
    tentacles.setHeadModel(ock_claw);
    tentacles.segmentLength = 6;
    tentacles.segmentLinks = 3;

    legends.head.setModel(utils.createModel(renderer, "legends:venom/venom_head", "model"));
    legends.body.setModel(utils.createModel(renderer, "legends:venom/venom_chest", "model"));
    legends.rightArm.setModel(utils.createModel(renderer, "legends:venom/venom_right_arm", "model"));
    legends.leftArm.setModel(utils.createModel(renderer, "legends:venom/venom_left_arm", "model"));
    legends.rightLeg.setModel(utils.createModel(renderer, "legends:venom/venom_right_leg", "model"));
    legends.leftLeg.setModel(utils.createModel(renderer, "legends:venom/venom_left_leg", "model"));

    utils.setOpacity(renderer, 0.999, 0.999);

    utils.bindBeam(renderer, "fiskheroes:charged_beam", "fiskheroes:energy_projection", "rightArm", 0x003AFF, [
        { "firstPerson": [-4.5, 3.75, -8.0], "offset": [-0.5, 9.0, 0.0], "size": [3.0, 3.0] }
    ]).setParticles(renderer.createResource("PARTICLE_EMITTER", "fiskheroes:impact_antimatter"));
}

function initAnimations(renderer) {
    parent.initAnimations(renderer);
    addAnimationWithData(renderer, "spiderman.AIMING", "legends:web_aim_right", "fiskheroes:web_aim_right_timer")
        .priority = 1;

    addAnimationWithData(renderer, "spiderman.AIMING_LEFT", "legends:web_aim_left", "fiskheroes:web_aim_left_timer")
        .priority = 1;
    utils.addAnimationEvent(renderer, "WEBSWING_LEAP", "legends:swing_springboard");
    utils.addAnimationEvent(renderer, "WEBSWING_DIVE", "fiskheroes:swing_dive"); 
    addAnimationWithData(renderer, "BEAM_CHARGE", "fiskheroes:aiming", "fiskheroes:beam_charge");
}

function render(entity, renderLayer, isFirstPersonArm) {
    legends.render(entity, renderLayer, isFirstPersonArm);
    var mask_open = entity.getInterpolatedData("fiskheroes:mask_open_timer2");
    if (!isFirstPersonArm && !mask_open || entity.isDisplayStand()) {
        tongue_model.render();
    }
}