/** * ============================================================================================== * Modul: DTIM-ZEC NORN ATOM-STARSHIP, MARS HOMEWORLD BASE, ELITE TRADE & 3D CITADEL * Datei: TLW_Atom_Starship_Norn.pde * Framework: DTIM-ZEC MODULAR PHYSICS FRAMEWORK (DAMTP ACADEMIC STANDARD) * Version: 4.7.0 (Exact floor(i/3.0) Row Alignment in Processing.js & Java) * Copyright: (c) 2026 Jan Bühring & Adaptive Intelligence Synthesis Network (Google AI) * Lizenz: MIT License * Plattform: Processing 4.5.6 (Linux x64) & Processing.js (processing.min.js) * ============================================================================================== */ int langMode = 0; boolean languageChosen = false; int viewMode = 0; int a11yTheme = 0; float simTime = 0.0; float WORLD_SIZE = 7200.0; float HALF_WORLD = 3600.0; float shipX = 0.0; float shipY = 0.0; float shipVX = 0.0; float shipVY = 0.0; float shipAngle = 0.0; float camX = 0.0; float camY = 0.0; boolean drivesActive = true; int rawErz = 45; int refinedErz = 85; int totalErzBuilt = 85; int rawQuanta = 4; int researchFP = 80; int totalFPBuilt = 80; int creditsEUR = 110; int wasteEntropy = 0; int hullHP = 100; int maxHullHP = 100; int rawOreCap = 95; int cargoCap = 14; int[] cargoQty = { 2, 1, 1, 1 }; int[] goodBasePrice = { 20, 36, 60, 88 }; int[] goodOreCost = { 10, 16, 24, 30 }; int[] goodFpCost = { 0, 6, 12, 18 }; String[] goodNameDe = { "CNT-Aerogel-Matten", "Bariumtitanat-Kerne", "Zeno-Stasis-Kapseln", "Plasma-Döner & Ayran" }; String[] goodNameEn = { "CNT Aerogel Mats", "Barium Titanate Cores", "Zeno Stasis Pods", "Plasma Doner & Ayran" }; ArrayList fractalDrones, npcShips, spaceStations, remotePeers; ArrayList spaceAtoms, spaceBonds, spaceQuanta, spaceRifts, spaceShots, shockRings, floatingTags; int dockedStationIdx = -1; float npcTaxPool = 0.0; int npcCubesCount = 0; // MARS-AUFBAUBASIS (3x3 SYMMETRISCHES RASTER) float MARS_BASE_X = 0.0; float MARS_BASE_Y = 1320.0; float MARS_PAD_W = 190.0; float MARS_PAD_H = 116.0; float MARS_STEP_X = 226.0; float MARS_STEP_Y = 152.0; float MARS_START_X = -321.0; float MARS_START_Y = -210.0; float[] marsPadProg = new float[9]; int[] marsReqGoodA = { 0, 1, 0, 1, 2, 2, 3, 3, 1 }; int[] marsReqGoodB = { -1, -1, -1, -1, -1, -1, -1, 0, 0 }; int marsSettlers = 0; boolean marsShieldOn = false; boolean marsDefenseOn = true; boolean marsHomeworldUnlocked = false; boolean showHomeworldBanner = false; int marsBuildCooldown = 0; int marsStaySquare = -1; int marsStayFrames = 0; float marsEventTimer = 420.0; boolean marsFlareOn = false; int marsFlareTime = 0; boolean marsMeteorOn = false; float marsMetX = 0.0; float marsMetY = 1000.0; float marsMetVX = 0.0; float marsMetVY = 0.30; float marsMetHP = 100.0; int marsLaserTimer = 0; // PHASE 2: 0-KLICK NORN-HEIMATWELT-FARM int hwKorn = 3, hwTom = 3, hwWasser = 4, hwHeu = 2; int hwMilch = 0, hwKaese = 0, hwMehl = 0, hwPizza = 0; float hwKornGrow = 0.0, hwTomGrow = 0.0; boolean hwStallBuilt = false, hwMuehleBuilt = false, hwKaeseBuilt = false; float hwStallWork = 0.0, hwMuehleWork = 0.0, hwKaeseWork = 0.0, hwPizzaWork = 0.0; float hwWalkerX = 560.0, hwWalkerY = 320.0, hwWalkAnim = 0.0; int activeWeapon = 1; boolean autoAim = true; boolean zeroClick = false; int autoFireTimer = 0; float aimAngle = 0.0; MultiShellAtom lockedAtom = null; MultiShellAtom playerShotAtom = null; int playerShotClaimTimer = 0; String sensorInfo = ""; boolean keyW = false, keyA = false, keyS = false, keyD = false; boolean keyTurnL = false, keyTurnR = false; boolean mouseSteer = true; String myClientId = ""; boolean lobbyOnline = false; int onlinePlayers = 1; int lobbySyncTimer = 0; String localQuickSave = ""; String bannerHead = ""; String bannerSub = ""; int NUM_TECH = 12; String[] tCode = new String[12]; String[] tTitleDe = new String[12]; String[] tTitleEn = new String[12]; String[] tBranchDe = new String[12]; String[] tBranchEn = new String[12]; String[] tDescDe = new String[12]; String[] tDescEn = new String[12]; int[] tBranchId = new int[12]; int[] tTier = new int[12]; int[] tPrereq = new int[12]; int[] tCost = new int[12]; int[] tLevel = new int[12]; boolean freeTechMode = false; float nornAtpPulse = 40.0; int BASE_DIM = 14; int BASE_HEIGHT = 6; int[] baseVoxels = new int[14 * 14 * 6]; int erzCubesCount = 0; int fpCubesCount = 0; int tradeCubesCount = 0; int isoRotation = 0; float walkX = 7.5, walkY = 7.5, walkDirX = 1.0, walkDirY = 0.0, walkPlaneX = 0.0, walkPlaneY = 0.66; String tr(String de, String en) { return (langMode == 0) ? de : en; } float getNormMouseX() { return constrain(mouseX, 0, width); } float getNormMouseY() { return constrain(mouseY, 0, height); } int getUiPalette(int theme, int role) { if (theme == 1) { if (role == 0) return color(5, 9, 17); if (role == 1) return color(11, 17, 29); if (role == 2) return color(180, 120, 10); if (role == 3) return color(10, 75, 130); if (role == 4) return color(251, 191, 36); return color(255); } if (theme == 2) return (role <= 3) ? color(0) : ((role == 4) ? color(255, 255, 0) : color(255)); if (role == 0) return color(6, 8, 14); if (role == 1) return color(13, 16, 26); if (role == 2) return color(122, 16, 38); if (role == 3) return color(18, 46, 98); if (role == 4) return color(225, 55, 85); return color(242, 246, 255); } int getKindColor(int theme, int k) { if (theme == 1) { if (k == 1 || k == 9) return color(251, 191, 36); if (k == 2) return color(195, 210, 230); if (k == 7) return color(52, 211, 153); if (k == 8) return color(244, 114, 182); return color(56, 189, 248); } if (theme == 2) return (k == 8) ? color(255, 0, 255) : ((k == 7) ? color(0, 255, 255) : color(255, 255, 0)); if (k == 1) return color(220, 42, 74); if (k == 2) return color(185, 198, 220); if (k == 3) return color(65, 145, 255); if (k == 4) return color(255, 215, 55); if (k == 5) return color(35, 215, 155); if (k == 6) return color(205, 85, 235); if (k == 7) return color(0, 255, 180); if (k == 8) return color(255, 45, 65); return color(255, 135, 55); } void pushBanner(String h, String s) { bannerHead = h; bannerSub = s; } void setup() { size(1120, 740); noSmooth(); frameRate(60); myClientId = "N" + int(random(100000, 999999)) + "_" + millis(); spaceAtoms = new ArrayList(); spaceBonds = new ArrayList(); spaceQuanta = new ArrayList(); spaceRifts = new ArrayList(); spaceShots = new ArrayList(); shockRings = new ArrayList(); floatingTags = new ArrayList(); fractalDrones = new ArrayList(); npcShips = new ArrayList(); spaceStations = new ArrayList(); remotePeers = new ArrayList(); initTechNodes(); initVoxelBase(); initMarsBase(); initSpaceStations(); seedCosmosWorld(); initNpcFleet(); syncFractalDronesWithTech(); setWelcomeBanner(); syncNornLobby(); } void setWelcomeBanner() { bannerHead = tr("Mars-Basis (Y: 1320) & [R] Mars-Basis bereit! Stationsprodukte bauen sie Stück für Stück aus.", "Mars Base (Y: 1320) & [R] Mars Base ready! Station products construct it step by step."); bannerSub = tr("Abwehrturm (3) zerstört Meteore automatisch · [Leertaste] Antrieb | [G] Handel | [K/O] Speichern/Laden", "Defense Tower (3) destroys meteors automatically · [Space] Drives | [G] Trade | [K/O] Save/Load"); } void initMarsBase() { for (int i = 0; i < 9; i++) marsPadProg[i] = 0.0; marsPadProg[0] = 25.0; marsPadProg[2] = 35.0; marsSettlers = 0; marsShieldOn = false; marsDefenseOn = true; marsHomeworldUnlocked = false; showHomeworldBanner = false; marsStaySquare = -1; marsStayFrames = 0; } int getMarsOverallProgress() { float sum = 0.0; for (int i = 0; i < 9; i++) sum += marsPadProg[i]; return int(sum / 9.0); } // Exakte Zeilen- und Spaltenberechnung mit floor() für 100% Processing.js-Kompatibilität! int getGridCol(int idx) { return idx % 3; } int getGridRow(int idx) { return int(floor(idx / 3.0)); } float getMarsPadLeftX(int idx) { return MARS_BASE_X + MARS_START_X + getGridCol(idx) * MARS_STEP_X; } float getMarsPadTopY(int idx) { return MARS_BASE_Y + MARS_START_Y + getGridRow(idx) * MARS_STEP_Y; } float getMarsPadCenterX(int idx) { return getMarsPadLeftX(idx) + MARS_PAD_W * 0.5; } float getMarsPadCenterY(int idx) { return getMarsPadTopY(idx) + MARS_PAD_H * 0.5; } int getMarsMenuCardX(int idx) { return 34 + getGridCol(idx) * 356; } int getMarsMenuCardY(int idx) { return 128 + getGridRow(idx) * 172; } void initSpaceStations() { spaceStations.clear(); spaceStations.add(new SpaceStation(0, 740.0, -580.0, "BASIS ALPHA: ERZ & MARKT", "BASE ALPHA: ORE & MARKET", 0, 1.00, color(225, 55, 85))); spaceStations.add(new SpaceStation(1, -780.0, 520.0, "BASIS BETA: FORSCHUNGSLABOR", "BASE BETA: RESEARCH LAB", 1, 1.05, color(56, 189, 248))); spaceStations.add(new SpaceStation(2, -2150.0, -1850.0, "STATION GAMMA: TECH-BÖRSE (+20%)", "STATION GAMMA: TECH EXCHANGE (+20%)", 2, 1.20, color(250, 195, 45))); spaceStations.add(new SpaceStation(3, 2250.0, 1950.0, "HAFEN DELTA: TIEFRAUM-DEPOT (+30%)", "PORT DELTA: DEEP-SPACE DEPOT (+30%)", 0, 1.30, color(45, 210, 145))); spaceStations.add(new SpaceStation(4, 140.0, -2650.0, "FREIHAFEN EPSILON: KREUZ (+25%)", "FREEPORT EPSILON: CROSSROADS (+25%)", 2, 1.25, color(205, 85, 235))); } void initNpcFleet() { npcShips.clear(); String[] names = { "NPC Vega", "NPC Orin", "NPC Lyra", "NPC Kael", "NPC Mira" }; int[] cols = { color(250, 195, 55), color(56, 189, 248), color(244, 114, 182), color(52, 211, 153), color(192, 132, 252) }; for (int i = 0; i < 5; i++) { float ang = (TWO_PI * i) / 5.0; npcShips.add(new NpcShip(i, names[i], cos(ang) * 950.0, sin(ang) * 950.0, cols[i])); } } void initTechNodes() { setTech(0, "A1", "120°-Waben-Kopplung", "120° Honeycomb Coupling", "Antrieb", "Drive", 0, 0, -1, 15, "Verankert das Norn-Schiff auf dem Gitter (+15% Tempo).", "Anchors Norn ship on lattice (+15% speed)."); setTech(1, "A2", "ALDI-YBCO Supraleiter-Ring", "ALDI-YBCO Superconductor Ring", "Antrieb", "Drive", 0, 1, 0, 30, "Heckring für Phasengradienten (+25% Schub).", "Stern ring for phase gradient (+25% thrust)."); setTech(2, "A3", "Adjacency-Fold-Drive (0.0 G)", "Adjacency Fold Drive (0.0 G)", "Antrieb", "Drive", 0, 2, 1, 55, "Trägheitslose Gitter-Faltung (+35% Max-Tempo).", "Inertialess lattice folding (+35% max speed)."); setTech(3, "B1", "Bohr-Slater Resonanz-Photon", "Bohr-Slater Resonance Photon", "Waffen", "Weapons", 1, 0, -1, 15, "Hebt Elektronen auf höhere Schalen (+FP).", "Elevates electrons to outer shells (+RP)."); setTech(4, "B2", "Mesonenkanone (Pi+/- Salve)", "Meson Cannon (Pi+/- Salvo)", "Waffen", "Weapons", 1, 1, 3, 30, "Löst Risse auf & extrahiert Kern-Erz.", "Dissolves rifts & extracts core Ore."); setTech(5, "B3", "Gluon- & W-Boson-Injektor", "Gluon & W-Boson Injector", "Waffen", "Weapons", 1, 2, 4, 55, "Verdoppelt Erz- & Isotopen-Ausbeute.", "Doubles Ore & isotope extraction yield."); setTech(6, "C1", "CNT-Aerogel-Panzerung", "CNT Aerogel Armor", "Panzerung", "Armor", 2, 0, -1, 15, "Erhöht Hüllenintegrität (+45 Max-HP/Stufe).", "Increases hull integrity (+45 Max HP/level)."); setTech(7, "C2", "Zeno-Stasis-Deflektorschild", "Zeno-Stasis Deflector Shield", "Panzerung", "Armor", 2, 1, 6, 35, "Dämpft Riss-Kollisionen um 50%.", "Dampens rift collisions by 50%."); setTech(8, "C3", "EVM-Void-Riss-Absorber", "EVM Void Rift Absorber", "Panzerung", "Armor", 2, 2, 7, 60, "Leitet Einschlagenergie ab.", "Routes impact energy into void."); setTech(9, "D1", "Norn-Biochemie-Pilot (ATP)", "Norn Biochemistry Pilot (ATP)", "Norn & Fraktal", "Norn & Fractal", 3, 0, -1, 15, "Erzeugt kontinuierlich Forschungspunkte.", "Continuously generates Research Points."); setTech(10, "D2", "Kleines Fraktalschiff (+Drohne)", "Little Fractal Ship (+Drone)", "Norn & Fraktal", "Norn & Fractal", 3, 1, 9, 25, "Bis zu 3 autonome Fraktal-Ernteschiffe.", "Up to 3 autonomous Fractal Harvesters."); setTech(11, "D3", "Elite-Frachtraum & Plasma-Lab", "Elite Cargo & Plasma Lab", "Norn & Fraktal", "Norn & Fractal", 3, 2, 10, 45, "+6 Frachtraum/Stufe & Waste-Recycling.", "+6 Cargo slots/level & Waste recycling."); for (int i = 0; i < NUM_TECH; i++) tLevel[i] = 0; tLevel[0] = 1; tLevel[3] = 1; tLevel[9] = 1; tLevel[10] = 1; recalcShipCapabilities(); } void setTech(int idx, String c, String tiDe, String tiEn, String brDe, String brEn, int bId, int tr, int pre, int cost, String dDe, String dEn) { tCode[idx] = c; tTitleDe[idx] = tiDe; tTitleEn[idx] = tiEn; tBranchDe[idx] = brDe; tBranchEn[idx] = brEn; tBranchId[idx] = bId; tTier[idx] = tr; tPrereq[idx] = pre; tCost[idx] = cost; tDescDe[idx] = dDe; tDescEn[idx] = dEn; } void recalcShipCapabilities() { maxHullHP = 100 + tLevel[6] * 45; hullHP = min(maxHullHP, hullHP); rawOreCap = 95 + tLevel[10] * 35; cargoCap = 14 + tLevel[11] * 6; syncFractalDronesWithTech(); } void syncFractalDronesWithTech() { int desired = max(1, tLevel[10]); while (fractalDrones.size() > desired) fractalDrones.remove(fractalDrones.size() - 1); while (fractalDrones.size() < desired) { float ang = fractalDrones.size() * TWO_PI / 3.0; fractalDrones.add(new FractalDrone(shipX + cos(ang) * 70.0, shipY + sin(ang) * 70.0, fractalDrones.size())); } } boolean isTooCloseToAnyStation(float wx, float wy, float minDist) { for (int i = 0; i < spaceStations.size(); i++) { SpaceStation st = (SpaceStation) spaceStations.get(i); if (dist(wx, wy, st.x, st.y) < minDist) return true; } return (abs(wx - MARS_BASE_X) < 460.0 && abs(wy - MARS_BASE_Y) < 380.0); } void seedCosmosWorld() { spaceAtoms.clear(); spaceBonds.clear(); spaceQuanta.clear(); spaceRifts.clear(); spaceShots.clear(); shockRings.clear(); floatingTags.clear(); for (int i = 0; i < 82; i++) spaceQuanta.add(new VacuumQuantum(random(-HALF_WORLD + 160, HALF_WORLD - 160), random(-HALF_WORLD + 160, HALF_WORLD - 160))); for (int i = 0; i < 32; i++) { float rx = random(-HALF_WORLD + 220, HALF_WORLD - 220), ry = random(-HALF_WORLD + 220, HALF_WORLD - 220); if (dist(0, 0, rx, ry) > 280.0 && !isTooCloseToAnyStation(rx, ry, 280.0)) spaceRifts.add(new SingularityRift(rx, ry)); } spaceAtoms.add(new MultiShellAtom(185, -50, 1, 0, 1)); spaceAtoms.add(new MultiShellAtom(278, -50, 1, 0, 1)); spaceAtoms.add(new MultiShellAtom(-195, -75, 6, 6, 6)); spaceAtoms.add(new MultiShellAtom(120, 210, 8, 8, 8)); for (int i = 0; i < 72; i++) { float ax = random(-HALF_WORLD + 220, HALF_WORLD - 220), ay = random(-HALF_WORLD + 220, HALF_WORLD - 220); if (dist(0, 0, ax, ay) < 250.0 || isTooCloseToAnyStation(ax, ay, 240.0)) continue; int r = i % 5; spaceAtoms.add(new MultiShellAtom(ax, ay, r == 0 ? 1 : (r == 1 ? 2 : (r == 2 ? 3 : (r == 3 ? 6 : 8))), r == 0 ? 0 : (r == 1 ? 2 : (r == 2 ? 4 : (r == 3 ? 6 : 8))), r == 0 ? 1 : (r == 1 ? 2 : (r == 2 ? 2 : (r == 3 ? 6 : 8))))); } } String serializeGameState() { String s1 = langMode + "," + a11yTheme + "," + nf(shipX, 1, 1) + "," + nf(shipY, 1, 1) + "," + nf(shipAngle, 1, 3); String s2 = rawErz + "," + refinedErz + "," + totalErzBuilt + "," + rawQuanta + "," + researchFP + "," + totalFPBuilt + "," + creditsEUR + "," + wasteEntropy + "," + hullHP + "," + activeWeapon + "," + (zeroClick ? 1 : 0) + "," + erzCubesCount + "," + fpCubesCount + "," + tradeCubesCount + "," + isoRotation + "," + (drivesActive ? 1 : 0) + "," + npcCubesCount; String s3 = cargoQty[0] + "," + cargoQty[1] + "," + cargoQty[2] + "," + cargoQty[3]; String techStr = ""; for (int i = 0; i < NUM_TECH; i++) { if (i > 0) techStr += ","; techStr += tLevel[i]; } String marsStr = (marsHomeworldUnlocked ? 1 : 0) + "," + marsSettlers + "," + (marsShieldOn ? 1 : 0) + "," + (marsDefenseOn ? 1 : 0); for (int i = 0; i < 9; i++) marsStr += "," + nf(marsPadProg[i], 1, 1); marsStr += "," + hwKorn + "," + hwTom + "," + hwWasser + "," + hwHeu + "," + hwMilch + "," + hwKaese + "," + hwMehl + "," + hwPizza + "," + (hwStallBuilt ? 1 : 0) + "," + (hwMuehleBuilt ? 1 : 0) + "," + (hwKaeseBuilt ? 1 : 0); String voxStr = ""; for (int i = 0; i < baseVoxels.length; i++) voxStr += baseVoxels[i]; return s1 + "|" + s2 + "|" + s3 + "|" + techStr + "|" + voxStr + "|" + marsStr; } boolean deserializeGameState(String raw) { if (raw == null || raw.length() < 30) return false; String[] parts = split(trim(raw), '|'); if (parts == null || parts.length < 5) return false; String[] p1 = split(parts[0], ','), p2 = split(parts[1], ','), p3 = split(parts[2], ','), p4 = split(parts[3], ','); String voxStr = parts[4]; if (p1 == null || p1.length < 5 || p2 == null || p2.length < 15 || p3 == null || p3.length < 4 || p4 == null || p4.length < NUM_TECH) return false; langMode = constrain(int(p1[0]), 0, 1); a11yTheme = constrain(int(p1[1]), 0, 2); shipX = float(p1[2]); shipY = float(p1[3]); shipAngle = float(p1[4]); shipVX = 0; shipVY = 0; camX = shipX; camY = shipY; rawErz = int(p2[0]); refinedErz = int(p2[1]); totalErzBuilt = int(p2[2]); rawQuanta = int(p2[3]); researchFP = int(p2[4]); totalFPBuilt = int(p2[5]); creditsEUR = int(p2[6]); wasteEntropy = int(p2[7]); hullHP = int(p2[8]); activeWeapon = constrain(int(p2[9]), 1, 5); zeroClick = (int(p2[10]) == 1); erzCubesCount = int(p2[11]); fpCubesCount = int(p2[12]); tradeCubesCount = int(p2[13]); isoRotation = constrain(int(p2[14]), 0, 3); drivesActive = (p2.length >= 16) ? (int(p2[15]) == 1) : true; npcCubesCount = (p2.length >= 17) ? int(p2[16]) : 0; for (int g = 0; g < 4; g++) cargoQty[g] = int(p3[g]); for (int i = 0; i < NUM_TECH; i++) tLevel[i] = constrain(int(p4[i]), 0, 3); if (voxStr.length() >= baseVoxels.length) for (int i = 0; i < baseVoxels.length; i++) baseVoxels[i] = constrain(int(str(voxStr.charAt(i))), 0, 3); if (parts.length >= 6) { String[] p5 = split(parts[5], ','); if (p5 != null && p5.length >= 24) { marsHomeworldUnlocked = (int(p5[0]) == 1); marsSettlers = int(p5[1]); marsShieldOn = (int(p5[2]) == 1); marsDefenseOn = (int(p5[3]) == 1); for (int i = 0; i < 9; i++) marsPadProg[i] = float(p5[4 + i]); hwKorn = int(p5[13]); hwTom = int(p5[14]); hwWasser = int(p5[15]); hwHeu = int(p5[16]); hwMilch = int(p5[17]); hwKaese = int(p5[18]); hwMehl = int(p5[19]); hwPizza = int(p5[20]); hwStallBuilt = (int(p5[21]) == 1); hwMuehleBuilt = (int(p5[22]) == 1); hwKaeseBuilt = (int(p5[23]) == 1); } } recalcShipCapabilities(); return true; } void saveCurrentGameSlot() { String payload = serializeGameState(); localQuickSave = payload; boolean savedRemote = false; try { String[] res = loadStrings("norn_lobby.php?action=save&cid=" + myClientId + "&data=" + payload); if (res != null) for (int i = 0; i < res.length; i++) if (trim(res[i]).equals("SAVE_STATUS=SAVED")) { savedRemote = true; lobbyOnline = true; } } catch (Exception e) {} if (!savedRemote) { try { String[] outLines = { payload }; saveStrings("norn_save.txt", outLines); } catch (Exception e) {} } spawnFloatingTag(shipX, shipY - 28, tr("SPIELSTAND GESPEICHERT!", "GAME SAVED!"), color(0, 255, 180)); pushBanner(tr("Spielstand gespeichert! (Mars: " + getMarsOverallProgress() + "%)", "Game saved! (Mars: " + getMarsOverallProgress() + "%)"), tr("Jederzeit wiederherstellbar mit [Laden / O].", "Restore anytime with [Load / O].")); } void loadSavedGameSlot() { String loadedData = ""; try { String[] res = loadStrings("norn_lobby.php?action=load&cid=" + myClientId); if (res != null) for (int i = 0; i < res.length; i++) { String line = trim(res[i]); if (line.startsWith("SAVE_DATA=")) { String val = line.substring(10); if (!val.equals("EMPTY") && val.length() > 30) { loadedData = val; lobbyOnline = true; } } } } catch (Exception e) {} if (loadedData.length() < 30) { try { String[] localLines = loadStrings("norn_save.txt"); if (localLines != null && localLines.length > 0) loadedData = localLines[0]; } catch (Exception e) {} } if (loadedData.length() < 30 && localQuickSave.length() > 30) loadedData = localQuickSave; if (deserializeGameState(loadedData)) { spawnFloatingTag(shipX, shipY - 28, tr("SPIELSTAND GELADEN!", "GAME LOADED!"), color(56, 189, 248)); pushBanner(tr("Spielstand geladen! (Mars: " + getMarsOverallProgress() + "%)", "Savegame loaded! (Mars: " + getMarsOverallProgress() + "%)"), tr("Fortschritt wiederhergestellt.", "Progress restored.")); } else pushBanner(tr("Noch kein Spielstand vorhanden.", "No saved game found yet."), tr("Klicke zuerst auf [Speichern / K].", "Click [Save / K] first.")); } void initVoxelBase() { for (int i = 0; i < baseVoxels.length; i++) baseVoxels[i] = 0; erzCubesCount = 0; fpCubesCount = 0; tradeCubesCount = 0; npcCubesCount = 0; setBaseVoxel(1, 1, 0, 1); setBaseVoxel(BASE_DIM - 2, 1, 0, 1); setBaseVoxel(1, BASE_DIM - 2, 0, 2); setBaseVoxel(BASE_DIM - 2, BASE_DIM - 2, 0, 3); } int getBaseVoxel(int x, int y, int z) { return (x < 0 || x >= BASE_DIM || y < 0 || y >= BASE_DIM || z < 0 || z >= BASE_HEIGHT) ? -1 : baseVoxels[x + y * BASE_DIM + z * BASE_DIM * BASE_DIM]; } void setBaseVoxel(int x, int y, int z, int val) { if (x >= 0 && x < BASE_DIM && y >= 0 && y < BASE_DIM && z >= 0 && z < BASE_HEIGHT) baseVoxels[x + y * BASE_DIM + z * BASE_DIM * BASE_DIM] = val; } void checkBaseVoxelMilestones() { while (totalErzBuilt >= (erzCubesCount + 1) * 100) { erzCubesCount++; growVoxelCubeInBase(1); } while (totalFPBuilt >= (fpCubesCount + 1) * 100) { fpCubesCount++; growVoxelCubeInBase(2); } } void buildTradeCubeBuilding() { if (creditsEUR < 70 || refinedErz < 40) return; creditsEUR -= 70; refinedErz -= 40; tradeCubesCount++; growVoxelCubeInBase(3); syncNornLobby(); } void growVoxelCubeInBase(int cubeType) { for (int z = 0; z < BASE_HEIGHT; z++) for (int r = 2; r <= 5; r++) for (int y = 7 - r; y <= 7 + r; y++) for (int x = 7 - r; x <= 7 + r; x++) { if (x <= 0 || x >= BASE_DIM - 1 || y <= 0 || y >= BASE_DIM - 1) continue; if (z == 0 && (x == 7 || y == 7 || (abs(x - 7) <= 1 && abs(y - 7) <= 1))) continue; if (getBaseVoxel(x, y, z) == 0 && (z == 0 || getBaseVoxel(x, y, z - 1) > 0)) { setBaseVoxel(x, y, z, cubeType); return; } } } void addResearchFP(int amount) { researchFP += amount; totalFPBuilt += amount; checkBaseVoxelMilestones(); } void addRefinedErz(int amount) { refinedErz += amount; totalErzBuilt += amount; checkBaseVoxelMilestones(); } void spawnFloatingTag(float wx, float wy, String txt, int col) { floatingTags.add(new FloatingTag(wx, wy, txt, col)); } String getMarsSquareName(int idx) { String[] de = { "1. DTIM-Energie-Kern", "2. Zeno-Schutzschild", "3. Meteor-Abwehrturm", "4. Dipol-Atmosphäre", "5. Wärme & Wasser", "6. Enthalpie-Flora", "7. Döner & Ayran ISRU", "8. Norn-Habitate", "9. Fraktal-Helfer-Dock" }; String[] en = { "1. DTIM Energy Core", "2. Zeno Shield", "3. Meteor Defense", "4. Dipole Atmosphere", "5. Thermal & Water", "6. Enthalpy Flora", "7. Doner & Ayran ISRU", "8. Norn Habitats", "9. Fractal Dock" }; return tr(de[idx], en[idx]); } String getMarsSquareReqLabel(int idx) { int gA = marsReqGoodA[idx], gB = marsReqGoodB[idx]; String shortA = (gA == 0) ? "CNT-Aerogel" : ((gA == 1) ? "Bariumtitanat" : ((gA == 2) ? "Zeno-Stasis" : "Plasma-Döner")); if (gB >= 0) return shortA + " + " + ((gB == 0) ? "CNT-Aerogel" : "Bariumtitanat"); return "1x " + shortA + " + 10 " + tr("Erz", "Ore"); } boolean canDeliverToMarsSquare(int idx) { if (marsPadProg[idx] >= 100.0) return false; int gA = marsReqGoodA[idx], gB = marsReqGoodB[idx]; return (gB >= 0) ? (cargoQty[gA] >= 1 && cargoQty[gB] >= 1) : (cargoQty[gA] >= 1 && refinedErz >= 10); } void deliverProductsToMarsSquare(int idx, String builderName, float bonusPct) { if (marsPadProg[idx] >= 100.0) return; float prev = marsPadProg[idx]; marsPadProg[idx] = min(100.0, marsPadProg[idx] + bonusPct); if (idx == 1 && marsPadProg[1] >= 25.0) marsShieldOn = true; if (idx == 2 && marsPadProg[2] >= 10.0) marsDefenseOn = true; if (idx == 7) { int tp = int((marsPadProg[7] / 100.0) * 60.0); if (marsSettlers < tp) marsSettlers = tp; } spawnFloatingTag(getMarsPadCenterX(idx), getMarsPadCenterY(idx) - 20, builderName + ": +" + int(bonusPct) + "%", color(80, 245, 175)); if (prev < 100.0 && marsPadProg[idx] >= 100.0) pushBanner(tr(getMarsSquareName(idx) + " zu 100% fertig!", getMarsSquareName(idx) + " completed!"), tr("Mars: " + getMarsOverallProgress() + "%", "Mars: " + getMarsOverallProgress() + "%")); checkMarsHomeworldCompletion(); } void checkMarsHomeworldCompletion() { if (marsHomeworldUnlocked) return; for (int i = 0; i < 9; i++) if (marsPadProg[i] < 100.0) return; marsHomeworldUnlocked = true; showHomeworldBanner = true; marsSettlers = 60; marsStaySquare = -1; marsStayFrames = 0; pushBanner(tr("DIE NORN HABEN IHRE ERSTE HEIMATWELT!", "THE NORNS HAVE FOUNDED THEIR FIRST HOMEWORLD!"), tr("0-Klick Heimatwelt-Farm aktiv!", "0-Click Homeworld Farm active!")); } void updateMarsBaseWorldLogic() { if (marsBuildCooldown > 0) marsBuildCooldown--; if (marsLaserTimer > 0) marsLaserTimer--; if (!marsHomeworldUnlocked) { marsEventTimer -= 1.0; if (marsEventTimer <= 0.0) { marsEventTimer = 720.0; if (!marsMeteorOn && random(1.0) < 0.75) { marsMeteorOn = true; marsMetX = MARS_BASE_X + random(-260, 260); marsMetY = MARS_BASE_Y - 330.0; marsMetVX = (MARS_BASE_X - marsMetX) * 0.0008; marsMetVY = 0.30; marsMetHP = 100.0; } else { marsFlareOn = true; marsFlareTime = 240; } } if (marsFlareOn) { marsFlareTime--; if (marsFlareTime <= 0) marsFlareOn = false; } if (marsMeteorOn) { marsMetX += marsMetVX; marsMetY += marsMetVY; if (marsDefenseOn && frameCount % 14 == 0) { marsMetHP -= (28.0 + (marsPadProg[2] / 100.0) * 24.0); marsLaserTimer = 10; shockRings.add(new ShockRing(marsMetX, marsMetY, color(56, 189, 248))); } if (marsMetHP <= 0.0) { marsMeteorOn = false; addRefinedErz(15); if (marsPadProg[4] < 100.0) { marsPadProg[4] = min(100.0, marsPadProg[4] + 5.0); checkMarsHomeworldCompletion(); } spawnFloatingTag(marsMetX, marsMetY, tr("+15 Erz & +5% Wasser!", "+15 Ore & +5% Water!"), color(56, 189, 248)); } else if (marsMetY > MARS_BASE_Y + 250.0) marsMeteorOn = false; } } int hoveredPad = -1; float margin = 12.0; for (int i = 0; i < 9; i++) { float qx = getMarsPadLeftX(i) + margin; float qy = getMarsPadTopY(i) + margin; if (shipX >= qx && shipX <= qx + MARS_PAD_W - margin * 2.0 && shipY >= qy && shipY <= qy + MARS_PAD_H - margin * 2.0) { hoveredPad = i; break; } } if (hoveredPad == -1 || marsHomeworldUnlocked || marsPadProg[hoveredPad] >= 100.0 || !canDeliverToMarsSquare(hoveredPad)) { if (hoveredPad != -1 && !marsHomeworldUnlocked && marsPadProg[hoveredPad] < 100.0 && !canDeliverToMarsSquare(hoveredPad) && frameCount % 50 == 0) { pushBanner(tr("Benötigt für " + getMarsSquareName(hoveredPad) + ": " + getMarsSquareReqLabel(hoveredPad), "Required for " + getMarsSquareName(hoveredPad) + ": " + getMarsSquareReqLabel(hoveredPad)), tr("Stelle die Ware unter [G] Handel her oder kaufe sie an einer Station!", "Synthesize the good in [G] Trade or buy it at a station!")); } marsStaySquare = -1; marsStayFrames = 0; if (hoveredPad != -1 && marsHomeworldUnlocked) runHomeworldSquareStep(hoveredPad); return; } if (hoveredPad == marsStaySquare) { if (marsBuildCooldown <= 0) marsStayFrames = min(26, marsStayFrames + 1); } else { marsStaySquare = hoveredPad; marsStayFrames = 1; } if (marsStayFrames >= 26 && marsBuildCooldown <= 0) { marsStayFrames = 0; marsBuildCooldown = 45; int gA = marsReqGoodA[hoveredPad], gB = marsReqGoodB[hoveredPad]; cargoQty[gA]--; if (gB >= 0) cargoQty[gB]--; else refinedErz -= 10; deliverProductsToMarsSquare(hoveredPad, tr("NORN", "NORN"), 25.0); } } void runHomeworldSquareStep(int idx) { if (idx == 0) { if (hwKornGrow == 0 && hwKorn >= 1) { hwKorn--; hwKornGrow = 1.0; } else if (hwKornGrow > 0 && hwWasser >= 1) { hwKornGrow += 1.6; if (hwKornGrow >= 100.0) { hwKornGrow = 0.0; hwWasser--; hwKorn += 4; hwHeu += 4; } } } else if (idx == 1) { if (hwTomGrow == 0 && hwTom >= 1) { hwTom--; hwTomGrow = 1.0; } else if (hwTomGrow > 0 && hwWasser >= 1) { hwTomGrow += 1.6; if (hwTomGrow >= 100.0) { hwTomGrow = 0.0; hwWasser--; hwTom += 4; hwHeu += 2; } } } else if (idx == 2 && frameCount % 18 == 0 && hwWasser < 15) hwWasser++; else if (idx == 3) { if (!hwStallBuilt && creditsEUR >= 15) { creditsEUR -= 15; hwStallBuilt = true; } else if (hwStallBuilt && hwKorn >= 2 && hwHeu >= 4) { hwStallWork += 1.8; if (hwStallWork >= 100.0) { hwStallWork = 0.0; hwKorn -= 2; hwHeu -= 4; hwMilch += 4; } } } else if (idx == 4) { if (!hwKaeseBuilt && creditsEUR >= 30) { creditsEUR -= 30; hwKaeseBuilt = true; } else if (hwKaeseBuilt && hwMilch >= 4) { hwKaeseWork += 1.8; if (hwKaeseWork >= 100.0) { hwKaeseWork = 0.0; hwMilch -= 4; hwKaese += 2; } } } else if (idx == 5) { if (!hwMuehleBuilt && creditsEUR >= 25) { creditsEUR -= 25; hwMuehleBuilt = true; } else if (hwMuehleBuilt && hwKorn >= 4) { hwMuehleWork += 1.8; if (hwMuehleWork >= 100.0) { hwMuehleWork = 0.0; hwKorn -= 4; hwMehl += 3; } } } else if (idx == 6 && hwMehl >= 1 && hwKaese >= 1 && hwTom >= 1) { hwPizzaWork += 2.2; if (hwPizzaWork >= 100.0) { hwPizzaWork = 0.0; hwMehl--; hwKaese--; hwTom--; hwPizza++; if (getCargoUsed() < cargoCap) cargoQty[3]++; } } else if (idx == 7 || idx == 8) { int earned = hwPizza * 32 + hwKaese * 14 + hwMehl * 6 + hwMilch * 5; if (earned > 0) { hwPizza = 0; hwKaese = 0; hwMehl = 0; hwMilch = 0; creditsEUR += earned; spawnFloatingTag(shipX, shipY - 24, "+" + earned + " EUR", color(80, 245, 175)); } } } void draw() { background(getUiPalette(a11yTheme, 0)); simTime += 0.025; if (!languageChosen) { drawLanguageSelectionGate(); return; } if (lobbyOnline) { lobbySyncTimer++; if (lobbySyncTimer >= 180) { lobbySyncTimer = 0; syncNornLobby(); } } if (tLevel[9] > 0) { nornAtpPulse += 0.12 * tLevel[9]; if (nornAtpPulse >= 100.0) { nornAtpPulse = 0.0; addResearchFP(2 * tLevel[9]); } } if (viewMode == 0) drawFlightMode(); else if (viewMode == 1) drawTechTreeMode(); else if (viewMode == 2) drawIsometricBaseMode(); else if (viewMode == 3) drawWalk3DBaseMode(); else if (viewMode == 4) drawEliteTradeMode(); else if (viewMode == 5) drawMarsBaseDetailMode(); drawGlobalTopBar(); if (showHomeworldBanner) drawHomeworldVictoryOverlay(); } void drawLanguageSelectionGate() { drawSpacetimeHexGrid(); fill(4, 5, 12, 218); noStroke(); rect(0, 0, width, height); int mx = 200, my = 110, mw = width - 400, mh = 510; fill(getUiPalette(a11yTheme, 1)); stroke(getUiPalette(a11yTheme, 4)); strokeWeight(2.0); rect(mx, my, mw, mh, 10); strokeWeight(1.0); fill(getUiPalette(a11yTheme, 2)); noStroke(); rect(mx + 1, my + 1, mw - 2, 48, 9); fill(255); textSize(17); textAlign(CENTER, CENTER); text("DTIM-ZEC NORN ATOM-STARSHIP · SPRACHE / LANGUAGE", width * 0.5, my + 25); fill(242, 246, 255); textSize(13); textAlign(LEFT, TOP); text("DEUTSCH:\nSteuere das Norn-Raumschiff durch das 7200x7200 Gitter, ernte Mehrschalen-Atome, produziere Handelsgüter an 5 Stationen und baue damit Stück für Stück die Mars-Basis zur ersten Norn-Heimatwelt aus!\n\nENGLISH:\nPilot the Norn starship across the 7200x7200 lattice, harvest multi-shell atoms, craft goods at 5 stations, and build the Mars Base step by step into the Norns' first 0-Click Homeworld!", mx + 30, my + 68, mw - 60, 270); drawBigGateBtn(mx + 35, my + 350, 305, 62, "DEUTSCH STARTEN ▶", getUiPalette(a11yTheme, 2)); drawBigGateBtn(mx + 380, my + 350, 305, 62, "START IN ENGLISH ▶", getUiPalette(a11yTheme, 3)); drawNavBtn(mx + 35, my + 430, 305, 38, "Spielstand laden / Load Save [O]", color(20, 115, 70)); drawNavBtn(mx + 380, my + 430, 305, 38, "Sehhilfe / A11y [H]: " + (a11yTheme == 0 ? "Standard" : (a11yTheme == 1 ? "Blue/Gold" : "Contrast")), color(28, 35, 52)); } void drawBigGateBtn(int bx, int by, int bw, int bh, String lbl, int bg) { if (a11yTheme == 2) { fill(0); stroke(255, 255, 0); } else { fill(bg); stroke(220, 232, 250); } strokeWeight(1.8); rect(bx, by, bw, bh, 7); strokeWeight(1.0); fill(a11yTheme == 2 ? color(255, 255, 0) : color(255)); textSize(16); textAlign(CENTER, CENTER); text(lbl, bx + bw * 0.5, by + bh * 0.5); } void drawGlobalTopBar() { fill(getUiPalette(a11yTheme, 1)); noStroke(); rect(0, 0, width, 38); stroke(getUiPalette(a11yTheme, 4)); line(0, 38, width, 38); drawNavBtn(8, 5, 92, 28, tr("[1] Kosmos", "[1] Cosmos"), viewMode == 0 ? getUiPalette(a11yTheme, 2) : color(22, 28, 42)); String marsTabLbl = marsHomeworldUnlocked ? tr("[R] Heimatwelt", "[R] Homeworld") : tr("[R] Mars (" + getMarsOverallProgress() + "%)", "[R] Mars (" + getMarsOverallProgress() + "%)"); drawNavBtn(105, 5, 112, 28, marsTabLbl, (viewMode == 5) ? getUiPalette(a11yTheme, 2) : (marsHomeworldUnlocked ? color(20, 115, 70) : color(22, 28, 42))); drawNavBtn(222, 5, 96, 28, "[T] Tech-Tree", viewMode == 1 ? getUiPalette(a11yTheme, 2) : color(22, 28, 42)); drawNavBtn(323, 5, 96, 28, tr("[G] Handel", "[G] Trade"), viewMode == 4 ? getUiPalette(a11yTheme, 2) : color(22, 28, 42)); int totalCubes = erzCubesCount + fpCubesCount + tradeCubesCount + npcCubesCount; drawNavBtn(424, 5, 106, 28, tr("[B] Basis (" + totalCubes + ")", "[B] Base (" + totalCubes + ")"), viewMode == 2 ? getUiPalette(a11yTheme, 2) : color(22, 28, 42)); drawNavBtn(535, 5, 94, 28, tr("[V] 3D-Walk", "[V] 3D Walk"), viewMode == 3 ? getUiPalette(a11yTheme, 2) : color(22, 28, 42)); drawNavBtn(636, 5, 88, 28, tr("Speichern", "Save"), color(20, 125, 75)); drawNavBtn(729, 5, 76, 28, tr("Laden", "Load"), getUiPalette(a11yTheme, 3)); fill(255); textSize(11); textAlign(LEFT, CENTER); text("E:" + refinedErz + " FP:" + researchFP + " " + creditsEUR + "€", 812, 19); drawNavBtn(936, 5, 56, 28, langMode == 0 ? "DE [L]" : "EN [L]", color(30, 38, 56)); String a11yLbl = (a11yTheme == 0) ? tr("Sehhilfe", "A11y") : ((a11yTheme == 1) ? tr("Blau/Gold", "Blue/Gold") : tr("Kontrast", "Contrast")); drawNavBtn(998, 5, 114, 28, a11yLbl + " [H]", getUiPalette(a11yTheme, 3)); } void drawNavBtn(int bx, int by, int bw, int bh, String lbl, int bg) { if (a11yTheme == 2) { fill(0); stroke(255, 255, 0); } else { fill(bg); stroke(125, 160, 220); } rect(bx, by, bw, bh, 5); fill(a11yTheme == 2 ? color(255, 255, 0) : color(255)); textSize(11); textAlign(CENTER, CENTER); text(lbl, bx + bw * 0.5, by + bh * 0.5); } void drawFlightMode() { float speedMult = 1.0 + tLevel[0] * 0.15 + tLevel[1] * 0.25 + tLevel[2] * 0.35; updateShipKinematics(speedMult); updateAutoAimTarget(); updateTargetReservations(); updateFractalDrones(); updateNpcFleet(); updateAtomsAndSpaceEntities(); updateMarsBaseWorldLogic(); processZeroClickBases(); if (zeroClick) { if (autoFireTimer > 0) autoFireTimer--; if (lockedAtom != null && autoFireTimer <= 0) { fireActiveWeapon(); autoFireTimer = 20; } } camX = lerp(camX, shipX, 0.12); camY = lerp(camY, shipY, 0.12); pushMatrix(); translate(width * 0.5 - camX, (height - 130) * 0.5 - camY); drawSpacetimeHexGrid(); drawSpaceBounds(); drawLargeMarsBaseInWorld(); drawSpaceStations(); drawCovalentBonds(); drawSpaceEntities(); drawFractalDrones(); drawNpcFleet(); drawRemotePeerShips(); drawAimBeam(); drawFloatingTags(); pushMatrix(); translate(shipX, shipY); rotate(shipAngle); drawNornStarship(); popMatrix(); popMatrix(); drawStationCompassMarkers(); drawFlightHUD(); } void drawSpacetimeHexGrid() { int step = 46, startX = floor((camX - width * 0.6) / step) * step, endX = ceil((camX + width * 0.6) / step) * step; int startY = floor((camY - height * 0.6) / step) * step, endY = ceil((camY + height * 0.6) / step) * step; for (int gx = startX; gx <= endX; gx += step) for (int gy = startY; gy <= endY; gy += step) { float dx = shipX - gx, dy = shipY - gy, d = max(0.1, sqrt(dx * dx + dy * dy)); float comp = (d < 180.0) ? map(d, 0, 180, 16.0, 0.0) : 0.0; float px = gx + (dx / d) * comp, py = gy + (dy / d) * comp; stroke(45, 85, 195, constrain(map(d, 0, 460, 48, 12), 10, 65)); noFill(); beginShape(); for (int i = 0; i < 6; i++) { float a = (PI / 3.0) * i + simTime * 0.02; vertex(px + cos(a) * 23.0, py + sin(a) * 23.0); } endShape(CLOSE); } } void drawSpaceBounds() { stroke(225, 55, 85, 130); strokeWeight(2.0); noFill(); rect(-HALF_WORLD, -HALF_WORLD, WORLD_SIZE, WORLD_SIZE); stroke(59, 110, 194, 55); line(-HALF_WORLD, 0, HALF_WORLD, 0); line(0, -HALF_WORLD, 0, HALF_WORLD); strokeWeight(1.0); } void drawLargeMarsBaseInWorld() { if (abs(MARS_BASE_X - camX) > width * 0.95 && abs(MARS_BASE_Y - camY) > height * 0.95) return; pushMatrix(); translate(MARS_BASE_X, MARS_BASE_Y); rectMode(CORNER); int overall = getMarsOverallProgress(); fill(lerpColor(color(68, 22, 18, 232), color(16, 48, 36, 236), map(overall, 0, 100, 0.0, 1.0))); stroke(marsHomeworldUnlocked ? color(80, 245, 175) : color(225, 85, 65)); strokeWeight(2.5); rect(-350, -252, 700, 504, 14); strokeWeight(1.0); if (marsShieldOn) { noFill(); stroke(56, 189, 248, 120 + sin(simTime * 3.0) * 35); strokeWeight(2.0); ellipse(0, 0, 750, 550); strokeWeight(1.0); } fill(255); textSize(13); textAlign(CENTER, TOP); text(marsHomeworldUnlocked ? tr("NORN HEIMATWELT (0-KLICK FARM & MANUFAKTUR) · 60 Norns", "NORN HOMEWORLD (0-CLICK FARM & MANUFACTORY) · 60 Norns") : tr("GROSSE MARS-AUFBAUBASIS (" + overall + "% · Siedler: " + marsSettlers + "/60)", "LARGE MARS CONSTRUCTION BASE (" + overall + "% · Settlers: " + marsSettlers + "/60)"), 0, -240); for (int i = 0; i < 9; i++) { float qx = getMarsPadLeftX(i) - MARS_BASE_X, qy = getMarsPadTopY(i) - MARS_BASE_Y, qw = MARS_PAD_W, qh = MARS_PAD_H; boolean shipOver = (marsStaySquare == i && !marsHomeworldUnlocked) || (marsHomeworldUnlocked && shipX >= getMarsPadLeftX(i) && shipX <= getMarsPadLeftX(i) + qw && shipY >= getMarsPadTopY(i) && shipY <= getMarsPadTopY(i) + qh); if (!marsHomeworldUnlocked) { boolean ready = canDeliverToMarsSquare(i), done = (marsPadProg[i] >= 100.0); fill(done ? color(20, 95, 60) : (ready ? color(24, 54, 112) : color(24, 20, 28))); stroke(shipOver ? color(255) : (done ? color(80, 245, 175) : (ready ? color(255, 220, 80) : color(135, 95, 95)))); strokeWeight(shipOver ? 2.5 : 1.3); rect(qx, qy, qw, qh, 7); strokeWeight(1.0); fill(255); textSize(11); textAlign(CENTER, TOP); text(getMarsSquareName(i), qx + qw * 0.5, qy + 8); fill(ready ? color(255, 225, 95) : color(210, 220, 235)); textSize(10); text(done ? tr("FERTIG (100%)", "COMPLETE (100%)") : getMarsSquareReqLabel(i), qx + qw * 0.5, qy + 30); fill(10, 14, 22); noStroke(); rect(qx + 14, qy + 56, qw - 28, 12, 3); fill(done ? color(80, 245, 175) : color(56, 189, 248)); rect(qx + 14, qy + 56, constrain(map(marsPadProg[i], 0, 100, 0, qw - 28), 0, qw - 28), 12, 3); if (marsStaySquare == i && marsStayFrames > 0 && !done && ready) { float barW = constrain(map(min(marsStayFrames, 26), 0, 26, 0, qw - 28), 0, qw - 28); fill(255, 220, 80); rect(qx + 14, qy + 98, barW, 5, 2); } fill(255); textSize(11); text(int(marsPadProg[i]) + "%", qx + qw * 0.5, qy + 76); } else { String[] fDe = { "Korn-Feld (" + int(hwKornGrow) + "%)", "Tomaten-Feld (" + int(hwTomGrow) + "%)", "Brunnen (" + hwWasser + ")", hwStallBuilt ? "Kuhstall (" + int(hwStallWork) + "%)" : "Kuhstall (15€)", hwKaeseBuilt ? "Käserei (" + int(hwKaeseWork) + "%)" : "Käserei (30€)", hwMuehleBuilt ? "Mühle (" + int(hwMuehleWork) + "%)" : "Mühle (25€)", "Pizza-Ofen (" + int(hwPizzaWork) + "%)", "Heimat-Markt", "Norn-Dorf (60)" }; String[] fEn = { "Grain Field (" + int(hwKornGrow) + "%)", "Tomato Field (" + int(hwTomGrow) + "%)", "Well (" + hwWasser + ")", hwStallBuilt ? "Barn (" + int(hwStallWork) + "%)" : "Barn (15€)", hwKaeseBuilt ? "Creamery (" + int(hwKaeseWork) + "%)" : "Creamery (30€)", hwMuehleBuilt ? "Mill (" + int(hwMuehleWork) + "%)" : "Mill (25€)", "Pizza Oven (" + int(hwPizzaWork) + "%)", "Home Market", "Norn Village (60)" }; fill(shipOver ? color(28, 115, 74) : color(22, 88, 58)); stroke(shipOver ? color(255, 220, 80) : color(120, 255, 195)); rect(qx, qy, qw, qh, 7); fill(255); textSize(12); textAlign(CENTER, CENTER); text(tr(fDe[i], fEn[i]), qx + qw * 0.5, qy + qh * 0.5); } } if (marsMeteorOn) { float tx = getMarsPadCenterX(2) - MARS_BASE_X, ty = getMarsPadCenterY(2) - MARS_BASE_Y; float mx = marsMetX - MARS_BASE_X, my = marsMetY - MARS_BASE_Y; if (marsLaserTimer > 0) { stroke(56, 189, 248); strokeWeight(3.2); line(tx, ty, mx, my); stroke(255); strokeWeight(1.2); line(tx, ty, mx, my); strokeWeight(1.0); } fill(165, 85, 55); stroke(255, 190, 95); strokeWeight(2.0); ellipse(mx, my, 38, 38); strokeWeight(1.0); fill(255); textSize(10); textAlign(CENTER, CENTER); text(int(max(0, marsMetHP)) + "%", mx, my); } popMatrix(); } class SpaceStation { int id; float x, y; String nameDe, nameEn; int specialty; float priceBonus; int accentCol; SpaceStation(int sid, float sx, float sy, String nDe, String nEn, int spec, float bonus, int col) { id = sid; x = sx; y = sy; nameDe = nDe; nameEn = nEn; specialty = spec; priceBonus = bonus; accentCol = col; } } void drawSpaceStations() { for (int i = 0; i < spaceStations.size(); i++) { SpaceStation st = (SpaceStation) spaceStations.get(i); if (abs(st.x - camX) > width * 0.75 || abs(st.y - camY) > height * 0.75) continue; pushMatrix(); translate(st.x, st.y); rectMode(CORNER); fill(14, 18, 28, 228); stroke(st.accentCol); strokeWeight(2.0); rect(-175, -125, 350, 250, 10); strokeWeight(1.0); fill(255); textSize(12); textAlign(CENTER, TOP); text(tr(st.nameDe, st.nameEn), 0, -116); if (st.specialty == 0) { drawBasePad(-155, -80, 145, 78, color(122, 16, 38), tr("1. Erz-Schmelze", "1. Ore Smelter"), tr("Roh-Erz -> Bau-Erz", "Raw Ore -> Refined Ore")); drawBasePad(10, -80, 145, 78, color(145, 100, 18), tr("2. Elite-Markt", "2. Elite Market"), tr("Verkauf x" + nf(st.priceBonus, 1, 2) + " EUR", "Sell x" + nf(st.priceBonus, 1, 2) + " EUR")); drawBasePad(-155, 15, 310, 88, color(20, 105, 65), tr("3. Werft & Handels-Dock [G]", "3. Shipyard & Trade Dock [G]"), tr("Repariert Hülle · [G] für Mars-Waren", "Repairs hull · [G] for Mars goods")); } else if (st.specialty == 1) { drawBasePad(-155, -80, 145, 78, color(18, 46, 98), tr("1. Quanten-Labor", "1. Quantum Lab"), tr("Quanta -> Forschung", "Quanta -> Research")); drawBasePad(10, -80, 145, 78, color(122, 16, 38), tr("2. Plasma-Synthese", "2. Plasma Synthesis"), tr("Waste -> Erz + FP", "Waste -> Ore + RP")); drawBasePad(-155, 15, 310, 88, color(24, 54, 112), tr("3. Norn-Kuppel", "3. Norn Dome"), tr("ATP-Boost · [G] Handel | [R] Mars", "ATP Boost · [G] Trade | [R] Mars")); } else { drawBasePad(-155, -80, 145, 78, color(122, 16, 38), tr("1. Konverter", "1. Converter"), tr("Erz & Quanta", "Ore & Quanta")); drawBasePad(10, -80, 145, 78, color(145, 100, 18), tr("2. Freihafen-Börse", "2. Freeport Exchange"), tr("Verkauf x" + nf(st.priceBonus, 1, 2) + " EUR", "Sell x" + nf(st.priceBonus, 1, 2) + " EUR")); drawBasePad(-155, 15, 310, 88, color(20, 105, 65), tr("3. Handelskreuz [G]", "3. Trade Crossroads [G]"), tr("Repariert Hülle · [G] Mars-Waren", "Repairs hull · [G] Mars goods")); } popMatrix(); } } void drawBasePad(float px, float py, float pw, float ph, int col, String title, String desc) { fill(col); stroke(220, 232, 250); rect(px, py, pw, ph, 6); fill(255); textSize(12); textAlign(CENTER, TOP); text(title, px + pw * 0.5, py + 10); fill(235, 242, 255); textSize(10); text(desc, px + pw * 0.5, py + 38); } void drawStationCompassMarkers() { float viewH = height - 130; String[] shortNames = { "Alpha", "Beta", "Gamma", "Delta", "Epsilon" }; for (int i = 0; i < spaceStations.size(); i++) { SpaceStation st = (SpaceStation) spaceStations.get(i); float sx = width * 0.5 + (st.x - camX), sy = viewH * 0.5 + (st.y - camY); if (sx >= 30 && sx <= width - 30 && sy >= 46 && sy <= viewH - 20) continue; float cx = constrain(sx, 56, width - 56), cy = constrain(sy, 56, viewH - 22); fill(8, 10, 18, 225); stroke(st.accentCol); rect(cx - 48, cy - 13, 96, 26, 4); fill(255); textSize(10); textAlign(CENTER, CENTER); text(shortNames[i] + " " + int(dist(shipX, shipY, st.x, st.y) / 10.0) + "m", cx, cy); } float msx = width * 0.5 + (MARS_BASE_X - camX), msy = viewH * 0.5 + (MARS_BASE_Y - camY); if (msx < 30 || msx > width - 30 || msy < 46 || msy > viewH - 20) { float cx = constrain(msx, 62, width - 62), cy = constrain(msy, 56, viewH - 22); fill(24, 12, 16, 235); stroke(marsHomeworldUnlocked ? color(80, 245, 175) : color(225, 85, 65)); rect(cx - 56, cy - 14, 112, 28, 4); fill(255); textSize(10); textAlign(CENTER, CENTER); text("MARS (" + getMarsOverallProgress() + "%) " + int(dist(shipX, shipY, MARS_BASE_X, MARS_BASE_Y) / 10.0) + "m", cx, cy); } } float getActiveStationBonus() { return (dockedStationIdx >= 0 && dockedStationIdx < spaceStations.size()) ? ((SpaceStation) spaceStations.get(dockedStationIdx)).priceBonus : 1.0; } float getTradeMultiplier() { return (1.0 + tradeCubesCount * 0.15) * getActiveStationBonus(); } int getCargoUsed() { return cargoQty[0] + cargoQty[1] + cargoQty[2] + cargoQty[3]; } void processZeroClickBases() { dockedStationIdx = -1; for (int i = 0; i < spaceStations.size(); i++) { SpaceStation st = (SpaceStation) spaceStations.get(i); float dx = shipX - st.x, dy = shipY - st.y; if (abs(dx) < 175 && abs(dy) < 125) { dockedStationIdx = i; if (dx >= -155 && dx <= -10 && dy >= -80 && dy <= -2) { if ((st.specialty == 0 || st.specialty == 2) && rawErz > 0 && frameCount % 8 == 0) { int batch = min(5, rawErz); rawErz -= batch; addRefinedErz(batch * 2); } if ((st.specialty == 1 || st.specialty == 2) && rawQuanta > 0 && frameCount % 12 == 0) { rawQuanta--; addResearchFP(14 + tLevel[9] * 4); } } if (dx >= 10 && dx <= 155 && dy >= -80 && dy <= -2) { if ((st.specialty == 0 || st.specialty == 2) && frameCount % 16 == 0) { int earned = 0; float mult = getTradeMultiplier(); for (int g = 0; g < 4; g++) if (cargoQty[g] > 0) { earned += int(cargoQty[g] * goodBasePrice[g] * mult); cargoQty[g] = 0; } if (refinedErz >= 30) { refinedErz -= 20; earned += int(14 * mult); } if (earned > 0) { creditsEUR += earned; spawnFloatingTag(shipX, shipY - 26, "+" + earned + " EUR", color(255, 220, 65)); } } else if (st.specialty == 1 && wasteEntropy > 0 && frameCount % 12 == 0) { wasteEntropy--; addRefinedErz(8); addResearchFP(8); } } if (dx >= -155 && dx <= 155 && dy >= 15 && dy <= 103) { if (hullHP < maxHullHP && frameCount % 6 == 0) hullHP = min(maxHullHP, hullHP + 2); if (st.specialty == 1 && frameCount % 25 == 0) addResearchFP(2); } break; } } } void updateShipKinematics(float speedMult) { float maxSpd = 4.6 * speedMult; if (keyTurnL) shipAngle -= 0.055; if (keyTurnR) shipAngle += 0.055; if (drivesActive) { float mx = getNormMouseX(), my = getNormMouseY(); if (keyW || keyS) { mouseSteer = false; float thrust = keyW ? 0.26 : -0.16; shipVX += cos(shipAngle) * thrust; shipVY += sin(shipAngle) * thrust; } else if (mouseSteer && my > 40 && my < height - 130) { float sx = width * 0.5 + (shipX - camX), sy = (height - 130) * 0.5 + (shipY - camY); float dx = mx - sx, dy = my - sy, d = sqrt(dx * dx + dy * dy); if (d > 18.0) { float targetA = atan2(dy, dx); shipAngle += atan2(sin(targetA - shipAngle), cos(targetA - shipAngle)) * 0.12; float throttle = constrain((d - 18.0) / 140.0, 0.0, 1.0) * 0.23; shipVX += cos(shipAngle) * throttle; shipVY += sin(shipAngle) * throttle; } } shipVX *= 0.95; shipVY *= 0.95; } else { shipVX *= 0.88; shipVY *= 0.88; if (abs(shipVX) < 0.02) shipVX = 0.0; if (abs(shipVY) < 0.02) shipVY = 0.0; } float sp = sqrt(shipVX * shipVX + shipVY * shipVY); if (sp > maxSpd) { shipVX = (shipVX / sp) * maxSpd; shipVY = (shipVY / sp) * maxSpd; } shipX = constrain(shipX + shipVX, -HALF_WORLD + 60, HALF_WORLD - 60); shipY = constrain(shipY + shipVY, -HALF_WORLD + 60, HALF_WORLD - 60); } void updateAutoAimTarget() { lockedAtom = null; float bestD = 360.0; for (int i = 0; i < spaceAtoms.size(); i++) { MultiShellAtom a = (MultiShellAtom) spaceAtoms.get(i); if (!a.destroyed) { float d = dist(shipX, shipY, a.x, a.y); if (d < bestD) { bestD = d; lockedAtom = a; } } } if (autoAim && lockedAtom != null) { aimAngle = atan2(lockedAtom.y - shipY, lockedAtom.x - shipX); sensorInfo = lockedAtom.getSymbol() + " · " + tr("Erz: ", "Ore: ") + lockedAtom.oreReserve; } else { aimAngle = shipAngle; sensorInfo = tr("Sensoren aktiv · [Leertaste] Antrieb | [R] Mars-Basis (" + getMarsOverallProgress() + "%)", "Sensors active · [Space] Drives | [R] Mars Base (" + getMarsOverallProgress() + "%)"); } } void updateTargetReservations() { if (playerShotClaimTimer > 0) { playerShotClaimTimer--; if (playerShotClaimTimer <= 0) playerShotAtom = null; } for (int i = 0; i < spaceAtoms.size(); i++) { MultiShellAtom a = (MultiShellAtom) spaceAtoms.get(i); a.claimedBy = -1; a.claimLabel = ""; } if (autoAim && lockedAtom != null) { lockedAtom.claimedBy = 0; lockedAtom.claimLabel = "NORN"; } if (playerShotAtom != null && playerShotClaimTimer > 0) { playerShotAtom.claimedBy = 0; playerShotAtom.claimLabel = "NORN"; } for (int i = 0; i < fractalDrones.size(); i++) { FractalDrone d = (FractalDrone) fractalDrones.get(i); int myId = 1 + i; if (d.targetAtom != null) { if (d.targetAtom.destroyed || d.targetAtom.oreReserve < 6 || (d.targetAtom.claimedBy != -1 && d.targetAtom.claimedBy != myId)) d.targetAtom = null; else { d.targetAtom.claimedBy = myId; d.targetAtom.claimLabel = "FRAKTAL"; } } } for (int i = 0; i < npcShips.size(); i++) { NpcShip npc = (NpcShip) npcShips.get(i); int myId = 100 + i; if (npc.targetAtom != null) { if (npc.targetAtom.destroyed || npc.targetAtom.oreReserve < 8 || (npc.targetAtom.claimedBy != -1 && npc.targetAtom.claimedBy != myId)) npc.targetAtom = null; else { npc.targetAtom.claimedBy = myId; npc.targetAtom.claimLabel = npc.name; } } } } MultiShellAtom findUnclaimedAtomNear(float ox, float oy, float maxR, int minOre) { MultiShellAtom best = null; float bestD = maxR; for (int i = 0; i < spaceAtoms.size(); i++) { MultiShellAtom a = (MultiShellAtom) spaceAtoms.get(i); if (!a.destroyed && a.oreReserve >= minOre && a.claimedBy == -1) { float d = dist(ox, oy, a.x, a.y); if (d < bestD) { bestD = d; best = a; } } } return best; } void drawAimBeam() { if (autoAim && lockedAtom != null) { stroke(getKindColor(a11yTheme, activeWeapon == 5 ? 9 : 4)); strokeWeight(1.5); line(shipX, shipY, lockedAtom.x, lockedAtom.y); noFill(); ellipse(lockedAtom.x, lockedAtom.y, 92, 92); strokeWeight(1.0); } } void drawNornStarship() { if (tLevel[7] > 0) { noFill(); stroke(45, 210, 145, 160); strokeWeight(1.8); ellipse(0, 0, 114, 70); } if (drivesActive) { stroke(0, 255, 180); strokeWeight(2.0); fill(18, 28, 45); ellipse(-26, 0, 16, 48 + tLevel[1] * 4); noStroke(); fill(0, 255, 180, 140 + sin(simTime * 18.0) * 80); ellipse(-35, 0, 12, 22); } else { stroke(75, 90, 115); strokeWeight(1.5); fill(14, 18, 28); ellipse(-26, 0, 16, 48 + tLevel[1] * 4); } fill(235, 240, 250); stroke(tLevel[6] > 0 ? color(45, 210, 145) : color(30, 42, 60)); strokeWeight(1.5 + tLevel[6] * 0.8); beginShape(); vertex(-30, -10 - tLevel[6]); vertex(24, -8 - tLevel[6]); vertex(64, 0); vertex(24, 8 + tLevel[6]); vertex(-30, 10 + tLevel[6]); vertex(-16, 0); endShape(CLOSE); if (tLevel[4] > 0) { fill(getKindColor(a11yTheme, 9)); stroke(255); rect(8, -16, 20 + tLevel[4] * 4, 4); rect(8, 12, 20 + tLevel[4] * 4, 4); } fill(235, 185, 110); noStroke(); ellipse(-2, 0, 10, 8); strokeWeight(1.0); } void fireActiveWeapon() { float nx = shipX + cos(shipAngle) * 42.0, ny = shipY + sin(shipAngle) * 42.0; int kind = (activeWeapon == 5) ? 9 : (activeWeapon == 1 ? 4 : (activeWeapon == 2 ? 5 : (activeWeapon == 3 ? 6 : 3))); spaceShots.add(new BosonShot(nx, ny, cos(aimAngle) * 11.0, sin(aimAngle) * 11.0, kind)); if (activeWeapon == 5 && tLevel[4] >= 2) spaceShots.add(new BosonShot(nx - sin(aimAngle) * 8.0, ny + cos(aimAngle) * 8.0, cos(aimAngle) * 11.0, sin(aimAngle) * 11.0, 9)); } class FractalDrone { float x, y, vx, vy, spin, beamTargetX, beamTargetY; int idx, harvestCooldown, beamTimer; MultiShellAtom targetAtom; FractalDrone(float sx, float sy, int id) { x = sx; y = sy; idx = id; spin = random(TWO_PI); harvestCooldown = 35 + id * 15; } } void updateFractalDrones() { for (int i = 0; i < fractalDrones.size(); i++) { FractalDrone d = (FractalDrone) fractalDrones.get(i); int myId = 1 + i; d.spin += 0.08; if (d.beamTimer > 0) d.beamTimer--; if (d.targetAtom == null || dist(shipX, shipY, d.targetAtom.x, d.targetAtom.y) > 560.0) { d.targetAtom = findUnclaimedAtomNear(shipX, shipY, 520.0, 6); if (d.targetAtom != null) { d.targetAtom.claimedBy = myId; d.targetAtom.claimLabel = "FRAKTAL"; } } float gx = shipX + cos(simTime * 1.4 + i * 2.1) * 85.0, gy = shipY + sin(simTime * 1.4 + i * 2.1) * 85.0; if (d.targetAtom != null) { gx = d.targetAtom.x + cos(simTime * 2.0 + i) * 58.0; gy = d.targetAtom.y + sin(simTime * 2.0 + i) * 58.0; } d.vx = lerp(d.vx, (gx - d.x) * 0.06, 0.18); d.vy = lerp(d.vy, (gy - d.y) * 0.06, 0.18); d.x += d.vx; d.y += d.vy; if (d.targetAtom != null && dist(d.x, d.y, d.targetAtom.x, d.targetAtom.y) < 95.0) { d.harvestCooldown--; if (d.harvestCooldown <= 0) { d.harvestCooldown = max(45, 95 - tLevel[10] * 15); int mined = min(d.targetAtom.oreReserve, 6 + tLevel[10] * 2); d.targetAtom.oreReserve -= mined; rawErz = min(rawOreCap, rawErz + mined); d.targetAtom.hitFlash = 14; d.beamTargetX = d.targetAtom.x; d.beamTargetY = d.targetAtom.y; d.beamTimer = 14; spawnFloatingTag(d.targetAtom.x, d.targetAtom.y - 26, "+" + mined + " " + tr("Erz (Fraktal)", "Ore (Fractal)"), color(0, 255, 180)); if (d.targetAtom.oreReserve < 6) d.targetAtom = null; } } } } void drawFractalDrones() { for (int i = 0; i < fractalDrones.size(); i++) { FractalDrone d = (FractalDrone) fractalDrones.get(i); if (d.beamTimer > 0) { stroke(0, 255, 180); strokeWeight(1.8); line(d.x, d.y, d.beamTargetX, d.beamTargetY); strokeWeight(1.0); } pushMatrix(); translate(d.x, d.y); rotate(d.spin); noFill(); stroke(0, 255, 180); strokeWeight(1.5); for (int k = 0; k < 3; k++) { rotate(TWO_PI / 3.0); triangle(0, -13, -10, 9, 10, 9); } strokeWeight(1.0); popMatrix(); } } class NpcShip { int id; String name; float x, y, vx, vy, angle, beamX, beamY; int shipCol, state, rawOre, cargoGoods, marsSupplyCrate, credits, targetStationIdx, targetMarsPad, actionCooldown, beamTimer; MultiShellAtom targetAtom; NpcShip(int nid, String label, float sx, float sy, int col) { id = nid; name = label; x = sx; y = sy; angle = random(TWO_PI); shipCol = col; credits = 45; targetStationIdx = nid % spaceStations.size(); targetMarsPad = nid % 9; actionCooldown = 40 + nid * 12; } } void updateNpcFleet() { for (int i = 0; i < npcShips.size(); i++) { NpcShip npc = (NpcShip) npcShips.get(i); int myId = 100 + i; if (npc.beamTimer > 0) npc.beamTimer--; if (npc.state == 0) { if (npc.targetAtom == null) { npc.targetAtom = findUnclaimedAtomNear(npc.x, npc.y, 2400.0, 8); if (npc.targetAtom != null) { npc.targetAtom.claimedBy = myId; npc.targetAtom.claimLabel = npc.name; } } if (npc.targetAtom != null) { float dx = npc.targetAtom.x - npc.x, dy = npc.targetAtom.y - npc.y, d = max(1.0, sqrt(dx * dx + dy * dy)); npc.angle = atan2(dy, dx); if (d > 82.0) { npc.vx = lerp(npc.vx, (dx / d) * 2.4, 0.08); npc.vy = lerp(npc.vy, (dy / d) * 2.4, 0.08); } else { npc.vx = lerp(npc.vx, -dy / d * 1.1, 0.1); npc.vy = lerp(npc.vy, dx / d * 1.1, 0.1); npc.actionCooldown--; if (npc.actionCooldown <= 0) { npc.actionCooldown = 80; int mined = min(npc.targetAtom.oreReserve, 5); npc.targetAtom.oreReserve -= mined; npc.rawOre += mined; npc.beamX = npc.targetAtom.x; npc.beamY = npc.targetAtom.y; npc.beamTimer = 14; if (npc.rawOre >= 22 || npc.targetAtom.oreReserve < 8) { npc.targetAtom = null; npc.state = 1; npc.targetStationIdx = int(random(0, spaceStations.size())); } } } } else { npc.angle += 0.015; npc.vx = cos(npc.angle) * 2.0; npc.vy = sin(npc.angle) * 2.0; } } else if (npc.state == 1) { SpaceStation st = (SpaceStation) spaceStations.get(npc.targetStationIdx); float dx = st.x - npc.x, dy = st.y - npc.y, d = max(1.0, sqrt(dx * dx + dy * dy)); npc.angle = atan2(dy, dx); if (d > 75.0) { npc.vx = lerp(npc.vx, (dx / d) * 2.6, 0.08); npc.vy = lerp(npc.vy, (dy / d) * 2.6, 0.08); } else { npc.vx *= 0.85; npc.vy *= 0.85; npc.actionCooldown--; if (npc.actionCooldown <= 0) { npc.actionCooldown = 65; if (npc.cargoGoods > 0) { npc.credits += int(28 * st.priceBonus); npc.cargoGoods = 0; } if (npc.rawOre > 0) { npc.credits += npc.rawOre * 2; npc.rawOre = 0; } npcTaxPool += 9.0; if (npcTaxPool >= 100.0) { npcTaxPool -= 100.0; npcCubesCount++; growVoxelCubeInBase(1 + (npcCubesCount % 3)); } if (!marsHomeworldUnlocked && npc.credits >= 22) { npc.credits -= 18; npc.marsSupplyCrate = 1; npc.targetMarsPad = findLowestMarsSquare(); npc.state = 2; } else npc.state = 0; } } } else if (npc.state == 2) { float tx = getMarsPadCenterX(npc.targetMarsPad), ty = getMarsPadCenterY(npc.targetMarsPad); float dx = tx - npc.x, dy = ty - npc.y, d = max(1.0, sqrt(dx * dx + dy * dy)); npc.angle = atan2(dy, dx); if (d > 36.0) { npc.vx = lerp(npc.vx, (dx / d) * 2.3, 0.08); npc.vy = lerp(npc.vy, (dy / d) * 2.3, 0.08); } else { npc.vx *= 0.82; npc.vy *= 0.82; npc.actionCooldown--; if (npc.actionCooldown <= 0) { npc.actionCooldown = 60; if (!marsHomeworldUnlocked && npc.marsSupplyCrate > 0) { npc.marsSupplyCrate = 0; deliverProductsToMarsSquare(npc.targetMarsPad, npc.name, 3.5); } npc.state = 0; } } } npc.x = constrain(npc.x + npc.vx, -HALF_WORLD + 90, HALF_WORLD - 90); npc.y = constrain(npc.y + npc.vy, -HALF_WORLD + 90, HALF_WORLD - 90); } } int findLowestMarsSquare() { int best = 0; float lowest = 101.0; for (int i = 0; i < 9; i++) if (marsPadProg[i] < lowest) { lowest = marsPadProg[i]; best = i; } return best; } void drawNpcFleet() { for (int i = 0; i < npcShips.size(); i++) { NpcShip npc = (NpcShip) npcShips.get(i); if (abs(npc.x - camX) > width * 0.65 || abs(npc.y - camY) > height * 0.65) continue; if (npc.beamTimer > 0) { stroke(npc.shipCol); strokeWeight(1.5); line(npc.x, npc.y, npc.beamX, npc.beamY); strokeWeight(1.0); } pushMatrix(); translate(npc.x, npc.y); rotate(npc.angle); fill(20, 26, 40); stroke(npc.shipCol); strokeWeight(1.6); beginShape(); vertex(22, 0); vertex(-14, -11); vertex(-8, 0); vertex(-14, 11); endShape(CLOSE); strokeWeight(1.0); popMatrix(); fill(npc.shipCol); textSize(10); textAlign(CENTER, TOP); text(npc.name + ((npc.state == 2) ? " -> Mars" : ""), npc.x, npc.y + 15); } } void drawRemotePeerShips() { for (int i = 0; i < remotePeers.size(); i++) { RemotePeer rp = (RemotePeer) remotePeers.get(i); if (rp.mode == 0) { pushMatrix(); translate(rp.x, rp.y); rotate(rp.angle); fill(56, 189, 248); stroke(255); triangle(18, 0, -12, -9, -12, 9); popMatrix(); } } } class MultiShellAtom { float x, y, vx, vy, orbitPhase; int protons, neutrons, electrons, oreReserve, maxOre, excitedLevel, exciteTimer, hitFlash, bondCount, claimedBy; boolean destroyed; String claimLabel; MultiShellAtom(float ax, float ay, int p, int n, int e) { x = ax; y = ay; vx = random(-0.25, 0.25); vy = random(-0.25, 0.25); protons = p; neutrons = n; electrons = e; maxOre = (p + n) * 4 + 14; oreReserve = maxOre; orbitPhase = random(TWO_PI); claimedBy = -1; claimLabel = ""; } String getSymbol() { int A = protons + neutrons; return (protons == 1 ? "H-" : (protons == 2 ? "He-" : (protons == 3 ? "Li-" : (protons == 6 ? "C-" : (protons == 8 ? "O-" : "Z" + protons + "-"))))) + A; } int getOuterShell() { return (electrons <= 2) ? 1 : ((electrons <= 10) ? 2 : 3); } int getMaxBonds() { return ((protons == 1 && electrons == 1) ? 1 : (((protons == 6 && electrons >= 4) || (protons == 8 && electrons >= 6)) ? 2 : 0)); } } class AtomBond { MultiShellAtom a, b; AtomBond(MultiShellAtom aa, MultiShellAtom bb) { a = aa; b = bb; } } void updateAtomsAndSpaceEntities() { spaceBonds.clear(); float traktorR = 48.0 + tLevel[10] * 45.0; for (int i = spaceAtoms.size() - 1; i >= 0; i--) { MultiShellAtom a = (MultiShellAtom) spaceAtoms.get(i); if (a.destroyed) { spaceAtoms.remove(i); continue; } a.bondCount = 0; a.orbitPhase += 0.045; if (a.hitFlash > 0) a.hitFlash--; a.vx *= 0.985; a.vy *= 0.985; if (abs(a.vx) < 0.12) a.vx += random(-0.04, 0.04); if (abs(a.vy) < 0.12) a.vy += random(-0.04, 0.04); a.x += a.vx; a.y += a.vy; if (a.x < -HALF_WORLD + 110 || a.x > HALF_WORLD - 110) a.vx = -a.vx; if (a.y < -HALF_WORLD + 110 || a.y > HALF_WORLD - 110) a.vy = -a.vy; if (a.oreReserve < a.maxOre && frameCount % 80 == 0) a.oreReserve++; if (a.excitedLevel > 0 && a.electrons > 0) { a.exciteTimer--; if (a.exciteTimer <= 0) { a.excitedLevel = 0; a.hitFlash = 18; spaceQuanta.add(new VacuumQuantum(a.x + random(-28, 28), a.y + random(-28, 28))); shockRings.add(new ShockRing(a.x, a.y, getKindColor(a11yTheme, 4))); } } } for (int i = 0; i < spaceAtoms.size(); i++) { MultiShellAtom a1 = (MultiShellAtom) spaceAtoms.get(i); for (int j = i + 1; j < spaceAtoms.size(); j++) { MultiShellAtom a2 = (MultiShellAtom) spaceAtoms.get(j); float dx = a2.x - a1.x, dy = a2.y - a1.y, d = max(1.0, sqrt(dx * dx + dy * dy)); if (a1.bondCount < a1.getMaxBonds() && a2.bondCount < a2.getMaxBonds() && d >= 65.0 && d <= 145.0) { spaceBonds.add(new AtomBond(a1, a2)); a1.bondCount++; a2.bondCount++; float sp = (d - 102.0) * 0.012; a1.vx += (dx / d) * sp; a1.vy += (dy / d) * sp; a2.vx -= (dx / d) * sp; a2.vy -= (dy / d) * sp; } } } for (int i = spaceQuanta.size() - 1; i >= 0; i--) { VacuumQuantum q = (VacuumQuantum) spaceQuanta.get(i); float d = dist(shipX, shipY, q.x, q.y); if (d < traktorR && d > 1.0) { q.x += ((shipX - q.x) / d) * (2.2 + tLevel[10] * 0.8); q.y += ((shipY - q.y) / d) * (2.2 + tLevel[10] * 0.8); } if (d < 34.0) { rawQuanta++; q.x = random(-HALF_WORLD + 140, HALF_WORLD - 140); q.y = random(-HALF_WORLD + 140, HALF_WORLD - 140); spawnFloatingTag(shipX, shipY - 24, "+1 Quantum", getKindColor(a11yTheme, 7)); } } for (int i = 0; i < spaceRifts.size(); i++) { SingularityRift r = (SingularityRift) spaceRifts.get(i); r.x += cos(simTime * 1.4 + r.phase) * 0.6; r.y += sin(simTime * 1.7 + r.phase) * 0.6; if (dist(shipX, shipY, r.x, r.y) < 32.0) { hullHP = max(10, hullHP - max(6, 26 - tLevel[6] * 5 - tLevel[7] * 5)); wasteEntropy++; r.x = shipX + cos(shipAngle + PI) * 420.0; r.y = shipY + sin(shipAngle + PI) * 420.0; } } for (int i = spaceShots.size() - 1; i >= 0; i--) { BosonShot s = (BosonShot) spaceShots.get(i); s.x += s.vx; s.y += s.vy; s.life--; if (s.life <= 0) { spaceShots.remove(i); continue; } if (s.kind == 9) { boolean hitR = false; for (int r = 0; r < spaceRifts.size(); r++) { SingularityRift rf = (SingularityRift) spaceRifts.get(r); if (dist(s.x, s.y, rf.x, rf.y) < 30.0) { shockRings.add(new ShockRing(rf.x, rf.y, getKindColor(a11yTheme, 9))); rf.x = random(-HALF_WORLD + 160, HALF_WORLD - 160); rf.y = random(-HALF_WORLD + 160, HALF_WORLD - 160); addResearchFP(10); hitR = true; break; } } if (hitR) { spaceShots.remove(i); continue; } } for (int j = 0; j < spaceAtoms.size(); j++) { MultiShellAtom target = (MultiShellAtom) spaceAtoms.get(j); if (dist(s.x, s.y, target.x, target.y) < ((target.electrons > 2 || target.excitedLevel > 0) ? 48.0 : 34.0)) { applyWeaponReactionToAtom(s, target); spaceShots.remove(i); break; } } } for (int i = shockRings.size() - 1; i >= 0; i--) { ShockRing r = (ShockRing) shockRings.get(i); r.r += 2.8; r.alpha -= 10; if (r.alpha <= 0) shockRings.remove(i); } for (int i = floatingTags.size() - 1; i >= 0; i--) { FloatingTag ft = (FloatingTag) floatingTags.get(i); ft.y -= 0.75; ft.life -= 3; if (ft.life <= 0) floatingTags.remove(i); } } void applyWeaponReactionToAtom(BosonShot s, MultiShellAtom target) { int bonusMult = 1 + tLevel[5]; target.hitFlash = 24; target.vx += s.vx * 0.10; target.vy += s.vy * 0.10; playerShotAtom = target; playerShotClaimTimer = 180; target.claimedBy = 0; if (s.kind == 4 && target.electrons > 0) { int baseN = target.getOuterShell(); if (target.excitedLevel < 2 && (baseN + target.excitedLevel) < 3) { target.excitedLevel++; target.exciteTimer = 165; int fpGain = (target.bondCount > 0) ? 10 : 6; addResearchFP(fpGain); spawnFloatingTag(target.x, target.y - 34, "+" + fpGain + " FP", getKindColor(a11yTheme, 4)); } else { target.electrons--; target.excitedLevel = 0; addResearchFP(12); spaceQuanta.add(new VacuumQuantum(target.x + 26, target.y - 18)); spawnFloatingTag(target.x, target.y - 34, "+12 FP", getKindColor(a11yTheme, 4)); } } else if (s.kind == 5) { target.neutrons++; int mined = min(target.oreReserve, 12 * bonusMult); target.oreReserve -= mined; rawErz = min(rawOreCap, rawErz + mined); spawnFloatingTag(target.x, target.y - 34, "+" + mined + " " + tr("Erz", "Ore"), getKindColor(a11yTheme, 5)); } else if (s.kind == 6) { if (target.protons > 1) { target.protons--; target.neutrons++; } else target.neutrons++; int mined = min(target.oreReserve, 10 * bonusMult); target.oreReserve -= mined; rawErz = min(rawOreCap, rawErz + mined); addResearchFP(8); spawnFloatingTag(target.x, target.y - 34, "+" + mined + " " + tr("Erz", "Ore"), getKindColor(a11yTheme, 6)); } else if (s.kind == 3) { if (target.electrons < target.protons) { target.electrons++; creditsEUR += 14; spawnFloatingTag(target.x, target.y - 34, "+14 EUR", getKindColor(a11yTheme, 3)); } else { target.excitedLevel = min(2, target.excitedLevel + 1); target.exciteTimer = 120; creditsEUR += 6; spawnFloatingTag(target.x, target.y - 34, "+6 EUR", getKindColor(a11yTheme, 3)); } } else if (s.kind == 9) { int mined = min(target.oreReserve, 18 * bonusMult); target.oreReserve -= mined; rawErz = min(rawOreCap, rawErz + mined); wasteEntropy++; spawnFloatingTag(target.x, target.y - 34, "+" + mined + " " + tr("Erz", "Ore"), getKindColor(a11yTheme, 9)); } shockRings.add(new ShockRing(target.x, target.y, getKindColor(a11yTheme, s.kind))); } void drawCovalentBonds() { int eCol = getKindColor(a11yTheme, 3), glowC = (a11yTheme == 2) ? color(255, 255, 0) : color(56, 189, 248); for (int i = 0; i < spaceBonds.size(); i++) { AtomBond b = (AtomBond) spaceBonds.get(i); if (abs(b.a.x - camX) > width * 0.7 && abs(b.b.x - camX) > width * 0.7) continue; float mx = (b.a.x + b.b.x) * 0.5, my = (b.a.y + b.b.y) * 0.5, dx = b.b.x - b.a.x, dy = b.b.y - b.a.y, d = max(1.0, sqrt(dx * dx + dy * dy)); pushMatrix(); translate(mx, my); rotate(atan2(dy, dx)); noFill(); stroke(glowC); strokeWeight(1.5); ellipse(0, 0, d + 40.0, 40.0); strokeWeight(1.0); float t1 = simTime * 2.4 + i, t2 = t1 + PI; noStroke(); fill(eCol); ellipse(sin(t1) * (d * 0.58), sin(2.0 * t1) * 14.0, 9, 9); ellipse(sin(t2) * (d * 0.58), sin(2.0 * t2) * 14.0, 9, 9); popMatrix(); } } void drawSpaceEntities() { int qCol = getKindColor(a11yTheme, 7), rCol = getKindColor(a11yTheme, 8); for (int i = 0; i < spaceQuanta.size(); i++) { VacuumQuantum q = (VacuumQuantum) spaceQuanta.get(i); if (abs(q.x - camX) <= width * 0.6 && abs(q.y - camY) <= height * 0.6) { stroke(qCol); fill(8, 30, 36); ellipse(q.x, q.y, 18, 18); } } for (int i = 0; i < spaceRifts.size(); i++) { SingularityRift r = (SingularityRift) spaceRifts.get(i); if (abs(r.x - camX) <= width * 0.6 && abs(r.y - camY) <= height * 0.6) { stroke(rCol); fill(35, 6, 14); ellipse(r.x, r.y, 26, 26); } } int pCol = getKindColor(a11yTheme, 1), nCol = getKindColor(a11yTheme, 2), eCol = getKindColor(a11yTheme, 3), goldCol = getKindColor(a11yTheme, 4); for (int i = 0; i < spaceAtoms.size(); i++) { MultiShellAtom a = (MultiShellAtom) spaceAtoms.get(i); if (abs(a.x - camX) > width * 0.65 || abs(a.y - camY) > height * 0.65) continue; if (a.claimedBy > 0) { noFill(); stroke(a.claimedBy < 100 ? color(0, 255, 180, 110) : color(250, 195, 55, 110)); ellipse(a.x, a.y, 96, 96); } int e1 = min(2, a.electrons), e2 = max(0, min(8, a.electrons - 2)), e3 = 0; if (a.excitedLevel == 1 && e1 > 0) { e1--; e2++; } else if (a.excitedLevel >= 2 && a.electrons > 0) { if (e2 > 0) { e2--; e3++; } else if (e1 > 0) { e1--; e3++; } } noFill(); stroke(eCol); strokeWeight(1.2); ellipse(a.x, a.y, 56, 56); if (e2 > 0) { stroke(a.excitedLevel == 1 ? goldCol : eCol); ellipse(a.x, a.y, 88, 88); } if (e3 > 0) { stroke(goldCol); strokeWeight(1.6); ellipse(a.x, a.y, 118, 118); strokeWeight(1.0); } for (int k = 0; k < e1; k++) { float ang = a.orbitPhase * 1.4 + (TWO_PI * k) / max(1, e1); noStroke(); fill(eCol); ellipse(a.x + cos(ang) * 28.0, a.y + sin(ang) * 28.0, 8, 8); } for (int k = 0; k < e2; k++) { float ang = -a.orbitPhase + (TWO_PI * k) / max(1, e2); noStroke(); fill(a.excitedLevel == 1 ? goldCol : eCol); ellipse(a.x + cos(ang) * 44.0, a.y + sin(ang) * 44.0, 9, 9); } for (int k = 0; k < e3; k++) { float ang = a.orbitPhase * 0.8 + k; noStroke(); fill(goldCol); ellipse(a.x + cos(ang) * 59.0, a.y + sin(ang) * 59.0, 10, 10); } int totalNuc = a.protons + a.neutrons; for (int k = 0; k < totalNuc; k++) { float offX = 0.0, offY = 0.0; if (totalNuc > 1) { float kAng = (TWO_PI * k) / float(totalNuc) + simTime * 0.8, kRad = min(13.0, 3.5 + totalNuc * 0.8); offX = cos(kAng) * kRad; offY = sin(kAng) * kRad; } fill(k < a.protons ? pCol : nCol); stroke(255, 140); ellipse(a.x + offX, a.y + offY, 12, 12); } fill(245); textSize(10); textAlign(CENTER, TOP); text(a.getSymbol() + " · " + tr("Erz: ", "Ore: ") + a.oreReserve + ((a.claimedBy > 0) ? (" [" + a.claimLabel + "]") : ""), a.x, a.y + (e3 > 0 ? 64.0 : (e2 > 0 ? 50.0 : 34.0))); } for (int i = 0; i < spaceShots.size(); i++) { BosonShot s = (BosonShot) spaceShots.get(i); fill(getKindColor(a11yTheme, s.kind)); stroke(255); ellipse(s.x, s.y, 11, 11); } for (int i = 0; i < shockRings.size(); i++) { ShockRing r = (ShockRing) shockRings.get(i); noFill(); stroke(red(r.col), green(r.col), blue(r.col), r.alpha); ellipse(r.x, r.y, r.r * 2.0, r.r * 2.0); } strokeWeight(1.0); } void drawFloatingTags() { for (int i = 0; i < floatingTags.size(); i++) { FloatingTag ft = (FloatingTag) floatingTags.get(i); fill(red(ft.col), green(ft.col), blue(ft.col), ft.life); textSize(12); textAlign(CENTER, CENTER); text(ft.txt, ft.x, ft.y); } } void drawFlightHUD() { rectMode(CORNER); int hudTop = height - 130; fill(getUiPalette(a11yTheme, 1)); noStroke(); rect(0, hudTop, width, 130); stroke(getUiPalette(a11yTheme, 4)); line(0, hudTop, width, hudTop); fill(255); textSize(11); textAlign(LEFT, TOP); String driveTag = drivesActive ? tr("Antrieb: AN [Space]", "Drives: ON [Space]") : tr("Antrieb: AUS [Space]", "Drives: OFF [Space]"); text(driveTag + tr(" | Hülle: ", " | Hull: ") + hullHP + "/" + maxHullHP + tr(" | Roh-Erz: ", " | Raw Ore: ") + rawErz + "/" + rawOreCap + " | Quanta: " + rawQuanta + tr(" | Fracht: ", " | Cargo: ") + getCargoUsed() + "/" + cargoCap + tr(" | Mars: ", " | Mars: ") + getMarsOverallProgress() + "%", 16, hudTop + 8); drawWpnSlot(16, hudTop + 30, 1, "[1] Photon", getKindColor(a11yTheme, 4)); drawWpnSlot(127, hudTop + 30, 2, "[2] Gluon", getKindColor(a11yTheme, 5)); drawWpnSlot(238, hudTop + 30, 3, "[3] W-Boson", getKindColor(a11yTheme, 6)); drawWpnSlot(351, hudTop + 30, 4, tr("[4] Elektron", "[4] Electron"), getKindColor(a11yTheme, 3)); drawWpnSlot(464, hudTop + 30, 5, tr("[5] Mesonen", "[5] Mesons"), getKindColor(a11yTheme, 9)); drawNavBtn(578, hudTop + 30, 114, 26, zeroClick ? tr("0-Klick [0]: AN", "0-Click [0]: ON") : tr("0-Klick [0]: AUS", "0-Click [0]: OFF"), zeroClick ? color(20, 125, 75) : color(35, 45, 65)); drawNavBtn(698, hudTop + 30, 126, 26, tr("Mars-Basis [R]", "Mars Base [R]"), marsHomeworldUnlocked ? color(20, 125, 75) : getUiPalette(a11yTheme, 2)); drawNavBtn(830, hudTop + 30, 145, 26, tr("Handel & Waren [G]", "Trade & Goods [G]"), getUiPalette(a11yTheme, 3)); fill(8, 10, 18); stroke(55, 68, 95); rect(16, hudTop + 62, 959, 58, 5); fill(getKindColor(a11yTheme, 4)); textAlign(LEFT, TOP); text("SENSOR: " + sensorInfo, 26, hudTop + 68); fill(255); textSize(12); text(bannerHead, 26, hudTop + 86); fill(200, 215, 240); textSize(11); text(bannerSub, 26, hudTop + 104); int mapSize = 110, mapX = width - mapSize - 16, mapY = hudTop + 10; fill(4, 6, 12); stroke(getUiPalette(a11yTheme, 4)); rect(mapX, mapY, mapSize, mapSize, 4); fill(marsHomeworldUnlocked ? color(80, 245, 175) : color(225, 85, 65)); noStroke(); rect(map(MARS_BASE_X, -HALF_WORLD, HALF_WORLD, mapX + 6, mapX + mapSize - 6) - 6, map(MARS_BASE_Y, -HALF_WORLD, HALF_WORLD, mapY + 6, mapY + mapSize - 6) - 4, 12, 8); for (int i = 0; i < spaceStations.size(); i++) { SpaceStation st = (SpaceStation) spaceStations.get(i); fill(st.accentCol); rect(map(st.x, -HALF_WORLD, HALF_WORLD, mapX + 5, mapX + mapSize - 5) - 3, map(st.y, -HALF_WORLD, HALF_WORLD, mapY + 5, mapY + mapSize - 5) - 3, 6, 6); } fill(140, 185, 245, 160); for (int i = 0; i < spaceAtoms.size(); i++) { MultiShellAtom a = (MultiShellAtom) spaceAtoms.get(i); rect(map(a.x, -HALF_WORLD, HALF_WORLD, mapX + 3, mapX + mapSize - 3), map(a.y, -HALF_WORLD, HALF_WORLD, mapY + 3, mapY + mapSize - 3), 2, 2); } for (int i = 0; i < npcShips.size(); i++) { NpcShip npc = (NpcShip) npcShips.get(i); fill(npc.shipCol); ellipse(map(npc.x, -HALF_WORLD, HALF_WORLD, mapX + 4, mapX + mapSize - 4), map(npc.y, -HALF_WORLD, HALF_WORLD, mapY + 4, mapY + mapSize - 4), 3, 3); } fill(255); ellipse(map(shipX, -HALF_WORLD, HALF_WORLD, mapX + 4, mapX + mapSize - 4), map(shipY, -HALF_WORLD, HALF_WORLD, mapY + 4, mapY + mapSize - 4), 5, 5); } void drawWpnSlot(int bx, int by, int id, String lbl, int c) { rectMode(CORNER); boolean sel = (activeWeapon == id); fill(sel ? getUiPalette(a11yTheme, 2) : color(20, 25, 38)); stroke(sel ? getUiPalette(a11yTheme, 4) : color(60, 75, 105)); rect(bx, by, 106, 26, 4); fill(c); noStroke(); ellipse(bx + 11, by + 13, 9, 9); fill(255); textSize(11); textAlign(LEFT, CENTER); text(lbl, bx + 20, by + 13); } void drawMarsBaseDetailMode() { rectMode(CORNER); float mx = getNormMouseX(), my = getNormMouseY(); int overall = getMarsOverallProgress(); fill(getUiPalette(a11yTheme, 1)); stroke(marsHomeworldUnlocked ? color(80, 245, 175) : getUiPalette(a11yTheme, 4)); rect(16, 48, width - 32, 676, 8); fill(lerpColor(color(72, 22, 18), color(16, 52, 38), map(overall, 0, 100, 0.0, 1.0))); noStroke(); rect(34, 60, width - 68, 54, 6); fill(255); textSize(16); textAlign(LEFT, TOP); text(marsHomeworldUnlocked ? tr("NORN HEIMATWELT — LEBENDIGE 0-KLICK FARM & MANUFAKTUR (60 Norns)", "NORN HOMEWORLD — LIVING 0-CLICK FARM & MANUFACTORY (60 Norns)") : tr("MARS-AUFBAUBASIS (" + overall + "%) — KARTE ANKLICKEN ZUM LIEFERN", "MARS CONSTRUCTION BASE (" + overall + "%) — CLICK CARD TO DELIVER"), 48, 68); fill(230, 240, 255); textSize(12); text(tr("Fracht: CNT-Aerogel: " + cargoQty[0] + " | Bariumtitanat: " + cargoQty[1] + " | Zeno-Stasis: " + cargoQty[2] + " | Plasma-Döner: " + cargoQty[3] + " | Erz: " + refinedErz, "Cargo: CNT Aerogel: " + cargoQty[0] + " | Barium Titanate: " + cargoQty[1] + " | Zeno Stasis: " + cargoQty[2] + " | Plasma Doner: " + cargoQty[3] + " | Ore: " + refinedErz), 48, 91); if (!marsHomeworldUnlocked) { for (int i = 0; i < 9; i++) { int qx = getMarsMenuCardX(i), qy = getMarsMenuCardY(i), qw = 340, qh = 156; boolean done = (marsPadProg[i] >= 100.0), ready = canDeliverToMarsSquare(i); boolean cardHover = (mx >= qx && mx <= qx + qw && my >= qy && my <= qy + qh); fill(done ? color(18, 65, 45) : (cardHover ? color(24, 32, 50) : color(18, 23, 36))); stroke(cardHover ? color(255) : (done ? color(80, 245, 175) : (ready ? color(255, 220, 80) : color(59, 110, 194)))); strokeWeight(cardHover ? 2.0 : 1.3); rect(qx, qy, qw, qh, 7); strokeWeight(1.0); fill(255); textSize(14); textAlign(LEFT, TOP); text(getMarsSquareName(i), qx + 14, qy + 12); textAlign(RIGHT, TOP); text(int(marsPadProg[i]) + "%", qx + qw - 14, qy + 12); fill(215, 228, 248); textSize(12); textAlign(LEFT, TOP); text(tr("Bau-Bedarf: ", "Required: ") + getMarsSquareReqLabel(i), qx + 14, qy + 42); fill(10, 14, 22); noStroke(); rect(qx + 14, qy + 68, qw - 28, 16, 4); fill(done ? color(80, 245, 175) : color(56, 189, 248)); rect(qx + 14, qy + 68, constrain(map(marsPadProg[i], 0, 100, 0, qw - 28), 0, qw - 28), 16, 4); if (done) drawNavBtn(qx + 14, qy + 98, qw - 28, 42, tr("QUADRAT FERTIG (100%)", "SQUARE COMPLETE (100%)"), color(20, 115, 70)); else drawNavBtn(qx + 14, qy + 98, qw - 28, 42, ready ? tr("PRODUKT LIEFERN (+25%)", "DELIVER PRODUCT (+25%)") : tr("Fehlt -> [G] Handel", "Missing -> [G] Trade"), ready ? getUiPalette(a11yTheme, 2) : color(40, 48, 68)); } } else { if (my > 125 && my < 640) { hwWalkerX = lerp(hwWalkerX, mx, 0.09); hwWalkerY = lerp(hwWalkerY, my, 0.09); hwWalkAnim += 0.22; } int hoveredSq = -1; for (int i = 0; i < 9; i++) { int qx = getMarsMenuCardX(i), qy = 130 + getGridRow(i) * 165, qw = 340, qh = 152; boolean over = (hwWalkerX >= qx && hwWalkerX <= qx + qw && hwWalkerY >= qy && hwWalkerY <= qy + qh); if (over) hoveredSq = i; String[] fTitleDe = { "1. Korn-Feld (" + int(hwKornGrow) + "%)", "2. Tomaten-Feld (" + int(hwTomGrow) + "%)", "3. Brunnen (" + hwWasser + ")", hwStallBuilt ? "4. Kuhstall (" + int(hwStallWork) + "%)" : "4. Kuhstall (15€)", hwKaeseBuilt ? "5. Käserei (" + int(hwKaeseWork) + "%)" : "5. Käserei (30€)", hwMuehleBuilt ? "6. Mühle (" + int(hwMuehleWork) + "%)" : "6. Mühle (25€)", "7. Pizza-Ofen (" + int(hwPizzaWork) + "%)", "8. Heimat-Markt", "9. Norn-Siedlung (60)" }; String[] fSubDe = { "Korn: " + hwKorn + " | Stroh: " + hwHeu, "Tomaten: " + hwTom + " | Stroh: " + hwHeu, "Wasser: " + hwWasser, "Milch: " + hwMilch, "Käse: " + hwKaese, "Mehl: " + hwMehl, "Pizza: " + hwPizza + " + Plasma-Döner", "Verkauft Waren für EUR", "Guthaben: " + creditsEUR + " EUR" }; String[] fTitleEn = { "1. Grain Field (" + int(hwKornGrow) + "%)", "2. Tomato Field (" + int(hwTomGrow) + "%)", "3. Well (" + hwWasser + ")", hwStallBuilt ? "4. Barn (" + int(hwStallWork) + "%)" : "4. Barn (15€)", hwKaeseBuilt ? "5. Creamery (" + int(hwKaeseWork) + "%)" : "5. Creamery (30€)", hwMuehleBuilt ? "6. Mill (" + int(hwMuehleWork) + "%)" : "6. Mill (25€)", "7. Pizza Oven (" + int(hwPizzaWork) + "%)", "8. Home Market", "9. Norn Village (60)" }; String[] fSubEn = { "Grain: " + hwKorn + " | Straw: " + hwHeu, "Tomatoes: " + hwTom + " | Straw: " + hwHeu, "Water: " + hwWasser, "Milk: " + hwMilch, "Cheese: " + hwKaese, "Flour: " + hwMehl, "Pizza: " + hwPizza + " + Plasma Doner", "Sells goods for EUR", "Balance: " + creditsEUR + " EUR" }; fill(over ? color(26, 105, 68) : color(18, 56, 42)); stroke(over ? color(255, 220, 80) : color(80, 245, 175)); rect(qx, qy, qw, qh, 7); fill(255); textSize(14); textAlign(CENTER, TOP); text(tr(fTitleDe[i], fTitleEn[i]), qx + qw * 0.5, qy + 24); fill(225, 242, 235); textSize(11); text(tr(fSubDe[i], fSubEn[i]), qx + qw * 0.5, qy + 64); } if (hoveredSq >= 0) runHomeworldSquareStep(hoveredSq); float sw = sin(hwWalkAnim) * 10.0; stroke(255); strokeWeight(2.2); fill(235, 185, 110); triangle(hwWalkerX - 10, hwWalkerY - 30, hwWalkerX - 18, hwWalkerY - 42, hwWalkerX - 4, hwWalkerY - 34); triangle(hwWalkerX + 10, hwWalkerY - 30, hwWalkerX + 18, hwWalkerY - 42, hwWalkerX + 4, hwWalkerY - 34); ellipse(hwWalkerX, hwWalkerY - 24, 24, 22); line(hwWalkerX, hwWalkerY - 13, hwWalkerX, hwWalkerY + 16); line(hwWalkerX, hwWalkerY - 6, hwWalkerX - 14, hwWalkerY + 8 + sw); line(hwWalkerX, hwWalkerY - 6, hwWalkerX + 14, hwWalkerY + 8 - sw); line(hwWalkerX, hwWalkerY + 16, hwWalkerX - 10, hwWalkerY + 38 - sw); line(hwWalkerX, hwWalkerY + 16, hwWalkerX + 10, hwWalkerY + 38 + sw); strokeWeight(1.0); } drawNavBtn(int(width * 0.5 - 150), height - 62, 300, 34, tr("← ZURÜCK ZUM MIKROKOSMOS [1]", "← BACK TO MICRO-COSMOS [1]"), getUiPalette(a11yTheme, 3)); } void drawHomeworldVictoryOverlay() { rectMode(CORNER); fill(4, 5, 12, 222); noStroke(); rect(0, 38, width, height - 38); int mx = 210, my = 155, mw = width - 420, mh = 360; fill(getUiPalette(a11yTheme, 1)); stroke(color(80, 245, 175)); strokeWeight(2.5); rect(mx, my, mw, mh, 10); strokeWeight(1.0); fill(color(20, 125, 75)); noStroke(); rect(mx + 1, my + 1, mw - 2, 52, 9); fill(255); textSize(19); textAlign(CENTER, CENTER); text(tr("DIE NORN HABEN IHRE ERSTE HEIMATWELT!", "THE NORNS HAVE FOUNDED THEIR FIRST HOMEWORLD!"), width * 0.5, my + 27); fill(240, 246, 255); textSize(14); textAlign(CENTER, TOP); text(tr("Alle 9 Mars-Quadrate sind vollständig errichtet.\nDie Mars-Basis ist jetzt eure lebendige 0-Klick-Heimatwelt!", "All 9 Mars squares are fully constructed.\nThe Mars Base is now your living 0-Click Homeworld!"), mx + 30, my + 84, mw - 60, 180); drawNavBtn(int(width * 0.5 - 190), my + 282, 380, 48, tr("HEIMATWELT BETRETEN (0-KLICK) ▶", "ENTER HOMEWORLD (0-CLICK) ▶"), getUiPalette(a11yTheme, 2)); } void drawEliteTradeMode() { rectMode(CORNER); fill(getUiPalette(a11yTheme, 1)); stroke(59, 110, 194); rect(16, 48, width - 32, 676, 8); float mult = getTradeMultiplier(); int bonusPct = int((mult - 1.0) * 100.0); fill(255); textSize(16); textAlign(LEFT, TOP); text(tr("ELITE-HANDELSKONTOR — WAREN-WÜRFEL: " + tradeCubesCount + " (BONUS: +" + bonusPct + "%)", "ELITE TRADE EXCHANGE — TRADE CUBES: " + tradeCubesCount + " (BONUS: +" + bonusPct + "%)"), 32, 62); fill(215, 228, 248); textSize(12); text(tr("Fracht: " + getCargoUsed() + "/" + cargoCap + " t | Erz: " + refinedErz + " | FP: " + researchFP + " | " + creditsEUR + " EUR", "Cargo: " + getCargoUsed() + "/" + cargoCap + " t | Ore: " + refinedErz + " | RP: " + researchFP + " | " + creditsEUR + " EUR"), 32, 86); fill(24, 18, 10); stroke(251, 191, 36); rect(32, 116, width - 64, 96, 8); fill(255, 220, 85); textSize(14); text(tr("WAREN-WÜRFEL ERRICHTEN (+15% Handelsgewinn/Würfel)", "CONSTRUCT TRADE CUBE (+15% Trade Profit/Cube)"), 48, 128); drawNavBtn(width - 330, 134, 280, 56, tr("WAREN-WÜRFEL BAUEN (70 EUR + 40 Erz)", "BUILD TRADE CUBE (70 EUR + 40 Ore)"), (creditsEUR >= 70 && refinedErz >= 40) ? getUiPalette(a11yTheme, 2) : color(45, 52, 72)); for (int g = 0; g < 4; g++) { int ry = 228 + g * 108; fill(18, 23, 36); stroke(59, 110, 194); rect(32, ry, width - 64, 94, 6); int sellPrice = int(goodBasePrice[g] * mult), buyPrice = max(8, int(goodBasePrice[g] * 0.72)); fill(255); textSize(14); textAlign(LEFT, TOP); text(tr(goodNameDe[g], goodNameEn[g]) + " [" + cargoQty[g] + " t]", 48, ry + 12); fill(210, 225, 245); textSize(12); text(tr("Synthese: " + goodOreCost[g] + " Erz + " + goodFpCost[g] + " FP | Kauf: " + buyPrice + " EUR | Verkauf: " + sellPrice + " EUR", "Synthesize: " + goodOreCost[g] + " Ore + " + goodFpCost[g] + " RP | Buy: " + buyPrice + " EUR | Sell: " + sellPrice + " EUR"), 48, ry + 42); drawNavBtn(width - 540, ry + 24, 160, 44, tr("Synthese (-Erz/-FP)", "Synthesize (-Ore/-RP)"), (getCargoUsed() < cargoCap && refinedErz >= goodOreCost[g] && researchFP >= goodFpCost[g]) ? getUiPalette(a11yTheme, 3) : color(40, 48, 68)); drawNavBtn(width - 370, ry + 24, 155, 44, tr("Kaufen (-" + buyPrice + " EUR)", "Buy (-" + buyPrice + " EUR)"), (getCargoUsed() < cargoCap && creditsEUR >= buyPrice) ? color(24, 54, 112) : color(40, 48, 68)); drawNavBtn(width - 205, ry + 24, 155, 44, tr("Verkaufen (+" + sellPrice + " EUR)", "Sell (+" + sellPrice + " EUR)"), (cargoQty[g] > 0) ? getUiPalette(a11yTheme, 2) : color(40, 48, 68)); } drawNavBtn(int(width * 0.5 - 150), height - 66, 300, 34, tr("← ZURÜCK ZUM MIKROKOSMOS [1]", "← BACK TO MICRO-COSMOS [1]"), getUiPalette(a11yTheme, 3)); } void drawTechTreeMode() { rectMode(CORNER); fill(getUiPalette(a11yTheme, 1)); stroke(59, 110, 194); rect(16, 48, width - 32, 676, 8); fill(255); textSize(16); textAlign(LEFT, TOP); text(tr("NORN-FORSCHUNGSBAUM — FP: " + researchFP + " | " + creditsEUR + " EUR", "NORN RESEARCH TREE — RP: " + researchFP + " | " + creditsEUR + " EUR"), 32, 62); drawNavBtn(width - 420, 58, 195, 28, freeTechMode ? tr("Freies Klicken [M]: AN", "Free Click [M]: ON") : tr("FP-Kosten [M]: AN", "RP Cost [M]: ON"), freeTechMode ? color(20, 125, 75) : getUiPalette(a11yTheme, 2)); drawNavBtn(width - 215, 58, 185, 28, tr("30 EUR -> +25 FP", "30 EUR -> +25 RP"), getUiPalette(a11yTheme, 3)); for (int i = 0; i < NUM_TECH; i++) { float nx = 32 + tBranchId[i] * 268, ny = 108 + tTier[i] * 195, nw = 252, nh = 176; boolean unlocked = freeTechMode || (tPrereq[i] < 0) || (tLevel[tPrereq[i]] > 0); int lvl = tLevel[i]; fill(lvl > 0 ? color(20, 32, 54) : color(15, 19, 30)); stroke(lvl > 0 ? getUiPalette(a11yTheme, 4) : color(55, 68, 95)); rect(nx, ny, nw, nh, 6); fill(255); textSize(12); textAlign(LEFT, TOP); text(tCode[i] + " · " + tr(tBranchDe[i], tBranchEn[i]), nx + 10, ny + 8); textAlign(RIGHT, TOP); text(tr("Stufe ", "Level ") + lvl + "/3", nx + nw - 10, ny + 8); textAlign(LEFT, TOP); textSize(13); text(tr(tTitleDe[i], tTitleEn[i]), nx + 10, ny + 30, nw - 20, 36); fill(210, 225, 245); textSize(11); text(tr(tDescDe[i], tDescEn[i]), nx + 10, ny + 68, nw - 20, 62); int cost = tCost[i] * (lvl + 1); if (lvl >= 3) drawNavBtn(int(nx + 10), int(ny + 136), int(nw - 20), 28, "MAX (3/3)", color(20, 115, 70)); else if (!unlocked) drawNavBtn(int(nx + 10), int(ny + 136), int(nw - 20), 28, tr("Benötigt ", "Requires ") + tCode[tPrereq[i]], color(40, 48, 68)); else drawNavBtn(int(nx + 10), int(ny + 136), int(nw - 20), 28, freeTechMode ? ("-> St. " + (lvl + 1)) : (cost + " FP"), (freeTechMode || researchFP >= cost) ? getUiPalette(a11yTheme, 2) : color(45, 52, 72)); } } void drawIsometricBaseMode() { rectMode(CORNER); fill(getUiPalette(a11yTheme, 1)); stroke(59, 110, 194); rect(16, 48, width - 32, 676, 8); fill(255); textSize(15); textAlign(LEFT, TOP); text(tr("3D-RAUMBASIS — ERZ: " + erzCubesCount + " | FORSCHUNG: " + fpCubesCount + " | WAREN: " + tradeCubesCount + " | NPC: " + npcCubesCount, "3D SPACE BASE — ORE: " + erzCubesCount + " | RESEARCH: " + fpCubesCount + " | TRADE: " + tradeCubesCount + " | NPC: " + npcCubesCount), 32, 62); drawNavBtn(width - 165, 58, 135, 30, tr("Drehen [Q/E]", "Rotate [Q/E]"), getUiPalette(a11yTheme, 3)); float originX = width * 0.5, originY = 230.0, hw = 22.0, hh = 11.0, ch = 22.0; stroke(55, 72, 105); for (int i = 0; i <= BASE_DIM; i++) { line(originX + (0 - i) * hw, originY + (0 + i) * hh, originX + (BASE_DIM - i) * hw, originY + (BASE_DIM + i) * hh); line(originX + (i - 0) * hw, originY + (i + 0) * hh, originX + (i - BASE_DIM) * hw, originY + (i + BASE_DIM) * hh); } for (int z = 0; z < BASE_HEIGHT; z++) for (int py = 0; py < BASE_DIM; py++) for (int px = 0; px < BASE_DIM; px++) { int vx = (isoRotation == 1) ? py : ((isoRotation == 2) ? BASE_DIM - 1 - px : ((isoRotation == 3) ? BASE_DIM - 1 - py : px)); int vy = (isoRotation == 1) ? BASE_DIM - 1 - px : ((isoRotation == 2) ? BASE_DIM - 1 - py : ((isoRotation == 3) ? px : py)); int vType = getBaseVoxel(vx, vy, z); if (vType > 0) drawIsoCubeSolid(originX + (px - py) * hw, originY + (px + py) * hh - z * ch, hw, hh, ch, (vType == 1) ? color(210, 42, 74) : ((vType == 2) ? color(65, 155, 255) : color(250, 195, 45))); } drawNavBtn(int(width * 0.5 - 170), height - 66, 340, 36, tr("BASIS JETZT IN 3D BEGEHEN [V] >>", "WALK INSIDE 3D BASE NOW [V] >>"), getUiPalette(a11yTheme, 2)); } void drawIsoCubeSolid(float sx, float sy, float hw, float hh, float ch, int c) { stroke(12, 16, 26); fill(c); beginShape(); vertex(sx, sy); vertex(sx + hw, sy + hh); vertex(sx, sy + 2 * hh); vertex(sx - hw, sy + hh); endShape(CLOSE); fill(red(c) * 0.75, green(c) * 0.75, blue(c) * 0.75); beginShape(); vertex(sx - hw, sy + hh); vertex(sx, sy + 2 * hh); vertex(sx, sy + 2 * hh + ch); vertex(sx - hw, sy + hh + ch); endShape(CLOSE); fill(red(c) * 0.52, green(c) * 0.52, blue(c) * 0.52); beginShape(); vertex(sx, sy + 2 * hh); vertex(sx + hw, sy + hh); vertex(sx + hw, sy + hh + ch); vertex(sx, sy + 2 * hh + ch); endShape(CLOSE); } void enterWalk3DBaseMode() { viewMode = 3; walkX = 7.5; walkY = 7.5; walkDirX = 1.0; walkDirY = 0.0; walkPlaneX = 0.0; walkPlaneY = 0.66; } void drawWalk3DBaseMode() { rectMode(CORNER); int startX = 340, viewW = width - startX, viewH = height - 38, topY = 38; float spd = 0.065; if (keyTurnL) rotateWalkCam(-0.045); if (keyTurnR) rotateWalkCam(0.045); if (keyW) { if (!isWalkWall(int(walkX + walkDirX * spd), int(walkY))) walkX += walkDirX * spd; if (!isWalkWall(int(walkX), int(walkY + walkDirY * spd))) walkY += walkDirY * spd; } if (keyS) { if (!isWalkWall(int(walkX - walkDirX * spd), int(walkY))) walkX -= walkDirX * spd; if (!isWalkWall(int(walkX), int(walkY - walkDirY * spd))) walkY -= walkDirY * spd; } if (keyA) { float sx = walkDirY, sy = -walkDirX; if (!isWalkWall(int(walkX + sx * spd), int(walkY))) walkX += sx * spd; if (!isWalkWall(int(walkX), int(walkY + sy * spd))) walkY += sy * spd; } if (keyD) { float sx = -walkDirY, sy = walkDirX; if (!isWalkWall(int(walkX + sx * spd), int(walkY))) walkX += sx * spd; if (!isWalkWall(int(walkX), int(walkY + sy * spd))) walkY += sy * spd; } noStroke(); fill(18, 6, 12); rect(startX, topY, viewW, viewH / 2); fill(10, 16, 30); rect(startX, topY + viewH / 2, viewW, viewH / 2); for (int x = 0; x < viewW; x++) { float camXNorm = 2.0 * x / float(viewW) - 1.0, rdx = walkDirX + walkPlaneX * camXNorm, rdy = walkDirY + walkPlaneY * camXNorm; int mapX = int(walkX), mapY = int(walkY); float ddx = (rdx == 0.0) ? 1e30 : abs(1.0 / rdx), ddy = (rdy == 0.0) ? 1e30 : abs(1.0 / rdy); int stepX = (rdx < 0) ? -1 : 1, stepY = (rdy < 0) ? -1 : 1; float sdx = (rdx < 0) ? (walkX - mapX) * ddx : (mapX + 1.0 - walkX) * ddx, sdy = (rdy < 0) ? (walkY - mapY) * ddy : (mapY + 1.0 - walkY) * ddy; int hit = 0, side = 0, wallType = 0, guard = 0; while (hit == 0 && guard < 40) { guard++; if (sdx < sdy) { sdx += ddx; mapX += stepX; side = 0; } else { sdy += ddy; mapY += stepY; side = 1; } if (mapX <= 0 || mapX >= BASE_DIM - 1 || mapY <= 0 || mapY >= BASE_DIM - 1) { hit = 1; wallType = 4; } else { int v = getBaseVoxel(mapX, mapY, 0); if (v > 0) { hit = 1; wallType = v; } } } float distW = (side == 0) ? max(0.08, (mapX - walkX + (1 - stepX) * 0.5) / rdx) : max(0.08, (mapY - walkY + (1 - stepY) * 0.5) / rdy); int lh = int(viewH / distW), y0 = max(0, -lh / 2 + viewH / 2), y1 = min(viewH - 1, lh / 2 + viewH / 2); int col = (wallType == 1) ? color(210, 42, 74) : ((wallType == 2) ? color(65, 155, 255) : ((wallType == 3) ? color(250, 195, 45) : color(110, 125, 150))); float shade = constrain(1.0 / (1.0 + distW * 0.16), 0.22, 1.0) * ((side == 1) ? 0.72 : 1.0); fill(red(col) * shade, green(col) * shade, blue(col) * shade); rect(startX + x, topY + y0, 1, max(1, y1 - y0 + 1)); } fill(getUiPalette(a11yTheme, 1)); noStroke(); rect(0, topY, startX, viewH); stroke(getUiPalette(a11yTheme, 4)); line(startX, topY, startX, height); fill(255); textSize(15); textAlign(LEFT, TOP); text(tr("3D-BASIS BEGEHUNG", "3D BASE WALKTHROUGH"), 16, topY + 14); fill(215, 228, 248); textSize(12); text(tr("Rot = Erz (" + erzCubesCount + ") · Blau = FP (" + fpCubesCount + ")\nGold = Waren (" + tradeCubesCount + ") · NPC: " + npcCubesCount + "\n\n[W/A/S/D] Laufen · [Maus/Pfeile] Drehen", "Red = Ore (" + erzCubesCount + ") · Blue = RP (" + fpCubesCount + ")\nGold = Trade (" + tradeCubesCount + ") · NPC: " + npcCubesCount + "\n\n[W/A/S/D] Move · [Mouse/Arrows] Turn"), 16, topY + 44); drawNavBtn(24, height - 62, 290, 38, tr("← ZURÜCK ZUM RAUMSCHIFF [1]", "← BACK TO STARSHIP [1]"), getUiPalette(a11yTheme, 2)); } boolean isWalkWall(int gx, int gy) { return (gx <= 0 || gx >= BASE_DIM - 1 || gy <= 0 || gy >= BASE_DIM - 1) || (getBaseVoxel(gx, gy, 0) > 0); } void rotateWalkCam(float rot) { float od = walkDirX; walkDirX = walkDirX * cos(rot) - walkDirY * sin(rot); walkDirY = od * sin(rot) + walkDirY * cos(rot); float op = walkPlaneX; walkPlaneX = walkPlaneX * cos(rot) - walkPlaneY * sin(rot); walkPlaneY = op * sin(rot) + walkPlaneY * cos(rot); } void syncNornLobby() { try { String[] lines = loadStrings("norn_lobby.php?action=sync&cid=" + myClientId + "&x=" + nf(shipX, 1, 1) + "&y=" + nf(shipY, 1, 1) + "&a=" + nf(shipAngle, 1, 2) + "&m=" + viewMode + "&ec=" + erzCubesCount + "&fc=" + fpCubesCount + "&tc=" + tradeCubesCount); if (lines == null) return; for (int i = 0; i < lines.length; i++) { String line = trim(lines[i]); int eq = line.indexOf('='); if (eq <= 0) continue; String k = line.substring(0, eq), v = line.substring(eq + 1); if (k.equals("STATUS") && v.equals("OK")) lobbyOnline = true; else if (k.equals("ONLINE")) onlinePlayers = int(v); else if (k.equals("ERZ_CUBES")) { int rE = int(v); while (erzCubesCount < rE) { erzCubesCount++; growVoxelCubeInBase(1); } } else if (k.equals("FP_CUBES")) { int rF = int(v); while (fpCubesCount < rF) { fpCubesCount++; growVoxelCubeInBase(2); } } else if (k.equals("TRADE_CUBES")) { int rT = int(v); while (tradeCubesCount < rT) { tradeCubesCount++; growVoxelCubeInBase(3); } } else if (k.equals("PEERS")) { remotePeers.clear(); if (v.length() > 2) { String[] entries = split(v, ';'); for (int p = 0; p < entries.length; p++) { String[] c = split(entries[p], ','); if (c != null && c.length >= 4) remotePeers.add(new RemotePeer(float(c[0]), float(c[1]), float(c[2]), int(c[3]))); } } } } } catch (Exception e) {} } class VacuumQuantum { float x, y; VacuumQuantum(float qx, float qy) { x = qx; y = qy; } } class SingularityRift { float x, y, phase; SingularityRift(float rx, float ry) { x = rx; y = ry; phase = random(TWO_PI); } } class BosonShot { float x, y, vx, vy; int kind, life; BosonShot(float sx, float sy, float svx, float svy, int k) { x = sx; y = sy; vx = svx; vy = svy; kind = k; life = 110; } } class ShockRing { float x, y, r; int col, alpha; ShockRing(float rx, float ry, int c) { x = rx; y = ry; r = 12.0; col = c; alpha = 235; } } class FloatingTag { float x, y; String txt; int col, life; FloatingTag(float fx, float fy, String t, int c) { x = fx; y = fy; txt = t; col = c; life = 255; } } class RemotePeer { float x, y, angle; int mode; RemotePeer(float px, float py, float pa, int pm) { x = px; y = py; angle = pa; mode = pm; } } void mouseMoved() { if (languageChosen && viewMode == 0 && getNormMouseY() > 38 && getNormMouseY() < height - 130) mouseSteer = true; } void mousePressed() { float mx = getNormMouseX(), my = getNormMouseY(); if (!languageChosen) { int bx = 200, by = 110; if (my >= by + 350 && my <= by + 412) { if (mx >= bx + 35 && mx <= bx + 340) { langMode = 0; languageChosen = true; setWelcomeBanner(); return; } if (mx >= bx + 380 && mx <= bx + 685) { langMode = 1; languageChosen = true; setWelcomeBanner(); return; } } if (my >= by + 430 && my <= by + 468) { if (mx >= bx + 35 && mx <= bx + 340) { languageChosen = true; loadSavedGameSlot(); return; } if (mx >= bx + 380 && mx <= bx + 685) { a11yTheme = (a11yTheme + 1) % 3; return; } } return; } if (showHomeworldBanner) { if (mx >= width * 0.5 - 190 && mx <= width * 0.5 + 190 && my >= 437 && my <= 485) { showHomeworldBanner = false; viewMode = 5; } return; } if (my <= 38) { if (mx >= 8 && mx <= 100) { viewMode = 0; return; } if (mx >= 105 && mx <= 217) { viewMode = 5; return; } if (mx >= 222 && mx <= 318) { viewMode = 1; return; } if (mx >= 323 && mx <= 419) { viewMode = 4; return; } if (mx >= 424 && mx <= 530) { viewMode = 2; return; } if (mx >= 535 && mx <= 629) { enterWalk3DBaseMode(); return; } if (mx >= 636 && mx <= 724) { saveCurrentGameSlot(); return; } if (mx >= 729 && mx <= 805) { loadSavedGameSlot(); return; } if (mx >= 936 && mx <= 992) { langMode = (langMode + 1) % 2; setWelcomeBanner(); return; } if (mx >= 998 && mx <= 1112) { a11yTheme = (a11yTheme + 1) % 3; return; } return; } if (viewMode == 5) { if (!marsHomeworldUnlocked) { for (int i = 0; i < 9; i++) { int qx = getMarsMenuCardX(i), qy = getMarsMenuCardY(i), qw = 340, qh = 156; if (mx >= qx && mx <= qx + qw && my >= qy && my <= qy + qh && marsPadProg[i] < 100.0) { if (canDeliverToMarsSquare(i)) { int gA = marsReqGoodA[i], gB = marsReqGoodB[i]; cargoQty[gA]--; if (gB >= 0) cargoQty[gB]--; else refinedErz -= 10; deliverProductsToMarsSquare(i, tr("NORN", "NORN"), 25.0); } else viewMode = 4; return; } } } if (my >= height - 62 && my <= height - 28 && mx >= width * 0.5 - 150 && mx <= width * 0.5 + 150) viewMode = 0; return; } if (viewMode == 1) { if (mx >= width - 420 && mx <= width - 225 && my >= 58 && my <= 86) { freeTechMode = !freeTechMode; return; } if (mx >= width - 215 && mx <= width - 30 && my >= 58 && my <= 86) { if (creditsEUR >= 30) { creditsEUR -= 30; addResearchFP(25); } return; } for (int i = 0; i < NUM_TECH; i++) { float nx = 32 + tBranchId[i] * 268, ny = 108 + tTier[i] * 195; if (mx >= nx && mx <= nx + 252 && my >= ny && my <= ny + 176) { boolean unlocked = freeTechMode || (tPrereq[i] < 0) || (tLevel[tPrereq[i]] > 0); int cost = tCost[i] * (tLevel[i] + 1); if (unlocked && tLevel[i] < 3 && (freeTechMode || researchFP >= cost)) { if (!freeTechMode) researchFP -= cost; tLevel[i]++; recalcShipCapabilities(); if (i == 6) hullHP = min(maxHullHP, hullHP + 45); } return; } } return; } if (viewMode == 4) { if (mx >= width - 330 && mx <= width - 50 && my >= 134 && my <= 190) { buildTradeCubeBuilding(); return; } float mult = getTradeMultiplier(); for (int g = 0; g < 4; g++) { int ry = 228 + g * 108; if (my >= ry + 24 && my <= ry + 68) { int sellPrice = int(goodBasePrice[g] * mult), buyPrice = max(8, int(goodBasePrice[g] * 0.72)); if (mx >= width - 540 && mx <= width - 380 && getCargoUsed() < cargoCap && refinedErz >= goodOreCost[g] && researchFP >= goodFpCost[g]) { refinedErz -= goodOreCost[g]; researchFP -= goodFpCost[g]; cargoQty[g]++; return; } if (mx >= width - 370 && mx <= width - 215 && getCargoUsed() < cargoCap && creditsEUR >= buyPrice) { creditsEUR -= buyPrice; cargoQty[g]++; return; } if (mx >= width - 205 && mx <= width - 50 && cargoQty[g] > 0) { cargoQty[g]--; creditsEUR += sellPrice; return; } } } if (my >= height - 66 && my <= height - 32 && mx >= width * 0.5 - 150 && mx <= width * 0.5 + 150) viewMode = 0; return; } if (viewMode == 2) { if (my >= 58 && my <= 88 && mx >= width - 165 && mx <= width - 30) { isoRotation = (isoRotation + 1) % 4; return; } if (my >= height - 66 && my <= height - 30 && mx >= width * 0.5 - 170 && mx <= width * 0.5 + 170) { enterWalk3DBaseMode(); return; } return; } if (viewMode == 3) { if (mx >= 24 && mx <= 314 && my >= height - 62 && my <= height - 24) viewMode = 0; return; } int hudTop = height - 130; if (my >= hudTop) { if (my >= hudTop + 30 && my <= hudTop + 56) { if (mx >= 16 && mx <= 122) activeWeapon = 1; else if (mx >= 127 && mx <= 233) activeWeapon = 2; else if (mx >= 238 && mx <= 346) activeWeapon = 3; else if (mx >= 351 && mx <= 459) activeWeapon = 4; else if (mx >= 464 && mx <= 572) activeWeapon = 5; else if (mx >= 578 && mx <= 692) zeroClick = !zeroClick; else if (mx >= 698 && mx <= 824) viewMode = 5; else if (mx >= 830 && mx <= 975) viewMode = 4; } return; } if (my > 38 && my < hudTop && mouseButton == LEFT) fireActiveWeapon(); } void mouseDragged() { if (languageChosen && viewMode == 3 && getNormMouseX() > 340) rotateWalkCam(-(getNormMouseX() - pmouseX) * 0.012); } void keyPressed() { if (!languageChosen) { if (key == '1' || key == 'd' || key == 'D') { langMode = 0; languageChosen = true; setWelcomeBanner(); } if (key == '2' || key == 'e' || key == 'E') { langMode = 1; languageChosen = true; setWelcomeBanner(); } if (key == 'o' || key == 'O') { languageChosen = true; loadSavedGameSlot(); } if (key == 'h' || key == 'H') a11yTheme = (a11yTheme + 1) % 3; return; } if (key == ' ') { if (showHomeworldBanner) { showHomeworldBanner = false; viewMode = 5; return; } drivesActive = !drivesActive; spawnFloatingTag(shipX, shipY - 26, drivesActive ? tr("Antrieb AN", "Drives ON") : tr("Antrieb AUS", "Drives OFF"), drivesActive ? color(0, 255, 180) : color(255, 180, 60)); return; } if (key == '1') { if (viewMode != 0) viewMode = 0; else activeWeapon = 1; } if (key == '2') activeWeapon = 2; if (key == '3') activeWeapon = 3; if (key == '4') activeWeapon = 4; if (key == '5') activeWeapon = 5; if (key == '0') zeroClick = !zeroClick; if (key == 'k' || key == 'K') saveCurrentGameSlot(); if (key == 'o' || key == 'O') loadSavedGameSlot(); if (key == 'r' || key == 'R') viewMode = (viewMode == 5) ? 0 : 5; if (key == 't' || key == 'T') viewMode = (viewMode == 1) ? 0 : 1; if (key == 'g' || key == 'G') viewMode = (viewMode == 4) ? 0 : 4; if (key == 'b' || key == 'B') viewMode = (viewMode == 2) ? 0 : 2; if (key == 'v' || key == 'V') { if (viewMode == 3) viewMode = 0; else enterWalk3DBaseMode(); } if (key == 'm' || key == 'M') freeTechMode = !freeTechMode; if (key == 'q' || key == 'Q') isoRotation = (isoRotation + 3) % 4; if (key == 'e' || key == 'E') isoRotation = (isoRotation + 1) % 4; if (key == 'l' || key == 'L') { langMode = (langMode + 1) % 2; setWelcomeBanner(); } if (key == 'h' || key == 'H') a11yTheme = (a11yTheme + 1) % 3; if (key == 'w' || key == 'W') keyW = true; if (key == 's' || key == 'S') keyS = true; if (key == 'a' || key == 'A') keyA = true; if (key == 'd' || key == 'D') keyD = true; if (key == CODED) { if (keyCode == UP) keyW = true; if (keyCode == DOWN) keyS = true; if (keyCode == LEFT) keyTurnL = true; if (keyCode == RIGHT) keyTurnR = true; } } void keyReleased() { if (key == 'w' || key == 'W') keyW = false; if (key == 's' || key == 'S') keyS = false; if (key == 'a' || key == 'A') keyA = false; if (key == 'd' || key == 'D') keyD = false; if (key == CODED) { if (keyCode == UP) keyW = false; if (keyCode == DOWN) keyS = false; if (keyCode == LEFT) keyTurnL = false; if (keyCode == RIGHT) keyTurnR = false; } }