Skip to content
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

Add notes to AddSpecialEffectTarget, SetUnitColor and SetAllyColorFil… #141

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions common.j
Original file line number Diff line number Diff line change
Expand Up @@ -13497,12 +13497,18 @@ Sets a unit's player color accent.
@param whichUnit Unit to modify.
@param whichColor Set to this player's color.


@bug Visual bug (tested v1.32.10): if you create two units of the same type (Normal and Colored)
@bug Visual bug (tested v1.32.10): if you create two units of the same type, the same owning player (Normal and Colored),
and set Colored's color to a different color, then clicking between the two units
will not change the portrait color. The portrait will only update correctly if you
deselect the unit.
will not change the portrait color (switching to a unit of the same type and player will not do a re-render of the
portrait model, it won't restart the animation, either). The portrait model can be updated by deselect the unit, switching
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by deselect the unit

-> by deselecting the unit

to another unit of a differet type or of a different player. Another option is to call `SetUnitColor` on the unit that is
showing its portrait model or using `SetAllyColorFilterState` (see `SetAllyColorFilterState` for specifics).
Comment on lines +13503 to +13505
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a double new line before "The portrait model"? The paragraph is quite long and that sentence begins to describe one of two workarounds.

Double new line because of markdown interpretation


@note If the unit being re-colored is the one currently showing its portrait model in the user interface,
it will correctly re-color the portrait model.

@note If the unit being re-colored is the one currently showing its portrait model in the user interface,
the portrait model will be forced to update and restart its animation.
Comment on lines +13507 to +13511
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these two can be collapsed into one note, right? Not just for repetition's sake, I have seen the Notepad++ auto-completion screenshot by @Leyki, the longer descriptions of ours fill the entire 1080p screen


@patch 1.00
*/
Expand Down Expand Up @@ -17861,6 +17867,19 @@ click.

@note See: `GetAllyColorFilterState` for full description; `EnableMinimapFilterButtons`.

@note This can be used to force a playercolor update of unit-attached effects (see `AddSpecialEffectTarget`).
To do so, the effective rendered playercolor must be changed. You can toggle through all the states to achieve this, like:
```
function updateColor takes nothing returns nothing
local integer previousColor = GetAllyColorFilterState()
call SetAllyColorFilterState(0)
call SetAllyColorFilterState(1)
call SetAllyColorFilterState(2)
call SetAllyColorFilterState(previousColor)
endfunction
```
Warning: This will also force an update on the portrait model of a unit if its currently showing in the user interface
and restart its animation.

@patch 1.07
*/
Expand Down Expand Up @@ -20212,6 +20231,13 @@ you are attaching effects to.

@note To create an effect only visible to one player see <https://www.hiveworkshop.com/threads/gs.300430/#post-3209073>.

@bug Only works on units. For destructables and items, the function will still return a non-null effect.

@bug Attached effects initially have red playercolor (like PLAYER_COLOR_RED, ally color filter state modifications apply)
even if the unit the effect is attached to is not owned by a player with red playercolor. After creation, the color can be
set by using `SetUnitColor` on the unit (directly set to the color desired, no need to set the color to an intermediate
first) or by using `SetAllyColorFilterState` to set to the color to the current color of the unit
(ally color filter state modifications apply, see `SetAllyColorFilterState` for specifics).

@patch 1.00
*/
Expand Down