-
Notifications
You must be signed in to change notification settings - Fork 43
/
remote.lua
67 lines (51 loc) · 2.1 KB
/
remote.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
require "resmon"
local mod_gui = require("mod-gui")
local interface = {}
function interface.how_many_entities_tracked(player_name_or_index)
local player = game.players[player_name_or_index]
player.print({ "", "Tracking ", #storage.ore_tracker.entities, " entities" })
end
function interface.reset_ui(player_name_or_index)
local player = game.players[player_name_or_index]
local frame_flow = mod_gui.get_frame_flow(player)
local root = frame_flow.YARM_root
if root and root.valid then root.destroy() end
end
function interface.reset_player(player_name_or_index)
local player = game.players[player_name_or_index]
local player_data = storage.player_data[player.index]
player.character = player.selected
player_data.viewing_site = nil
player_data.real_character = nil
player_data.remote_viewer = nil
end
function interface.get_current_filter(player_name_or_index)
local player = game.players[player_name_or_index]
local player_data = storage.player_data[player.index]
return player_data.active_filter or 'none'
end
function interface.set_filter(player_name_or_index, new_filter)
local player = game.players[player_name_or_index]
local player_data = storage.player_data[player.index]
local old_filter = player_data.active_filter
-- TODO Could use some validation here... what values are actually allowed, that kind of thing.
player_data.active_filter = new_filter or 'none'
resmon.update_ui_filter_buttons(player, player_data.active_filter)
resmon.update_ui(player)
return old_filter
end
function interface.hide_expando(player_name_or_index)
log("hide_expando is no longer supported. Try set_filter(player_name_or_index, 'none' or 'warnings' or 'all')")
return false
end
function interface.show_expando(player_name_or_index)
log("show_expando is no longer supported. Try set_filter(player_name_or_index, 'none' or 'warnings' or 'all')")
return false
end
function interface.get_on_site_updated_event_id()
return on_site_updated
end
function interface.get_global_data()
return storage
end
remote.add_interface("YARM", interface)