Merge branch 'dev' into fix/autofill

This commit is contained in:
Cooldude2606
2023-03-07 21:11:26 +00:00
committed by GitHub
152 changed files with 4311 additions and 273 deletions

View File

@@ -183,7 +183,7 @@ end)
if not value then value = 0 end
local clamped = math.clamp(value, 0, 1000)
local item_name = element.parent.tooltip
local entity_name = element.parent.parent.parent.parent.name
local entity_name = element.parent.parent.parent.name
if not autofill_player_settings[player.name] then return end
local setting = autofill_player_settings[player.name][entity_name]
if not setting then return end

View File

@@ -764,8 +764,8 @@ Event.on_nth_tick(math.floor(60/config.update_smoothing), function()
end
-- Check if the force has any warps
local closest_warp
local closest_distance
local closest_warp = nil
local closest_distance = nil
if #warp_ids > 0 then
local surface = player.surface
local pos = player.position
@@ -794,7 +794,7 @@ Event.on_nth_tick(math.floor(60/config.update_smoothing), function()
end
-- Check the dist to the closest warp
local in_range = closest_warp.warp_id == warp_ids.spawn and closest_distance < rs2 or closest_distance < r2
local in_range = closest_warp ~= nil and (closest_warp.warp_id == warp_ids.spawn and closest_distance < rs2 or closest_distance < r2)
if was_in_range and not in_range then
PlayerInRange:set(player, nil)
elseif not was_in_range and in_range then
@@ -804,17 +804,16 @@ Event.on_nth_tick(math.floor(60/config.update_smoothing), function()
-- Change the enabled state of the add warp button
local frame = Gui.get_left_element(player, warp_list_container)
local add_warp_element = frame.container.header.alignment[add_new_warp.name]
local old_closest_warp_name = add_warp_element.tooltip[2] or closest_warp.name
local old_closest_warp_name = add_warp_element.tooltip[2] or closest_warp and closest_warp.name
local was_able_to_make_warp = add_warp_element.enabled
local can_make_warp = closest_distance > mr2
local can_make_warp = closest_distance == nil or closest_distance > mr2
if can_make_warp and not was_able_to_make_warp then
add_warp_element.enabled = true
add_warp_element.tooltip = {'warp-list.add-tooltip'}
elseif not can_make_warp and was_able_to_make_warp or old_closest_warp_name ~= closest_warp.name then
elseif not can_make_warp and was_able_to_make_warp or closest_warp and (old_closest_warp_name ~= closest_warp.name) then
add_warp_element.enabled = false
add_warp_element.tooltip = {'warp-list.too-close', closest_warp.name}
end
end
end