From f89a12e9142705249bf143e5f6036b5315097526 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Fri, 7 Feb 2025 12:58:26 -0500 Subject: [PATCH] test log --- index.html | 32 +++--------- index.js | 13 +++++ map.js | 142 ----------------------------------------------------- 3 files changed, 21 insertions(+), 166 deletions(-) create mode 100644 index.js delete mode 100644 map.js diff --git a/index.html b/index.html index fb641f2..8266ce2 100644 --- a/index.html +++ b/index.html @@ -8,16 +8,8 @@
-

Astrophis is a civilization roleplay. Lead your nation's destiny throughout the - Minecraft world.

-

- Unlike similar servers, the server doesn't use traditional claim plugins, and is not a short-term challenge. - Everything is crafted by the players and their interactions, under the rules. +

Astrophis is a simple SMP connected to BiglyChat.

-
-
War
- -
Discord
@@ -27,31 +19,23 @@
-
Wiki +
Wiki
-

Nations

-

Pan camera: [WASD/Mouse], Fast motion: [Q], Zoom: [Mouse wheel]

- -

         

Rules

  1. Don't harrass others.
  2. Don't use glitches.
  3. Don't use utility mods or hacks. Exceptions: shaders, minimap (no caves), ViaVersion.
  4. -
  5. Land that belongs to someone else can't be looted, griefed, or built on, unless the land is vastly empty - or inactive for 5+ days (squatting).
  6. -
  7. Claims of excessive size will not be mapped.
  8. -
  9. The first nation to claim a land in Discord, and anyone squatting there, owns it.
  10. -
  11. Wars must be declared in Discord to be valid.
  12. -
  13. In a war, each nation starts with 3 points per citizen, 3 points per settlement. These are deducted by - player death.
  14. -
  15. To end a war, a nation must have 0 points, have surrendered, or have withdrawn.
  16. -
  17. Not all points need to be taken to partially annex a nation.
  18. +
  19. Land that belongs to someone else can't be looted, griefed, or built on.
+

Logs

+
+ +
- + \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..42d1bb4 --- /dev/null +++ b/index.js @@ -0,0 +1,13 @@ +(async function( ){ + let msgs = await fetch("https://civ.dervland.net/api/messages"); + let msgJ = await msgs.json(); + + for (let msg of msgJ) { + let msgC1 = document.createElement('big'); + msgC1.textContent = `<${msg.username}> (${(new Date(msg.date)+'').split(' GMT')[0]})`; + let msgC2 = document.createElement('div'); + msgC2.textContent = `${msg.content}`; + document.querySelector('.msgs').appendChild(msgC1); + document.querySelector('.msgs').appendChild(msgC2); + } +})() \ No newline at end of file diff --git a/map.js b/map.js deleted file mode 100644 index 1c6ba0e..0000000 --- a/map.js +++ /dev/null @@ -1,142 +0,0 @@ -const mapWidth = 16000; -const mapHeight = 16000; - -let assets = [ - 'base.png', - 'pol.svg' -] - -let imgA = []; - -let map = document.querySelector('.map'); -let ctx = map.getContext('2d'); - -let coords = document.querySelector('.coords'); - -let pos = []; -let mpos = [0, 0]; -let keys = []; -let vel = [0, 0]; -let center = [0, 0]; -let lastPos = [0, 0]; -let isMouse = false; -let zoom = 5; -let timer = 0; - -let id = ''; - -ctx.imageSmoothingEnabled = false; - -function fixEvent(e) { - let r = map.getBoundingClientRect(); - e = { clientX: e.clientX, clientY: e.clientY }; - - e.clientX -= r.x; - e.clientY -= r.y; - - e.clientX /= r.width / map.width; - e.clientY /= r.height / map.height; - - return e; -} - -function down(e) { - keys[e.key.toLowerCase()] = true; -}; - -function up(e) { - keys[e.key.toLowerCase()] = false; -}; - -function mouseMove(e) { - e = fixEvent(e); - - lastPos = [e.clientX, e.clientY]; - if (!isMouse) return; - mpos[0] += e.clientX - center[0]; - mpos[1] += e.clientY - center[1]; - center = lastPos; -} - -function mouseUp(e) { - isMouse = false; -} - -function mouseDown(e) { - e = fixEvent(e); - if (e.button == '2') return; - isMouse = true; - center = [e.clientX, e.clientY]; -} - -function wheel(e) { - document.body.style.overflow = 'hidden'; - - if (timer != 0) clearTimeout(timer); - - timer = setTimeout(function() { - document.body.style.overflow = ''; - },400) - - mpos[0] -= lastPos[0]; - mpos[1] -= lastPos[1]; - - let f = (2 ** -(e.deltaY/256)); - - mpos[0] *= f; - mpos[1] *= f; - - mpos[0] += lastPos[0]; - mpos[1] += lastPos[1]; - - zoom *= f; -} - -function move() { - var isShift = keys['q']; - vel[0] += ((keys['a'] ? 1 : 0) - (keys['d'] ? 1 : 0)) * (isShift ? 5 : 1); - vel[1] += ((keys['w'] ? 1 : 0) - (keys['s'] ? 1 : 0)) * (isShift ? 5 : 1); - - vel[0] *= 0.9; - vel[1] *= 0.9; - - mpos[0] += vel[0]; - mpos[1] += vel[1]; - - ctx.clearRect(0, 0, map.width, map.height); - - for (let img of imgA) { - let w = img.width * zoom; - let h = img.height * zoom; - ctx.drawImage(img, mpos[0], mpos[1], w, h) - } - - off = [-(imgA[0].width * zoom - map.width) / 2, -(imgA[0].height * zoom - map.height) / 2]; - coords.textContent = `X: ${(mpos[0] - off[0]) * mapWidth / imgA[0].width / -zoom}\nZ: ${(mpos[1] - off[1]) * mapHeight / imgA[0].height / -zoom}`; -} - -for (let asset of assets) { - let img = new Image(); - img.src = `./${asset}`; - imgA.push(img); -} - -let off = [-(imgA[0].width * zoom - map.width) / 2, -(imgA[0].height * zoom - map.height) / 2]; -setTimeout(function() { - mpos = [off[0], off[1]]; -},300) - -setInterval(move, 10); - -window.addEventListener('keydown', down); -window.addEventListener('keyup', up); -map.addEventListener('wheel', wheel); -window.addEventListener('mousemove', mouseMove); -window.addEventListener('mousedown', mouseDown); -window.addEventListener('mouseup', mouseUp); - -function copy() { - let addr = 'play.dervland.net'; - navigator.clipboard.writeText(addr); - alert(addr); -} \ No newline at end of file