Conversation
|
What would the user interaction look like? |
|
I was thinking about a hotkey. When hotkey is pressed and user issue a move order (RMB), we catch it and send data to some simCallback function. Then delete initial move order there, call Also we have to strore units that were send to simCallback's function somewhere on UI side, so we know that they are "reversed" now. And next time when user issue normal move, and if some of selected units are in this "reversed" array, we send a callback to remove flag. |
|
@GodFuper Yeah, similar to COH2. I remember coh1 and it had same problem as we have now in FAF, when you are trying to retreat with your low hp tank and placing move order as close as possible to its back. Yeah, nostalgia hits hard :') good times... Anyway, let's see how our Lua guys will implement this. Even simple hotkey with some indicator near cursor will be enough I think. |
📝 WalkthroughWalkthroughConsolidates a removed memory-write from Changes
Sequence DiagramsequenceDiagram
participant Lua as "Lua Script"
participant Cpp as "ForceReverseMove() (C++)"
participant Unit as "Unit Entity"
participant Mem as "Memory [eax+0x0A4]"
participant Asm as "Assembly Hooks"
Lua->>Cpp: Call ForceReverseMove(unit, flag)
Cpp->>Unit: Resolve unit pointer
Cpp->>Mem: Write flag to [eax+0x0A4]
Unit->>Asm: Movement logic executes
Asm->>Mem: Read forceReverseMove flag
alt flag == true
Asm->>Asm: Jump to reverse-move path
else
Asm->>Asm: Continue default movement
end
Asm-->>Unit: Resume execution
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@section/UnitForceReverseMove.cpp`:
- Around line 5-6: Fix the minor grammar in the top comment: change "goes" to
"go" in the sentence "Without this flag all movement calculations goes through
default route" so it reads "Without this flag all movement calculations go
through default route"; locate and edit the comment in UnitForceReverseMove.cpp
(the two-line header comment starting with "Any changes made here WILL NOT
affect units without ForceReverseMove flag") and update the wording only.
- Around line 36-38: Fix the typos in the comment block in
UnitForceReverseMove.cpp: change "randonly" to "randomly" and "notmal" to
"normal" in the comment that explains ForceReverseMove behavior (the comment
referencing ForceReverseMove mode and movementTypeID being 5); keep the rest of
the comment wording unchanged so the explanation about movementTypeID and
formation reverse move remains intact.
🧹 Nitpick comments (1)
hooks/UnitForceReverseMove.hook (1)
1-14: Consider ordering hook addresses sequentially for maintainability.The hook addresses are defined out of order (0x005B34FB, 0x005B3578, 0x005B3566). Reordering them sequentially would improve readability when correlating with disassembly or debugging.
Suggested reordering
0x005B34FB: jmp `@asm__UnitForceReverseCheck` nop nop nop nop -0x005B3578: - jmp `@asm__BackUpDistanceCheck` - 0x005B3566: jmp `@asm__MovementTypeIDCheck` nop nop + +0x005B3578: + jmp `@asm__BackUpDistanceCheck`

Added sim
Unit:ForceReverseMove(true/false)It affects both: new move command and already existed one. BUT if unit has a command already and moves forward, then there will be delay (~5-10 ticks) before it switches to reverse. That's because of movement function update rate.
So, if we want it to be instant (or at least as fast as possible) it's better to remove existed move order in simCallback, then
Unit:ForceReverseMove(true)and then add new move command via sim function.*Feel free to suggest different namings :)
Summary by CodeRabbit
New Features
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.