Annotate SetNavigatorPersonalPosMaxDistance and check it exists before calling it#7155
Annotate SetNavigatorPersonalPosMaxDistance and check it exists before calling it#7155lL1l1 wants to merge 4 commits into
SetNavigatorPersonalPosMaxDistance and check it exists before calling it#7155Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR adds the ChangesNavigator threshold update
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
lua/simInit.lua (1)
588-592: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winPrefer simple nil check over
rawget(_G, ...)unless metatable protection is required.
rawget(_G, "SetNavigatorPersonalPosMaxDistance")is defensive against_Gmetatable__index, but a simpleif SetNavigatorPersonalPosMaxDistance thenis more idiomatic in Lua and equally safe for standard global access. If this codebase usesrawgetconsistently for engine API guards, keep it; otherwise, simplify for readability.function SetupPathfinding() - if rawget(_G, "SetNavigatorPersonalPosMaxDistance") then + if SetNavigatorPersonalPosMaxDistance then SetNavigatorPersonalPosMaxDistance(9999) - end end🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lua/simInit.lua` around lines 588 - 592, In SetupPathfinding, replace the defensive rawget(_G, "SetNavigatorPersonalPosMaxDistance") guard with a simple direct nil check on SetNavigatorPersonalPosMaxDistance unless this code intentionally relies on bypassing _G metatable behavior. Keep the call to SetNavigatorPersonalPosMaxDistance(9999) unchanged, and use the same style as the rest of the engine API checks in simInit.lua for consistency.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@lua/simInit.lua`:
- Around line 588-592: In SetupPathfinding, replace the defensive rawget(_G,
"SetNavigatorPersonalPosMaxDistance") guard with a simple direct nil check on
SetNavigatorPersonalPosMaxDistance unless this code intentionally relies on
bypassing _G metatable behavior. Keep the call to
SetNavigatorPersonalPosMaxDistance(9999) unchanged, and use the same style as
the rest of the engine API checks in simInit.lua for consistency.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f92e60df-c097-4290-8ae3-7e2358dbe8d5
📒 Files selected for processing (3)
changelog/snippets/other.7155.mdengine/Sim.lualua/simInit.lua
Description of the proposed changes
Adds annotation to fix undefined global warning.
Check it exists before calling it because its resulting in an error in the current lua deployment because exe isn't automatically deployed with it.
Testing done on the proposed changes
no intellisense warning are given anymore
Checklist
Summary by CodeRabbit
New Features
Bug Fixes