Reduce the time between automated refreshing of the unit tree. Also makes an initial call to the tree populating code upon first opening to remove the initial delay.
- Account for decrement in node index when culling the tree of sides/groups/units
- Fix non-zero-based index `to` value when navigating the units in the tree
Minor oversight introduced in pabst's fix for #2989, the icon handler is a mission event handler that isn't self terminating so the index needs to be preserved until after it is removed via `removeMissionEventHandler`. It is safe to let the `onUnload` event take care of that (and preferable so that icons disappear while temporarily closed).
This allows me to explicitly close the right display and hopefully fix the interface staying open upon mission end.
@Commy2's theory is that perhaps the main display `46` is killed upon mission end, meaning that `findDisplay` can't find the spectator display to close it because the game thinks it doesn't exist.
Should fix#2989
There is a race condition between these 4 PFEH and the "onUnload" event
in handleInterface.
If the PFEHs run first they will use nil variables and throw a script
error.
This sets them to nil immediately when exiting spectator
Turns out custom radio channels are kind of a pain to work with. However this should work fine assuming the radioChannelAdd commands will work on client machines.
Fixes#2514 by only rendering individual unit icons when zoomed in and only rendering the units currently within the screen bounds.
Behaves as expected, but whether or not it has a significant performance increase under scaled up testing conditions remains to be seen.
Previously they were only hidden, but this didn't account for the annoying audio they play so now they're entirely staged like a spectator unit would be.
Adds an optional boolean paremeter to the setSpectator function for forcing the interface. It is forced by default, so if `false` is passed as the value the spectator will be able to close the interface with the escape button.
When the value of respawn delay is 0 the timing of the killed and respawn events can be a little strange and result in spectator being entered but never exited. The respawn template should just do nothing when the delay is so small.
Changes the position calculation of the external spectator camera to correctly retain the pan and tilt of the free camera. Makes transitioning between the two less disorienting for the user.
Using the "external" view is limited by the server difficulty setting. Instead the spectator external camera has been replaced with an oribtal camera as was originally planned to be added alongside the default views.
- Use a display rather than a dialog (contextually makes more sense).
- Move the entry/exit functionality to the setSpectator function. Preserves the handleInterface function for purely display related events and makes more sense.
- Fix missing semi-colon
A public API system to allow external systems to interrupt and resume the spectator interface. Also made use of it for the escape menu and zeus support.
If the spectator camera unit was set before the camera had ever opened then the unit list wouldn't be populated and as such the camera would automatically abort to free mode since the unit wasn't available to spectate.
So now I'm running the updateUnits function before opening the camera to pre-populate the list.
Type 0 worked, but the mission didn't end when all players were killed.
Type 1 didn't work because isPlayer isn't true for seagulls. So spectator virtual state is now entirely unassociated from objects in the game.
Having the help window in the centre of the screen blocked too much of the users view and also clashed with the MPTable element (the table that appears on death, aka "respawnDialog"). It was moved to the right of the screen and now mirrors the unit list. To save screen space, the action keys are given as tooltips for the listbox entries so users must mouse over for more info.
The old method of refreshing the tree on each update would reset all expanded/collapsed nodes. Now the code will cull any units/groups/sides no longer spectatable from the list and cache the ones that are still valid. The cached data is then used to populate the list with new units.
Add coloured unit icons beside units in the list for quick user reference of side and type.
Store group netIDs in respective nodes for possible use in code.
- Optimize and improve 3D icon drawing
- Combine 2D and 3D PFHs into 1
- Render group icons outside of 200m, unit icons within
- Store list of groups on units update to cut down on what needs to be done each frame
- Change map control type to 100 to remove all default unit icons
- Improve colour caching, group colours don't change, unit colours do
- Remove icon setting, toggling should be at users discretion
Now that booming the free camera is influenced by the camera speed, the keys should be whitelisted from the held-key prevention system to allow the speed to be adjusted on the move. Also includes a failed attempt to fix the free camera map teleporting functionality.