diff --git a/common/crypto.js b/common/crypto.js new file mode 100644 index 0000000..757b938 --- /dev/null +++ b/common/crypto.js @@ -0,0 +1 @@ +export default crypto; \ No newline at end of file diff --git a/common/player.js b/common/player.js index 4d57fc7..072aa45 100644 --- a/common/player.js +++ b/common/player.js @@ -1,4 +1,4 @@ -let crypto = (typeof window === 'undefined') ? await import('node:crypto') : crypto; +import crypto from "./crypto.js"; function distF(ent, target) { return ((ent.pos.x - target.pos.x) ** 2) + ((ent.pos.y - target.pos.y) ** 2) diff --git a/crypto.js b/crypto.js new file mode 100644 index 0000000..a2de468 --- /dev/null +++ b/crypto.js @@ -0,0 +1,3 @@ +import crypto from "node:crypto"; + +export default crypto; \ No newline at end of file