From 5f63baf38387c8e5ffdda059c96d280bb3102dbe Mon Sep 17 00:00:00 2001 From: TheRealSeq <164523836+TheRealSeq@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:59:05 +0100 Subject: [PATCH] Lorem Ipsum, dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. --- .../src/client-static/editor/js/mapEdit.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/server-client/src/client-static/editor/js/mapEdit.js b/server-client/src/client-static/editor/js/mapEdit.js index 0026e9e5..846f2182 100644 --- a/server-client/src/client-static/editor/js/mapEdit.js +++ b/server-client/src/client-static/editor/js/mapEdit.js @@ -20,6 +20,10 @@ const preferences = { } initPref("loremipsim", "loremIpsum", true, "ds"); +initPref("playtestHotkey", "Playtest Hotkey", true, "the \"p\" hotkey for playtesting"); +initPref("pointerLockOnClose", "Pointerlock on object menu close", true, "lock the pointer when the object menu is closed"); +initPref("doubleSlotForOM", "double-select slot for object menu", true, "opens the object menu when pressing hotkey for selected slot again"); + function initPref(internalName, displayName, val, description){ preferences[internalName] = { @@ -29,6 +33,10 @@ function initPref(internalName, displayName, val, description){ } } +function pref(interNalName){ + return preferences[interNalName].val; +} + //wow, this is NOT the best way to do this. Eh it's 1am ITS FINE //ye keeping this document.addEventListener("DOMContentLoaded", ()=>{ //wowoowow DYNAMIC preference menu!!!111111 @@ -89264,7 +89272,7 @@ var extern = (() => { el.style.display = "none"; tooltipEl.style.display = "none"; //Seq added - canvas.requestPointerLock(); + if(pref("pointerLockOnClose")) canvas.requestPointerLock(); } else { el.style.display = "block"; document.exitPointerLock(); @@ -89360,7 +89368,7 @@ var extern = (() => { if (idx == -1) idx = 9; //Seq added - if(idx == paletteIdx) + if(idx == paletteIdx && pref("doubleSlotForOM")) toggleObjectMenu(); selectPaletteSlot(idx); if (e.shiftKey) @@ -89427,7 +89435,7 @@ var extern = (() => { break; //Seq added case "p": - testMap(); + if(pref("playtestHotkey")) testMap(); break; } }