Files
lit.ruv.wtf/src/mining.html
2025-11-25 06:42:23 +11:00

331 lines
9.3 KiB
HTML

<!--
METADATA:{
"title": "Prison Mine - Litruv",
"metaDescription": "Infinite isometric prison mining game.",
"csp": "script-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com https://cdn.jsdelivr.net;",
"ogTitle": "Prison Mine - Litruv",
"ogDescription": "Dig deep in this infinite isometric mining game.",
"ogUrl": "https://lit.ruv.wtf/mining.html",
"twitterTitle": "Prison Mine - Litruv",
"twitterDescription": "Dig deep in this infinite isometric mining game.",
"twitterUrl": "https://lit.ruv.wtf/mining.html",
"useCommonHeader": true,
"useCommonFooter": true
}
-->
<!-- START_STYLES -->
<style>
.mining-container {
width: min(100%, 80vh);
aspect-ratio: 1;
margin: 0 auto;
position: relative;
overflow: hidden;
background: #000;
border: 2px solid var(--post-border);
box-shadow: 4px 6px 0 var(--shadow-light);
}
#game-canvas {
width: 100%;
height: 100%;
display: block;
position: absolute;
top: 0;
left: 0;
z-index: 0;
}
.mining-ui {
position: absolute;
top: 10px;
left: 10px;
color: white;
font-family: 'Minecraft', monospace; /* Fallback */
pointer-events: none;
text-shadow: 2px 2px 0 #000;
z-index: 100;
}
.mining-stat {
font-size: 1.5rem;
margin-bottom: 0.5rem;
}
.inventory-container {
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 5px;
background: rgba(0, 0, 0, 0.5);
padding: 5px;
border-radius: 5px;
pointer-events: auto;
overflow-x: auto;
max-width: 95%;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
z-index: 100;
}
/* Scrollbar styling for inventory */
.inventory-container::-webkit-scrollbar {
height: 6px;
}
.inventory-container::-webkit-scrollbar-track {
background: rgba(0,0,0,0.3);
border-radius: 3px;
}
.inventory-container::-webkit-scrollbar-thumb {
background: rgba(255,255,255,0.3);
border-radius: 3px;
}
.inventory-slot {
flex: 0 0 auto; /* Don't shrink */
width: 40px;
height: 40px;
background: rgba(255, 255, 255, 0.1);
border: 2px solid #555;
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
.inventory-slot img {
width: 32px;
height: 32px;
image-rendering: pixelated;
}
.inventory-count {
position: absolute;
bottom: 0;
right: 2px;
font-size: 12px;
color: white;
text-shadow: 1px 1px 0 #000;
}
.crafting-container {
position: absolute;
top: 50%;
right: 10px;
transform: translateY(-50%);
display: flex;
flex-direction: column;
gap: 5px;
background: rgba(0, 0, 0, 0.5);
padding: 5px;
border-radius: 5px;
pointer-events: auto; /* Allow clicking */
overflow-y: auto;
max-height: 60vh;
-webkit-overflow-scrolling: touch;
z-index: 100;
}
/* Scrollbar styling for crafting */
.crafting-container::-webkit-scrollbar {
width: 6px;
}
.crafting-container::-webkit-scrollbar-track {
background: rgba(0,0,0,0.3);
border-radius: 3px;
}
.crafting-container::-webkit-scrollbar-thumb {
background: rgba(255,255,255,0.3);
border-radius: 3px;
}
.crafting-slot {
width: 40px;
height: 40px;
background: rgba(255, 255, 255, 0.1);
border: 2px solid #555;
position: relative;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: background 0.2s;
}
.crafting-slot:hover {
background: rgba(255, 255, 255, 0.2);
}
.crafting-slot.can-craft {
border-color: #79C05A;
background: rgba(121, 192, 90, 0.2);
}
.crafting-slot img {
width: 32px;
height: 32px;
image-rendering: pixelated;
}
.crafting-tooltip {
position: absolute;
right: 100%;
top: 50%;
transform: translateY(-50%);
background: rgba(0, 0, 0, 0.8);
color: white;
padding: 5px;
border-radius: 3px;
font-size: 12px;
white-space: nowrap;
display: none;
margin-right: 10px;
pointer-events: none;
z-index: 20;
}
.crafting-slot:hover .crafting-tooltip {
display: block;
}
.shop-btn {
position: absolute;
top: 10px;
right: 10px;
background: #4CAF50;
color: white;
border: 2px solid #388E3C;
padding: 5px 10px;
font-family: 'Minecraft', monospace;
cursor: pointer;
z-index: 100;
}
.shop-container {
position: absolute;
top: 10%;
left: 50%;
transform: translateX(-50%);
background: rgba(0, 0, 0, 0.9);
border: 2px solid #555;
padding: 20px;
color: white;
font-family: 'Minecraft', monospace;
display: none;
z-index: 101;
min-width: 300px;
max-height: 80vh;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.shop-section {
margin-bottom: 20px;
}
.shop-section h3 {
border-bottom: 1px solid #555;
padding-bottom: 5px;
margin-top: 0;
}
.shop-item {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 5px;
padding: 5px;
background: rgba(255, 255, 255, 0.05);
}
.shop-item button {
background: #333;
color: white;
border: 1px solid #555;
padding: 2px 5px;
cursor: pointer;
font-family: inherit;
}
.shop-item button:hover {
background: #555;
}
.close-shop {
position: absolute;
top: 5px;
right: 5px;
background: none;
border: none;
color: white;
font-size: 20px;
cursor: pointer;
}
/* Override for buttons inside shop */
.shop-container .shop-btn {
position: static;
display: block;
width: 100%;
margin-bottom: 5px;
background: #333;
text-align: left;
}
.shop-container .shop-btn:hover {
background: #555;
}
.shop-container .close-btn {
text-align: center;
background: #d32f2f;
border-color: #b71c1c;
}
.shop-container .close-btn:hover {
background: #f44336;
}
.fullscreen-btn {
position: absolute;
top: 10px;
right: 80px;
background: #2196F3;
color: white;
border: 2px solid #1976D2;
padding: 5px 10px;
font-family: 'Minecraft', monospace;
cursor: pointer;
z-index: 100;
}
.fullscreen-btn:hover {
background: #42A5F5;
}
.mining-container:fullscreen {
width: 100vw;
height: 100vh;
max-width: none;
aspect-ratio: auto;
border: none;
background: #87CEEB; /* Match sky color */
}
.mining-container:fullscreen #game-canvas {
width: 100vw;
height: 100vh;
}
</style>
<!-- END_STYLES -->
<!-- START_SCRIPTS_DEFER -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/shaders/CopyShader.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/shaders/SSAOShader.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/postprocessing/EffectComposer.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/postprocessing/RenderPass.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/postprocessing/ShaderPass.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/postprocessing/SSAOPass.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/shaders/GammaCorrectionShader.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/math/SimplexNoise.js" defer></script>
<script src="mining.js" defer></script>
<!-- END_SCRIPTS_DEFER -->
<div class="mining-container">
<div class="mining-ui">
<div class="mining-stat">Depth: <span id="depth-counter">0</span></div>
<div class="mining-stat">Score: <span id="score-counter">0</span></div>
</div>
<button id="fullscreen-btn" class="fullscreen-btn" onclick="toggleFullscreen()">[ ]</button>
<button id="shop-btn" class="shop-btn" onclick="toggleShop()">Shop</button>
<div id="inventory-display" class="inventory-container">
<!-- Slots will be added here dynamically -->
</div>
<div id="crafting-display" class="crafting-container">
<!-- Crafting slots will be added here dynamically -->
</div>
<div id="shop-modal" class="shop-container" style="display:none; flex-direction:column; max-height: 80vh; overflow-y: auto;">
<div id="shop-content"></div>
</div>
<canvas id="game-canvas"></canvas>
</div>