Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Also move close_settings_gui() up.
Browse files Browse the repository at this point in the history
  • Loading branch information
narc0tiq committed Sep 9, 2015
1 parent 97b8b3d commit 737a78a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
10 changes: 0 additions & 10 deletions value_sensors/day_time.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,6 @@ function sensor:get_line()
end


function sensor:close_settings_gui(player_index)
local player = game.get_player(player_index)
local root_name = self:settings_root_name()

player.gui.center[root_name].destroy()

if self.settings_gui_closed then self.settings_gui_closed(player_index) end
end


function sensor:settings_gui(player_index)
local player = game.get_player(player_index)
local sensor_settings = global.evogui[player.name].sensor_settings[self.name]
Expand Down
11 changes: 1 addition & 10 deletions value_sensors/player_locations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ require "template"
if not evogui.on_click then evogui.on_click = {} end
local sensor = ValueSensor.new("player_locations")


function sensor:create_ui(owner)
if owner[self.name] == nil then
local root = owner.add{type="flow",
Expand All @@ -16,16 +17,6 @@ function sensor:create_ui(owner)
end


function sensor:close_settings_gui(player_index)
local player = game.get_player(player_index)
local root_name = self:settings_root_name()

player.gui.center[root_name].destroy()

if self.settings_gui_closed then self.settings_gui_closed(player_index) end
end


function sensor:settings_gui(player_index)
local player = game.get_player(player_index)
local sensor_settings = global.evogui[player.name].sensor_settings[self.name]
Expand Down
9 changes: 9 additions & 0 deletions value_sensors/template.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ function ValueSensor.new(name)
return self.name.."_settings"
end

function sensor:close_settings_gui(player_index)
local player = game.get_player(player_index)
local root_name = self:settings_root_name()

player.gui.center[root_name].destroy()

if self.settings_gui_closed then self.settings_gui_closed(player_index) end
end

function sensor:make_on_click_checkbox_handler(setting_name)
local sensor_name = self.name

Expand Down

0 comments on commit 737a78a

Please sign in to comment.