Skip to content

Commit f8e4ab5

Browse files
manuqclaude
andcommitted
GameState: The lambda function inside trinkets.map(), make it a named function.
Extract the lambda into a named _trinket_to_dict() function and simplify the _update_trinkets_state() call. Remove the gdformat:disable/enable comments that are no longer needed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4c6038e commit f8e4ab5

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

scenes/globals/game_state/game_state.gd

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -308,22 +308,18 @@ func has_trinket(id: StringName) -> bool:
308308
return trinkets.any(func(t: Trinket) -> bool: return t.id == id)
309309

310310

311-
# gdformat:disable
311+
func _trinket_to_dict(t: Trinket) -> Dictionary:
312+
return {
313+
"id": t.id,
314+
"name": t.name,
315+
"description": t.description,
316+
"icon": t.icon.resource_path if t.icon else "",
317+
"full_text": t.full_text,
318+
}
319+
320+
312321
func _update_trinkets_state() -> void:
313-
_state.set_value(
314-
TRINKETS_SECTION,
315-
TRINKETS_IDS_KEY,
316-
trinkets.map(
317-
func(t: Trinket) -> Dictionary: return {
318-
"id": t.id,
319-
"name": t.name,
320-
"description": t.description,
321-
"icon": t.icon.resource_path if t.icon else "",
322-
"full_text": t.full_text,
323-
}
324-
)
325-
)
326-
# gdformat:enable
322+
_state.set_value(TRINKETS_SECTION, TRINKETS_IDS_KEY, trinkets.map(_trinket_to_dict))
327323

328324

329325
func _update_inventory_state() -> void:

0 commit comments

Comments
 (0)