Skip to content

Refactor duplicated scene controller patterns into base class #69

@justinmadison

Description

@justinmadison

Summary

Several patterns are duplicated across scene controller subclasses (foraging.gd, crafting_chain.gd, team_capture.gd) that should be refactored into base_scene_controller.gd.

Duplicated Patterns

  1. _input() handler - SPACE (start/stop), R (reset), S (step) keyboard handling is identical in all 3 scene controllers
  2. _process()_update_metrics_ui() - All 3 call _update_metrics_ui() from _process(). Could be a virtual method called from base class
  3. _reset_scene() pattern - All 3 call simulation_manager.reset_simulation() and reset_backend_decisions(). A _on_scene_reset() hook could standardize this
  4. _complete_scene() / _print_final_metrics() - Nearly identical completion guard + stop simulation + print metrics pattern

Context

Identified during Issue #64 (crafting system) implementation. Kept as a separate issue to keep #64 focused on crafting functionality.

Acceptance Criteria

  • _input() handler moved to SceneController base class
  • _process() calls virtual _update_metrics_ui() from base class
  • _reset_scene() standardized with base class hook
  • _complete_scene() pattern consolidated
  • Existing foraging scene still works correctly after refactor

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions