style(client): gdformat all 52 GDScript files — zero format warnings
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,14 +7,34 @@ extends RefCounted
|
||||
|
||||
const _WALLS: Array = [
|
||||
# Room walls (8x8 room from (7,7) to (14,14))
|
||||
Vector2i(7,7), Vector2i(8,7), Vector2i(9,7), Vector2i(10,7),
|
||||
Vector2i(11,7), Vector2i(12,7), Vector2i(13,7), Vector2i(14,7),
|
||||
Vector2i(7,14), Vector2i(8,14), Vector2i(9,14), Vector2i(10,14),
|
||||
Vector2i(11,14), Vector2i(12,14), Vector2i(13,14), Vector2i(14,14),
|
||||
Vector2i(7,8), Vector2i(7,9), Vector2i(7,10), Vector2i(7,11),
|
||||
Vector2i(7,12), Vector2i(7,13),
|
||||
Vector2i(14,8), Vector2i(14,9), Vector2i(14,10), Vector2i(14,11),
|
||||
Vector2i(14,12), Vector2i(14,13),
|
||||
Vector2i(7, 7),
|
||||
Vector2i(8, 7),
|
||||
Vector2i(9, 7),
|
||||
Vector2i(10, 7),
|
||||
Vector2i(11, 7),
|
||||
Vector2i(12, 7),
|
||||
Vector2i(13, 7),
|
||||
Vector2i(14, 7),
|
||||
Vector2i(7, 14),
|
||||
Vector2i(8, 14),
|
||||
Vector2i(9, 14),
|
||||
Vector2i(10, 14),
|
||||
Vector2i(11, 14),
|
||||
Vector2i(12, 14),
|
||||
Vector2i(13, 14),
|
||||
Vector2i(14, 14),
|
||||
Vector2i(7, 8),
|
||||
Vector2i(7, 9),
|
||||
Vector2i(7, 10),
|
||||
Vector2i(7, 11),
|
||||
Vector2i(7, 12),
|
||||
Vector2i(7, 13),
|
||||
Vector2i(14, 8),
|
||||
Vector2i(14, 9),
|
||||
Vector2i(14, 10),
|
||||
Vector2i(14, 11),
|
||||
Vector2i(14, 12),
|
||||
Vector2i(14, 13),
|
||||
# Interior wall blocking NPC
|
||||
Vector2i(12, 10),
|
||||
]
|
||||
@@ -48,6 +68,7 @@ func process_facing(new_facing: String) -> void:
|
||||
|
||||
# -- Snapshot generation -------------------------------------------------------
|
||||
|
||||
|
||||
func snapshot() -> Dictionary:
|
||||
tick += 1
|
||||
|
||||
@@ -76,42 +97,60 @@ func snapshot() -> Dictionary:
|
||||
var py := player_pos.y
|
||||
|
||||
# Build entities — player always visible
|
||||
var entities: Array = [{
|
||||
"entity_id": 1,
|
||||
"x": float(px),
|
||||
"y": float(py),
|
||||
"z": 0,
|
||||
"kind": { "variant": "Player", "data": null },
|
||||
"visibility": "Forward",
|
||||
}]
|
||||
var entities: Array = [
|
||||
{
|
||||
"entity_id": 1,
|
||||
"x": float(px),
|
||||
"y": float(py),
|
||||
"z": 0,
|
||||
"kind": {"variant": "Player", "data": null},
|
||||
"visibility": "Forward",
|
||||
}
|
||||
]
|
||||
|
||||
# NPC at (12, 9) — visible if within range and not blocked by wall at (12, 10)
|
||||
var npc_pos := Vector2i(12, 9)
|
||||
var npc_dist := absi(px - npc_pos.x) + absi(py - npc_pos.y)
|
||||
if npc_dist <= 4 and has_los(Vector2i(px, py), npc_pos):
|
||||
var sector: String = "Forward" if npc_pos.y <= py else "Peripheral"
|
||||
entities.append({
|
||||
"entity_id": 2,
|
||||
"x": float(npc_pos.x),
|
||||
"y": float(npc_pos.y),
|
||||
"z": 0,
|
||||
"kind": { "variant": "Npc", "data": null },
|
||||
"visibility": sector,
|
||||
"relationship": npc_relationship,
|
||||
})
|
||||
(
|
||||
entities
|
||||
. append(
|
||||
{
|
||||
"entity_id": 2,
|
||||
"x": float(npc_pos.x),
|
||||
"y": float(npc_pos.y),
|
||||
"z": 0,
|
||||
"kind": {"variant": "Npc", "data": null},
|
||||
"visibility": sector,
|
||||
"relationship": npc_relationship,
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
# v4: nearby_interactions when NPC is nearby and visible (#404/#405)
|
||||
var nearby: Array = []
|
||||
if npc_dist <= 2 and has_los(Vector2i(px, py), npc_pos):
|
||||
nearby.append({
|
||||
"entity_id": 2,
|
||||
"entity_type": "Npc",
|
||||
"distance": npc_dist,
|
||||
"verbs": [
|
||||
{"kind": "Talk", "label": "Talk", "priority": 1, "available": true},
|
||||
{"kind": "ExamineNpc", "label": "Observe", "priority": 2, "available": true},
|
||||
],
|
||||
})
|
||||
(
|
||||
nearby
|
||||
. append(
|
||||
{
|
||||
"entity_id": 2,
|
||||
"entity_type": "Npc",
|
||||
"distance": npc_dist,
|
||||
"verbs":
|
||||
[
|
||||
{"kind": "Talk", "label": "Talk", "priority": 1, "available": true},
|
||||
{
|
||||
"kind": "ExamineNpc",
|
||||
"label": "Observe",
|
||||
"priority": 2,
|
||||
"available": true
|
||||
},
|
||||
],
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
# v5: monologue on first tick (#414)
|
||||
var monologue: Variant = null
|
||||
@@ -128,11 +167,28 @@ func snapshot() -> Dictionary:
|
||||
dialogue = {
|
||||
"npc_name": "Kael",
|
||||
"npc_entity_id": 2,
|
||||
"speech": "Haven't seen you around the transit hub before. You new to Sova, or just passing through?",
|
||||
"options": [
|
||||
{"text": "Just arrived. Still getting my bearings.", "response_id": "kael_greet_01", "priority": 1, "confrontation": false}, # gdlint:ignore = max-line-length
|
||||
{"text": "Passing through. Know where I can find work?", "response_id": "kael_greet_02", "priority": 2, "confrontation": false}, # gdlint:ignore = max-line-length
|
||||
{"text": "I saw you near the cargo bay last night.", "response_id": "kael_confront_01", "priority": 3, "confrontation": true}, # gdlint:ignore = max-line-length
|
||||
"speech":
|
||||
"Haven't seen you around the transit hub before. You new to Sova, or just passing through?",
|
||||
"options":
|
||||
[
|
||||
{
|
||||
"text": "Just arrived. Still getting my bearings.",
|
||||
"response_id": "kael_greet_01",
|
||||
"priority": 1,
|
||||
"confrontation": false
|
||||
}, # gdlint:ignore = max-line-length
|
||||
{
|
||||
"text": "Passing through. Know where I can find work?",
|
||||
"response_id": "kael_greet_02",
|
||||
"priority": 2,
|
||||
"confrontation": false
|
||||
}, # gdlint:ignore = max-line-length
|
||||
{
|
||||
"text": "I saw you near the cargo bay last night.",
|
||||
"response_id": "kael_confront_01",
|
||||
"priority": 3,
|
||||
"confrontation": true
|
||||
}, # gdlint:ignore = max-line-length
|
||||
],
|
||||
}
|
||||
|
||||
@@ -142,26 +198,55 @@ func snapshot() -> Dictionary:
|
||||
if cycle_pos < 6:
|
||||
var total_delay := 6
|
||||
var remaining := total_delay - cycle_pos
|
||||
pending_recs.append({
|
||||
"entity_id": 100,
|
||||
"x": 13.5,
|
||||
"y": 12.5,
|
||||
"z": 0,
|
||||
"remaining_ticks": remaining,
|
||||
"total_delay_ticks": total_delay,
|
||||
})
|
||||
(
|
||||
pending_recs
|
||||
. append(
|
||||
{
|
||||
"entity_id": 100,
|
||||
"x": 13.5,
|
||||
"y": 12.5,
|
||||
"z": 0,
|
||||
"remaining_ticks": remaining,
|
||||
"total_delay_ticks": total_delay,
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
# #535: Mock overheard NPC-NPC conversation (D-078)
|
||||
var conv_events: Array = []
|
||||
var conv_ended: Array = []
|
||||
var conv_start := 3
|
||||
var conv_lines := [
|
||||
{"speaker": "Mira", "target": "Soren", "line": "The cargo manifests don't add up. Three containers unaccounted for."},
|
||||
{"speaker": "Soren", "target": "Mira", "line": "Could be a logging error. Happens every... cycle."},
|
||||
{"speaker": "Mira", "target": "Soren", "line": "Not like this. Someone moved them after... check."},
|
||||
{"speaker": "Soren", "target": "Mira", "line": "You're reading too much into it. The docks are... these days."},
|
||||
{"speaker": "Mira", "target": "Soren", "line": "Then explain the weight discrepancy. Two hundred kilos... just gone."}, # gdlint:ignore = max-line-length
|
||||
{"speaker": "Soren", "target": "Mira", "line": "Fine. I'll pull the bay... tonight. But keep this between us."},
|
||||
{
|
||||
"speaker": "Mira",
|
||||
"target": "Soren",
|
||||
"line": "The cargo manifests don't add up. Three containers unaccounted for."
|
||||
},
|
||||
{
|
||||
"speaker": "Soren",
|
||||
"target": "Mira",
|
||||
"line": "Could be a logging error. Happens every... cycle."
|
||||
},
|
||||
{
|
||||
"speaker": "Mira",
|
||||
"target": "Soren",
|
||||
"line": "Not like this. Someone moved them after... check."
|
||||
},
|
||||
{
|
||||
"speaker": "Soren",
|
||||
"target": "Mira",
|
||||
"line": "You're reading too much into it. The docks are... these days."
|
||||
},
|
||||
{
|
||||
"speaker": "Mira",
|
||||
"target": "Soren",
|
||||
"line": "Then explain the weight discrepancy. Two hundred kilos... just gone."
|
||||
}, # gdlint:ignore = max-line-length
|
||||
{
|
||||
"speaker": "Soren",
|
||||
"target": "Mira",
|
||||
"line": "Fine. I'll pull the bay... tonight. But keep this between us."
|
||||
},
|
||||
]
|
||||
var conv_tick_interval := 5
|
||||
var conv_total_ticks := conv_lines.size() * conv_tick_interval
|
||||
@@ -170,20 +255,26 @@ func snapshot() -> Dictionary:
|
||||
var within_tick := (tick - conv_start) % conv_tick_interval
|
||||
if within_tick == 0 and conv_index < conv_lines.size():
|
||||
var cl: Dictionary = conv_lines[conv_index]
|
||||
conv_events.append({
|
||||
"speaker_id": 10,
|
||||
"target_id": 11,
|
||||
"speaker_name": cl.speaker,
|
||||
"target_name": cl.target,
|
||||
"occluded_line": cl.line,
|
||||
})
|
||||
(
|
||||
conv_events
|
||||
. append(
|
||||
{
|
||||
"speaker_id": 10,
|
||||
"target_id": 11,
|
||||
"speaker_name": cl.speaker,
|
||||
"target_name": cl.target,
|
||||
"occluded_line": cl.line,
|
||||
}
|
||||
)
|
||||
)
|
||||
elif tick == conv_start + conv_total_ticks:
|
||||
conv_ended.append({"speaker_id": 10, "target_id": 11})
|
||||
|
||||
return {
|
||||
"tick": tick,
|
||||
"version": Protocol.PROTOCOL_VERSION,
|
||||
"game_time": {
|
||||
"game_time":
|
||||
{
|
||||
"day": 0,
|
||||
"time_of_day": tick * 10,
|
||||
"day_phase": "Morning",
|
||||
@@ -207,6 +298,7 @@ func snapshot() -> Dictionary:
|
||||
|
||||
# -- Map generation ------------------------------------------------------------
|
||||
|
||||
|
||||
func _tiles() -> Array:
|
||||
var tiles: Array = []
|
||||
var room_x := 7
|
||||
@@ -216,8 +308,9 @@ func _tiles() -> Array:
|
||||
|
||||
for x in range(room_x, room_x + room_w):
|
||||
for y in range(room_y, room_y + room_h):
|
||||
var is_edge := (x == room_x or x == room_x + room_w - 1
|
||||
or y == room_y or y == room_y + room_h - 1)
|
||||
var is_edge := (
|
||||
x == room_x or x == room_x + room_w - 1 or y == room_y or y == room_y + room_h - 1
|
||||
)
|
||||
var tile_type: String
|
||||
if is_edge:
|
||||
if y == room_y + room_h - 1 and x == room_x + room_w / 2:
|
||||
@@ -253,7 +346,9 @@ func _visible_tiles() -> Array:
|
||||
if dist <= radius:
|
||||
if x >= room_x and x < room_x + room_w and y >= room_y and y < room_y + room_h:
|
||||
var sector: String = "Forward" if y <= py else "Peripheral"
|
||||
vtiles.append({"x": x, "y": y, "z": 0, "visibility": sector, "type": _get_tile_type(x, y)})
|
||||
vtiles.append(
|
||||
{"x": x, "y": y, "z": 0, "visibility": sector, "type": _get_tile_type(x, y)}
|
||||
)
|
||||
return vtiles
|
||||
|
||||
|
||||
@@ -262,8 +357,9 @@ func _get_tile_type(x: int, y: int) -> String:
|
||||
var room_y := 7
|
||||
var room_w := 8
|
||||
var room_h := 8
|
||||
var is_edge := (x == room_x or x == room_x + room_w - 1
|
||||
or y == room_y or y == room_y + room_h - 1)
|
||||
var is_edge := (
|
||||
x == room_x or x == room_x + room_w - 1 or y == room_y or y == room_y + room_h - 1
|
||||
)
|
||||
if is_edge:
|
||||
if y == room_y + room_h - 1 and x == room_x + room_w / 2:
|
||||
return "door"
|
||||
@@ -273,6 +369,7 @@ func _get_tile_type(x: int, y: int) -> String:
|
||||
|
||||
# -- Spatial helpers -----------------------------------------------------------
|
||||
|
||||
|
||||
func _is_walkable(pos: Vector2i) -> bool:
|
||||
return not _WALLS.has(pos)
|
||||
|
||||
@@ -302,25 +399,43 @@ func has_los(from: Vector2i, to: Vector2i) -> bool:
|
||||
|
||||
static func action_to_delta(action_name: String) -> Vector2i:
|
||||
match action_name:
|
||||
"MoveNorth": return Vector2i(0, -1)
|
||||
"MoveNortheast": return Vector2i(1, -1)
|
||||
"MoveEast": return Vector2i(1, 0)
|
||||
"MoveSoutheast": return Vector2i(1, 1)
|
||||
"MoveSouth": return Vector2i(0, 1)
|
||||
"MoveSouthwest": return Vector2i(-1, 1)
|
||||
"MoveWest": return Vector2i(-1, 0)
|
||||
"MoveNorthwest": return Vector2i(-1, -1)
|
||||
_: return Vector2i.ZERO
|
||||
"MoveNorth":
|
||||
return Vector2i(0, -1)
|
||||
"MoveNortheast":
|
||||
return Vector2i(1, -1)
|
||||
"MoveEast":
|
||||
return Vector2i(1, 0)
|
||||
"MoveSoutheast":
|
||||
return Vector2i(1, 1)
|
||||
"MoveSouth":
|
||||
return Vector2i(0, 1)
|
||||
"MoveSouthwest":
|
||||
return Vector2i(-1, 1)
|
||||
"MoveWest":
|
||||
return Vector2i(-1, 0)
|
||||
"MoveNorthwest":
|
||||
return Vector2i(-1, -1)
|
||||
_:
|
||||
return Vector2i.ZERO
|
||||
|
||||
|
||||
static func delta_to_facing(delta: Vector2i) -> String:
|
||||
match delta:
|
||||
Vector2i(0, -1): return "North"
|
||||
Vector2i(1, -1): return "Northeast"
|
||||
Vector2i(1, 0): return "East"
|
||||
Vector2i(1, 1): return "Southeast"
|
||||
Vector2i(0, 1): return "South"
|
||||
Vector2i(-1, 1): return "Southwest"
|
||||
Vector2i(-1, 0): return "West"
|
||||
Vector2i(-1, -1): return "Northwest"
|
||||
_: return "North"
|
||||
Vector2i(0, -1):
|
||||
return "North"
|
||||
Vector2i(1, -1):
|
||||
return "Northeast"
|
||||
Vector2i(1, 0):
|
||||
return "East"
|
||||
Vector2i(1, 1):
|
||||
return "Southeast"
|
||||
Vector2i(0, 1):
|
||||
return "South"
|
||||
Vector2i(-1, 1):
|
||||
return "Southwest"
|
||||
Vector2i(-1, 0):
|
||||
return "West"
|
||||
Vector2i(-1, -1):
|
||||
return "Northwest"
|
||||
_:
|
||||
return "North"
|
||||
|
||||
Reference in New Issue
Block a user