add emotes and npcs. this really needs a cleanup
This commit is contained in:
parent
da4b0f5df8
commit
f8b014507f
11 changed files with 267 additions and 85 deletions
16
common/util.js
Normal file
16
common/util.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
import crypto from "../crypto.js";
|
||||
|
||||
function distF(ent, target) {
|
||||
return ((ent.pos.x - target.pos.x) ** 2) + ((ent.pos.y - target.pos.y) ** 2)
|
||||
}
|
||||
|
||||
function uuidv4() {
|
||||
return "#000000-000000".replace(/[018]/g, c =>
|
||||
(+c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +c / 4).toString(16)
|
||||
);
|
||||
}
|
||||
|
||||
export {
|
||||
distF,
|
||||
uuidv4
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue