Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc3ff26523 | ||
|
|
cdd1c0b670 | ||
|
|
572c02199b | ||
|
|
77ff2f62b4 | ||
|
|
4484ca1089 | ||
|
|
b86ce56ef5 | ||
|
|
dd0fc8aaa7 | ||
|
|
5890f3607c | ||
|
|
5044bd2517 | ||
|
|
97bf6a3928 | ||
|
|
14f771b12a | ||
|
|
1de519c79c | ||
|
|
5017664255 | ||
|
|
d2baf41c0d | ||
|
|
520c22e821 |
@@ -98,6 +98,39 @@ jobs:
|
||||
run: |
|
||||
TEMPLATE=tools/template.exe sh ../ci/wine_check.sh ../game_godot/TinMerezhi.exe /tmp/shots
|
||||
|
||||
- name: Mirror on the droplet (fast download for the updater, game page site/index.html)
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
env:
|
||||
# repo secret MIRROR_SSH_KEY: private key of the sftp-only user "mirror" on the droplet; without it this step is skipped
|
||||
KEY: ${{ secrets.MIRROR_SSH_KEY }}
|
||||
TAG: ${{ github.ref_name }}
|
||||
run: |
|
||||
if [ -z "$KEY" ] || [ ! -s ci/mirror_known_hosts ]; then echo "mirror: no MIRROR_SSH_KEY or ci/mirror_known_hosts, skipped (the updater falls back to Gitea)"; exit 0; fi
|
||||
umask 077; printf '%s\n' "$KEY" > /tmp/mirror_key
|
||||
echo "$TAG" > /tmp/version.txt
|
||||
# before the Release: once the game sees the new tag, the mirror already has its exe (the updater checks the size)
|
||||
sftp -b - -i /tmp/mirror_key -o UserKnownHostsFile=ci/mirror_known_hosts -o StrictHostKeyChecking=yes mirror@46.101.222.25 <<EOF \
|
||||
|| echo "::warning::mirror upload failed: the updater will download from Gitea"
|
||||
-mkdir /srv/tm/$TAG
|
||||
put game_godot/TinMerezhi.exe /srv/tm/$TAG/TinMerezhi.exe.tmp
|
||||
-rm /srv/tm/$TAG/TinMerezhi.exe
|
||||
rename /srv/tm/$TAG/TinMerezhi.exe.tmp /srv/tm/$TAG/TinMerezhi.exe
|
||||
-rm /srv/tm/TinMerezhi.exe
|
||||
symlink /srv/tm/$TAG/TinMerezhi.exe /srv/tm/TinMerezhi.exe
|
||||
put /tmp/version.txt /srv/tm/version.txt
|
||||
-mkdir /srv/tm/img
|
||||
put itch/wide_cover_2520x1080.png /srv/tm/img/
|
||||
put itch/social_1200x630.png /srv/tm/img/
|
||||
put itch/favicon_512.png /srv/tm/img/
|
||||
put itch/screenshots/1_start.png /srv/tm/img/
|
||||
put itch/screenshots/2_crack.png /srv/tm/img/
|
||||
put itch/screenshots/6_act5.png /srv/tm/img/
|
||||
put itch/screenshots/11_endless_en.png /srv/tm/img/
|
||||
put site/index.html /srv/tm/index.html
|
||||
EOF
|
||||
rm -f /tmp/mirror_key
|
||||
echo "mirror: https://tinmerezhi.duckdns.org/$TAG/TinMerezhi.exe"
|
||||
|
||||
- name: Upload to Release
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
env:
|
||||
|
||||
1
ci/mirror_known_hosts
Normal file
1
ci/mirror_known_hosts
Normal file
@@ -0,0 +1 @@
|
||||
46.101.222.25 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDWagZdsEc7Ljc7qO0TudlpbCMtZZ4hlGbfvSwqxiJNc
|
||||
BIN
game_godot/TinMerezhi.exe
(Stored with Git LFS)
BIN
game_godot/TinMerezhi.exe
(Stored with Git LFS)
Binary file not shown.
@@ -238,7 +238,7 @@ help <команда> — докладно про будь-яку команду
|
||||
Обирається на початку (до першого зламу): difficulty novice | normal | paranoid.
|
||||
Новачок — трасування −25%, слідчі повільніші, +2 арешти.
|
||||
Звичайний — як задумано.
|
||||
Параноя — трасування +50%, слідчі швидші, на 1 арешт менше; гра зберігається
|
||||
Параноя — трасування +90%, слідчі швидші, на 1 арешт менше; гра зберігається
|
||||
ЛИШЕ НА ПОЧАТКУ АКТУ: закрив вікно — повернешся на початок акту.
|
||||
|
||||
МІНІ-ІГРИ ЗЛАМУ
|
||||
|
||||
@@ -29,6 +29,9 @@ EVENTS = {"start", "ch", "bust", "over"}
|
||||
|
||||
lock = threading.Lock()
|
||||
hits = {}
|
||||
STATS_TTL = 60 # /stats рахує всю таблицю подій — частіше ніж раз на хвилину не треба
|
||||
_stats = [0.0, None]
|
||||
_stats_lock = threading.Lock()
|
||||
|
||||
|
||||
def db():
|
||||
@@ -165,6 +168,7 @@ def stats():
|
||||
|
||||
class H(BaseHTTPRequestHandler):
|
||||
server_version = "tm-online/1"
|
||||
timeout = 15 # повільний чи завислий клієнт не тримає потік вічно
|
||||
|
||||
def path_q(self):
|
||||
u = urlparse(self.path)
|
||||
@@ -204,7 +208,11 @@ class H(BaseHTTPRequestHandler):
|
||||
return self.send(400, {"error": "board"})
|
||||
return self.send(200, {"top": top(board)})
|
||||
if p == "/stats":
|
||||
return self.send(*stats())
|
||||
with _stats_lock:
|
||||
if time.time() - _stats[0] > STATS_TTL:
|
||||
_stats[:] = [time.time(), stats()]
|
||||
r = _stats[1]
|
||||
return self.send(*r)
|
||||
self.send(404, {"error": "not_found"})
|
||||
|
||||
def do_POST(self):
|
||||
|
||||
@@ -43,6 +43,8 @@ assert req("/event", {"sid": S, "ev": "hack", "ch": 1})[0] == 400
|
||||
st = req("/stats")[1]
|
||||
assert st["players"] == 1 and st["chapters"][0] == {"ch": 1, "reached": 1, "passed": 1, "median_acts": 12, "busts": 0, "game_over": 0, "quit_here": 0}, st
|
||||
assert st["chapters"][1]["busts"] == 1 and st["chapters"][1]["game_over"] == 1
|
||||
assert req("/event", {"sid": S, "ev": "start", "ch": 5})[0] == 200 and req("/stats")[1] == st, "/stats кешується"
|
||||
assert server.H.timeout > 0, "тайм-аут з'єднання"
|
||||
codes = [req("/event", {"sid": S, "ev": "start", "ch": 0}, ip="9.9.9.9")[0] for _ in range(35)]
|
||||
assert codes.count(429) == 5, "ліміт 30 за хвилину"
|
||||
print("server OK")
|
||||
|
||||
170
site/index.html
Normal file
170
site/index.html
Normal file
@@ -0,0 +1,170 @@
|
||||
<!doctype html>
|
||||
<html lang="uk">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>ТінМережі · Shadow Net</title>
|
||||
<meta name="description" content="Хакерська гра в терміналі українською та англійською · A hacking game played in a terminal, in Ukrainian and English">
|
||||
<meta property="og:title" content="ТінМережі · Shadow Net">
|
||||
<meta property="og:image" content="https://tinmerezhi.duckdns.org/img/social_1200x630.png">
|
||||
<link rel="icon" href="img/favicon_512.png">
|
||||
<!-- Сторінка гри на дзеркалі (CI кладе site/ та itch/ картинки в /srv/tm). Рекорди: /api/* → Caddy → сервер онлайн-рекордів (/tm-api). -->
|
||||
<style>
|
||||
:root { --bg: #0b0f0c; --panel: #111814; --line: #1f2e24; --fg: #c8f5d4; --dim: #6f9a7c; --acc: #39ff7a; --warn: #ffcc4d; --bad: #ff5c6c; }
|
||||
* { box-sizing: border-box; }
|
||||
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; }
|
||||
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; }
|
||||
header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
|
||||
h1 { color: var(--acc); font-size: 34px; margin: 0; text-shadow: 0 0 14px rgba(57,255,122,.45); }
|
||||
h2 { color: var(--acc); font-size: 20px; margin: 36px 0 12px; }
|
||||
h3 { color: var(--acc); font-size: 16px; margin: 0 0 10px; }
|
||||
a { color: var(--acc); }
|
||||
.lang button { background: var(--panel); color: var(--dim); border: 1px solid var(--line); padding: 4px 10px; font: inherit; cursor: pointer; border-radius: 6px; }
|
||||
.lang button.on { color: var(--acc); border-color: var(--acc); }
|
||||
.tag { color: var(--dim); margin: 6px 0 20px; }
|
||||
.hero { width: 100%; border: 1px solid var(--line); border-radius: 8px; display: block; }
|
||||
.cta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 20px 0; }
|
||||
.btn { display: inline-block; background: var(--acc); color: #04140a; font-weight: bold; padding: 12px 20px; border-radius: 8px; text-decoration: none; }
|
||||
.btn.alt { background: var(--panel); color: var(--acc); border: 1px solid var(--line); font-weight: normal; }
|
||||
.small { color: var(--dim); font-size: 14px; }
|
||||
ul.feat { padding-left: 20px; }
|
||||
ul.feat li { margin: 4px 0; }
|
||||
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 12px; }
|
||||
.shots img { width: 100%; border: 1px solid var(--line); border-radius: 6px; display: block; }
|
||||
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
|
||||
section.b { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; overflow-x: auto; }
|
||||
table { width: 100%; border-collapse: collapse; }
|
||||
th, td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
|
||||
th { color: var(--dim); font-weight: normal; font-size: 13px; }
|
||||
.n { text-align: right; font-variant-numeric: tabular-nums; }
|
||||
tr.first td { color: var(--warn); }
|
||||
.empty { color: var(--dim); }
|
||||
.bad { color: var(--bad); }
|
||||
footer { color: var(--dim); font-size: 13px; margin-top: 36px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<header>
|
||||
<h1 data-t="title">▓ ТІНЬ МЕРЕЖІ</h1>
|
||||
<div class="lang"><button data-l="uk">УКР</button> <button data-l="en">ENG</button></div>
|
||||
</header>
|
||||
<p class="tag" data-t="tag"></p>
|
||||
<img class="hero" src="img/wide_cover_2520x1080.png" alt="ТінМережі / Shadow Net">
|
||||
<div class="cta">
|
||||
<a class="btn" href="TinMerezhi.exe" data-t="dl"></a>
|
||||
<a class="btn alt" href="https://tuberon.itch.io/tinmerezhi">🎮 itch.io</a>
|
||||
<a class="btn alt" href="#records" data-t="recs"></a>
|
||||
<span class="small"><span data-t="ver"></span> <span id="ver">…</span> · Windows 10/11 · <span data-t="noinst"></span></span>
|
||||
</div>
|
||||
<p data-t="story"></p>
|
||||
<ul class="feat" id="feat"></ul>
|
||||
<h2 data-t="shots"></h2>
|
||||
<div class="shots">
|
||||
<img src="img/1_start.png" alt="" loading="lazy">
|
||||
<img src="img/2_crack.png" alt="" loading="lazy">
|
||||
<img src="img/6_act5.png" alt="" loading="lazy">
|
||||
<img src="img/11_endless_en.png" alt="" loading="lazy">
|
||||
</div>
|
||||
<h2 id="records" data-t="recs"></h2>
|
||||
<p class="small" data-t="recnote"></p>
|
||||
<div class="grid" id="boards"></div>
|
||||
<footer data-t="foot"></footer>
|
||||
</main>
|
||||
<script>
|
||||
const T = {
|
||||
uk: {
|
||||
title: "▓ ТІНЬ МЕРЕЖІ", tag: "Хакерська гра, де все робиш у терміналі.",
|
||||
dl: "⬇ Завантажити для Windows", recs: "🏆 Рекорди", ver: "Версія", noinst: "без встановлення",
|
||||
story: "Ти — Shadow, хакер-одинак. Таємничий Оракул дає завдання: від Wi-Fi кав'ярні до Нульового вузла, де ховається серце Пуйла. Скануй мережу, підбирай коди, відкривай порти, будуй маршрут через зламані сервери й стирай логи, бо трасування росте з кожною помилкою.",
|
||||
feat: ["6 актів, 48 глав і кілька кінцівок, що залежать від твоїх виборів",
|
||||
"45 серверів на анімованій мапі мережі: шари шифрування, закриті порти, активне трасування",
|
||||
"Міні-ігри зламу: обхід фаєрвола і словникова атака",
|
||||
"Суперники-хакери Cobra, Mantis і Nyx: перегони за замовлення, крадіжки й помста",
|
||||
"Соціальна інженерія, криптоголоволомки, чорний ринок експлойтів і рідкісні побічні квести",
|
||||
"Після фіналу: Нескінченна мережа з рекордами, щоденний виклик і New Game+",
|
||||
"Три складності: Новачок, Звичайний і Параноя (без збережень)",
|
||||
"Адаптивна синтвейв-музика, українська та англійська мови, автооновлення"],
|
||||
shots: "📸 Скриншоти",
|
||||
recnote: "Онлайн-рекорди надсилаються з гри лише за згодою (налаштування → онлайн-рекорди). Таблиці оновлюються щохвилини.",
|
||||
foot: "Розробник: JunioR. Гра і код — під ліцензією MIT. Рушій Godot.",
|
||||
boards: ["♾ Нескінченна мережа", "📅 Виклик дня", "🤖 1 · Кур'єр", "🤖 2 · Прибиральник", "🤖 3 · Збирач", "🤖 4 · Нічний рейс"],
|
||||
nick: "Нік", score: "Рахунок", depth: "Глибина", diff: "Складність", jobs: "Замовлень", lines: "Рядків", steps: "Кроків",
|
||||
diffs: ["Новачок", "Звичайний", "Параноя"], empty: "Поки порожньо. Стань першим!", down: "Сервер рекордів недоступний"
|
||||
},
|
||||
en: {
|
||||
title: "▓ SHADOW NET", tag: "A hacking game played entirely in a terminal.",
|
||||
dl: "⬇ Download for Windows", recs: "🏆 Leaderboards", ver: "Version", noinst: "no install",
|
||||
story: "You are Shadow, a lone hacker. The mysterious Oracle sends you jobs, from a café's Wi-Fi all the way to the Zero Node where Puilo's heart hides. Scan the network, crack codes, open ports, route through hacked servers and wipe your logs, because every mistake raises the trace.",
|
||||
feat: ["6 acts, 48 chapters and several endings shaped by your choices",
|
||||
"45 servers on an animated network map: encryption layers, closed ports, active tracing",
|
||||
"Hacking mini-games: firewall bypass and dictionary attack",
|
||||
"Rival hackers Cobra, Mantis and Nyx race you for jobs, steal from you and take revenge",
|
||||
"Social engineering, crypto puzzles, a black market of exploits and rare side quests",
|
||||
"After the finale: the Endless Network with leaderboards, a daily challenge and New Game+",
|
||||
"Three difficulties: Novice, Normal and Paranoid (no saves)",
|
||||
"Adaptive synthwave music, English and Ukrainian, auto-update"],
|
||||
shots: "📸 Screenshots",
|
||||
recnote: "Scores are sent from the game only if you opt in (settings → online leaderboards). Tables refresh every minute.",
|
||||
foot: "Developer: JunioR. The game and its code are MIT-licensed. Godot engine.",
|
||||
boards: ["♾ Endless Network", "📅 Daily", "🤖 1 · Courier", "🤖 2 · Janitor", "🤖 3 · Collector", "🤖 4 · Night Flight"],
|
||||
nick: "Nick", score: "Score", depth: "Depth", diff: "Difficulty", jobs: "Jobs", lines: "Lines", steps: "Steps",
|
||||
diffs: ["Novice", "Normal", "Paranoid"], empty: "Empty so far. Be the first!", down: "Leaderboard server unavailable"
|
||||
}
|
||||
};
|
||||
const DAY = "d" + new Date().toISOString().slice(0, 10).replaceAll("-", ""); // виклик дня — за UTC, як у грі
|
||||
const IDS = ["endless", DAY, "agent0", "agent1", "agent2", "agent3"];
|
||||
let lang = "uk";
|
||||
try { lang = localStorage.getItem("lang") || (navigator.language.startsWith("uk") ? "uk" : "en"); } catch (e) {}
|
||||
if (new URLSearchParams(location.search).get("lang") in T) lang = new URLSearchParams(location.search).get("lang");
|
||||
let tops = {}; // кеш таблиць, щоб перемикання мови не ходило в мережу
|
||||
|
||||
function el(tag, text, cls) { const e = document.createElement(tag); if (text !== undefined) e.textContent = text; if (cls) e.className = cls; return e; }
|
||||
|
||||
function render() {
|
||||
const t = T[lang];
|
||||
document.documentElement.lang = lang;
|
||||
for (const e of document.querySelectorAll("[data-t]")) e.textContent = t[e.dataset.t];
|
||||
for (const b of document.querySelectorAll("[data-l]")) b.classList.toggle("on", b.dataset.l === lang);
|
||||
document.getElementById("feat").replaceChildren(...t.feat.map(f => el("li", f)));
|
||||
document.getElementById("boards").replaceChildren(...IDS.map((id, k) => {
|
||||
const s = el("section", undefined, "b"), tb = el("table"), head = el("tr");
|
||||
s.append(el("h3", t.boards[k]));
|
||||
const cols = k === 0 ? ["#", t.nick, t.score, t.depth, t.diff] : k === 1 ? ["#", t.nick, t.score, t.jobs] : ["#", t.nick, t.lines, t.steps];
|
||||
cols.forEach((c, i) => head.append(el("th", c, i > 1 && c !== t.diff ? "n" : "")));
|
||||
tb.append(head); s.append(tb);
|
||||
const top = tops[id];
|
||||
if (top === undefined) s.append(el("p", "…", "empty"));
|
||||
else if (top === null) s.append(el("p", t.down, "bad"));
|
||||
else if (!top.length) s.append(el("p", t.empty, "empty"));
|
||||
else top.forEach((r, i) => {
|
||||
const tr = el("tr");
|
||||
tr.append(el("td", i + 1), el("td", r.nick), el("td", r.a.toLocaleString(lang), "n"), el("td", r.b, "n"));
|
||||
if (k === 0) tr.append(el("td", t.diffs[r.diff] ?? ""));
|
||||
if (i === 0) tr.className = "first";
|
||||
tb.append(tr);
|
||||
});
|
||||
return s;
|
||||
}));
|
||||
}
|
||||
|
||||
async function load() {
|
||||
await Promise.all(IDS.map(async id => {
|
||||
try { const r = await fetch("api/top?board=" + id, {cache: "no-store"}); tops[id] = r.ok ? (await r.json()).top : null; }
|
||||
catch (e) { tops[id] = null; }
|
||||
}));
|
||||
render();
|
||||
}
|
||||
|
||||
for (const b of document.querySelectorAll("[data-l]")) b.onclick = () => {
|
||||
lang = b.dataset.l;
|
||||
try { localStorage.setItem("lang", lang); } catch (e) {}
|
||||
render();
|
||||
};
|
||||
fetch("version.txt", {cache: "no-store"}).then(r => r.ok ? r.text() : "–").then(v => document.getElementById("ver").textContent = v.trim()).catch(() => {});
|
||||
render();
|
||||
load();
|
||||
setInterval(load, 60000);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -44,7 +44,7 @@ const HELP := {
|
||||
"about": "about — про гру і розробника.",
|
||||
"update": "update — перевірити й завантажити нову версію гри.",
|
||||
"choose": "choose 1|2 — вибір у фіналі акту.",
|
||||
"difficulty": "difficulty novice|normal|paranoid — складність (лише до першого зламу).\nНовачок: трасування −25%, слідчі повільніші, +2 арешти. Параноя: трасування +50%, слідчі швидші, на 1 арешт менше, за замками серверів ще й код, збереження лише на початку кожного акту.",
|
||||
"difficulty": "difficulty novice|normal|paranoid — складність (лише до першого зламу).\nНовачок: трасування −25%, слідчі повільніші, +2 арешти, +20% дій у термінових главах. Параноя: трасування +90%, слідчі швидші, на 1 арешт менше, за замками серверів ще й код, збереження лише на початку кожного акту.",
|
||||
"firewall": "firewall — міні-гра \"Обхід фаєрвола\" перед зламом: вимкни всі фільтри (перемикач змінює себе й сусідів).\nУспіх — трасування на сервері −40% до відключення. Провал — +10%. Одна спроба за підключення.\nЗамок: на деяких серверах (🧱 📖 📞 🔐 у scan) саме ця атака відкриває зовнішній шар замість коду.",
|
||||
"dict": "dict — міні-гра \"Словникова атака\": вгадай пароль адміна серед слів дампу (видно, скільки літер на місцях).\nУспіх — наступний crack почнеться з 2 відомими цифрами. Одна спроба за підключення.\nЗамок: на деяких серверах (🧱 📖 📞 🔐 у scan) саме ця атака відкриває зовнішній шар замість коду.",
|
||||
"rivals": "rivals — суперники-хакери: хто в кого що вкрав і хто має на тебе образу.\nНа сервері із замовленням суперник може почати перегони: забери файл, поки не минув час, інакше оплата вдвічі менша.\nПереможений тримає образу і може злити твій IP слідчим, поки ти онлайн.",
|
||||
|
||||
@@ -29,10 +29,10 @@ static func new_layer(g: Main, k, length := -1) -> void:
|
||||
for d in ds.slice(0, int(g.eff(g.skills["crypto"]))): # Криптограф
|
||||
k["absent"][d] = true
|
||||
|
||||
# стан внутрішнього шару живе на сервері між візитами
|
||||
# стан шару (і зовнішнього теж) живе на сервері між візитами, доки сервер не відкрито чи не закрито знову (арешт, Відлуння)
|
||||
# shortcut: між запусками гри зберігається лише номер шару, не його код — після перезапуску шар отримає новий пароль
|
||||
static func keep_layer(g: Main) -> void:
|
||||
if g.crack != null and g.crack["layer"] > 1:
|
||||
if g.crack != null:
|
||||
g.cur["layer_state"] = {"code": g.crack["code"], "known": g.crack["known"], "present": g.crack["present"], "absent": g.crack["absent"], "hist": g.crack["hist"]}
|
||||
|
||||
static func auto_enter(g: Main) -> void:
|
||||
@@ -317,29 +317,34 @@ static func c_crack(g: Main, _a: String) -> void:
|
||||
var n := mini(T.CODE_MAX, 3 + lvl / 2) # 7-значний код наосліп + 3 шари — забагато навіть для уважного гравця
|
||||
if g.Variety.aff_of(g, g.cur) == "old":
|
||||
n = maxi(3, n - 1)
|
||||
var code := g.random_code(n)
|
||||
var known := {}
|
||||
# зовнішній шар після відступу: той самий пароль і все, що про нього вже з'ясовано (інакше захист 7–8 на Параної — лотерея)
|
||||
var outer = g.cur["layer_state"] if not g.cur["layer_done"] and g.cur["layer_state"] != null and g.cur["layer_state"]["code"].length() == n else null
|
||||
var code: String = outer["code"] if outer != null else g.random_code(n)
|
||||
var known: Dictionary = outer["known"].duplicate() if outer != null else {}
|
||||
var pos := range(n)
|
||||
pos.shuffle()
|
||||
for i in pos.slice(0, mini(g.hw["cpu"] - 1, n - 2)): # хоч дві цифри гравець вгадує сам
|
||||
known[i] = true
|
||||
if outer == null: # обладнання підказує раз на пароль: перепідключення не відкриває нових цифр
|
||||
for i in pos.slice(0, mini(g.hw["cpu"] - 1, n - 2)): # хоч дві цифри гравець вгадує сам
|
||||
known[i] = true
|
||||
var bonus: int = g.cur.get("dict_bonus", 0) # пароль адміна зі словникової атаки
|
||||
g.cur.erase("dict_bonus")
|
||||
for i in pos:
|
||||
if bonus > 0 and not known.has(i) and known.size() < n - 1:
|
||||
known[i] = true
|
||||
bonus -= 1
|
||||
var absent := {}
|
||||
var absent: Dictionary = outer["absent"].duplicate() if outer != null else {}
|
||||
var ds := g.DIGITS.filter(func(d): return not d in code)
|
||||
ds.shuffle()
|
||||
for d in ds.slice(0, int(T.RAM_ABSENT * g.eff(g.hw["ram"])) + int(g.eff(g.skills["social"]))):
|
||||
for d in ds.slice(0, 0 if outer != null else int(T.RAM_ABSENT * g.eff(g.hw["ram"])) + int(g.eff(g.skills["social"]))):
|
||||
absent[d] = true
|
||||
var jam := maxi(0, lvl - T.JAM_FROM) # фаєрвол сильних серверів глушить відеокарту і ШІ-асистента
|
||||
var layers := g.layers_of(lvl)
|
||||
var rotate := T.ROTATE_AFTER if lvl >= T.ROTATE_FROM else 0 # зміна пароля шару після помилок поспіль
|
||||
g.crack = {"code": code, "known": known, "absent": absent, "present": {}, "blind": g.is_blind(lvl),
|
||||
g.crack = {"code": code, "known": known, "absent": absent, "present": outer["present"].duplicate() if outer != null else {}, "blind": g.is_blind(lvl),
|
||||
"free": maxi(0, int(g.eff(g.hw["gpu"])) - jam), "free_hints": maxi(0, int(g.eff(g.hw["ai"])) - jam), "layer": 1, "layers": layers,
|
||||
"rotate": rotate, "since": 0, "inner_len": maxi(3, n - 2), "hist": [], "ice": g.Variety.has_ice(g, g.cur)}
|
||||
"rotate": rotate, "since": 0, "inner_len": maxi(3, n - 2), "hist": outer["hist"] if outer != null else [], "ice": g.Variety.has_ice(g, g.cur)}
|
||||
if not g.cur["layer_done"]:
|
||||
keep_layer(g)
|
||||
if g.crack["ice"]:
|
||||
g.crack["free"] = 0
|
||||
g.crack["free_hints"] = 0
|
||||
|
||||
@@ -21,6 +21,8 @@ const FACE := [
|
||||
" ▀▀██▄▄▄▄▄▄▄▄██▀▀ ",
|
||||
]
|
||||
const NOISE := "█▓▒░#%@&01"
|
||||
# своя випадковість для прикрас: кадри й таймери залежать від швидкості машини, а randf() гри — ні (бот у CI й під Wine грає однаково)
|
||||
static var rng := RandomNumberGenerator.new()
|
||||
|
||||
static func calm(g: Main) -> bool:
|
||||
return g.cfg.get("calm", false)
|
||||
@@ -59,7 +61,7 @@ static func tick(g: Main, delta: float) -> void:
|
||||
# рамка тремтить, коли от-от відстежать (не заважаючи трусінню від помилок)
|
||||
g.shake_t = maxf(0.0, g.shake_t - delta)
|
||||
if g.shake_t <= 0.0:
|
||||
g.ui.position = Vector2(randf_range(-2.5, 2.5), randf_range(-1.2, 1.2)) * k * g.threat_v if g.threat_v > 0.7 and randf() < 0.12 else Vector2.ZERO
|
||||
g.ui.position = Vector2(rng.randf_range(-2.5, 2.5), rng.randf_range(-1.2, 1.2)) * k * g.threat_v if g.threat_v > 0.7 and rng.randf() < 0.12 else Vector2.ZERO
|
||||
# візуалізація зламу: які цифри щойно знайдено
|
||||
if g.crack != null:
|
||||
if g.crack["code"] != g.cv_code:
|
||||
@@ -78,19 +80,19 @@ static func tick(g: Main, delta: float) -> void:
|
||||
var o = g.get_node_or_null(n)
|
||||
if o:
|
||||
o.queue_redraw()
|
||||
if g.call_face != null and is_instance_valid(g.call_face) and not calm(g) and randf() < 0.35:
|
||||
if g.call_face != null and is_instance_valid(g.call_face) and not calm(g) and rng.randf() < 0.35:
|
||||
g.call_face.text = glitch_lines(FACE, 0.06)
|
||||
g.call_face.position.x = randf_range(-3, 3) if randf() < 0.3 else 0.0
|
||||
g.call_face.position.x = rng.randf_range(-3, 3) if rng.randf() < 0.3 else 0.0
|
||||
|
||||
static func glitch_lines(lines: Array, amount: float) -> String:
|
||||
var res := PackedStringArray()
|
||||
for ln in lines:
|
||||
var s: String = ln
|
||||
for i in s.length():
|
||||
if s[i] != " " and randf() < amount:
|
||||
s[i] = NOISE[randi() % NOISE.length()]
|
||||
if randf() < amount * 2:
|
||||
s = s.substr(1) + " " if randf() < 0.5 else " " + s.left(s.length() - 1)
|
||||
if s[i] != " " and rng.randf() < amount:
|
||||
s[i] = NOISE[rng.randi() % NOISE.length()]
|
||||
if rng.randf() < amount * 2:
|
||||
s = s.substr(1) + " " if rng.randf() < 0.5 else " " + s.left(s.length() - 1)
|
||||
res.append(s)
|
||||
return "\n".join(res)
|
||||
|
||||
@@ -226,13 +228,13 @@ static func map_node_fx(g: Main, c: Control) -> void:
|
||||
var p: Vector2 = g._mp(g.map_pos[e[0]])
|
||||
var r: float = 12.0 * g.map_scale
|
||||
var a := 1.0 - f
|
||||
var j := Vector2(randf_range(2, 6) * a, 0)
|
||||
var j := Vector2(rng.randf_range(2, 6) * a, 0)
|
||||
c.draw_circle(p - j, r, Color(1, 0, 0.35, 0.45 * a))
|
||||
c.draw_circle(p + j, r, Color(0, 1, 1, 0.45 * a))
|
||||
var sc := Color(1, 0.25, 0.25, 0.7 * a) if e[2] == "burn" else Color(0.8, 1, 0.85, 0.7 * a)
|
||||
for s in 6:
|
||||
c.draw_rect(Rect2(p + Vector2(randf_range(-r * 2.2, 0), randf_range(-r * 1.6, r * 1.6)), Vector2(randf_range(r, r * 3), randf_range(1, 3))), sc)
|
||||
if randf() < 0.5 or f > 0.5:
|
||||
c.draw_rect(Rect2(p + Vector2(rng.randf_range(-r * 2.2, 0), rng.randf_range(-r * 1.6, r * 1.6)), Vector2(rng.randf_range(r, r * 3), rng.randf_range(1, 3))), sc)
|
||||
if rng.randf() < 0.5 or f > 0.5:
|
||||
c.draw_circle(p, r * 1.05, Color(0, 0, 0, 0.75 * a))
|
||||
|
||||
# ── ASCII-емблема сервера: симетричний "логотип" 7×4 з хешу назви ──
|
||||
@@ -372,7 +374,7 @@ static func _city(gr: Array, lit: float, flicker := false) -> void:
|
||||
var win := xx % 2 == 1 and yy % 2 == 1 and xx < bw - 1 and yy < bh - 1
|
||||
if win:
|
||||
var on: bool = (abs(hash(gx * 31 + gy * 17)) % 1000) / 1000.0 < lit
|
||||
if flicker and on and randf() < 0.05:
|
||||
if flicker and on and rng.randf() < 0.05:
|
||||
on = false
|
||||
_put(gr, gx, gy, "█" if on else "·", Color("#ffdd66") if on else Color(0.3, 0.4, 0.35))
|
||||
else:
|
||||
@@ -395,7 +397,7 @@ static func _scene(id: String, t: float) -> Array:
|
||||
"end_silence": # ботоферма замовкає, місто гасне
|
||||
_city(gr, 1.0 - p)
|
||||
for r in 6:
|
||||
var on: bool = randf() < 0.6 and p < 0.55 + r * 0.05
|
||||
var on: bool = rng.randf() < 0.6 and p < 0.55 + r * 0.05
|
||||
_put(gr, W - 9, 2 + r * 2, "[" + ("■" if on else "□") + "■■]", Color("#ff5555") if on else Color(0.3, 0.3, 0.3))
|
||||
if p >= 1.0:
|
||||
_put(gr, 4, 3, "_" if int(t * 2) % 2 == 0 else " ", Color("#33ff66"))
|
||||
@@ -449,7 +451,7 @@ static func _scene(id: String, t: float) -> Array:
|
||||
var gone: bool = (abs(hash(xx * 11 + i * 7)) % 100) / 100.0 * 0.6 + (fig.size() - i) / float(fig.size()) * 0.4 < p
|
||||
if s[xx] != " " and not gone:
|
||||
_put(gr, (W - s.length()) / 2 + xx, fy + i, s[xx], Color(0.75, 0.85, 0.8))
|
||||
elif s[xx] != " " and p < 1.0 and randf() < 0.3:
|
||||
elif s[xx] != " " and p < 1.0 and rng.randf() < 0.3:
|
||||
_put(gr, (W - s.length()) / 2 + xx, fy + i, "░", Color(0.4, 0.5, 0.45))
|
||||
"end_zero": # обличчя глітчить, гасне, як старий телевізор, і вранці місто світиться
|
||||
if t < 2.0:
|
||||
|
||||
@@ -722,6 +722,8 @@ const EN := {
|
||||
"⚠ Слідчі зовсім близько! Повернись і зітри логи (wipe), поки не пізно.": "⚠ The investigators are very close! Go back and wipe the logs (wipe) before it's too late.",
|
||||
"ТЕБЕ ВІДСТЕЖИЛИ": "YOU'VE BEEN TRACED",
|
||||
"📜 Контракт провалено: тебе заарештували з файлом.": "📜 Contract failed: you were arrested with the file.",
|
||||
"🔒 Оновитися можна після зламу: заверши його або відключись (disconnect).": "🔒 You can update after the crack: finish it or disconnect.",
|
||||
"📦 %s конфісковано під час арешту — доведеться завантажити знову.": "📦 %s was confiscated in the arrest — you will have to download it again.",
|
||||
"!!! %s !!! Конфісковано $%d.": "!!! %s !!! $%d confiscated.",
|
||||
"ВІДСТЕЖЕНО": "TRACED",
|
||||
"%s · конфісковано $%d": "%s · $%d confiscated",
|
||||
@@ -1061,6 +1063,7 @@ const EN := {
|
||||
"не вдалося записати файл — перевір вільне місце й права на папку гри": "couldn't write the file — check free disk space and permissions for the game folder",
|
||||
"сервер відповів кодом %d": "the server responded with code %d",
|
||||
"з'єднання обірвалось на %.1f з %.1f МБ": "the connection dropped at %.1f of %.1f MB",
|
||||
"⚠ Швидкий сервер не віддав файл (%s). Качаю з основного…": "⚠ The fast server did not deliver the file (%s). Downloading from the main one…",
|
||||
"з'єднання зависло на %.1f з %.1f МБ": "the connection stalled at %.1f of %.1f MB",
|
||||
"Біржа \"Меридіан\"": "\"Meridian\" Exchange",
|
||||
"Енергохаб \"Дніпро-Сітка\"": "\"Dnipro-Grid\" Power Hub",
|
||||
@@ -1369,7 +1372,7 @@ const EN := {
|
||||
"🤍 Біла команда: \"Ключ від клітки — у тебе. Ми довіряємо тобі більше, ніж будь-якому замку.\"": "🤍 White Team: \"You hold the key to the cage. We trust you more than any lock.\"",
|
||||
"🌀 Відлуння: \"Він був моїм початком. Тепер мережу вартую я — і я не забуду третього правила.\"": "🌀 Echo: \"He was my beginning. Now I guard the network — and I won't forget the third rule.\"",
|
||||
"🌀 Відлуння вартує клітку Пуйла: батька стереже його ж відлуння. \"Він питає, чому я не такий, як він. Я кажу: через Shadow.\"": "🌀 Echo guards Puilo's cage: the father watched by his own echo. \"He asks why I'm not like him. I tell him: because of Shadow.\"",
|
||||
"difficulty novice|normal|paranoid — складність (лише до першого зламу).\nНовачок: трасування −25%, слідчі повільніші, +2 арешти. Параноя: трасування +50%, слідчі швидші, на 1 арешт менше, за замками серверів ще й код, збереження лише на початку кожного акту.": "difficulty novice|normal|paranoid — difficulty (only before your first crack).\nNovice: trace −25%, investigators slower, +2 arrests. Paranoid: trace +50%, investigators faster, 1 arrest fewer, server locks still have a code behind them, saves only at the start of each act.",
|
||||
"difficulty novice|normal|paranoid — складність (лише до першого зламу).\nНовачок: трасування −25%, слідчі повільніші, +2 арешти, +20% дій у термінових главах. Параноя: трасування +90%, слідчі швидші, на 1 арешт менше, за замками серверів ще й код, збереження лише на початку кожного акту.": "difficulty novice|normal|paranoid — difficulty (only before your first crack).\nNovice: trace −25%, investigators slower, +2 arrests, +20% actions in urgent chapters. Paranoid: trace +90%, investigators faster, 1 arrest fewer, server locks still have a code behind them, saves only at the start of each act.",
|
||||
"🆕 Нові команди: %s (докладно — help <команда>).": "🆕 New commands: %s (details — help <command>).",
|
||||
" ще: daily, top, settings, lang, sound, save, update, about, achievements, newgame, clear": " more: daily, top, settings, lang, sound, save, update, about, achievements, newgame, clear",
|
||||
"🔒 Ще %d команд відкриються з рівнем і сюжетом. help all — повний список.": "🔒 %d more commands unlock with your level and the story. help all — the full list.",
|
||||
@@ -1382,7 +1385,7 @@ const EN := {
|
||||
"🔎 Ціль невідома: прочитай %s (cat) на \"%s\" (№%d).": "🔎 Target unknown: read %s (cat) on \"%s\" (#%d).",
|
||||
" Частин залито: %d/%d.": " Parts uploaded: %d/%d.",
|
||||
"☠ Параноя: гра зберігається лише на початку кожного акту.": "☠ Paranoid: the game only saves at the start of each act.",
|
||||
"🎚 Складність: %s. Варіанти: novice (Новачок: трасування −25%%, +2 арешти), normal, paranoid (Параноя: трасування +50%%, слідчі швидші, на 1 арешт менше, за замками ще й код, ЗБЕРЕЖЕННЯ ЛИШЕ НА ПОЧАТКУ АКТУ).": "🎚 Difficulty: %s. Options: novice (Novice: trace −25%%, +2 arrests), normal, paranoid (Paranoid: trace +50%%, faster investigators, 1 arrest fewer, a code behind every lock, SAVES ONLY AT THE START OF AN ACT).",
|
||||
"🎚 Складність: %s. Варіанти: novice (Новачок: трасування −25%%, +2 арешти, +20%% дій у термінових главах), normal, paranoid (Параноя: трасування +90%%, слідчі швидші, на 1 арешт менше, за замками ще й код, ЗБЕРЕЖЕННЯ ЛИШЕ НА ПОЧАТКУ АКТУ).": "🎚 Difficulty: %s. Options: novice (Novice: trace −25%%, +2 arrests, +20%% actions in urgent chapters), normal, paranoid (Paranoid: trace +90%%, faster investigators, 1 arrest fewer, a code behind every lock, SAVES ONLY AT THE START OF AN ACT).",
|
||||
"☠ Параноя: гра зберігається лише на початку кожного акту. Закриєш вікно — повернешся на початок акту.": "☠ Paranoid: the game only saves at the start of each act. Close the window — and you go back to the start of the act.",
|
||||
"🌐 Онлайн-рекорди і статистика": "🌐 Online leaderboards and stats",
|
||||
"Твої результати в Нескінченній мережі, щоденному виклику й задачах агентів можуть потрапити в спільну онлайн-таблицю (top). Надсилаються лише нік і рахунок.\n\nАнонімна статистика допомагає розробнику побачити, на якій главі гравці застрягають: номер глави, кількість дій і арештів, складність, мова й версія. Без ніка, імені чи IP.\n\nОбидва вимкнені, поки ти їх не ввімкнеш. Змінити можна будь-коли командою settings.": "Your Endless Network, daily challenge and agent task results can go to a shared online leaderboard (top). Only your nickname and score are sent.\n\nAnonymous stats help the developer see which chapter players get stuck on: chapter number, action and arrest counts, difficulty, language and version. No nickname, name or IP.\n\nBoth are off until you turn them on. You can change this any time with the settings command.",
|
||||
|
||||
@@ -543,25 +543,35 @@ func _emit(text: String, cls: String) -> void:
|
||||
|
||||
# Довгі сесії не гальмують: тримаємо останні MAX_LINES рядків.
|
||||
# remove_paragraph у Godot 4.3 аварійно падає, тому зрідка (раз на 200 рядків) перемальовуємо вивід заново.
|
||||
func _track(text: String, cls := "") -> void:
|
||||
log_lines.append([text, cls])
|
||||
# redraw — як перемалювати рядок із кольорами (емблема, фішки, лист); без нього — звичайний рядок кольору cls.
|
||||
func _track(text: String, cls := "", redraw := Callable()) -> void:
|
||||
log_lines.append([text, cls, redraw])
|
||||
if log_lines.size() > MAX_LINES + 200:
|
||||
log_lines = log_lines.slice(-MAX_LINES)
|
||||
out.clear()
|
||||
for l in log_lines:
|
||||
_emit(l[0], l[1])
|
||||
if l[2].is_valid():
|
||||
l[2].call()
|
||||
else:
|
||||
_emit(l[0], l[1])
|
||||
|
||||
# рядок з ASCII-емблемою ліворуч (її колір — окремо)
|
||||
func say_logo(art: String, art_col: Color, text: String, cls: String) -> void:
|
||||
_emit_logo(art, art_col, text, cls)
|
||||
_track(art + " " + text, cls, _emit_logo.bind(art, art_col, text, cls))
|
||||
|
||||
func _emit_logo(art: String, art_col: Color, text: String, cls: String) -> void:
|
||||
out.push_color(art_col)
|
||||
out.add_text(art + " ")
|
||||
out.pop()
|
||||
_emit(text, cls)
|
||||
_track(art + " " + text, cls)
|
||||
|
||||
# рядок із кольоровими "фішками": [[текст, колір фону або null], ...]
|
||||
func say_chips(parts: Array) -> void:
|
||||
var plain := ""
|
||||
_emit_chips(parts)
|
||||
_track(" ".join(PackedStringArray(parts.map(func(p): return p[0]))).strip_edges(), "", _emit_chips.bind(parts))
|
||||
|
||||
func _emit_chips(parts: Array) -> void:
|
||||
for p in parts:
|
||||
if p[1] != null:
|
||||
out.push_bgcolor(p[1])
|
||||
@@ -571,9 +581,7 @@ func say_chips(parts: Array) -> void:
|
||||
out.pop()
|
||||
out.pop()
|
||||
out.add_text(" ")
|
||||
plain += p[0] + " "
|
||||
out.newline()
|
||||
_track(plain.strip_edges())
|
||||
|
||||
func mail(from: String, text: String) -> void:
|
||||
Popups.mail(self, from, text)
|
||||
@@ -626,7 +634,7 @@ func _process(delta: float) -> void:
|
||||
btn_scroll.custom_minimum_size.y = minf(btns.get_combined_minimum_size().y, maxf(120.0, size.y * 0.34))
|
||||
map_bg.queue_redraw() # пульси, з'єднання, слідопит — щокадру; статичний шар — лише в render()
|
||||
map_fx.queue_redraw()
|
||||
ticker.position.x -= 70.0 * delta
|
||||
ticker.position.x = 0.0 if Gfx.calm(self) else ticker.position.x - 70.0 * delta # «Менше анімацій»: стрічка стоїть
|
||||
if ticker.position.x < -ticker.size.x:
|
||||
_fill_ticker()
|
||||
ticker.position.x = ticker_bar.size.x
|
||||
@@ -665,19 +673,22 @@ func _input(e: InputEvent) -> void:
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
func _tick_rain() -> void:
|
||||
rain.visible = not Gfx.calm(self) # «Менше анімацій»: без дощу символів
|
||||
if not rain.visible:
|
||||
return
|
||||
var cols := int(rain.size.x / 16)
|
||||
if drops.size() != cols:
|
||||
drops = []
|
||||
for i in cols:
|
||||
drops.append(randf() * rain.size.y / 16)
|
||||
drops.append(Gfx.rng.randf() * rain.size.y / 16)
|
||||
for i in cols:
|
||||
drops[i] = 0.0 if drops[i] * 16 > rain.size.y and randf() > 0.975 else drops[i] + 1
|
||||
drops[i] = 0.0 if drops[i] * 16 > rain.size.y and Gfx.rng.randf() > 0.975 else drops[i] + 1
|
||||
rain.queue_redraw()
|
||||
|
||||
func _draw_rain() -> void:
|
||||
for i in drops.size():
|
||||
for t in 14:
|
||||
var ch := RAIN_CHARS[randi() % RAIN_CHARS.length()]
|
||||
var ch := RAIN_CHARS[Gfx.rng.randi() % RAIN_CHARS.length()]
|
||||
rain.draw_char(font, Vector2(i * 16, (drops[i] - t) * 16), ch, 15, Color(0.2, 1, 0.4, 1.0 - t / 14.0)) # draw_char не шейпить текст — у рази швидше
|
||||
|
||||
func _on_submit(text: String) -> void:
|
||||
@@ -886,6 +897,11 @@ func arrest(reason: String) -> void:
|
||||
if cur != null:
|
||||
Story._lock(cur)
|
||||
cur["logs"] = false
|
||||
for f in cur["files"]: # файл "піти без логів" конфісковано: інакше після арешту connect + disconnect зараховував главу
|
||||
if done.has("+" + f) and not done.has(f):
|
||||
done.erase("+" + f)
|
||||
done["?" + f] = true # ціль розвідки вже відома
|
||||
say(L.t("📦 %s конфісковано під час арешту — доведеться завантажити знову.") % f, "err")
|
||||
var burnt := route_servers()
|
||||
for s in burnt:
|
||||
node_fx.append([servers.find(s), time, "burn"])
|
||||
@@ -1140,7 +1156,11 @@ func add_news(h: String) -> void:
|
||||
func _fill_ticker() -> void:
|
||||
var items := news.slice(-3)
|
||||
var w: Array = Extra.WORLD_NEWS.duplicate()
|
||||
w.shuffle()
|
||||
for i in range(w.size() - 1, 0, -1): # Фішер — Єйтс на Gfx.rng: стрічка крутиться в реальному часі й не має зсувати randf() гри
|
||||
var j := Gfx.rng.randi_range(0, i)
|
||||
var t = w[i]
|
||||
w[i] = w[j]
|
||||
w[j] = t
|
||||
items.append_array(w.slice(0, 5 - items.size()))
|
||||
ticker.text = "📰 " + " ◆ ".join(PackedStringArray(items))
|
||||
ticker.reset_size()
|
||||
@@ -1211,7 +1231,7 @@ func c_difficulty(a: String) -> void:
|
||||
if a.is_valid_int() and int(a) >= 1 and int(a) <= 3:
|
||||
i = int(a) - 1
|
||||
if i < 0:
|
||||
say(L.t("🎚 Складність: %s. Варіанти: novice (Новачок: трасування −25%%, +2 арешти), normal, paranoid (Параноя: трасування +50%%, слідчі швидші, на 1 арешт менше, за замками ще й код, ЗБЕРЕЖЕННЯ ЛИШЕ НА ПОЧАТКУ АКТУ).") % L.t(T.DIFF_NAMES[diff]), "info")
|
||||
say(L.t("🎚 Складність: %s. Варіанти: novice (Новачок: трасування −25%%, +2 арешти, +20%% дій у термінових главах), normal, paranoid (Параноя: трасування +90%%, слідчі швидші, на 1 арешт менше, за замками ще й код, ЗБЕРЕЖЕННЯ ЛИШЕ НА ПОЧАТКУ АКТУ).") % L.t(T.DIFF_NAMES[diff]), "info")
|
||||
return
|
||||
if not can_change_diff():
|
||||
say(L.t("Складність обирають на початку гри (до першого зламу). Почни нову гру: newgame."), "err")
|
||||
|
||||
@@ -99,11 +99,11 @@ static func c_disconnect(g: Main, _a: String) -> void:
|
||||
if s["logs"] and not g.heat.any(func(h): return h["ip"] == s["ip"]):
|
||||
g.heat.append({"ip": s["ip"], "t": g.investigation_time(s)})
|
||||
g.say(L.t("⚠ Ти лишив логи на \"%s\". Почалося розслідування: %d дій, щоб повернутися і стерти їх (wipe).") % [s["name"], g.investigation_time(s)], "err")
|
||||
if g.endless == null:
|
||||
g.Variety.on_disconnect(g, s) # ще онлайн: перегони за це замовлення зараховуються як виграні
|
||||
g.cur = null
|
||||
g.trace = 0.0
|
||||
g.say(L.t("Відключено. Трасування скинуто."))
|
||||
if g.endless == null:
|
||||
g.Variety.on_disconnect(g, s)
|
||||
var m = g.missions[g.mission]
|
||||
if g.endless == null and m.get("clean", false) and g.done.has("+" + m["file"]) and g.srv_of(m["file"]) == s:
|
||||
if s["logs"]:
|
||||
|
||||
@@ -7,6 +7,15 @@ const L = preload("res://lang.gd") # мова: L.t() у коді, L.wrap() —
|
||||
# лист від персонажа: аватар, ім'я, текст друкується
|
||||
static func mail(g: Main, from: String, text: String) -> void:
|
||||
var before := g.out.get_total_character_count()
|
||||
_emit_mail(g, from, text)
|
||||
g._track(from + ": " + text, "mail", _emit_mail.bind(g, from, text))
|
||||
g.out.visible_characters = before
|
||||
g.typing = true
|
||||
g.voice_hz = 150.0 + (abs(hash(from)) % 6) * 45.0 # кожен персонаж "говорить" своїм тоном
|
||||
fx(g, "mail")
|
||||
_show_call(g, from, text)
|
||||
|
||||
static func _emit_mail(g: Main, from: String, text: String) -> void:
|
||||
g.out.push_color(g.COL["mail"])
|
||||
g.out.push_font_size(26)
|
||||
g.out.add_text(g.avatars.get(from, "📨"))
|
||||
@@ -20,12 +29,6 @@ static func mail(g: Main, from: String, text: String) -> void:
|
||||
g.out.pop()
|
||||
g.out.pop()
|
||||
g.out.newline()
|
||||
g._track(from + ": " + text, "mail")
|
||||
g.out.visible_characters = before
|
||||
g.typing = true
|
||||
g.voice_hz = 150.0 + (abs(hash(from)) % 6) * 45.0 # кожен персонаж "говорить" своїм тоном
|
||||
fx(g, "mail")
|
||||
_show_call(g, from, text)
|
||||
|
||||
# Картка "📡 вхідне повідомлення": аватар пульсує, еквалайзер "говорить", поки лист друкується
|
||||
static func _show_call(g: Main, from: String, text := "") -> void:
|
||||
@@ -105,10 +108,10 @@ static func _tick_call(g: Main, delta: float) -> void:
|
||||
var bars := "▁▂▃▄▅▆▇"
|
||||
var eq := ""
|
||||
for i in 14:
|
||||
eq += bars[randi() % bars.length()]
|
||||
eq += bars[Gfx.rng.randi() % bars.length()]
|
||||
g.call_eq.text = eq
|
||||
if g.sound and g.notes.size() < 2 and randf() < 0.5: # "голос": синтезовані склади
|
||||
g.notes.append([g.voice_hz * (1.0 + (randi() % 5) * 0.08), 0.04, "sine"])
|
||||
if g.sound and g.notes.size() < 2 and Gfx.rng.randf() < 0.5: # "голос": синтезовані склади
|
||||
g.notes.append([g.voice_hz * (1.0 + (Gfx.rng.randi() % 5) * 0.08), 0.04, "sine"])
|
||||
return
|
||||
g.call_eq.text = "▁".repeat(14)
|
||||
g.call_left -= delta
|
||||
|
||||
@@ -99,14 +99,14 @@ static func _finish_mission(g: Main) -> void:
|
||||
g.stats["ch_acts"] = 0
|
||||
g.mission += 1
|
||||
var nm = g.missions[g.mission]
|
||||
g.deadline = int(round(nm["limit"] * Modes.ng_limit(g))) + int(round(T.REFLEX_ADD * g.eff(g.skills["reflex"]))) if nm.has("limit") else -1
|
||||
g.deadline = int(round(nm["limit"] * Modes.ng_limit(g) * T.DIFF_LIMIT[g.diff])) + int(round(T.REFLEX_ADD * g.eff(g.skills["reflex"]))) if nm.has("limit") else -1
|
||||
if nm.has("act") and not T.DIFF_SAVES[g.diff] and g.endless == null:
|
||||
g.cp = g.mission # Параноя: контрольна точка на початку акту (пишеться в кінці глави, коли акт уже налаштовано)
|
||||
if nm.has("act"):
|
||||
Gfx.act_card(g, nm["act"], L.t("Нова частина історії"))
|
||||
Modes.ng_mail(g, g.missions.slice(0, g.mission + 1).filter(func(x): return x.has("act")).size() - 1)
|
||||
if g.endless == null:
|
||||
g.get_tree().create_timer(5.0).timeout.connect(func(): g.Settings.ask_rate(g)) # після заставки акту
|
||||
g.get_tree().create_timer(5.0).timeout.connect(func(): if is_instance_valid(g): g.Settings.ask_rate(g)) # після заставки акту
|
||||
if g.mission == g.Data.MISSIONS.size():
|
||||
_relock_act4(g)
|
||||
if g.mission == g.A5_START:
|
||||
|
||||
@@ -63,7 +63,7 @@ func _run() -> void:
|
||||
if g.mission != m_prev:
|
||||
if m_prev >= 0 and g.missions[m_prev].has("limit"):
|
||||
print(" ⏱ глава %d (ліміт %d): %d дій" % [m_prev + 1, g.missions[m_prev]["limit"], actions - m_start])
|
||||
if actions - m_start > g.missions[m_prev]["limit"] * g.Modes.ng_limit(g):
|
||||
if actions - m_start > g.missions[m_prev]["limit"] * g.Modes.ng_limit(g) * g.T.DIFF_LIMIT[g.diff]:
|
||||
late.append(m_prev + 1)
|
||||
m_start = actions
|
||||
m_prev = g.mission
|
||||
|
||||
@@ -94,6 +94,23 @@ func _run() -> void:
|
||||
ok(g.crt.visible, "спалах показує CRT-шар і на нулі")
|
||||
g.flash = Color(0, 0, 0, 0)
|
||||
g.Settings.set_value(g, "crt", 40)
|
||||
g.Settings.set_value(g, "calm", true)
|
||||
g.ticker.position.x = 300.0
|
||||
g._process(0.1)
|
||||
g._tick_rain()
|
||||
ok(g.ticker.position.x == 0.0 and not g.rain.visible, "менше анімацій: стрічка новин стоїть, дощу символів нема")
|
||||
g.Settings.set_value(g, "calm", false)
|
||||
g._tick_rain()
|
||||
ok(g.rain.visible, "менше анімацій вимкнено — дощ повертається")
|
||||
g.log_lines = []
|
||||
for i in 300:
|
||||
g.say("рядок %d" % i)
|
||||
g.say_chips([["12", Color.RED], ["~1", null]])
|
||||
g.mail("Оракул", "тест листа")
|
||||
for i in g.MAX_LINES - 101: # разом 1201 рядок — журнал перебудовується, лишаючи останні MAX_LINES
|
||||
g.say("рядок %d" % i)
|
||||
var txt: String = g.out.get_parsed_text()
|
||||
ok(g.log_lines.size() == g.MAX_LINES and "тест листа" in txt and not "Оракул: тест листа" in txt and "12 ~1" in txt, "після перебудови журналу лист і фішки малюються як були")
|
||||
drop(g)
|
||||
g = fresh(true)
|
||||
ok(g.cfg["crt"] == 40 and g.cfg["font"] == 20 and g.cfg["ui"] == 150, "налаштування зберігаються між запусками")
|
||||
@@ -1007,6 +1024,14 @@ func _variety() -> void:
|
||||
g.run("disconnect")
|
||||
ok(not g.done.has(f) and not g.done.has("+" + f), "без логів: наслідив — замовлення не зараховано")
|
||||
g.heat = []
|
||||
g.run("connect " + jcs["ip"])
|
||||
g.run("download " + f)
|
||||
g.arrest("тест")
|
||||
g.busts = 0
|
||||
jcs["open"] = true
|
||||
g.run("connect " + jcs["ip"])
|
||||
g.run("disconnect")
|
||||
ok(not g.done.has(f) and not g.done.has("+" + f), "без логів: арешт конфіскує файл — connect + disconnect не зараховує")
|
||||
g.heat = [] # прибрати хвости розслідувань з попередніх перевірок
|
||||
g.run("connect " + jcs["ip"])
|
||||
g.run("download " + f)
|
||||
|
||||
@@ -145,6 +145,28 @@ func _run() -> void:
|
||||
g.trace = 0.0
|
||||
ok(g.servers[13]["open"] and g.crack == null, "підказки відкрили всі цифри → автовведення → доступ")
|
||||
g.run("disconnect")
|
||||
g.run("connect 16")
|
||||
crack(g)
|
||||
var c1: String = g.crack["code"]
|
||||
var kn1: Array = g.crack["known"].keys()
|
||||
var wrong := c1
|
||||
while wrong == c1:
|
||||
wrong = g.random_code(c1.length())
|
||||
g.trace = 0.0
|
||||
g.run(wrong)
|
||||
g.run("disconnect")
|
||||
g.run("connect 16")
|
||||
crack(g)
|
||||
ok(g.crack["code"] == c1 and g.crack["hist"].size() == 1 and g.crack["known"].keys().size() >= kn1.size(), "відступ: зовнішній шар зберігає пароль і спроби")
|
||||
g.run("abort")
|
||||
g.run("disconnect")
|
||||
g.servers[15]["open"] = true
|
||||
g.Story._lock(g.servers[15])
|
||||
g.run("connect 16")
|
||||
crack(g)
|
||||
ok(g.crack["hist"].is_empty(), "сервер закрито знову — зовнішній шар з нуля")
|
||||
g.run("abort")
|
||||
g.run("disconnect")
|
||||
|
||||
# 5. розслідування і закриття гри з логами
|
||||
g.heat = []
|
||||
|
||||
1
source_godot/tests/trailer.gd.uid
Normal file
1
source_godot/tests/trailer.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dice1cde0wej5
|
||||
@@ -69,11 +69,15 @@ func _run() -> void:
|
||||
var u = g.updater
|
||||
u.install = false
|
||||
u.dest = "user://upd_test.exe"
|
||||
u.latest = {"tag": "v9.9.9", "url": "http://127.0.0.1:9/TinMerezhi.exe", "size": 1000}
|
||||
# дзеркало недоступне → друга спроба з Gitea, теж недоступна → збій
|
||||
u.latest = {"tag": "v9.9.9", "url": "http://127.0.0.1:9/TinMerezhi.exe", "size": 1000, "mirror": "http://127.0.0.1:9/m/TinMerezhi.exe"}
|
||||
u.download()
|
||||
while u.busy:
|
||||
await process_frame
|
||||
var last: String = g.log_lines[-1][0]
|
||||
if not g.log_lines[-2][0].contains("Качаю з основного") or u.src != u.latest["url"]:
|
||||
print("FAIL запасний сервер: ", g.log_lines[-2][0])
|
||||
bad += 1
|
||||
if not last.contains("немає з'єднання") or FileAccess.file_exists(u.dest):
|
||||
print("FAIL обрив: ", last)
|
||||
bad += 1
|
||||
|
||||
@@ -77,9 +77,10 @@ const REFLEX_ADD := 4 # Рефлекси: + дій до термі
|
||||
# ── рівні складності: 0 — Новачок, 1 — Звичайний, 2 — Параноя ──
|
||||
const DIFF_NAMES := ["Новачок", "Звичайний", "Параноя"]
|
||||
const DIFF_IDS := ["novice", "normal", "paranoid"]
|
||||
const DIFF_TRACE := [0.75, 1.04, 1.5] # множник усього трасування (v1.0.62: було 0.6/1.0; 1.08 на Звичайному — запізнення в главах 32–33)
|
||||
const DIFF_TRACE := [0.75, 1.04, 2.0] # множник усього трасування (v1.0.62: було 0.6/1.0; 1.08 на Звичайному — запізнення в главах 32–33; v1.0.81 Параноя 1.5 → 2.0, бо зовнішній шар тепер пам'ятається після відступу)
|
||||
const DIFF_INVEST := [1.4, 1.0, 0.7] # множник часу до арешту за лишені логи
|
||||
const DIFF_BUSTS := [2, 0, -1] # + арештів до кінця гри
|
||||
const DIFF_LIMIT := [1.2, 1.0, 1.0] # множник дій у термінових главах (v1.0.80: Новачок запізнювався так само часто, як Звичайний)
|
||||
const DIFF_SAVES := [true, true, false] # Параноя: збереження лише на початку акту (контрольні точки, save.gd), між ними закрив гру — прогрес акту зник
|
||||
|
||||
# ── різноманіття (variety.gd) ──
|
||||
|
||||
@@ -7,6 +7,8 @@ const L = preload("res://lang.gd")
|
||||
|
||||
const API := "https://serv.tail9357bc.ts.net/api/v1/repos/junior/TinMerezhi/releases/latest"
|
||||
const ASSET := "TinMerezhi.exe"
|
||||
# Дзеркало exe на дроплеті (CI кладе <тег>/TinMerezhi.exe): швидше за Funnel; якщо не вийшло — качаємо з Gitea.
|
||||
const MIRROR := "https://tinmerezhi.duckdns.org/"
|
||||
|
||||
var g # main.gd
|
||||
var http := HTTPRequest.new()
|
||||
@@ -14,6 +16,7 @@ var latest := {} # {"tag", "url", "size"}, коли є новіша версі
|
||||
var busy := false
|
||||
var dest := "" # куди качаємо новий exe (тести підставляють свій шлях)
|
||||
var install := true # false — лише завантажити й перевірити (тест завантаження)
|
||||
var src := "" # звідки качаємо зараз: дзеркало або latest.url
|
||||
var dl_t0 := 0 # мс початку завантаження; 0 — не качаємо
|
||||
var dl_sample := [0, 0] # [мс, байти] останнього заміру швидкості
|
||||
var dl_speed := 0.0 # байт/с, згладжена
|
||||
@@ -97,7 +100,7 @@ func _on_checked(result: int, code: int, _h: PackedStringArray, body: PackedByte
|
||||
var tag := str(d.get("tag_name", ""))
|
||||
for a in d.get("assets", []):
|
||||
if a.get("name") == ASSET and newer(tag, version()):
|
||||
latest = {"tag": tag, "url": a["browser_download_url"], "size": int(a["size"])}
|
||||
latest = {"tag": tag, "url": a["browser_download_url"], "size": int(a["size"]), "mirror": MIRROR + tag + "/" + ASSET}
|
||||
set_badge(version_label() + L.t(" → ⬆ доступна %s: введи update") % tag, "#ffdd33")
|
||||
g.say(L.t("⬆ Доступна нова версія %s (у тебе %s). Введи update, щоб оновитися.") % [tag, version_label()], "warn")
|
||||
if start:
|
||||
@@ -119,12 +122,18 @@ func run() -> void:
|
||||
check(true)
|
||||
elif g.paranoid_run():
|
||||
g.say(L.t("☠ Параноя зберігається лише на початку акту: оновлення перезапустить гру й поверне туди. Онови після кінця забігу."), "err")
|
||||
elif g.crack != null: # перезапуск посеред зламу = висмикнутий кабель (+25% трасування після старту), як і зі зміною мови
|
||||
g.say(L.t("🔒 Оновитися можна після зламу: заверши його або відключись (disconnect)."), "err")
|
||||
else:
|
||||
download()
|
||||
|
||||
func download() -> void:
|
||||
g.say(L.t("⬇ Завантажую %s (%d МБ)…") % [latest["tag"], latest["size"] >> 20], "info")
|
||||
busy = true
|
||||
_start(latest.get("mirror", latest["url"]))
|
||||
|
||||
func _start(url: String) -> void:
|
||||
src = url
|
||||
dl_t0 = Time.get_ticks_msec()
|
||||
dl_sample = [dl_t0, 0]
|
||||
dl_speed = 0.0
|
||||
@@ -133,9 +142,19 @@ func download() -> void:
|
||||
http.timeout = 0.0 # повільний інтернет качає скільки треба; обрив ловить _process
|
||||
http.download_file = dest
|
||||
http.request_completed.connect(_on_downloaded, CONNECT_ONE_SHOT)
|
||||
if http.request(latest["url"]) != OK:
|
||||
if http.request(url) != OK:
|
||||
http.request_completed.disconnect(_on_downloaded)
|
||||
_fail(L.t("запит не відправився"))
|
||||
_retry(L.t("запит не відправився"))
|
||||
|
||||
# дзеркало підвело → ще раз з Gitea; Gitea підвела → збій
|
||||
func _retry(reason: String) -> void:
|
||||
if src == latest["url"]:
|
||||
_fail(reason)
|
||||
return
|
||||
if FileAccess.file_exists(dest):
|
||||
DirAccess.remove_absolute(dest)
|
||||
g.say(L.t("⚠ Швидкий сервер не віддав файл (%s). Качаю з основного…") % reason, "warn")
|
||||
_start(latest["url"])
|
||||
|
||||
# Рядок прогресу: [██████░░░░░░░░░░] 37% 42.1/114.4 МБ · 3.2 МБ/с · ~23 с
|
||||
static func progress_line(done: int, total: int, speed: float) -> String:
|
||||
@@ -164,7 +183,7 @@ func _process(_d: float) -> void:
|
||||
if http.request_completed.is_connected(_on_downloaded):
|
||||
http.request_completed.disconnect(_on_downloaded)
|
||||
http.download_file = ""
|
||||
_fail(L.t("з'єднання зависло на %.1f з %.1f МБ") % [got / 1048576.0, latest["size"] / 1048576.0])
|
||||
_retry(L.t("з'єднання зависло на %.1f з %.1f МБ") % [got / 1048576.0, latest["size"] / 1048576.0])
|
||||
return
|
||||
if now - dl_sample[0] >= 1000: # швидкість: замір раз на секунду, згладжена, щоб час не скакав
|
||||
var v: float = (got - dl_sample[1]) * 1000.0 / (now - dl_sample[0])
|
||||
@@ -184,7 +203,7 @@ func _on_downloaded(result: int, code: int, _h: PackedStringArray, _b: PackedByt
|
||||
var path := exe()
|
||||
var got := FileAccess.get_size(dest) if FileAccess.file_exists(dest) else 0
|
||||
if result != HTTPRequest.RESULT_SUCCESS or code != 200 or got != latest["size"]:
|
||||
_fail(why(result, code, got, latest["size"]))
|
||||
_retry(why(result, code, got, latest["size"]))
|
||||
return
|
||||
g.tip.text = ""
|
||||
g.say(" " + progress_line(got, got, got / maxf(secs, 0.001)) + " · " + eta(secs), "info")
|
||||
|
||||
@@ -8,6 +8,15 @@ const Updater = preload("res://updater.gd")
|
||||
const MAX_ITEMS := 8 # коротко: вікно має влазити й з великим шрифтом
|
||||
|
||||
const CHANGES := [
|
||||
["1.0.84", "Команда update качає нові версії зі швидшого сервера, а якщо він недоступний — як раніше.", "The update command downloads new versions from a faster server, and falls back to the old one if it is unavailable."],
|
||||
["1.0.81", "Пароль зовнішнього шару більше не змінюється, коли відступаєш: усе, що ти про нього з'ясував, лишається до наступного візиту.", "The outer layer password no longer changes when you retreat: everything you learned about it stays until your next visit."],
|
||||
["1.0.81", "Параноя: трасування вище (+90% замість +50%), щоб вона лишилась такою ж важкою, але без безкінечних повторних зламів.", "Paranoid: higher trace (+90% instead of +50%) so it stays just as hard, without endless repeated cracks."],
|
||||
["1.0.81", "«Менше анімацій» зупиняє стрічку новин і дощ символів.", "\"Fewer animations\" now stops the news ticker and the symbol rain."],
|
||||
["1.0.81", "Дуже довгий журнал більше не втрачає кольорів емблем, листів і підказок зламу.", "A very long log no longer loses the colours of emblems, mails and crack hints."],
|
||||
["1.0.80", "Новачок: у термінових главах на 20% більше дій.", "Novice: 20% more actions in urgent chapters."],
|
||||
["1.0.79", "Арешт з файлом «піти без логів» конфіскує його: главу чи замовлення тепер не зарахувати простим connect і disconnect.", "An arrest while holding a \"leave no logs\" file confiscates it: the chapter or job no longer counts after a plain connect and disconnect."],
|
||||
["1.0.79", "Перегони із суперником за замовлення «піти без логів» зараховуються як виграні, коли ти чисто відключився.", "A rival race for a \"leave no logs\" job now counts as won when you disconnect cleanly."],
|
||||
["1.0.79", "update посеред зламу більше не перезапускає гру (це було б як висмикнути кабель): спершу заверши злам.", "update in the middle of a crack no longer restarts the game (that would be like pulling the cable): finish the crack first."],
|
||||
["1.0.78", "Ефект CRT на нулі тепер справді вимкнений: на слабких ноутбуках гра менше навантажує відеокарту.", "CRT effect at zero is now truly off: the game puts less load on the GPU of weak laptops."],
|
||||
["1.0.77", "Нова заставка при запуску: тінь у капюшоні з оком мережі над нічним Києвом.", "New startup splash: a hooded shadow with a network eye over night Kyiv."],
|
||||
["1.0.76", "Після першого акту гра один раз запропонує оцінити її на itch.io.", "After the first act the game asks once whether you would rate it on itch.io."],
|
||||
|
||||
Reference in New Issue
Block a user