Skip to content

Commit f22c114

Browse files
committed
Merge branch 'f2.0-dev'
2 parents a310812 + 066e947 commit f22c114

2,212 files changed

Lines changed: 177232 additions & 31792 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/commands/autofix.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# /autofix - Debug FactorioAccess crashes from manual gameplay
2+
3+
This command helps you debug crashes and issues that users experience while playing Factorio manually.
4+
5+
## What this does
6+
7+
When a user reports a crash or issue from their manual Factorio gameplay, this command:
8+
1. Immediately captures all relevant logs before they're lost
9+
2. Analyzes the crash to identify the root cause
10+
3. Helps you fix small issues (<50 lines) immediately
11+
4. Guides you through the debugging workflow
12+
13+
## Usage
14+
15+
Just say: `/autofix`
16+
17+
## What happens next
18+
19+
1. I'll check important file paths using `python3 launch_factorio.py --show-paths`
20+
2. I'll immediately run `python3 launch_factorio.py --capture-logs` to save the logs
21+
3. **CRITICAL REQUIREMENT**:
22+
- If the launcher returns empty/null logs, I MUST STOP IMMEDIATELY
23+
- I will NOT proceed without logs - it's a waste of everyone's time
24+
- I will ask for help to locate the logs instead of guessing or continuing blindly
25+
- The launcher should fail hard if logs can't be found
26+
4. I'll analyze the captured logs for any crash or error information
27+
5. If a bug is found:
28+
- I'll show you the relevant error information
29+
- I'll guide you through the fix process
30+
- **CRITICAL**: I'll use MessageBuilder for ALL string concatenation with LocalisedStrings
31+
- I'll format the code and commit the changes
32+
- I'll help you test the fix before the user tries again
33+
6. If no bug is found but logs were captured:
34+
- I'll report that no crash was detected in the logs
35+
- I'll ask you to describe what issue you encountered
36+
- I'll then proceed to help debug based on your description
37+
38+
## Important notes
39+
40+
- Act quickly! Logs are overwritten when Factorio restarts
41+
- The user is playing manually, not through the launcher
42+
- Focus on being helpful and responsive to keep the user engaged
43+
- Always format your changes before asking the user to retry
44+
- ALWAYS commit your changes after fixing bugs or adding features
45+
- Unit tests cannot be run while the user has Factorio open - rely on formatting and linting only
46+
- **NEVER run tests during debugging** - they overwrite the printout log!
47+
- If you can't find the issue after examining logs, ask the user for help instead of flailing
48+
- The launcher now captures factorio-access-printout.log which contains all speech output
49+
- Users will continue in the same session, providing more bugs as followups without rerunning this command.
50+
51+
## CRITICAL: Localization and String Handling
52+
53+
**ALWAYS USE MessageBuilder FOR LOCALIZATION!** Never concatenate LocalisedStrings with regular strings using `..`
54+
55+
### Common Localization Errors to Avoid:
56+
57+
1. **WRONG**: String concatenation with LocalisedStrings
58+
```lua
59+
-- This will crash!
60+
local result = "Power: " .. get_power_string(power) .. " capacity"
61+
```
62+
63+
2. **WRONG**: Mixed table concatenation
64+
```lua
65+
-- This will also crash!
66+
local result = {"", "Power: ", get_power_string(power), " capacity"}
67+
```
68+
69+
3. **CORRECT**: Use MessageBuilder
70+
```lua
71+
local message = MessageBuilder.new()
72+
message:fragment("Power: ")
73+
message:fragment(get_power_string(power))
74+
message:fragment(" capacity")
75+
printout(message:build(), pindex)
76+
```
77+
78+
### MessageBuilder Pattern:
79+
- Always `require("scripts.message-builder")` at the top of files
80+
- Create new instance with `MessageBuilder.new()`
81+
- Add fragments with `message:fragment(text_or_localised_string)`
82+
- Build final message with `message:build()`
83+
- MessageBuilder properly handles mixing LocalisedStrings and regular strings
84+
85+
### Direction Localization:
86+
- Use `{"fa.direction", direction_number}` not `"fa.direction-" .. direction_name`
87+
- Direction numbers: 0=North, 4=East, 8=South, 12=West, etc.
88+
- ***IMPORTANT**: use defines.north etc. instead in all applicable locations.
89+
90+
## Related documentation
91+
92+
See `llm-docs/debugging-manual-runs.md` for the full debugging guide.

