-
Notifications
You must be signed in to change notification settings - Fork 250
adding "Reverse move" hotkey #7003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -826,6 +826,38 @@ do | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ---@param data { Enable: boolean, ShowMsg: boolean } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ---@param selection Unit[] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Callbacks.ForceReverseMove = function(data, selection) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- verify selection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not data.Units then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| selection = SecureUnits(selection) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| selection = SecureUnits(data.Units) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (not selection) or TableEmpty(selection) then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for k, unit in selection do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if unit.Blueprint.Physics.MaxSpeedReverse and unit.Blueprint.Physics.MaxSpeedReverse > 0 then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| unit:ForceReverseMove(data.Enable) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if data.ShowMsg then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if data.Enable == true then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print(string.format("Force reverse move ENABLED for %d units", table.getn(selection))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print(string.format("Force reverse move DISABLED for %d units", table.getn(selection))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+831
to
+856
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Count only reverse-capable units in the status message. 🐛 Proposed fix- for k, unit in selection do
+ local affected = 0
+ for k, unit in selection do
if unit.Blueprint.Physics.MaxSpeedReverse and unit.Blueprint.Physics.MaxSpeedReverse > 0 then
unit:ForceReverseMove(data.Enable)
+ affected = affected + 1
end
end
if data.ShowMsg then
if data.Enable == true then
- print(string.format("Force reverse move ENABLED for %d units", table.getn(selection)))
+ print(string.format("Force reverse move ENABLED for %d units", affected))
else
- print(string.format("Force reverse move DISABLED for %d units", table.getn(selection)))
+ print(string.format("Force reverse move DISABLED for %d units", affected))
end
end📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --#endregion | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -201,6 +201,7 @@ skins = { | |
| RULEUCC_Teleport = {'/textures/ui/common/game/cursors/transport.dds', 15, 15}, | ||
| RULEUCC_Script = {'/textures/ui/common/game/cursors/attack.dds', 15, 15}, | ||
| RULEUCC_Invalid = {'/textures/ui/common/game/cursors/attack-invalid.dds', 15, 15}, | ||
| RULEUCC_ReverseMove = {'/textures/ui/common/game/cursors/reverse_move-.dds', 15, 15, 12, 12}, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Verify the reverse-move cursor DDS exists in the repo
fd -a 'reverse_move-.dds' .Repository: FAForever/fa Length of output: 38 🏁 Script executed: # Search for CursorType definition to understand the typing context
rg -i "CursorType" --type luaRepository: FAForever/fa Length of output: 138 🏁 Script executed: # Get context around line 204 in the target file
sed -n '190,220p' lua/skins/skins.luaRepository: FAForever/fa Length of output: 2821 🏁 Script executed: # Find the CursorType alias definition in skins.lua
rg -A 50 '---@alias CursorType' lua/skins/skins.luaRepository: FAForever/fa Length of output: 477 🏁 Script executed: # Find the CursorType alias definition in skins.lua with proper escaping
rg -A 50 '@alias CursorType' lua/skins/skins.luaRepository: FAForever/fa Length of output: 1306 Add the missing 🤖 Prompt for AI Agents |
||
| COORDINATED_ATTACK = {'/textures/ui/common/game/cursors/attack_coordinated.dds', 15, 15}, | ||
| MESSAGE = {'/textures/ui/common/game/cursors/message-.dds', 15, 15, 11, 12}, | ||
| BUILD = {'/textures/ui/common/game/cursors/selectable-.dds', 2, 2, 7, 12}, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -201,6 +201,9 @@ local orderToCursorCallback = { | |
| RULEUCC_Script = 'OnCursorScript', | ||
| RULEUCC_Invalid = 'OnCursorInvalid', | ||
| RULEUCC_CallTransport = 'OnCursorCallTransport', | ||
|
|
||
| -- A fake RULEUCC for cursor rendering. Actual CM in commandmode.lua is still RULEUCC_Move | ||
| RULEUCC_ReverseMove = 'OnCursorReverseMove', | ||
|
|
||
| -- misc | ||
| CommandHighlight = 'OnCursorCommandHover', | ||
|
|
@@ -392,6 +395,10 @@ WorldView = ClassUI(moho.UIWorldView, Control, WorldViewShapeComponent, WorldVie | |
| if order == 'RULEUCC_Attack' then | ||
| order = 'RULEUCC_AttackGround' | ||
| end | ||
|
|
||
| if command_data.isReverseMove then | ||
| order = 'RULEUCC_ReverseMove' | ||
| end | ||
| -- 2. then command highlighting | ||
| elseif self:HasHighlightCommand() then | ||
| order = 'CommandHighlight' | ||
|
|
@@ -526,6 +533,21 @@ WorldView = ClassUI(moho.UIWorldView, Control, WorldViewShapeComponent, WorldVie | |
| self:EnableIgnoreMode(false) | ||
| end | ||
| end, | ||
|
|
||
| --- Called when the order `RULEUCC_ReverseMove` is being applied | ||
| ---@param self WorldView | ||
| ---@param identifier 'RULEUCC_ReverseMove' | ||
| ---@param enabled boolean | ||
| ---@param changed boolean | ||
| OnCursorReverseMove = function(self, identifier, enabled, changed) | ||
| if enabled then | ||
| if changed then | ||
| local cursor = self.Cursor | ||
| cursor[1], cursor[2], cursor[3], cursor[4], cursor[5] = UIUtil.GetCursor(identifier) | ||
| self:ApplyCursor() | ||
| end | ||
| end | ||
|
Comment on lines
+537
to
+549
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Align reverse-move cursor with Move ignore-mode behavior. 🐛 Proposed fix OnCursorReverseMove = function(self, identifier, enabled, changed)
if enabled then
if changed then
local cursor = self.Cursor
cursor[1], cursor[2], cursor[3], cursor[4], cursor[5] = UIUtil.GetCursor(identifier)
self:ApplyCursor()
+ self:EnableIgnoreMode(true)
end
else
+ self:EnableIgnoreMode(false)
end
end,🤖 Prompt for AI Agents |
||
| end, | ||
|
|
||
| --- Called when the order `RULEUCC_Guard` is being applied | ||
| ---@param self WorldView | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it not be better to always use the current selection? That way you don't even need to use the SecureUnits function as far as I am aware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are cases when we don't need all selected units but only part of them (exlcude units without MaxSpeedReverse or with MaxSpeedReverse = 0). I do this check on UI and sim side just in case. Theoretically we can do this check only in sim and just use current selection, idk what is better