feat: multiplayer, voice chat, minimap, crafting, day/night, nginx cache-control

This commit is contained in:
Mk 2026-05-26 03:45:52 +00:00
parent b37727ae66
commit 0ed7d9966d
5 changed files with 852 additions and 96 deletions

View File

@ -1,11 +1,9 @@
FROM nginx:alpine FROM nginx:alpine
# Копируем файлы игры в директорию nginx COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY index.html /usr/share/nginx/html/index.html COPY index.html /usr/share/nginx/html/index.html
COPY style.css /usr/share/nginx/html/style.css COPY style.css /usr/share/nginx/html/style.css
COPY game.js /usr/share/nginx/html/game.js COPY game.js /usr/share/nginx/html/game.js
# Используем конфигурацию nginx по умолчанию
EXPOSE 80 EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]

899
game.js

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@
<title>GrechkaCraft: Multiplayer</title> <title>GrechkaCraft: Multiplayer</title>
<!-- Socket.io Client --> <!-- Socket.io Client -->
<script src="https://cdn.socket.io/4.7.4/socket.io.min.js"></script> <script src="https://cdn.socket.io/4.7.4/socket.io.min.js"></script>
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css?v=4">
</head> </head>
<body> <body>
@ -23,16 +23,31 @@
<div class="row" id="multiplayerStatus" style="display:none;">👥 <span id="playerCount">0</span></div> <div class="row" id="multiplayerStatus" style="display:none;">👥 <span id="playerCount">0</span></div>
</div> </div>
<div id="modeBtn" class="rbtn pe">🏃</div> <div id="modeBtn" class="rbtn pe">⛏️</div>
<div id="saveBtn" class="rbtn pe">💾</div> <div id="saveBtn" class="rbtn pe">💾</div>
<div id="craftBtn" class="rbtn pe">🔨</div> <div id="craftBtn" class="rbtn pe">🔨</div>
<div id="resetBtn" class="rbtn pe">🔄</div> <div id="resetBtn" class="rbtn pe">🔄</div>
<div id="chatToggle" class="rbtn pe">💬</div> <div id="chatToggle" class="rbtn pe">💬</div>
<div id="invToggle" class="rbtn pe">📦</div> <div id="invToggle" class="rbtn pe">📦</div>
<div id="mapToggle" class="rbtn pe">🗺️</div>
<div id="hotbar" class="pe"></div> <div id="hotbar" class="pe"></div>
</div> </div>
<!-- Миникарта -->
<div id="minimapWrap" style="display:none;position:absolute;left:10px;top:120px;z-index:200;pointer-events:auto;">
<canvas id="minimap" width="200" height="120" style="border:2px solid rgba(255,255,255,0.7);border-radius:8px;background:rgba(0,0,0,0.8);"></canvas>
</div>
<!-- Печь -->
<div id="furnacePanel" class="panel" style="display:none;">
<div class="panel-header">
<span>🔥 Печь</span>
<span id="furnaceClose" class="close" style="cursor:pointer;"></span>
</div>
<div id="furnaceContent" style="padding:8px;"></div>
</div>
<div id="controls"> <div id="controls">
<div id="left" class="btn pe">⬅️</div> <div id="left" class="btn pe">⬅️</div>
<div id="jump" class="btn pe">⬆️</div> <div id="jump" class="btn pe">⬆️</div>
@ -77,6 +92,6 @@
</div> </div>
</div> </div>
<script src="game.js"></script> <script src="game.js?v=6"></script>
</body> </body>
</html> </html>

15
nginx.conf Normal file
View File

@ -0,0 +1,15 @@
server {
listen 80;
root /usr/share/nginx/html;
index index.html;
location ~* \.(js|css)$ {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
expires 0;
}
location / {
try_files $uri $uri/ /index.html;
}
}

View File

@ -38,6 +38,7 @@ canvas { display:block; width:100%; height:100%; image-rendering:pixelated; }
#modeBtn { top:10px; background:#f39c12; } #modeBtn { top:10px; background:#f39c12; }
#saveBtn { top:10px; right:70px !important; background:#27ae60; } #saveBtn { top:10px; right:70px !important; background:#27ae60; }
#resetBtn { top:10px; right:130px !important; background:#e74c3c; } #resetBtn { top:10px; right:130px !important; background:#e74c3c; }
#mapToggle { top:10px; right:190px !important; background:#1abc9c; }
#craftBtn { top:74px; right:10px !important; background:#9b59b6; } #craftBtn { top:74px; right:10px !important; background:#9b59b6; }
#invToggle { top:74px; right:70px !important; background:#3498db; } #invToggle { top:74px; right:70px !important; background:#3498db; }
#chatToggle { display: none !important; } #chatToggle { display: none !important; }