diff --git a/expcore/gui/center.lua b/expcore/gui/center.lua index b849075a..59c978c2 100644 --- a/expcore/gui/center.lua +++ b/expcore/gui/center.lua @@ -75,8 +75,8 @@ function CenterFrames.toggle_frame(player,name,state) return true elseif state == false then local flow = CenterFrames.get_flow(player) - if flow[define.name] then - flow[define.name].destroy() + if flow[define.name..'-frame'] then + flow[define.name..'-frame'].destroy() end return false else @@ -99,7 +99,7 @@ function CenterFrames.new_frame(permision_name) mt.__index = CenterFrames._prototype mt.__call = self.event_handler - Gui.on_custom_close(self.name,function(event) + Gui.on_custom_close(self.name..'-frame',function(event) local element = event.element if element and element.valid then element.destroy() end end) @@ -124,8 +124,8 @@ function CenterFrames._prototype:draw_frame(player) player = Game.get_player_from_any(player) local flow = CenterFrames.get_flow(player) - if flow[self.name] then - return flow[self.name] + if flow[self.name..'-frame'] then + return flow[self.name..'-frame'] end if self.auto_focus then @@ -134,7 +134,7 @@ function CenterFrames._prototype:draw_frame(player) local frame = flow.add{ type='frame', - name=self.name + name=self.name..'-frame' } if self.auto_focus then @@ -155,8 +155,8 @@ function CenterFrames._prototype:redraw_frame(player) player = Game.get_player_from_any(player) local flow = CenterFrames.get_flow(player) - if flow[self.name] then - flow[self.name].destroy() + if flow[self.name..'-frame'] then + flow[self.name..'-frame'].destroy() end return self:draw_frame(player) @@ -169,8 +169,8 @@ function CenterFrames._prototype:toggle_frame(player) player = Game.get_player_from_any(player) local flow = CenterFrames.get_flow(player) - if flow[self.name] then - flow[self.name].destroy() + if flow[self.name..'-frame'] then + flow[self.name..'-frame'].destroy() return false else self:draw_frame(player) diff --git a/expcore/gui/left.lua b/expcore/gui/left.lua index 35a8b66b..a2dcf1d1 100644 --- a/expcore/gui/left.lua +++ b/expcore/gui/left.lua @@ -174,8 +174,8 @@ end -- @treturn LuaGuiElement the frame in the left frame flow for this define function LeftFrames._prototype:get_frame(player) local flow = LeftFrames.get_flow(player) - if flow[self.name] and flow[self.name].valid then - return flow[self.name] + if flow[self.name..'-frame'] and flow[self.name..'-frame'].valid then + return flow[self.name..'-frame'] end end @@ -276,7 +276,7 @@ Event.add(defines.events.on_player_created,function(event) for _,define in pairs(LeftFrames.frames) do local frame = flow.add{ type='frame', - name=define.name, + name=define.name..'-frame', direction=define.direction }