Refactor InSim button handling
The API for button handling is now the following:
-
InSimButtonbecomes a base class forInSimButtonSingleandInSimButtonMulti. - Adding and updating buttons is limited to a single method per button type (
add_button()andadd_button_multi()for adding,update_button()andupdate_button_multi()for updating). - Deleting buttons requires one or more references to
InSimButtonobjects. - Getting buttons returns a single
InSimButtonor an array of them.
Note that some renames may still happen to better represent single buttons vs multi-buttons, e.g. add_single_button() and update_single_button(), since those only work with InSimButtonSingle. Button classes would be renamed to InSimSingleButton and InSimMultiButton along with this change.
Global buttons are InSimButtonMulti objects assigned to all UCIDs on the server (created with an empty UCID array, or set to global with set_global_button()), the mapped UCIDs are added and removed automatically from people joining or leaving the server, and the global_buttons_restored signal can be used to update newly added global buttons.
Broadcast buttons are InSimButtonSingle objects assigned to UCID 255. They are automatically sent when a player joins the server or when a player requests buttons after hiding them. Since they use UCID 255, they bypass the request to hide buttons, and will be displayed whenever they are sent. Sending broadcast buttons as soon as a player hides buttons is not desirable, as it would effectively prevent them from restoring their own buttons.
Closes #7 (closed).
Note
Renames were applied:
- Button classes are now
InSimSoloButtonandInsimMultiButton. - Button methods are
add_solo_button(),add_multi_button(),update_solo_button(), andupdate_multi_button().