#84: move 215 root files into a folder hierarchy
Everything lived in one flat directory, so a diff gave no clue what area it touched and finding the file you wanted meant knowing its exact name. Twelve folders now, grouped by what a thing IS rather than what type it is - a vessel's definition, its component scenes and its upgrade resources sit together, because that is the set you read when you change one of them. buildings core controllers enemies logistics planets resources shaders surface ui vessels vfx world 332 files moved and every res:// reference rewritten - 306 files touched, including the autoload and main-scene paths in project.godot. Nothing renamed: this is purely where files sit, so the diff is a pile of pure moves and no behaviour is buried in it. ui_theme.tres, icon.svg and web_shell.html stay at the root, where Godot and the export preset expect them. Verified three ways, because a suite alone would not have caught all of it: the full 117 pass, the web export builds clean, and the game renders. The export is why that matters. The FIRST export after the move failed with "Attempt to open script 'res://GameState.gd'" - the old path - while project.godot on disk plainly said res://core/GameState.gd. That is this project's documented Android FUSE mtime trap: Godot served a cached copy of a file whose content had changed. A `touch` fixed it. Nothing in the test suite would have found that, because the suite runs from a copy on a native filesystem - the one place the bug cannot happen. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
baac11ae8b
commit
2f161621c3
495 changed files with 571 additions and 567 deletions
92
ui/NeonNumber.gd
Normal file
92
ui/NeonNumber.gd
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
class_name NeonNumber
|
||||
extends Control
|
||||
|
||||
# An ore amount drawn in the game's own hand-stroked style: the resource
|
||||
# hexagon followed by segment-drawn digits. Godot's default Label font has
|
||||
# no place in this look, which is why the digits are strokes rather than
|
||||
# text.
|
||||
#
|
||||
# Used both for the live resource readout (see ResourceReadout, which feeds
|
||||
# it from GameState) and for the fixed prices under each build option.
|
||||
|
||||
@export var amount: int = 0: set = set_amount
|
||||
@export var show_icon: bool = true
|
||||
@export var glow_color: Color = Color(0.0, 0.62, 0.7)
|
||||
@export var core_color: Color = Color(0.0, 0.12, 0.15)
|
||||
@export var digit_height: float = 30.0
|
||||
@export var digit_gap: float = 9.0
|
||||
|
||||
# Segment weight as a fraction of digit height, so the strokes keep the same
|
||||
# visual heft at any size. This used to be a fixed width regardless of the
|
||||
# digit height, which left large readouts looking hairline next to the solid
|
||||
# ore hexagon beside them.
|
||||
const STROKE_RATIO: float = 0.014
|
||||
const HEX_STROKE_RATIO: float = 0.030
|
||||
|
||||
# Which of the seven segments each digit lights, in the usual order:
|
||||
# top, top-right, bottom-right, bottom, bottom-left, top-left, middle.
|
||||
const DIGIT_SEGMENTS: Array = [
|
||||
[true, true, true, true, true, true, false], # 0
|
||||
[false, true, true, false, false, false, false], # 1
|
||||
[true, true, false, true, true, false, true], # 2
|
||||
[true, true, true, true, false, false, true], # 3
|
||||
[false, true, true, false, false, true, true], # 4
|
||||
[true, false, true, true, false, true, true], # 5
|
||||
[true, false, true, true, true, true, true], # 6
|
||||
[true, true, true, false, false, false, false], # 7
|
||||
[true, true, true, true, true, true, true], # 8
|
||||
[true, true, true, true, false, true, true], # 9
|
||||
]
|
||||
|
||||
|
||||
func set_amount(value: int) -> void:
|
||||
if amount == value:
|
||||
return
|
||||
amount = value
|
||||
queue_redraw()
|
||||
|
||||
|
||||
func _draw() -> void:
|
||||
var h: float = digit_height
|
||||
var w: float = h * 0.56
|
||||
var x: float = 0.0
|
||||
|
||||
if show_icon:
|
||||
_draw_hexagon(Vector2(h * 0.42, h * 0.5), h * 0.62)
|
||||
x = h * 1.15
|
||||
|
||||
for ch in str(maxi(amount, 0)):
|
||||
_draw_digit(int(ch), Vector2(x, 0.0), w, h)
|
||||
x += w + digit_gap
|
||||
|
||||
|
||||
func _draw_hexagon(centre: Vector2, radius: float) -> void:
|
||||
# Same silhouette as the ore pickup itself, so a price and the thing it
|
||||
# is priced in are unmistakably the same resource.
|
||||
var pts: PackedVector2Array = PackedVector2Array()
|
||||
for i in range(6):
|
||||
var a: float = (float(i) / 6.0) * TAU - PI / 2.0
|
||||
pts.append(centre + Vector2(cos(a), sin(a)) * radius)
|
||||
NeonDraw.draw_glowing_polygon(self, pts, glow_color, 1.0, core_color, radius * HEX_STROKE_RATIO)
|
||||
NeonDraw.draw_glowing_line(self, pts[5], pts[2], glow_color, 0.6, radius * HEX_STROKE_RATIO * 0.8, core_color)
|
||||
|
||||
|
||||
func _draw_digit(value: int, at: Vector2, w: float, h: float) -> void:
|
||||
if value < 0 or value > 9:
|
||||
return
|
||||
var on: Array = DIGIT_SEGMENTS[value]
|
||||
var mid: float = h * 0.5
|
||||
var seg: Array = [
|
||||
[Vector2(0.0, 0.0), Vector2(w, 0.0)], # top
|
||||
[Vector2(w, 0.0), Vector2(w, mid)], # top-right
|
||||
[Vector2(w, mid), Vector2(w, h)], # bottom-right
|
||||
[Vector2(0.0, h), Vector2(w, h)], # bottom
|
||||
[Vector2(0.0, mid), Vector2(0.0, h)], # bottom-left
|
||||
[Vector2(0.0, 0.0), Vector2(0.0, mid)], # top-left
|
||||
[Vector2(0.0, mid), Vector2(w, mid)], # middle
|
||||
]
|
||||
var stroke: float = h * STROKE_RATIO
|
||||
for i in range(seg.size()):
|
||||
if not on[i]:
|
||||
continue
|
||||
NeonDraw.draw_glowing_line(self, at + seg[i][0], at + seg[i][1], glow_color, 1.0, stroke, core_color)
|
||||
Loading…
Reference in a new issue