This commit is contained in:
biglyderv 2025-02-07 12:58:26 -05:00
parent 2fe22ae5b8
commit f89a12e914
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5
3 changed files with 21 additions and 166 deletions

View file

@ -8,16 +8,8 @@
<body>
<div class='content'>
<p><b class='important'>Astrophis</b> is a civilization roleplay. Lead your nation's destiny throughout the
Minecraft world.</p>
<p>
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 <a href='#rules'>rules</a>.
<p><b class='important'>Astrophis</b> is a simple SMP connected to <a href='https://nbg.dervland.net'>BiglyChat.</a>
</p>
<div class='path'>
<div><b class='important'>War</b></div>
<img src='war.svg'>
</div>
<div class='path'>
<div><b class='important'><a href='https://discord.gg/yeyJfgAYGp'>Discord</a></b></div>
<img src='discord.svg'>
@ -27,31 +19,23 @@
<img src='server.svg'>
</div>
<div class='path'>
<div><b class='important'><a href='https://wiki.dervland.net/wiki/Astrophis'>Wiki</a></b>
<div><b class='important'><a href='https://wiki.dervland.net/wiki/Scraftia'>Wiki</a></b>
</div>
<img src='wiki.svg'>
</div>
<h1>Nations</h1>
<p><b>Pan camera:</b> [WASD/Mouse], <b>Fast motion:</b> [Q], <b>Zoom:</b> [Mouse wheel]</p>
<canvas class='map' width='1200' height='800'></canvas>
<pre class='coords'></pre>
<h1 id='rules'>Rules</h1>
<ol>
<li>Don't harrass others.</li>
<li>Don't use glitches.</li>
<li>Don't use utility mods or hacks. Exceptions: shaders, minimap (no caves), ViaVersion.</li>
<li>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).</li>
<li>Claims of excessive size will not be mapped.</li>
<li>The first nation to claim a land in Discord, and anyone squatting there, owns it.</li>
<li>Wars must be declared in Discord to be valid.</li>
<li>In a war, each nation starts with 3 points per citizen, 3 points per settlement. These are deducted by
player death.</li>
<li>To end a war, a nation must have 0 points, have surrendered, or have withdrawn.</li>
<li>Not all points need to be taken to partially annex a nation.</li>
<li>Land that belongs to someone else can't be looted, griefed, or built on.</li>
</ol>
<h1>Logs</h1>
<div class="msgs">
</div>
<script src="/map.js"></script>
</div>
<script src='/index.js'></script>
</body>
</html>

13
index.js Normal file
View file

@ -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);
}
})()

142
map.js
View file

@ -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);
}