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

Commit

Permalink
Unfuck the player_locations sensor.
Browse files Browse the repository at this point in the history
Fixes #14
  • Loading branch information
narc0tiq committed Aug 21, 2015
1 parent c57d076 commit 931410f
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions value_sensors/player_locations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,18 @@ function sensor:create_ui(owner)
style="description_flow_style"}

root.add{type="label", caption={self.format_key}}
self.player_list = root.add{type="table",
name="player_list",
colspan=1}
root.add{type="table", name="player_list", colspan=1}
end
end

function sensor:update_ui(owner)
if self.player_list == nil or not self.player_list.valid then return end

for _, p in ipairs(game.players) do
if self.player_list[p.name] == nil then
self.player_list.add{type="label", name=p.name}
if owner[self.name].player_list[p.name] == nil then
owner[self.name].player_list.add{type="label", name=p.name}
end
local desc = string.format("%s @(%d, %d on %s)", p.name,
p.position.x, p.position.y, p.surface.name)
self.player_list[p.name].caption = desc
owner[self.name].player_list[p.name].caption = desc
end
end

Expand Down

0 comments on commit 931410f

Please sign in to comment.