ZEN
ZEN copied to clipboard
Feature: area marker visibility by player side
Add a new feature to the area marker configuration.
By default, new area markers will be visible to all players as before:
But markers can be made invisible to some or all sides, like here - marker is only visible to blufor and civilian players:
Test cases:
- [x] visibility by side
- Zeus Z creates marker
- non-Zeus player A can see the marker
- Z disables visibility for side A belongs to by clicking the side icon (in marker configuration dialog)
- marker should disappear for A
- Z can fiddle with other parameters of that markers without it re-appearing for A
- Z can make the marker for A visible again by clicking their side icon (in marker configuration dialog)
- [x] more than one Zeus
- Zeus Z creates marker and disables visbility
- Zeus Y should continue to see the marker
I have a weird issue. The way I implemented this is by exchanging setMarkerAlpha
(run by Zeus) with setMarkerAlphaLocal
(run by all clients via cba global event) to hide the marker on certain clients
Works well, except for one thing:
- given a marker that is visible to Zeus, and invisible to another client
- when Zeus doubleclicks the marker (to open the configuration)
- on the other client, the marker's alpha value mysteriously changes from 0 to either 1 (or to whatever the Zeus sees, not sure yet) ⚡️
From what I can see logging and looking into the profiler, neither the applyProperties
nor the updateAlpha
method are called, so... looks like our code is not to blame.
My suspicion: engine somehow re-broadcasts global marker when I touch it.
Tentative conclusion: having a global marker and then running *Local
commands on it invites trouble.
edit: ah, there is even a warning in the biki
Will refactor to exclusively use local marker, see if that works better 😬
The updateAlpha
event is currently only added on the server.
The
updateAlpha
event is currently only added on the server.
ah right, had forgotten to push the fix to that. 😓 the locality problem I described existed regardless.
I just refactored the whole thing to use local markers only, and tested with a buddy and it seems to work. 👍
things I still have to test :
- [x] with more than one zeus
- [x] dragging markers
It happens because onMouseButtonUp
is called when the icon is double clicked, which calls setMarkerPos
and it seems that any global marker commands will re-synchronize all marker properties.
aaah. right. ok. - so are you okay with the "let's be safe and do local markers only" solution, or should I keep global markers and try and change the setMarkerPos
to setMarkerPosLocal
? @mharis001
I think the simpler solution is probably better - if the global setMarkerPos
is the only issue then that can be changed. However, if there are other problems, local markers would make sense then.
Area marker documentation/images should be updated too.
@mharis001 Should it be handled by this PR or not?
Either works, we can do it later in another PR if that is easier.
This should be changed to use #362's common sides control for the UI handling. Currently, the icons are white when hovered and change side instantly when clicked.
Some things that need to be taken care of for this:
-
playerSide
does not change if the player joins a group of a different side. - verify that it works as expected for JIP players.
- consider showing all markers to curators when they are in the Zeus interface only, not always.
- fix configure display positioning.