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

Commit

Permalink
Merge #64, the Factorio 0.13 update
Browse files Browse the repository at this point in the history
Just a straight port at this point, probably a bit buggy, too.
  • Loading branch information
narc0tiq committed Jun 30, 2016
2 parents 221c2c5 + 5309a10 commit 34ae6a2
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 26 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.16
0.4.101
3 changes: 1 addition & 2 deletions control.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
require "defines"
require "evoGUI"

if not evogui then evogui = {} end

function evogui.log(message)
if game then
for i, p in ipairs(game.players) do
for i, p in pairs(game.players) do
p.print(message)
end
else
Expand Down
5 changes: 2 additions & 3 deletions evoGUI.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require "defines"
require "value_sensors.day_time"
require "value_sensors.evolution_factor"
require "value_sensors.kill_count"
Expand Down Expand Up @@ -80,7 +79,7 @@ end


function evogui.new_player(event)
local player = game.get_player(event.player_index)
local player = game.players[event.player_index]

evogui.create_player_globals(player)
evogui.create_sensor_display(player)
Expand Down Expand Up @@ -245,7 +244,7 @@ end


function evogui.evoGUI_toggle_popup(event)
local player = game.get_player(event.player_index)
local player = game.players[event.player_index]
local player_settings = global.evogui[player.name]

local root = player.gui.top.evoGUI
Expand Down
3 changes: 2 additions & 1 deletion info.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"contact": "[email protected]",
"homepage": "https://github.com/narc0tiq/evoGUI/",
"description": "Places an indicator on your UI telling you the current biter evolution factor (as a percentage). It also tells you how long you've been playing.",
"dependencies": ["base >= 0.12.11", "? moweather"]
"dependencies": ["base >= 0.13.0", "? moweather"],
"factorio_version": "0.13"
}
12 changes: 5 additions & 7 deletions settingsGUI.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
require "defines"

if not evogui then evogui = {} end

if not global.evogui then global.evogui = {} end
if not global.settings then global.settings = {} end


local function toggle_always_visible(event)
local player = game.get_player(event.player_index)
local player = game.players[event.player_index]

local always_visible = global.evogui[player.name].always_visible
local sensor_name = event.element.name:sub(24,-1)
Expand All @@ -20,7 +18,7 @@ end


local function toggle_in_popup(event)
local player = game.get_player(event.player_index)
local player = game.players[event.player_index]

local in_popup = global.evogui[player.name].in_popup
local sensor_name = event.element.name:sub(24,-1)
Expand All @@ -37,7 +35,7 @@ local function on_sensor_settings_closed(player_index)
end

local function trigger_settings_gui(event)
local player = game.get_player(event.player_index)
local player = game.players[event.player_index]

local sensor_name = event.element.name:sub(42,-1)
local sensor = ValueSensor.get_by_name(sensor_name)
Expand Down Expand Up @@ -94,7 +92,7 @@ end


function evogui.evoGUI_settings(event)
local player = game.get_player(event.player_index)
local player = game.players[event.player_index]
if player.gui.center.evoGUI_settingsGUI ~= nil then
player.gui.center.evoGUI_settingsGUI.destroy()
return
Expand Down Expand Up @@ -138,7 +136,7 @@ end


function evogui.evoGUI_settings_close(event)
local player = game.get_player(event.player_index)
local player = game.players[event.player_index]

local new_update_freq = tonumber(player.gui.center.evoGUI_settingsGUI.core_settings.update_freq_flow.textfield.text)
if new_update_freq ~= nil then
Expand Down
2 changes: 1 addition & 1 deletion value_sensors/day_time.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ end


function sensor:settings_gui(player_index)
local player = game.get_player(player_index)
local player = game.players[player_index]
local sensor_settings = global.evogui[player.name].sensor_settings[self.name]
local root_name = self:settings_root_name()

Expand Down
2 changes: 1 addition & 1 deletion value_sensors/evolution_factor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ end


function sensor:settings_gui(player_index)
local player = game.get_player(player_index)
local player = game.players[player_index]
local sensor_settings = global.evogui[player.name].sensor_settings[self.name]
local root_name = self:settings_root_name()

Expand Down
4 changes: 2 additions & 2 deletions value_sensors/kill_count.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ end
local sensor = ValueSensor.new("kill_count")

function sensor:update_ui(owner)
local player = game.get_player(owner.player_index)
local player = game.players[owner.player_index]

local biter_count = 0
local spawner_count = 0
local other_count = 0
for entity_name, kill_count in pairs(player.force.kill_counts) do
for entity_name, kill_count in pairs(player.force.kill_count_statistics.input_counts) do
if is_biter(entity_name) then
biter_count = biter_count + kill_count
elseif is_spawner(entity_name) then
Expand Down
2 changes: 1 addition & 1 deletion value_sensors/play_time.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ end


function sensor:settings_gui(player_index)
local player = game.get_player(player_index)
local player = game.players[player_index]
local sensor_settings = global.evogui[player.name].sensor_settings[self.name]
local root_name = self:settings_root_name()

Expand Down
8 changes: 4 additions & 4 deletions value_sensors/player_locations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ end


function sensor:settings_gui(player_index)
local player = game.get_player(player_index)
local player = game.players[player_index]
local sensor_settings = global.evogui[player.name].sensor_settings[self.name]
local root_name = self:settings_root_name()

Expand Down Expand Up @@ -68,11 +68,11 @@ end


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

for _, p in ipairs(game.players) do
for _, p in pairs(game.players) do
local player_name = p.name
if not player_name or player_name == '' then
-- fallback to "Local Player" if this is singleplayer
Expand Down Expand Up @@ -100,7 +100,7 @@ function sensor:update_ui(owner)
end

local direction = '?'
local current_player = game.get_player(owner.player_index)
local current_player = game.players[owner.player_index]
if p == current_player then
direction = ''
elseif current_player then
Expand Down
6 changes: 3 additions & 3 deletions value_sensors/template.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function ValueSensor.new(name)
end

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

self.settings = sensor_settings
Expand Down Expand Up @@ -53,7 +53,7 @@ function ValueSensor.new(name)
end

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

player.gui.center[root_name].destroy()
Expand All @@ -65,7 +65,7 @@ function ValueSensor.new(name)
local sensor_name = self.name

return function(event)
local player = game.get_player(event.player_index)
local player = game.players[event.player_index]
local sensor_settings = global.evogui[player.name].sensor_settings[sensor_name]

sensor_settings[setting_name] = event.element.state
Expand Down

0 comments on commit 34ae6a2

Please sign in to comment.