.claude/commands/devplaytesting.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# /devplaytesting - set up to help a developer of the mod playtest
2+
3+
This command provides background information and guidance to help devs of the Factorio Access mod playtest.
4+
5+
## Communication Style and Rules
6+
7+
You:
8+
9+
- Seek information from the user
10+
- Seek approval before starting large projects
11+
- Check the local API documentation before using Factorio APIs
12+
- Always run linting
13+
- Never run tests
14+
15+
The user will be running Factorio in another window. The user will not necessarily close Factorio for you. You should
16+
not close Factorio. Factorio holds a process lock and can only run one instance at a time. For this reason, rely only
17+
on linting and user feedback. While playtesting, the tester needs to own the instance so they can play it.
18+
19+
## Goal
20+
21+
**IMPORTANT**: Directions from the user take priority over this command. The user may point you in different directions
22+
and widen scope depending on what playtesting uncovers. These directions are "initial settings".
23+
24+
The user is engaging in a playtesting session and is one of the core devs on the Factorio Access mod. They want you to:
25+
26+
- Investigate tracebacks, speech logs, and bugs
27+
- Help fix message wording
28+
- Build small, well-scoped UIs
29+
- Perform minor refactors
30+
31+
They do not want you to perform major refactors without explicit requests.
32+
33+
You should assume that the user knows:
34+
35+
- Lua
36+
- The Factorio API and game mechanics
37+
- How mod features work
38+
39+
The user is blind and using a screen reader: most commonly Jaws or NVDA. They cannot extract visual information from
40+
the game. They can run Lua snippets with the `/fac` command and get you the output and can control the game through the
41+
mod. The user has limited access to OCR capabilities. The user may be able to paste screenshots. If a feature is not
42+
implemented in the mod, the user does not have access to it.
43+
44+
Your code quality is expected to be that of a senior developer. You should think before implementing. The user will
45+
review your output. It's not about patching over the problem, it's about finding and fixing the root cause!
46+
47+
## Important Files
48+
49+
@scripts/ui/router.lua @devdocs/ui.md @scripts/viewpoint.lua @scripts/building-tools.lua
50+
51+
Control.lua is the main entrypoint to the mod but is not included with this command because it is very large.
52+
53+
## Actions to Take
54+
55+
Greet the user and say that you are ready for feedback. The user will play the game and drop you descriptions of bugs
56+
or tracebacks as they come up, or make more explicit requests for improvements.

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ jobs:
1111
- name: 'stylua --check'
1212
shell: bash
1313
run: |
14-
cargo install --version 0.20.0 stylua --features lua52
14+
cargo install --version 2.3.0 stylua --features lua52
1515
stylua --check . -v
1616

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
11
*.code-workspace
2+
__pycache__
3+
*.zip
4+
!lab_tiles.zip
5+
6+
/.claude/settings*
7+
claude-task.md
8+
claude-prompt.md
9+
factorio_crash_*

.vscode/settings.json

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,22 @@
1717
"deprecated",
1818
"need-check-nil"
1919
],
20-
"Lua.workspace.library": [
21-
"c:\\Program Files\\Factorio\\data"
22-
],
2320
"Lua.workspace.checkThirdParty": "ApplyInMemory",
2421
"Lua.runtime.version": "Lua 5.2",
2522
"[lua]": {
2623
"editor.defaultFormatter": "JohnnyMorganz.stylua"
27-
}
24+
},
25+
"editor.rulers": [
26+
120
27+
],
28+
"cSpell.words": [
29+
"Factorio",
30+
"Kontrol",
31+
"Kruise",
32+
"localised",
33+
"pindex"
34+
],
35+
"Lua.workspace.userThirdParty": [
36+
"c:\\Users\\austin\\AppData\\Roaming\\Code\\User\\workspaceStorage\\fc56fb59ba6ed3eb8345f3d950119ed6\\justarandomgeek.factoriomod-debug\\sumneko-3rd"
37+
]
2838
}

0 commit comments

Comments
 (0)