From 9c3de7d34f53f82ab6e81f31f0c3c2332142b7ee Mon Sep 17 00:00:00 2001 From: Choumiko <ghostface@ghostface.info> Date: Thu, 22 Oct 2015 15:12:32 +0200 Subject: [PATCH 1/2] interface to show/hide gui. Returns previous state --- remote.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/remote.lua b/remote.lua index b7f5bc6..8b82286 100644 --- a/remote.lua +++ b/remote.lua @@ -12,5 +12,22 @@ function interface.reset_player(player_name_or_index) player_data.remote_viewer = nil end +function interface.hide_expando(event) + if global.player_data[event.player_index].expandoed then + resmon.on_click.YARM_expando(event) + return true + end + + return false +end + +function interface.show_expando(event) + if not global.player_data[event.player_index].expandoed then + resmon.on_click.YARM_expando(event) + return false + end + + return true +end remote.add_interface("YARM", interface) From 978318dc593554552112bcd0d1f42099a9cfa561 Mon Sep 17 00:00:00 2001 From: Choumiko <ghostface@ghostface.info> Date: Tue, 27 Oct 2015 12:59:14 +0100 Subject: [PATCH 2/2] change interface to take player_index or name --- remote.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/remote.lua b/remote.lua index 8b82286..78b4828 100644 --- a/remote.lua +++ b/remote.lua @@ -12,18 +12,20 @@ function interface.reset_player(player_name_or_index) player_data.remote_viewer = nil end -function interface.hide_expando(event) - if global.player_data[event.player_index].expandoed then - resmon.on_click.YARM_expando(event) +function interface.hide_expando(player_name_or_index) + local player = game.get_player(player_name_or_index) + if global.player_data[player.index].expandoed then + resmon.on_click.YARM_expando({player_index=player.index}) return true end return false end -function interface.show_expando(event) - if not global.player_data[event.player_index].expandoed then - resmon.on_click.YARM_expando(event) +function interface.show_expando(player_name_or_index) + local player = game.get_player(player_name_or_index) + if not global.player_data[player.index].expandoed then + resmon.on_click.YARM_expando({player_index=player.index}) return false end