// gimhook: {"name":"ClickTP","description":"A mod that lets you teleport to where you shift-click!","version":"1.0.0","author":"Blackhole927","license":"MIT"}
(() => {
gimhook.addHook("join", () => {
console.log("Game joined!")
console.log("Test...")
var w = 0
var h = 0
var clickTPon = false;
onmousemove = function(e) {
w = window.innerWidth
h = window.innerHeight
mouseX = e.clientX
mouseY = e.clientY
mouseX -= w/2
mouseX = mouseX/(w)
mouseY -= h/2
mouseY = mouseY/h
zoom = gimhook.graphics.camera.getZoom()
zoom = 1/zoom
mouseX *= zoom
mouseY *= zoom
mouseX *= 2
mouseY *= 2
}
onmousedown = function(e) {
if (e.shiftKey) {
xy = gimhook.graphics.player.getPosition()
xy["x"] += mouseX*(w/2)
xy["y"] += mouseY*(h/2)
}
gimhook.graphics.player.setPosition(xy["x"], xy["y"])
}
});
})();