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.