Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (async () => {
- const sleep = ms => new Promise(r => setTimeout(r, ms));
- const randInt = (min,max)=>Math.floor(Math.random()*(max-min+1))+min;
- const explosionChars='█▓▒░▀▄'.split('');
- const burnChars='.,:;\'`"~-_'.split('');
- const burnCIDs=[29,6,22];
- const randChar=()=>explosionChars[randInt(0,explosionChars.length-1)];
- const randBurnChar=()=>burnChars[randInt(0,burnChars.length-1)];
- // ═════════ SHAPE ENGINE ═════════
- function isInShape(dx,dy,radius,shape,outline=false){
- let include=false;
- switch(shape){
- case "circle": { const d=dx*dx+dy*dy; include=outline?(d<=radius*radius && d>=(radius-1)*(radius-1)):(d<=radius*radius); break; }
- case "square": include=outline?(Math.abs(dx)===radius||Math.abs(dy)===radius):(Math.abs(dx)<=radius&&Math.abs(dy)<=radius); break;
- case "diamond": include=outline?(Math.abs(dx)+Math.abs(dy)===radius):(Math.abs(dx)+Math.abs(dy)<=radius); break;
- case "cross": include=(dx===0||dy===0); break;
- case "x": include=(dx===dy||dx===-dy); break;
- case "triangle": include=(dy<=0 && Math.abs(dx)<=-dy); break;
- case "inverted-triangle": include=(dy>=0 && Math.abs(dx)<=dy); break;
- case "hexagon": include=(Math.abs(dx)<=radius && Math.abs(dy)<=radius && Math.abs(dx+dy)<=radius); break;
- case "star": include=(dx===0||dy===0||dx===dy||dx===-dy); break;
- case "ring": { const dist=Math.sqrt(dx*dx+dy*dy); include=(Math.abs(dist-radius)<1); break; }
- case "hourglass": include=(Math.abs(dx)<=radius-Math.abs(dy)); break;
- case "arrow-up": include=(dy<=0 && Math.abs(dx)<=-dy); break;
- case "arrow-down": include=(dy>=0 && Math.abs(dx)<=dy); break;
- case "arrow-left": include=(dx<=0 && Math.abs(dy)<=-dx); break;
- case "arrow-right": include=(dx>=0 && Math.abs(dy)<=dx); break;
- case "heart": { const v=(dx*dx+dy*dy-radius*radius/2)*(dx*dx+dy*dy-radius*radius/2)-dx*dx*dy*dy; include=(v<=0); break; }
- case "plus-circle": include=((dx*dx+dy*dy<=radius*radius)||dx===0||dy===0); break;
- }
- return include;
- }
- // ═════════ HUD PANEL ═════════
- const settings = await new Promise(resolve=>{
- let _speed=50;
- const hud=document.createElement("div");
- Object.assign(hud.style,{
- position:"fixed",top:"50%",left:"50%",transform:"translate(-50%,-50%)",
- background:"#1a0000",color:"#ff9944",padding:"26px",borderRadius:"12px",
- fontFamily:"monospace",zIndex:"999999",border:"2px solid #ff4444",
- boxShadow:"0 0 40px rgba(255,0,0,.6)",minWidth:"420px",textAlign:"center"
- });
- hud.innerHTML=`
- <h2 style="color:#ff4444">VAPORIZER CONTROL PANEL</h2>
- Radius
- <input id="vap-radius" type="number" value="15" style="width:100%;margin-bottom:10px;background:#000;color:#ff9944">
- Target X
- <input id="vap-x" type="number" style="width:100%;margin-bottom:10px;background:#000;color:#ff9944">
- Target Y
- <input id="vap-y" type="number" style="width:100%;margin-bottom:12px;background:#000;color:#ff9944">
- Shape
- <select id="vap-shape" style="width:100%;margin-bottom:10px;background:#000;color:#ff9944">
- <option value="circle">Circle</option>
- <option value="square">Square</option>
- <option value="diamond">Diamond</option>
- <option value="cross">Cross</option>
- <option value="x">X</option>
- <option value="triangle">Triangle</option>
- <option value="inverted-triangle">Inverted Triangle</option>
- <option value="hexagon">Hexagon</option>
- <option value="star">Star</option>
- <option value="ring">Ring</option>
- <option value="hourglass">Hourglass</option>
- <option value="arrow-up">Arrow Up</option>
- <option value="arrow-down">Arrow Down</option>
- <option value="arrow-left">Arrow Left</option>
- <option value="arrow-right">Arrow Right</option>
- <option value="heart">Heart</option>
- <option value="plus-circle">Plus Circle</option>
- </select>
- Mode
- <select id="vap-mode" style="width:100%;margin-bottom:12px;background:#000;color:#ff9944">
- <option value="classic">Classic</option>
- <option value="firestorm">Firestorm</option>
- <option value="mushroom">Mushroom Cloud</option>
- <option value="shrapnel">Shrapnel</option>
- <option value="electric">Electric Arc</option>
- <option value="pulse">Pulse</option>
- </select>
- Speed
- <input id="vap-speed" type="range" min="1" max="100" value="50">
- <br><br>
- <button id="vap-arm" style="width:100%;padding:10px;background:#8b0000;color:white;font-weight:bold">
- ARM & DETONATE
- </button>
- `;
- document.body.appendChild(hud);
- document.getElementById("vap-arm").onclick = ()=>{
- const r=parseInt(document.getElementById("vap-radius").value);
- const x=parseInt(document.getElementById("vap-x").value);
- const y=parseInt(document.getElementById("vap-y").value);
- const shape=document.getElementById("vap-shape").value;
- const mode=document.getElementById("vap-mode").value;
- hud.remove();
- resolve({radius:r,startX:x,startY:-y,shape,mode,speed:_speed});
- };
- });
- // ═════════ SETTINGS ═════════
- const {radius,startX,startY,shape,mode,speed} = settings;
- const baseDelay = Math.max(0, 40-(speed*0.4));
- const tick=async()=>{if(baseDelay>0) await sleep(baseDelay);};
- // countdown
- for(let i=5;i>=1;i--){ console.log("Detonating in",i); await sleep(1000); }
- // compute positions
- const positions=[];
- for(let dy=-radius;dy<=radius;dy++){
- for(let dx=-radius;dx<=radius;dx++){
- if(isInShape(dx,dy,radius,shape,false)) positions.push({dx,dy});
- }
- }
- // ═════════ MODES ═════════
- async function firestorm(){
- for(let i=0;i<500;i++){
- const p=positions[randInt(0,positions.length-1)];
- const x=startX+p.dx; const y=startY+p.dy-randInt(0,radius);
- w.changeColor(randInt(9,14));
- writeCharAt("^",randInt(9,14),x,y);
- await tick();
- }
- }
- async function mushroom(){
- for(let h=0;h<radius*2;h++){
- writeCharAt("█",14,startX,startY-h);
- await tick();
- }
- }
- async function shrapnel(){
- for(let i=0;i<600;i++){
- const p=positions[randInt(0,positions.length-1)];
- const x=startX+p.dx+randInt(-radius,radius);
- const y=startY+p.dy+randInt(-radius,radius);
- writeCharAt("*",randInt(2,29),x,y);
- await tick();
- }
- }
- async function electric(){
- for(let i=0;i<300;i++){
- const p=positions[randInt(0,positions.length-1)];
- writeCharAt("≈",11,startX+p.dx,startY+p.dy);
- await tick();
- }
- }
- async function pulse(){
- for(let r=1;r<=radius;r++){
- for(const p of positions){
- if(p.dx*p.dx+p.dy*p.dy<=r*r){
- writeCharAt("•",randInt(2,29),startX+p.dx,startY+p.dy);
- }
- }
- await tick();
- }
- }
- // execute selected mode
- switch(mode){
- case "firestorm": await firestorm(); break;
- case "mushroom": await mushroom(); break;
- case "shrapnel": await shrapnel(); break;
- case "electric": await electric(); break;
- case "pulse": await pulse(); break;
- default: break;
- }
- // classic explosion
- const t0=Date.now();
- while(Date.now()-t0<20000){
- const p=positions[randInt(0,positions.length-1)];
- const x=startX+p.dx; const y=startY+p.dy;
- w.changeColor(randInt(2,29));
- writeCharAt(randChar(),randInt(2,29),x,y);
- await tick();
- }
- w.chat.send("Vaporizer complete.");
- })();
Advertisement
Add Comment
Please, Sign In to add comment