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

Commit

Permalink
Push sensor setting handling up to the template
Browse files Browse the repository at this point in the history
  • Loading branch information
narc0tiq committed Sep 9, 2015
1 parent 34896bf commit 97b8b3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
10 changes: 0 additions & 10 deletions value_sensors/day_time.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ if not evogui.on_click then evogui.on_click = {} end
local sensor = ValueSensor.new("day_time")


function sensor:update_ui(owner)
local player = game.get_player(owner.player_index)
local sensor_settings = global.evogui[player.name].sensor_settings[self.name]

self.settings = sensor_settings

owner[self.name].caption = self:get_line()
end


function sensor:get_line()
-- 0.5 is midnight; let's make days *start* at midnight instead.
local day_time = math.fmod(game.daytime + 0.5, 1)
Expand Down
5 changes: 5 additions & 0 deletions value_sensors/template.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ function ValueSensor.new(name)
end

function sensor:update_ui(owner)
local player = game.get_player(owner.player_index)
local sensor_settings = global.evogui[player.name].sensor_settings[self.name]

self.settings = sensor_settings

owner[self.name].caption = self:get_line()
end

Expand Down

0 comments on commit 97b8b3d

Please sign in to comment.