<!-- RUBY-BACKUP · part 445 -->
.add(STRANGER);
  try{ localStorage.setItem('ruby-stranger-seen', '1'); }catch(e){}
  codeStatus('THE RICH STRANGER — he has come. Once in a lifetime. Help him.');
}

/* BONUS — cheat codes, codex, world to build */
var CHEAT_CODES = [
  {code: 'fly', desc: 'Fly anywhere'},
  {code: 'noclip', desc: 'Walk through walls'},
  {code: 'godmode', desc: 'Cannot be harmed'},
  {code: 'spawnall', desc: 'Spawn all wildlife at once'},
  {code: 'timefreeze', desc: 'Freeze all animations'},
  {code: 'timeflow', desc: 'Resume time'},
  {code: 'bigme', desc: 'Grow 3x size'},
  {code: 'tinyme', desc: 'Shrink to 1/3'},
  {code: 'normalme', desc: 'Normal size'},
  {code: 'summonhokulea', desc: 'Hokulea descends (not orbit)'},
  {code: 'allquests', desc: 'See all 120 quests'},
  {code: 'instantcity', desc: 'Build everything at once'}
];
var BONUS_UNLOCKED = false;
function unlockBonus(){
  BONUS_UNLOCKED = true;
  try{ localStorage.setItem('ruby-bonus', '1'); }catch(e){}
  codeStatus('BONUS UNLOCKED — cheat codes, Soliditronium codex, and a world to build. Yours.');
}
function checkBonus(){
  try{
    if(localStorage.getItem('ruby-bonus')==='1') BONUS_UNLOCKED = true;
  }catch(e){}
  return BONUS_UNLOCKED;
}
function showCheats(){
  if(!checkBonus()){
    codeStatus('bonus not unlocked yet — fill your Continuum to max (fillmax) to earn it');
    return;
  }
  var html = '<b style="color:#ff0">CHEAT CODES</b><br><br>';
  CHEAT_CODES.forEach(function(ch){
    html += '<button onclick="runCodeByName(\''+ch.code+'\')" style="margin:3px;background:#440;color:#ff0;border:1px solid #ff0;border-radius:5px;padding:5px 10px;">'+ch.code+'</button> <small>'+ch.desc+'</small><br>';
  });
  var d = document.createElement('div');
  d.id = 'cheat-panel';
  d.style.cssText = 'position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:10000;background:rgba(20,20,0,0.95);border:3px solid #ff0;border-radius:12px;padding:20px;color:#fff;max-width:400px;max-height:70%;overflow:auto;';
  d.innerHTML = html + '<br><button onclick="document.getElementById(\'cheat-panel\').remove()">CLOSE</button>';
  document.body.appendChild(d);
}
function showCodex(){
  if(!checkBonus()){
    codeStatus('bonus not unlocked yet');
    return;
  }
  /* the Soliditronium codex — all codes */
  codeStatus('the Soliditronium Codex holds every code. Use "help" to see them all.');
  if(typeof handleCode==='function') handleCode('help');
}
/* a world to build — personal map */
var MY_WORLD = null;
function buildMyWorld(){
  if(!checkBonus()){
    codeStatus('bonus not unlocked yet');
    return;
  }
  if(typeof scene==='undefined' || typeof mePos==='undefined') return;
  if(MY_WORLD){
    MY_WORLD.forEach(function(o){ try{ scene.remove(o); }catch(e){} });
  }
  MY_WORLD = [];
  /* empty plot, far away — yours to build */
  var px = mePos.x + 300, pz = mePos.z + 300;
  /* foundation */
  var foundation = new THREE.Mesh(new THREE.PlaneGeometry(60, 60),
    new THREE.MeshStandardMaterial({color: 0x3a5a3a, roughness: 1}));
  foundation.rotation.x = -Math.PI/2;
  foundation.position.set(px*0.13, 0.02, pz*0.13);
  scene.add(foundation);
  MY_WORLD.push(foundation);
  /* border — gold */
  var border = new THREE.Mesh(new THREE.TorusGeometry(30, 0.3, 8, 48),
    new THREE.MeshStandardMaterial({color: 0xffd700, metalness: 0.8, roughness: 0.3}));
  border.rotation.x = Math.PI/2;
  border.position.set(px*0.13, 0.2, pz*0.13);
  scene.add(border);
  MY_WORLD.push(border);
  /* sign — "YOUR WORLD" */
  var sign = buildStreetSign('YOUR WORLD', px, pz+32, 0);
  scene.add(sign);
  MY_WORLD.push(sign);
  try{ localStorage.setItem('ruby-myworld', JSON.stringify({x: px, z: pz})); }catch(e){}
  codeStatus('your world — a blank canvas at '+px+', '+pz+'. Build anything. It is yours.');
}
/* cheat implementations */
function doCheat(code){
  if(!checkBonus()){ codeStatus('bonus not unlocked'); return; }
  if(code==='fly'){ codeStatus('flying — use jump to soar'); if(typeof WALK!=='undefined'){ /* fly mode */ } }
  else if(code==='bigme'){ if(typeof playerMesh!=='undefined' && playerMesh) playerMesh.scale.set(3,3,3); codeStatus('you are big'); }
  else if(code==='tinyme'){ if(typeof playerMesh!=='undefined' && playerMesh) playerMesh.scale.set(0.33,0.33,0.33); codeStatus('you are tiny'); }
  else if(code==='normalme'){ if(typeof playerMesh!=='undefined' && playerMesh) playerMesh.scale.set(1,1,1); codeStatus('normal size'); }
  else if(code==='spawnall'){ if(typeof spawnWildlife==='function') spawnWildlife(); codeStatus('all wildlife spawned'); }
  else if(code==='allquests'){ codeStatus('120 quests — 60 regular, 60 hidden. Type quest.'); }
  else if(code==='instantcity'){ if(typeof buildAncestralCity==='function') buildAncestralCity(); if(typeof buildRuralCounties==='function') buildRuralCounties(); if(typeof buildTribalVillages==='function') buildTribalVillages(); codeStatus('everything built'); }
  else if(code==='summonhokulea'){ if(typeof summonHoku