Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd0fc8aaa7 | ||
|
|
5890f3607c |
BIN
game_godot/TinMerezhi.exe
(Stored with Git LFS)
BIN
game_godot/TinMerezhi.exe
(Stored with Git LFS)
Binary file not shown.
@@ -21,6 +21,8 @@ const FACE := [
|
|||||||
" ▀▀██▄▄▄▄▄▄▄▄██▀▀ ",
|
" ▀▀██▄▄▄▄▄▄▄▄██▀▀ ",
|
||||||
]
|
]
|
||||||
const NOISE := "█▓▒░#%@&01"
|
const NOISE := "█▓▒░#%@&01"
|
||||||
|
# своя випадковість для прикрас: кадри й таймери залежать від швидкості машини, а randf() гри — ні (бот у CI й під Wine грає однаково)
|
||||||
|
static var rng := RandomNumberGenerator.new()
|
||||||
|
|
||||||
static func calm(g: Main) -> bool:
|
static func calm(g: Main) -> bool:
|
||||||
return g.cfg.get("calm", false)
|
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)
|
g.shake_t = maxf(0.0, g.shake_t - delta)
|
||||||
if g.shake_t <= 0.0:
|
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 != null:
|
||||||
if g.crack["code"] != g.cv_code:
|
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)
|
var o = g.get_node_or_null(n)
|
||||||
if o:
|
if o:
|
||||||
o.queue_redraw()
|
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.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:
|
static func glitch_lines(lines: Array, amount: float) -> String:
|
||||||
var res := PackedStringArray()
|
var res := PackedStringArray()
|
||||||
for ln in lines:
|
for ln in lines:
|
||||||
var s: String = ln
|
var s: String = ln
|
||||||
for i in s.length():
|
for i in s.length():
|
||||||
if s[i] != " " and randf() < amount:
|
if s[i] != " " and rng.randf() < amount:
|
||||||
s[i] = NOISE[randi() % NOISE.length()]
|
s[i] = NOISE[rng.randi() % NOISE.length()]
|
||||||
if randf() < amount * 2:
|
if rng.randf() < amount * 2:
|
||||||
s = s.substr(1) + " " if randf() < 0.5 else " " + s.left(s.length() - 1)
|
s = s.substr(1) + " " if rng.randf() < 0.5 else " " + s.left(s.length() - 1)
|
||||||
res.append(s)
|
res.append(s)
|
||||||
return "\n".join(res)
|
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 p: Vector2 = g._mp(g.map_pos[e[0]])
|
||||||
var r: float = 12.0 * g.map_scale
|
var r: float = 12.0 * g.map_scale
|
||||||
var a := 1.0 - f
|
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(1, 0, 0.35, 0.45 * a))
|
||||||
c.draw_circle(p + j, r, Color(0, 1, 1, 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)
|
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:
|
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)
|
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 randf() < 0.5 or f > 0.5:
|
if rng.randf() < 0.5 or f > 0.5:
|
||||||
c.draw_circle(p, r * 1.05, Color(0, 0, 0, 0.75 * a))
|
c.draw_circle(p, r * 1.05, Color(0, 0, 0, 0.75 * a))
|
||||||
|
|
||||||
# ── ASCII-емблема сервера: симетричний "логотип" 7×4 з хешу назви ──
|
# ── 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
|
var win := xx % 2 == 1 and yy % 2 == 1 and xx < bw - 1 and yy < bh - 1
|
||||||
if win:
|
if win:
|
||||||
var on: bool = (abs(hash(gx * 31 + gy * 17)) % 1000) / 1000.0 < lit
|
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
|
on = false
|
||||||
_put(gr, gx, gy, "█" if on else "·", Color("#ffdd66") if on else Color(0.3, 0.4, 0.35))
|
_put(gr, gx, gy, "█" if on else "·", Color("#ffdd66") if on else Color(0.3, 0.4, 0.35))
|
||||||
else:
|
else:
|
||||||
@@ -395,7 +397,7 @@ static func _scene(id: String, t: float) -> Array:
|
|||||||
"end_silence": # ботоферма замовкає, місто гасне
|
"end_silence": # ботоферма замовкає, місто гасне
|
||||||
_city(gr, 1.0 - p)
|
_city(gr, 1.0 - p)
|
||||||
for r in 6:
|
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))
|
_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:
|
if p >= 1.0:
|
||||||
_put(gr, 4, 3, "_" if int(t * 2) % 2 == 0 else " ", Color("#33ff66"))
|
_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
|
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:
|
if s[xx] != " " and not gone:
|
||||||
_put(gr, (W - s.length()) / 2 + xx, fy + i, s[xx], Color(0.75, 0.85, 0.8))
|
_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))
|
_put(gr, (W - s.length()) / 2 + xx, fy + i, "░", Color(0.4, 0.5, 0.45))
|
||||||
"end_zero": # обличчя глітчить, гасне, як старий телевізор, і вранці місто світиться
|
"end_zero": # обличчя глітчить, гасне, як старий телевізор, і вранці місто світиться
|
||||||
if t < 2.0:
|
if t < 2.0:
|
||||||
|
|||||||
@@ -674,21 +674,21 @@ func _input(e: InputEvent) -> void:
|
|||||||
|
|
||||||
func _tick_rain() -> void:
|
func _tick_rain() -> void:
|
||||||
rain.visible = not Gfx.calm(self) # «Менше анімацій»: без дощу символів
|
rain.visible = not Gfx.calm(self) # «Менше анімацій»: без дощу символів
|
||||||
if not rain.visible or DisplayServer.get_name() == "headless":
|
if not rain.visible:
|
||||||
return # без екрана дощ не видно, а його randf() зсував би випадковість бота залежно від швидкості машини
|
return
|
||||||
var cols := int(rain.size.x / 16)
|
var cols := int(rain.size.x / 16)
|
||||||
if drops.size() != cols:
|
if drops.size() != cols:
|
||||||
drops = []
|
drops = []
|
||||||
for i in cols:
|
for i in cols:
|
||||||
drops.append(randf() * rain.size.y / 16)
|
drops.append(Gfx.rng.randf() * rain.size.y / 16)
|
||||||
for i in cols:
|
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()
|
rain.queue_redraw()
|
||||||
|
|
||||||
func _draw_rain() -> void:
|
func _draw_rain() -> void:
|
||||||
for i in drops.size():
|
for i in drops.size():
|
||||||
for t in 14:
|
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 не шейпить текст — у рази швидше
|
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:
|
func _on_submit(text: String) -> void:
|
||||||
@@ -1156,7 +1156,11 @@ func add_news(h: String) -> void:
|
|||||||
func _fill_ticker() -> void:
|
func _fill_ticker() -> void:
|
||||||
var items := news.slice(-3)
|
var items := news.slice(-3)
|
||||||
var w: Array = Extra.WORLD_NEWS.duplicate()
|
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()))
|
items.append_array(w.slice(0, 5 - items.size()))
|
||||||
ticker.text = "📰 " + " ◆ ".join(PackedStringArray(items))
|
ticker.text = "📰 " + " ◆ ".join(PackedStringArray(items))
|
||||||
ticker.reset_size()
|
ticker.reset_size()
|
||||||
|
|||||||
@@ -108,10 +108,10 @@ static func _tick_call(g: Main, delta: float) -> void:
|
|||||||
var bars := "▁▂▃▄▅▆▇"
|
var bars := "▁▂▃▄▅▆▇"
|
||||||
var eq := ""
|
var eq := ""
|
||||||
for i in 14:
|
for i in 14:
|
||||||
eq += bars[randi() % bars.length()]
|
eq += bars[Gfx.rng.randi() % bars.length()]
|
||||||
g.call_eq.text = eq
|
g.call_eq.text = eq
|
||||||
if g.sound and g.notes.size() < 2 and randf() < 0.5: # "голос": синтезовані склади
|
if g.sound and g.notes.size() < 2 and Gfx.rng.randf() < 0.5: # "голос": синтезовані склади
|
||||||
g.notes.append([g.voice_hz * (1.0 + (randi() % 5) * 0.08), 0.04, "sine"])
|
g.notes.append([g.voice_hz * (1.0 + (Gfx.rng.randi() % 5) * 0.08), 0.04, "sine"])
|
||||||
return
|
return
|
||||||
g.call_eq.text = "▁".repeat(14)
|
g.call_eq.text = "▁".repeat(14)
|
||||||
g.call_left -= delta
|
g.call_left -= delta
|
||||||
|
|||||||
Reference in New Issue
Block a user