Player unable to choose a slot due if lava is either disconnected or not started
Kaidrick opened this issue · comments
Player won't be able to choose a slot to join if the connection between lava and dcs lua server fails, because Lava actively pull player slot change data from server to determine whether a player meets the requirement to join.
A few changes should be made to make lava be able to hand-off the validation.
A timer should be set in lava, and if the field is not set to true before the next tick by a heartbeat signal, dcs lua server will automatically bypass the validation.
Need further testing on DCS.setUserCallbacks() behavior. When a new callback is to be set, it might be pushed to a callback array, or it might be put into a namespaced table.
If callback are namespaced, it is possible to replace the callback in the run. Otherwise the only possible solution seems to be reference to a object that is not in the callback table.
In the worst case, for instance, the callback are deep copy and everything are passed by value (neither correct nor accurate for Lua though), we can use a file for flagging but I'd rather avoid this kind of ugly solution as much as possible.
use a global variable
Player slot change request is now handled by an injected hook to handle onPlayerTryChangeSlot callback function. The validation of a slot change is completely handed off to Lua in the current implementation, even if the connection has been lost between DCS server and Lava backend.