Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- 'use strict';
- function go_to_pos(y, x) {
- let world = window.w;
- world._state.offsetX = -x * 576;
- world._state.offsetY = y * 576;
- world._container.scrollLeft(0);
- world._container.scrollTop(0);
- console.log("Teleport complete");
- }
- function create_teleport_button() {
- $('body')
- .append('<input type="button" value="TP" id="TP">');
- $("#TP")
- .css("position", "fixed")
- .css("top", 0)
- .css("left", 0);
- $('#TP').click(function() {
- let world = window.w;
- world._ui.coordinateInputModal.open("Teleport to coordinates:", go_to_pos);
- });
- }
- function init_wall() {
- console.log("Prepared");
- setUpAjax();
- window.w = new World($("#yourworld"), window.state);
- }
- function kill_begin_script(e) {
- var src = e.target.src;
- if (src.indexOf("begin.js") !== -1) {
- console.log("Disabling begin script");
- e.stopPropagation();
- e.preventDefault();
- $(e.target).remove();
- }
- }
- create_teleport_button();
- document.addEventListener("beforescriptexecute", kill_begin_script, true);
- $(init_wall);
- console.log("Teleportation initialized");
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement