Compare commits

...

7 Commits

Author SHA1 Message Date
Claude
cdd1c0b670 CI: ключ хоста дроплета для дзеркала exe
All checks were successful
ci-image / image (push) Successful in 14s
build / build (push) Successful in 2m27s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017HrHZxa3KBighPXSxK7efY
2026-12-01 12:27:50 +00:00
Gitea Actions
572c02199b game_godot: TinMerezhi.exe v1.0.85 2026-12-01 12:25:08 +00:00
Claude
77ff2f62b4 Дзеркало exe: tinmerezhi.duckdns.org замість sslip.io
All checks were successful
build / build (push) Successful in 2m23s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017HrHZxa3KBighPXSxK7efY
2026-12-01 12:21:53 +00:00
Gitea Actions
4484ca1089 game_godot: TinMerezhi.exe v1.0.84 2026-12-01 12:20:39 +00:00
Claude
b86ce56ef5 update качає exe з дзеркала на дроплеті (46-101-222-25.sslip.io), при збої — з Gitea; CI кладе exe на дзеркало через sftp (секрет MIRROR_SSH_KEY)
All checks were successful
build / build (push) Successful in 2m22s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017HrHZxa3KBighPXSxK7efY
2026-12-01 12:17:23 +00:00
Gitea Actions
dd0fc8aaa7 game_godot: TinMerezhi.exe v1.0.83 2026-11-30 10:27:51 +00:00
Claude
5890f3607c Прикраси (дощ, стрічка, глітчі) на власному генераторі Gfx.rng: randf() гри не залежить від кадрів і таймерів, бот під Wine грає як у CI
All checks were successful
build / build (push) Successful in 2m22s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017HrHZxdPyXJXoks2gzFtd2
2026-11-30 10:24:36 +00:00
10 changed files with 80 additions and 30 deletions

View File

@@ -98,6 +98,26 @@ 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)
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
# 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
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
View File

@@ -0,0 +1 @@
46.101.222.25 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDWagZdsEc7Ljc7qO0TudlpbCMtZZ4hlGbfvSwqxiJNc

BIN
game_godot/TinMerezhi.exe (Stored with Git LFS)

Binary file not shown.

View File

@@ -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:

View File

@@ -1063,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",

View File

@@ -674,21 +674,21 @@ func _input(e: InputEvent) -> void:
func _tick_rain() -> void:
rain.visible = not Gfx.calm(self) # «Менше анімацій»: без дощу символів
if not rain.visible or DisplayServer.get_name() == "headless":
return # без екрана дощ не видно, а його randf() зсував би випадковість бота залежно від швидкості машини
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:
@@ -1156,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()

View File

@@ -108,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

View File

@@ -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

View File

@@ -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:
@@ -127,6 +130,10 @@ func run() -> void:
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
@@ -135,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:
@@ -166,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])
@@ -186,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")

View File

@@ -8,6 +8,7 @@ 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."],