mirror of
https://git.j0bot.ch/admin_j0bot/ploxion-shipyard.git
synced 2026-11-29 07:15:04 +00:00
synchro du labo (0bf0da65) : app.blade.php, README.md
This commit is contained in:
parent
1e422af9c9
commit
ed02c041e0
22
README.md
22
README.md
@ -1,3 +1,21 @@
|
||||
# ploxion-shipyard
|
||||
# 🚀 Chantier spatial
|
||||
|
||||
PLOXION · Le but du jeu : construis ton vaisseau (façon Kerbal), assemble les pièces, calcule le Δv, et lance vers l'orbite puis Véga. · fournit: game, ship-builder, ksp, vega
|
||||
Le but du jeu : construis ton vaisseau (façon Kerbal), assemble les pièces, calcule le Δv, et lance vers l'orbite puis Véga.
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
| id | `shipyard` |
|
||||
| fournit | `game` `ship-builder` `ksp` `vega` |
|
||||
| bions qu'il nomme | `jOSApps` `jOSBoxion` `jOSGame` `jOSMobile` `jOSOp` |
|
||||
| fichiers | `app.blade.php` |
|
||||
| dans le labo | `resources/views/ploxions/shipyard/` (dépôt `my_website2`) |
|
||||
|
||||
## Contribuer
|
||||
|
||||
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=shipyard — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
|
||||
- **Dans VS Code** : `xb prendre shipyard` (ou l'extension xerboxion › ⇩ Prendre), puis ⧗ Envoyer.
|
||||
- Le chemin complet : https://labo.j0bot.ch/px/contribuer
|
||||
|
||||
Ce dépôt est un **miroir** du labo (synchronisé par `bin/ploxions-forge.mjs`, depuis le commit `0bf0da65`) : une modif se propose par un tsoin ou une branche du labo, pas directement ici.
|
||||
|
||||
© 2026 chill-tekk · ne pas nuire
|
||||
|
||||
161
app.blade.php
Normal file
161
app.blade.php
Normal file
@ -0,0 +1,161 @@
|
||||
{{-- PL0XI0N shipyard 🚀 — LE BUT DU JEU (RS-7) : construire un vaisseau spatial façon Kerbal Space
|
||||
Program, sur le xerboxion, pour atteindre VÉGA (quête RS-7). On assemble des PIÈCES (= des cubions),
|
||||
on calcule delta-v / TWR (Tsiolkovsky, déterministe), on LANCE. Orbite = XP ; le wormion-drive +
|
||||
assez de dv = Véga (achievement). Branché sur jOSGame. Le Nexus 3D = plus tard ; ici le chantier 2D. --}}
|
||||
<style>
|
||||
.px-sy{display:flex;height:100%;background:var(--xr-bg,#060810);color:var(--xr-fg,#e8ecf8);font-family:var(--xr-font-ui,ui-sans-serif,system-ui);overflow:hidden;position:relative}
|
||||
.px-sy .pal{width:132px;flex:0 0 auto;border-right:1px solid var(--xr-line,#18213f);overflow:auto;padding:8px}
|
||||
.px-sy .pal h4{margin:2px 0 7px;font-size:.62rem;text-transform:uppercase;color:var(--xr-muted,#8aa0c8);letter-spacing:.05em}
|
||||
.px-sy .pal .nom{font-size:.56rem;color:var(--xr-muted,#7f93c8);cursor:pointer;margin:0 0 6px;padding-bottom:5px;border-bottom:1px dotted #3a4a78}
|
||||
.px-sy .pal .nom:hover{color:var(--xr-accent,#6ad0ff)}
|
||||
.px-sy .pal .p{display:flex;gap:6px;align-items:center;padding:7px 8px;border:1px solid var(--xr-line,#223056);border-radius:9px;margin-bottom:5px;background:var(--xr-card,#111a30);cursor:pointer;font-size:.72rem}
|
||||
.px-sy .pal .p:hover{border-color:var(--xr-accent,#6ad0ff)}.px-sy .pal .p.xer{border-color:#6a4ad0;background:#160f2e}
|
||||
.px-sy .pal .p .ic{font-size:1.05rem}.px-sy .pal .p small{display:block;color:var(--xr-muted,#7f93c8);font-size:.56rem}
|
||||
.px-sy .mid{flex:1;display:flex;flex-direction:column;min-width:0}
|
||||
.px-sy .stack{flex:1;overflow:auto;display:flex;flex-direction:column-reverse;align-items:center;justify-content:flex-start;padding:14px 8px;gap:2px}
|
||||
.px-sy .part{width:64px;border:1.5px solid #3a6ad0;background:linear-gradient(180deg,#1a2748,var(--xr-surface,#111a30));color:var(--xr-text,#dbe6ff);text-align:center;font-size:.62rem;padding:5px 2px;cursor:pointer;position:relative}
|
||||
.px-sy .part.nose{clip-path:polygon(50% 0,100% 100%,0 100%);height:44px;padding-top:16px;border:0;background:#3a6ad0}
|
||||
.px-sy .part.engine{clip-path:polygon(0 0,100% 0,80% 100%,20% 100%);height:40px;background:#5a2a2a;border-color:#d06a4a}
|
||||
.px-sy .part.wormion{background:#2a1a4a;border-color:#8a6ad0}
|
||||
.px-sy .part.decoupler{height:13px;padding:1px;font-size:.5rem;color:#bbb;background:repeating-linear-gradient(90deg,#4a4a4a 0 5px,#2a2a2a 5px 10px);border-color:#888}
|
||||
.px-sy .part .rm{position:absolute;top:-6px;right:-6px;background:#3a1015;border:1px solid #d06a4a;color:#ff9a9a;border-radius:50%;width:16px;height:16px;font-size:.6rem;line-height:14px;display:none}
|
||||
.px-sy .part:hover .rm{display:block}
|
||||
.px-sy .empty{color:var(--xr-muted,#7f93c8);font-size:.8rem;text-align:center;margin:auto;padding:20px}
|
||||
.px-sy .stats{flex:0 0 auto;border-top:1px solid var(--xr-line,#18213f);padding:9px 11px;font-size:.72rem}
|
||||
.px-sy .stats .row{display:flex;gap:10px;flex-wrap:wrap;color:var(--xr-muted,#9fb0d0)}.px-sy .stats b{color:var(--xr-text,#dbe6ff)}
|
||||
.px-sy .gauge{height:8px;border-radius:5px;background:var(--xr-surface,#101a34);overflow:hidden;margin:7px 0 8px}.px-sy .gauge i{display:block;height:100%;background:linear-gradient(90deg,#2a5ad0,var(--xr-accent,#6ad0ff))}
|
||||
.px-sy .gauge i.ok{background:linear-gradient(90deg,#2a8a4a,#6affa0)}
|
||||
.px-sy .launch{width:100%;padding:12px;border:0;border-radius:10px;background:linear-gradient(135deg,#1a3a7a,#2a5ad0);color:#fff;font-weight:800;font-size:1rem;cursor:pointer}
|
||||
.px-sy .launch:disabled{opacity:.4}
|
||||
.px-sy .verdict{position:absolute;inset:0;background:rgba(4,6,14,.9);display:none;flex-direction:column;align-items:center;justify-content:center;text-align:center;z-index:5;padding:20px}
|
||||
.px-sy .verdict.on{display:flex}.px-sy .verdict h2{margin:0 0 8px;font-size:1.5rem}.px-sy .verdict p{color:var(--xr-muted,#9fb0d0);max-width:280px}
|
||||
.px-sy .verdict button{margin-top:14px;background:#1a3a7a;border:0;color:#fff;border-radius:9px;padding:10px 18px;cursor:pointer}
|
||||
@keyframes sy-rise{to{transform:translateY(-120vh)}}
|
||||
.px-sy.launching .stack .part-wrap{animation:sy-rise 2.2s ease-in forwards}
|
||||
</style>
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
// pièces = les bions de la nomenclature Space Cubion (resources/papers/cubion-nomenclature-v0.md)
|
||||
// mêmes stats qu'avant (équilibrage intact) — seuls noms + micro-descriptions parlent la nomenclature.
|
||||
var PARTS = [
|
||||
{ id: 'nose', name: 'Coiffe', ic: '🔺', mass: 0.2, fuel: 0, thrust: 0, isp: 0, shape: 'nose' },
|
||||
{ id: 'pod', name: 'Bion-coque', ic: '🧑🚀', mass: 0.8, fuel: 0, thrust: 0, isp: 0, shape: 'body', d: 'coque + bion-nid, 1 humain' },
|
||||
{ id: 'tank', name: 'Ergol', ic: '🛢️', mass: 0.4, fuel: 4, thrust: 0, isp: 0, shape: 'body', d: 'du bion-hall (xénon)' },
|
||||
{ id: 'tank2', name: 'Gros ergol', ic: '🛢️', mass: 0.8, fuel: 9, thrust: 0, isp: 0, shape: 'body', d: 'bion-hall, grand voyage' },
|
||||
{ id: 'engine', name: 'Bion-poussée', ic: '🔥', mass: 1.2, fuel: 0, thrust: 215, isp: 300, shape: 'engine', d: 'monergol vert' },
|
||||
{ id: 'booster', name: 'Booster', ic: '🧨', mass: 1, fuel: 3, thrust: 250, isp: 250, shape: 'engine' },
|
||||
{ id: 'fins', name: 'Ailerons', ic: '🪁', mass: 0.1, fuel: 0, thrust: 0, isp: 0, shape: 'body' },
|
||||
{ id: 'solar', name: 'Bion-solaire', ic: '🔆', mass: 0.1, fuel: 0, thrust: 0, isp: 0, shape: 'body', d: 'iROSA ~300 W/m²' },
|
||||
{ id: 'amarre', name: 'Bion-amarre', ic: '⚓', mass: 0.3, fuel: 0, thrust: 0, isp: 0, shape: 'body', d: 'port IDSS androgyne' },
|
||||
{ id: 'wormion', name: 'Wormion-drive', ic: '🌀', mass: 0.6, fuel: 2, thrust: 90, isp: 2000, shape: 'wormion', xer: true, d: 'dans le slot bion-fusion' },
|
||||
{ id: 'decoupler', name: 'Découpleur', ic: '⎯', mass: 0.15, fuel: 0, thrust: 0, isp: 0, shape: 'decoupler' },
|
||||
{ id: 'parachute', name: 'Parachute', ic: '🪂', mass: 0.1, fuel: 0, thrust: 0, isp: 0, shape: 'body' }
|
||||
];
|
||||
var ORBIT_DV = 3400, VEGA_DV = 6500;
|
||||
function P(id) { for (var i = 0; i < PARTS.length; i++) if (PARTS[i].id === id) return PARTS[i]; return null; }
|
||||
|
||||
function describe(){
|
||||
var ship=[]; try{ var sv=JSON.parse(localStorage.getItem('jos:ship')||'[]'); if(sv.length) ship=sv; }catch(e){}
|
||||
return { v:1, id:'shipyard', title:'Chantier spatial', icon:'🚀', items:[
|
||||
{ p:1, kind:'stat', label:'vaisseau (pièces)', value:ship.length }
|
||||
]};
|
||||
}
|
||||
function mount(container, ctx) {
|
||||
container.innerHTML =
|
||||
'<div class="px-sy">' +
|
||||
'<div class="pal"><div class="nom" data-nom>les pièces = les bions de la nomenclature 📖</div><h4>Pièces (= bions)</h4><div data-pal></div></div>' +
|
||||
'<div class="mid">' +
|
||||
'<div class="stack" data-stack></div>' +
|
||||
'<div class="stats"><div class="row" data-row></div><div class="gauge"><i data-g style="width:0"></i></div><button class="launch" data-launch disabled>🧪 Simuler le vol</button></div>' +
|
||||
'</div>' +
|
||||
'<div class="verdict" data-verdict></div>' +
|
||||
'</div>';
|
||||
var root = container.querySelector('.px-sy');
|
||||
var palEl = root.querySelector('[data-pal]'), stackEl = root.querySelector('[data-stack]');
|
||||
var ship = [];
|
||||
try { var sv = JSON.parse(localStorage.getItem('jos:ship') || '[]'); if (sv.length) ship = sv; } catch (e) {}
|
||||
|
||||
palEl.innerHTML = PARTS.map(function (p) {
|
||||
return '<div class="p' + (p.xer ? ' xer' : '') + '" data-add="' + p.id + '"><span class="ic">' + p.ic + '</span><span>' + p.name + '<small>' + p.mass + 't' + (p.fuel ? ' · ' + p.fuel + 'f' : '') + (p.thrust ? ' · ' + p.thrust + 'kN' : '') + (p.d ? ' · ' + p.d : '') + '</small></span></div>';
|
||||
}).join('');
|
||||
palEl.querySelectorAll('[data-add]').forEach(function (el) { el.onclick = function () { ship.push(el.getAttribute('data-add')); persist(); render(); }; });
|
||||
|
||||
function persist() { try { localStorage.setItem('jos:ship', JSON.stringify(ship)); } catch (e) {} try { if (window.jOSBoxion && window.jOSBoxion.saveSoon) window.jOSBoxion.saveSoon('ship', ship); } catch (e) {} }
|
||||
|
||||
function stats() {
|
||||
// découpe en ÉTAGES (bas→haut), un 'decoupler' clôt l'étage courant (KSP : on largue le mort)
|
||||
var stages = [[]], si = 0;
|
||||
ship.forEach(function (id) { var p = P(id); if (!p) return; stages[si].push(p); if (id === 'decoupler') { stages.push([]); si++; } });
|
||||
function massOf(parts, wet) { var m = 0; for (var i = 0; i < parts.length; i++) m += parts[i].mass + (wet ? parts[i].fuel * 0.5 : 0); return m; }
|
||||
var totalDry = 0, fuelTot = 0, hasPod = false, hasWorm = false, thrustBottom = 0, nz = 0;
|
||||
ship.forEach(function (id) { var p = P(id); if (!p) return; totalDry += p.mass; fuelTot += p.fuel; if (p.id === 'pod') hasPod = true; if (p.id === 'wormion') hasWorm = true; });
|
||||
var totalWet = totalDry + fuelTot * 0.5, dv = 0;
|
||||
for (var k = 0; k < stages.length; k++) {
|
||||
if (!stages[k].length) continue;
|
||||
var above = 0; for (var j = k + 1; j < stages.length; j++) above += massOf(stages[j], true);
|
||||
var sDry = above + massOf(stages[k], false), sWet = above + massOf(stages[k], true);
|
||||
var thr = 0, ispW = 0, ispM = 0;
|
||||
for (var i = 0; i < stages[k].length; i++) { var p = stages[k][i]; thr += p.thrust; if (p.thrust) { ispW += p.isp * p.thrust; ispM += p.thrust; } }
|
||||
if (thr > 0) nz++;
|
||||
if (k === 0) thrustBottom = thr;
|
||||
var isp = ispM ? ispW / ispM : 0;
|
||||
if (isp > 0 && sWet > sDry) dv += isp * 9.81 * Math.log(sWet / sDry);
|
||||
}
|
||||
var twr = thrustBottom ? thrustBottom / (totalWet * 9.81) : 0;
|
||||
return { mDry: totalDry, mWet: totalWet, fuel: fuelTot, thrust: thrustBottom, twr: twr, dv: dv, hasPod: hasPod, hasWorm: hasWorm, nStages: nz };
|
||||
}
|
||||
|
||||
function render() {
|
||||
if (!ship.length) { stackEl.innerHTML = '<div class="empty">Empile des pièces →<br>Un bion-poussée en bas, de l\'ergol, une bion-coque, une coiffe. Vise l\'orbite, puis Véga 🌟</div>'; }
|
||||
else {
|
||||
stackEl.innerHTML = ship.map(function (id, i) { var p = P(id) || {}; return '<div class="part-wrap"><div class="part ' + (p.shape || 'body') + '" data-rm="' + i + '">' + p.ic + '<br>' + p.name + '<span class="rm">✕</span></div></div>'; }).join('');
|
||||
stackEl.querySelectorAll('[data-rm]').forEach(function (el) { el.onclick = function () { ship.splice(+el.getAttribute('data-rm'), 1); persist(); render(); }; });
|
||||
}
|
||||
var s = stats();
|
||||
root.querySelector('[data-row]').innerHTML =
|
||||
'masse <b>' + s.mWet.toFixed(1) + 't</b> · poussée <b>' + s.thrust + 'kN</b> · TWR <b>' + s.twr.toFixed(2) + '</b> · Δv <b>' + Math.round(s.dv) + '</b> m/s · <b>' + s.nStages + '</b> étage' + (s.nStages > 1 ? 's' : '');
|
||||
var target = s.hasWorm ? VEGA_DV : ORBIT_DV;
|
||||
var gi = root.querySelector('[data-g]'), pct = Math.min(100, s.dv / target * 100);
|
||||
gi.style.width = pct + '%'; gi.className = (pct >= 100 && s.twr >= 1.05 && s.hasPod) ? 'ok' : '';
|
||||
var canLaunch = ship.length > 0 && s.thrust > 0;
|
||||
root.querySelector('[data-launch]').disabled = !canLaunch;
|
||||
}
|
||||
|
||||
function openPx(id) { // séquence canonique (succès, pas existence)
|
||||
try { if (window.jOSOp && window.jOSOp.openPloxion) { var r = window.jOSOp.openPloxion(id); if (r && r.ok) return; } } catch (e) {}
|
||||
try { if (window.jOSMobile && window.jOSMobile.open && window.jOSMobile.open(id, id)) return; } catch (e) {}
|
||||
try { if (window.jOS && window.jOS.openPloxion && window.jOS.openPloxion(id)) return; } catch (e) {}
|
||||
location.href = '/local#px=' + encodeURIComponent(id);
|
||||
}
|
||||
function verdict(html) { var v = root.querySelector('[data-verdict]'); v.innerHTML = html + '<button data-close>continuer</button>'; v.classList.add('on');
|
||||
v.querySelector('[data-close]').onclick = function () { v.classList.remove('on'); root.classList.remove('launching'); render(); };
|
||||
var m = v.querySelector('[data-map]'); if (m) m.onclick = function () { openPx('carte-espace'); };
|
||||
var c = v.querySelector('[data-cubion]'); if (c) c.onclick = function () { openPx('space-cubion'); }; }
|
||||
function game(ev) { try { if (window.jOSGame) window.jOSGame.event ? window.jOSGame.unlock && window.jOSGame.unlock(ev) : null; } catch (e) {} }
|
||||
|
||||
root.querySelector('[data-launch]').onclick = function () {
|
||||
var s = stats();
|
||||
root.classList.add('launching');
|
||||
setTimeout(function () {
|
||||
// TOUT ICI = une SIMULATION (RS-7). Le VRAI lancement vers Véga se débloquera au vrai départ.
|
||||
if (!s.hasPod) { verdict('<h2>💥 Simulation : sans pilote</h2><p>Ajoute une <b>Bion-coque</b> — il faut quelqu\'un au bion-nid.</p>'); }
|
||||
else if (s.twr < 1.05) { verdict('<h2>💥 Simulation : trop lourd</h2><p>TWR ' + s.twr.toFixed(2) + ' < 1 : la poussée ne décolle pas la masse. Plus de bions-poussée, moins d\'ergol.</p>'); }
|
||||
else if (s.hasWorm && s.dv >= VEGA_DV) {
|
||||
try { if (window.jOSGame && window.jOSGame.unlock) window.jOSGame.unlock('space'); } catch (e) {}
|
||||
verdict('<h2>🌟 Simulation Véga : VALIDÉE</h2><p>Ton vaisseau <b>en est capable</b> — Δv ' + Math.round(s.dv) + ' m/s + wormion-drive. Mais c\'est une <b>simulation</b> : le <b>vrai lancement vers Véga</b> ne se débloque que quand on partira <b>pour de vrai</b>. Garde ce design. 🚀</p><button data-map style="margin-top:10px;background:#101a34;border:1px solid #3a6ad0;color:#9fc0ff;border-radius:9px;padding:9px 14px;cursor:pointer">🌌 voir Véga sur la carte</button><button data-cubion style="margin-top:8px;background:#160f2e;border:1px solid #6a4ad0;color:#c8b0ff;border-radius:9px;padding:9px 14px;cursor:pointer">🛸 le vrai vaisseau — Space Cubion</button><button disabled style="margin-top:8px;opacity:.45;cursor:not-allowed;background:#241f0a;border:1px solid #6a5a20;color:#ffd35a;border-radius:9px;padding:9px 14px">🌟 Lancer vers Véga — 🔒 verrouillé (le vrai)</button>');
|
||||
}
|
||||
else if (s.dv >= ORBIT_DV) { try { if (window.jOSGame && window.jOSGame.unlock) window.jOSGame.unlock('space'); } catch (e) {} verdict('<h2>🛰️ Simulation : en orbite</h2><p>Δv ' + Math.round(s.dv) + ' m/s — orbite atteinte en simu ! Pour viser Véga : un <b>Wormion-drive</b> 🌀 et ' + VEGA_DV + ' m/s.</p>'); }
|
||||
else { verdict('<h2>🪂 Simulation : retombé</h2><p>Δv ' + Math.round(s.dv) + ' m/s < ' + ORBIT_DV + ' : pas assez pour l\'orbite. Ajoute de l\'ergol.</p>'); }
|
||||
}, 2100);
|
||||
};
|
||||
|
||||
root.querySelector('[data-nom]').onclick = function () { openPx('space-cubion'); };
|
||||
|
||||
render();
|
||||
return { unmount: function () { container.innerHTML = ''; } };
|
||||
}
|
||||
window.jOSApps = window.jOSApps || {};
|
||||
window.jOSApps['shipyard'] = { manifest: { id: 'shipyard', name: 'Chantier spatial', icon: '🚀' }, mount: mount, describe: describe };
|
||||
})();
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user