Distribution click action mode
Reopen #1453 again. Documents:
[ ] Distribution Mode Spread / Filter / Enable
- Now you can change the click action by using
AllowSwitchNoMoveCommandhotkey. If the behavior to be executed by the current techno is different from the behavior displayed by the mouse, and the behavior to be executed will make the techno move near the target, the behavior will be replaced with area guard. Regardless of whether or not switch hotkey is used, default behavior can be changed throughDefaultApplyNoMoveCommand. - Now you can also change the click action when hold down the specific hotkey if enabled
AllowDistributionCommand. The new behavior is like using the selected objects one by one to click on each target within the range. AllowDistributionCommand.SpreadMode&AllowDistributionCommand.FilterModeallow you to set spread range and target filter by hotkeys, which default toDefaultDistributionSpreadModeandDefaultDistributionFilterMode.- When the range is 0, it is the original default behavior of the game. The range can be adjusted to 4, 8 or 16 cells by another shortcut key. You can also adjust this by using the mouse wheel while holding down the specific hotkey if
AllowDistributionCommand.SpreadModeScrollset to true;- The targets within the range will be allocated equally to the selected technos. Only when the behavior to be performed by the current techno is the same as that displayed by the mouse will it be allocated. Otherwise, it will return to the original default behavior of the game (it will not be effective for technos in the air). This will display a range ring.
- When the filter is
None, it is the default behavior of the game. If the range is not zero at this time, a green ring will be displayed. You can adjust the filter mode to:Like- only targets with the same armor type (Completely identicalArmor) will be selected among the targets allocated in the range. At this time, a blue ring will be displayed.Type- only targets of the same type (like infantries, vehicles or buildings) will be selected among the targets allocated in the range. At this time, a yellow ring will be displayed.Name- only targets of the same name (or with the sameGroupAs) will be selected among the targets allocated in the range. At this time, a red ring will be displayed.
- When the range is 0, it is the original default behavior of the game. The range can be adjusted to 4, 8 or 16 cells by another shortcut key. You can also adjust this by using the mouse wheel while holding down the specific hotkey if
AllowDistributionCommand.AffectsAllies&AllowDistributionCommand.AffectsEnemiesallow the distribution command to work on allies (including owner) or enemies target. If picking a target that's not eligible, it'll fallback to vanilla command.- It's possible to add a button for distribution mode in the bottom bar by adding
DistributionModein theButtonListofAdvancedCommandBarandMultiplayerAdvancedCommandBar.- The positions of each button are hardcoded, so it'll only decide whether enable this button or not. Distribute Mode button is now always listed after all the vanilla ones.
- The asset of these buttons should be added in
sidec0x.mixfiles which correspond to different sides, with the namebutton12.shp.
- For localization add
TXT_SWITCH_NOMOVE,TXT_DISTR_SPREAD,TXT_DISTR_FILTER,TXT_DISTR_HOLDDOWN,TXT_SWITCH_NOMOVE_DESC,TXT_DISTR_SPREAD_DESC,TXT_DISTR_FILTER_DESC,TXT_DISTR_HOLDDOWN_DESC,MSG:DistributionModeOn,MSG:DistributionModeOff,TIP:DistributionModeinto your.csffile.
In rulesmd.ini:
[GlobalControls]
AllowSwitchNoMoveCommand=false ; boolean
AllowDistributionCommand=false ; boolean
AllowDistributionCommand.SpreadMode=true ; boolean
AllowDistributionCommand.SpreadModeScroll=true ; boolean
AllowDistributionCommand.FilterMode=true ; boolean
AllowDistributionCommand.AffectsAllies=true ; boolean
AllowDistributionCommand.AffectsEnemies=true ; boolean
[AudioVisual]
StartDistributionModeSound= ; sound entry
EndDistributionModeSound= ; sound entry
AddDistributionModeCommandSound= ; sound entry
In ra2md.ini:
[Phobos]
DefaultApplyNoMoveCommand=true ; boolean
DefaultDistributionSpreadMode=2 ; integer, 0 - r=0 , 1 - r=4 , 2 - r=8 , 3 - r=16
DefaultDistributionFilterMode=2 ; integer, 0 - None , 1 - Like , 2 - Type , 3 - Name
In uimd.ini:
[AdvancedCommandBar]
ButtonList=[Button1],DistributionMode,[ButtonX] ; List of button entry
[MultiplayerAdvancedCommandBar]
ButtonList=[Button1],DistributionMode,[ButtonX] ; List of button entry
Nightly build for this pull request:
- compiled-dll-2e61e398b1cd9bef779dc1ab952acc96de292848.zip These artifacts will expire in 90 days and will not be available for download after that time.
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.
@Metadorius Any issue other than https://github.com/Phobos-developers/Phobos/pull/1949#pullrequestreview-3473595716?
TODO: (Summarized from https://github.com/Phobos-developers/Phobos/pull/1949#pullrequestreview-3473595716)
- [ ] Create independent file for
AdvancedCommandBarButtonClass. - [ ] Allow registering new
AdvancedCommandBarButtonClasslikeMakeCommand.
@Metadorius Please confirm the above summary, or supplement/correct the incorrect parts.
@TaranDahl yeah, correct, there was also a comment about implementing press-and-drag mode (and not sure if the "same type" (infantry/buildings/vehicles/etc) is needed, since we have "same armor" mode). CrimRecya said it's too problematic, however I don't really see why, since we already have drag selection and we could reuse drag selection to calculate the radius.
there was also a comment about implementing press-and-drag mode (and not sure if the "same type" (infantry/buildings/vehicles/etc) is needed
I think there is not enough labor force to add more features. I think the existing work is sufficient in terms of completion. We should just perfect the existing features and then merge them. As for more features, they should be another work, and can be implemented later, by anyone who wants them. Breaking it into two PR can also help avoid the problem of having an excessive amount of code piled up in one PR, which may lead to no one willing to review it.
I think there is not enough labor force to add more features. I think the existing work is sufficient in terms of completion. We should just perfect the existing features and then merge them. As for more features, they should be another work, and can be implemented later, by anyone who wants them. Breaking it into two PR can also help avoid the problem of having an excessive amount of code piled up in one PR, which may lead to no one willing to review it.
This isn't a feature though? It is just a somewhat small improvement that brings it in line with how modern games do it.
0x6D2280(exists in YRpp) for transforming screen coords into world coords (though Z is 0, maybe would want to account for that)0x4AC4CCis where the drag-selection band is set and the mouse hold is done0x4ABCEBis where the drag-selection release is handled0xD90inTacticalClassisRectthat contains X, Y, Width, Height
From that you could calculate 2 points, get world coords via function above, use this info to draw a corresponding circle and set the mode to such. I am not sure what is complex here. If needed I can send my decompile for this.