diff --git a/VERSION b/VERSION index 5745cc7..72400f8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.16 +0.4.101 diff --git a/control.lua b/control.lua index 220cc4f..28e6792 100644 --- a/control.lua +++ b/control.lua @@ -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 diff --git a/evoGUI.lua b/evoGUI.lua index 352feb7..dd48d6b 100644 --- a/evoGUI.lua +++ b/evoGUI.lua @@ -1,4 +1,3 @@ -require "defines" require "value_sensors.day_time" require "value_sensors.evolution_factor" require "value_sensors.kill_count" @@ -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) @@ -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 diff --git a/info.json b/info.json index d3d404b..7a44bee 100644 --- a/info.json +++ b/info.json @@ -6,5 +6,6 @@ "contact": "factorio-mods@narc.ro", "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" } diff --git a/settingsGUI.lua b/settingsGUI.lua index 1024f1c..ddb493d 100644 --- a/settingsGUI.lua +++ b/settingsGUI.lua @@ -1,5 +1,3 @@ -require "defines" - if not evogui then evogui = {} end if not global.evogui then global.evogui = {} end @@ -7,7 +5,7 @@ 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) @@ -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) @@ -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) @@ -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 @@ -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 diff --git a/value_sensors/day_time.lua b/value_sensors/day_time.lua index 0ae000d..185f641 100644 --- a/value_sensors/day_time.lua +++ b/value_sensors/day_time.lua @@ -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() diff --git a/value_sensors/evolution_factor.lua b/value_sensors/evolution_factor.lua index 2faebba..8d2f64b 100644 --- a/value_sensors/evolution_factor.lua +++ b/value_sensors/evolution_factor.lua @@ -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() diff --git a/value_sensors/kill_count.lua b/value_sensors/kill_count.lua index f59515d..8888039 100644 --- a/value_sensors/kill_count.lua +++ b/value_sensors/kill_count.lua @@ -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 diff --git a/value_sensors/play_time.lua b/value_sensors/play_time.lua index 1df0d3e..8e6fa85 100644 --- a/value_sensors/play_time.lua +++ b/value_sensors/play_time.lua @@ -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() diff --git a/value_sensors/player_locations.lua b/value_sensors/player_locations.lua index d1b19e6..17970f8 100644 --- a/value_sensors/player_locations.lua +++ b/value_sensors/player_locations.lua @@ -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() @@ -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 @@ -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 diff --git a/value_sensors/template.lua b/value_sensors/template.lua index 62fe096..42e50e4 100644 --- a/value_sensors/template.lua +++ b/value_sensors/template.lua @@ -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 @@ -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() @@ -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