Fixed role event emit

This commit is contained in:
Cooldude2606
2020-08-14 16:49:55 +01:00
parent f5a2f7ed70
commit 1172baf2b9

View File

@@ -153,12 +153,11 @@ local function emit_player_roles_updated(player, type, roles, by_player_name, sk
event = Roles.events.on_role_unassigned
end
-- convert the roles to objects and get the names of the roles
local index, role_names, valid_roles = 0, {}, {}
local index, role_names = 0, {}
for _, role in ipairs(roles) do
role = Roles.get_role_from_any(role)
if role then
index = index + 1
valid_roles[index] = role
role_names[index] = role.name
end
end
@@ -176,7 +175,7 @@ local function emit_player_roles_updated(player, type, roles, by_player_name, sk
tick=game.tick,
player_index=player.index,
by_player_index=by_player_index,
roles=valid_roles
roles=role_names
})
write_json('log/roles.log', {
player_name=player.name,