Restore locked files if not all removed within 60 seconds
Removing one of the 3 AI-virus-protected files now starts a 60-second window (tracked session-wide via LockedFilesRemovalDeadline). If the other locked files aren't also removed before it expires, the virus restores whichever ones were deleted and broadcasts a red warning to the whole session, forcing players to coordinate the removal instead of picking them off one at a time. Also extends the Mercure broadcast payload with an optional 3rd "messageType" element so pushed messages can render red (virus) or green (mainframe) instead of always defaulting to green.
This commit is contained in:
+2
-6
@@ -14,7 +14,7 @@ function subscribeToMercure(mercurePublicUrl, topic, myScreen) {
|
||||
const data = JSON.parse(event.data);
|
||||
console.log('[Mercure][game1] Update:', data);
|
||||
|
||||
// data is [sendTo, message]
|
||||
// data is [sendTo, message, messageType?] - messageType defaults to 'mainframe' (green)
|
||||
if (Array.isArray(data) && data.length >= 2) {
|
||||
const sendTo = parseInt(data[0]);
|
||||
// Filter: 0 means everyone, otherwise must match myScreen
|
||||
@@ -25,11 +25,7 @@ function subscribeToMercure(mercurePublicUrl, topic, myScreen) {
|
||||
|
||||
const messageContainer = document.getElementById('message-container');
|
||||
if (messageContainer) {
|
||||
const msgEl = document.createElement('div');
|
||||
msgEl.className = 'message';
|
||||
msgEl.textContent = data[1];
|
||||
msgEl.style.color = '#0F0'; // Green for incoming messages
|
||||
messageContainer.appendChild(msgEl);
|
||||
appendResultMessage(messageContainer, data[1], data[2] || 'mainframe');
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
if(stillPlayingSound)
|
||||
playSound();
|
||||
|
||||
Reference in New Issue
Block a user