-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathswamp_goblins_client.lua
39 lines (34 loc) · 1.18 KB
/
swamp_goblins_client.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
swamp_goblins = {
constants = require 'constants'
}
local player_service_trace = nil
local function check_override_ui(players, player_id)
-- Load ui mod
if not player_id then
player_id = _radiant.client.get_player_id()
end
local client_player = players[player_id]
if client_player then
if client_player.kingdom == "swamp_goblins:kingdoms:firefly_clan" then
-- hot load rayyas children ui mod
_radiant.res.apply_manifest("/swamp_goblins/firefly_clan_selected/manifest.json")
end
end
end
local function trace_player_service()
_radiant.call('stonehearth:get_service', 'player')
:done(function(r)
local player_service = r.result
check_override_ui(player_service:get_data().players)
player_service_trace = player_service:trace('firefly_clan changes')
:on_changed(function(o)
check_override_ui(player_service:get_data().players)
end)
end)
end
radiant.events.listen(swamp_goblins, 'radiant:init', function()
radiant.events.listen(radiant, 'radiant:client:server_ready', function()
trace_player_service()
end)
end)
return swamp_goblins