Skip to content

Add .node mod support and refactor mod loader/manager; fix lexer/parser formatting and team index bug; add tests#3

Open
MonthZifang wants to merge 1 commit intotest-aifrom
codex/compare-official-mindustry-repo-with-go-server
Open

Add .node mod support and refactor mod loader/manager; fix lexer/parser formatting and team index bug; add tests#3
MonthZifang wants to merge 1 commit intotest-aifrom
codex/compare-official-mindustry-repo-with-go-server

Conversation

@MonthZifang
Copy link
Copy Markdown
Member

Motivation

  • Enable loading of Node-based mods and make mod file extension checks robust and case-insensitive.
  • Simplify and centralize mod lifecycle handling in the manager/loader and provide a dedicated mod logger.
  • Fix representation and formatting of token/operator types and correct team index computation to avoid integer-type issues.

Description

  • Add case-insensitive extension handling in internal/mods/loader.go and support .node mods, including aliasing the go package import to gomod and registering a node manager.
  • Introduce a package-level modLog logger in internal/mods/types.go and replace calls to the previous Log target with modLog in internal/mods/manager.go, and delegate start/stop to the loader via loader.Start()/loader.Stop() and collect loaded mods into m.mods with collectLoadedModsLocked().
  • Improve error handling in Unload to avoid unused variable and normalize JSON marshaling/unmarshaling field naming in loader.go.
  • Add unit tests internal/mods/loader_test.go covering loading of .jar, .js, .go, .node (case-insensitive) and disabled/unsupported scenarios.
  • Fix string formatting for token and operator types by using %v in internal/logic/lexer.go and internal/logic/parser.go to avoid printing type values incorrectly.
  • Fix team color indexing in internal/render/render.go by using int conversions for modulo and negative-index correction to avoid int32 mixing.
  • Update example code to use config.PersistConfig instead of persist.Config in examples/双核心集成示例.go.

Testing

  • Ran go test ./internal/mods -v which executed TestModLoaderLoadTypes and TestModLoaderDisabledAndUnsupported and both tests passed.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant