godot-signals-patterns

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Godot Signals Patterns

Godot 信号模式

Purpose

目的

Use signals for decoupling without creating hidden event webs, ownership confusion, or lifecycle bugs.
使用信号实现解耦,同时避免形成隐藏事件网、所有权混淆或生命周期错误。

Use When

适用场景

  • signal usage is growing
  • scene communication is brittle
  • callbacks and node dependencies are hard to debug
  • 信号使用量不断增加
  • 场景通信脆弱易断
  • 回调函数和节点依赖难以调试

Inputs

输入信息

  • scene architecture
  • system boundaries
  • signal producers and consumers
  • lifecycle notes
  • 场景架构
  • 系统边界
  • 信号生产者与消费者
  • 生命周期说明

Process

实施流程

  1. define which signals are stable contracts
  2. document who connects, disconnects, and owns signal lifetime
  3. avoid using signals when direct ownership is clearer
  4. prevent scene-tree timing assumptions from becoming hidden requirements
  5. add debug support for signal-heavy flows
  1. 定义哪些信号属于稳定契约
  2. 记录谁负责连接、断开信号,以及谁拥有信号的生命周期
  3. 当直接所有权关系更清晰时,避免使用信号
  4. 防止将场景树时序假设转化为隐藏需求
  5. 为信号密集型流程添加调试支持

Outputs

输出成果

  • signal contract list
  • ownership notes
  • debugging guidance
  • anti-pattern warnings
  • 信号契约列表
  • 所有权说明
  • 调试指南
  • 反模式警告

Quality Bar

质量标准

  • respects scene-tree ownership, autoload boundaries, and resource behavior
  • keeps scripts, signals, and resources understandable at scale
  • supports export reliability and content iteration without hidden coupling
  • 遵循场景树所有权规则、自动加载边界和资源行为规范
  • 确保脚本、信号和资源在大规模场景下仍具备可理解性
  • 支持导出可靠性和内容迭代,无隐藏耦合

Common Failure Modes

常见失败模式

  • autoloads becoming global dumping grounds
  • signal webs with no ownership
  • shared resources causing accidental state leakage
  • 自动加载成为全局“垃圾场”
  • 无所有权归属的信号网
  • 共享资源导致意外状态泄露

Related Agents

相关Agent

  • godot-reviewer
  • tools-programmer
  • gameplay-programmer
  • godot-reviewer
  • tools-programmer
  • gameplay-programmer

Related Commands

相关命令

  • godot-review
  • godot-scene-audit
  • refactor-clean
  • godot-review
  • godot-scene-audit
  • refactor-clean

Notes

注意事项

  • Keep this skill aligned with the relevant rules layer and current project documentation.
  • If engine-specific constraints materially change the workflow, hand off to the matching engine skill or engine-specific reviewer.
  • 保持此技能与相关规则层和当前项目文档一致。
  • 如果引擎特定约束对工作流程产生重大影响,请移交至匹配的引擎技能或引擎特定审核人员。