diff --git a/cmd/client/web/game.js b/cmd/client/web/game.js
index 4d3f03c..1e86def 100644
--- a/cmd/client/web/game.js
+++ b/cmd/client/web/game.js
@@ -1060,14 +1060,13 @@ window.onPresentationUpdate = function(players) {
if (!el) {
el = document.createElement('div');
el.className = 'presi-player';
- el.innerHTML = `
`;
+ el.innerHTML = `
`;
layer.appendChild(el);
presiPlayers.set(p.id, el);
}
// Map world coords to screen
- // World width is roughly 1280, height 720
- const screenX = (p.x % 1280) / 1280 * window.innerWidth;
+ const screenX = ((p.x + 1280000) % 1280) / 1280 * window.innerWidth;
const screenY = (p.y / 720) * window.innerHeight;
el.style.left = `${screenX}px`;
@@ -1075,23 +1074,22 @@ window.onPresentationUpdate = function(players) {
// Handle Emotes
if (p.state && p.state.startsWith('EMOTE_')) {
- const emoteNum = p.state.split('_')[1];
- const emotes = ["❤️", "😂", "😡", "👍"];
- const emoji = emotes[parseInt(emoteNum)-1] || "❓";
-
- let emoteEl = el.querySelector('.presi-player-emote');
- if (!emoteEl) {
- emoteEl = document.createElement('div');
+ if (el.lastEmoteState !== p.state) {
+ el.lastEmoteState = p.state;
+ const emoteNum = p.state.split('_')[1];
+ const emotes = ["❤️", "😂", "😡", "👍"];
+ const emoji = emotes[parseInt(emoteNum)-1] || "❓";
+ const oldEmote = el.querySelector('.presi-player-emote');
+ if (oldEmote) oldEmote.remove();
+ const emoteEl = document.createElement('div');
emoteEl.className = 'presi-player-emote';
+ emoteEl.textContent = emoji;
el.appendChild(emoteEl);
+ setTimeout(() => {
+ if (emoteEl.parentNode === el) emoteEl.remove();
+ el.lastEmoteState = "";
+ }, 2000);
}
- emoteEl.textContent = emoji;
-
- // Auto-remove emote text after 2s
- clearTimeout(el.emoteTimeout);
- el.emoteTimeout = setTimeout(() => {
- if (emoteEl) emoteEl.remove();
- }, 2000);
}
});
};
diff --git a/cmd/client/web/index.html b/cmd/client/web/index.html
index 40131ea..ec927da 100644
--- a/cmd/client/web/index.html
+++ b/cmd/client/web/index.html
@@ -320,10 +320,6 @@