mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-29 21:47:08 +02:00
Mtn: fix more bugs
This commit is contained in:
parent
a8f2db5fe2
commit
d3ce9d24cb
@ -49,7 +49,7 @@ local this = {
|
|||||||
},
|
},
|
||||||
['equipment'] = {
|
['equipment'] = {
|
||||||
['solar-panel-equipment'] = { value = 240, rarity = 3 },
|
['solar-panel-equipment'] = { value = 240, rarity = 3 },
|
||||||
['fusion-reactor-equipment'] = { value = 9000, rarity = 7 },
|
['fission-reactor-equipment'] = { value = 9000, rarity = 7 },
|
||||||
['energy-shield-equipment'] = { value = 400, rarity = 6 },
|
['energy-shield-equipment'] = { value = 400, rarity = 6 },
|
||||||
['energy-shield-mk2-equipment'] = { value = 4000, rarity = 8 },
|
['energy-shield-mk2-equipment'] = { value = 4000, rarity = 8 },
|
||||||
['battery-equipment'] = { value = 160, rarity = 2 },
|
['battery-equipment'] = { value = 160, rarity = 2 },
|
||||||
|
@ -17,6 +17,7 @@ local player_frame_name = Where.player_frame_name
|
|||||||
local chest_converter_frame_for_player_name = Gui.uid_name()
|
local chest_converter_frame_for_player_name = Gui.uid_name()
|
||||||
local convert_chest_to_linked = Gui.uid_name()
|
local convert_chest_to_linked = Gui.uid_name()
|
||||||
local item_name_frame_name = Gui.uid_name()
|
local item_name_frame_name = Gui.uid_name()
|
||||||
|
local close_name = Gui.uid_name()
|
||||||
|
|
||||||
local module_name = '[Linked Chests] '
|
local module_name = '[Linked Chests] '
|
||||||
local deepcopy = table.deepcopy
|
local deepcopy = table.deepcopy
|
||||||
@ -575,15 +576,15 @@ local function gui_opened(event)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local inside_frame, close_button
|
||||||
local frame = player.gui.center[tostring(unit_number)]
|
local frame = player.gui.center[tostring(unit_number)]
|
||||||
if not frame or not frame.valid then
|
if not frame or not frame.valid then
|
||||||
frame =
|
frame, inside_frame, close_button = Gui.add_main_frame_with_toolbar(player, 'center', tostring(unit_number), nil, close_name, 'Linked chest')
|
||||||
player.gui.center.add {
|
end
|
||||||
type = 'frame',
|
|
||||||
caption = 'Linked chest',
|
if close_button then
|
||||||
direction = 'vertical',
|
inside_frame.name = 'inside_frame'
|
||||||
name = tostring(unit_number)
|
Gui.set_data(close_button, tostring(unit_number))
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local controls = frame.add { type = 'flow', direction = 'horizontal' }
|
local controls = frame.add { type = 'flow', direction = 'horizontal' }
|
||||||
@ -1283,12 +1284,39 @@ Event.add(
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Gui.on_click(
|
||||||
|
close_name,
|
||||||
|
function (event)
|
||||||
|
local player = game.get_player(event.player_index)
|
||||||
|
if not player or not player.valid then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local element = event.element
|
||||||
|
local data = Gui.get_data(element)
|
||||||
|
if not data then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local frame = player.gui.center[data]
|
||||||
|
if frame and frame.valid then
|
||||||
|
Gui.destroy(frame)
|
||||||
|
end
|
||||||
|
|
||||||
|
Where.remove_camera_frame(player)
|
||||||
|
this.linked_gui[player.name] = nil
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
Gui.on_click(
|
Gui.on_click(
|
||||||
item_name_frame_name,
|
item_name_frame_name,
|
||||||
function (event)
|
function (event)
|
||||||
local player = game.get_player(event.player_index)
|
local player = game.get_player(event.player_index)
|
||||||
local player_data = this.linked_gui[player.name]
|
local player_data = this.linked_gui[player.name]
|
||||||
local element = event.element
|
local element = event.element
|
||||||
|
if not element or not element.valid then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if not player_data then
|
if not player_data then
|
||||||
Gui.remove_data_recursively(element)
|
Gui.remove_data_recursively(element)
|
||||||
return
|
return
|
||||||
|
@ -39,6 +39,7 @@ end
|
|||||||
|
|
||||||
local function shoo(event)
|
local function shoo(event)
|
||||||
local icw_locomotive = Public.get('icw_locomotive')
|
local icw_locomotive = Public.get('icw_locomotive')
|
||||||
|
if not icw_locomotive then return end
|
||||||
local loco_surface = icw_locomotive.surface
|
local loco_surface = icw_locomotive.surface
|
||||||
|
|
||||||
if not loco_surface or not loco_surface.valid then
|
if not loco_surface or not loco_surface.valid then
|
||||||
|
@ -67,7 +67,7 @@ local item_worths = {
|
|||||||
['power-armor'] = 4096,
|
['power-armor'] = 4096,
|
||||||
['power-armor-mk2'] = 32768,
|
['power-armor-mk2'] = 32768,
|
||||||
['solar-panel-equipment'] = 256,
|
['solar-panel-equipment'] = 256,
|
||||||
['fusion-reactor-equipment'] = 8192,
|
['fission-reactor-equipment'] = 8192,
|
||||||
['energy-shield-equipment'] = 512,
|
['energy-shield-equipment'] = 512,
|
||||||
['energy-shield-mk2-equipment'] = 4096,
|
['energy-shield-mk2-equipment'] = 4096,
|
||||||
['battery-equipment'] = 128,
|
['battery-equipment'] = 128,
|
||||||
|
@ -199,6 +199,8 @@ Event.add(
|
|||||||
launch_item.actual = launch_item.actual + 1
|
launch_item.actual = launch_item.actual + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
rocket_inventory.clear()
|
||||||
|
rocket_inventory.insert({ name = 'space-science-pack', count = 200 })
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1568,11 +1568,10 @@ function Public.reset_stateful(refresh_gui, clear_buffs)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
if not this.objectives.launch_item or (this.objectives_completed ~= nil and this.objectives_completed.launch_item) then
|
if not this.objectives.launch_item or (this.objectives_completed ~= nil and this.objectives_completed.launch_item) then
|
||||||
local item = get_random_handcrafted_item()
|
|
||||||
this.objectives.launch_item = {
|
this.objectives.launch_item = {
|
||||||
actual = 0,
|
actual = 0,
|
||||||
expected = scale(1, 50),
|
expected = scale(1, 500),
|
||||||
name = item.name
|
name = 'raw-fish'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
if not this.objectives.research_level_selection or (this.objectives_completed ~= nil and this.objectives_completed.research_level_selection) then
|
if not this.objectives.research_level_selection or (this.objectives_completed ~= nil and this.objectives_completed.research_level_selection) then
|
||||||
|
@ -36,6 +36,11 @@ local function compute_fullness(player, position)
|
|||||||
if not player.mining_state.mining then
|
if not player.mining_state.mining then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if player.controller_type == defines.controllers.remote then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local warn_player = is_player_warned(player)
|
local warn_player = is_player_warned(player)
|
||||||
local free_slots = player.get_main_inventory().count_empty_stacks()
|
local free_slots = player.get_main_inventory().count_empty_stacks()
|
||||||
local inventory_size = #player.get_main_inventory()
|
local inventory_size = #player.get_main_inventory()
|
||||||
|
@ -56,7 +56,7 @@ local function apply_logistic_network(player, saved_data)
|
|||||||
for i, slot in pairs(saved_data) do
|
for i, slot in pairs(saved_data) do
|
||||||
if slot and slot.name and check_if_item_exists(slot.name) then
|
if slot and slot.name and check_if_item_exists(slot.name) then
|
||||||
local item_stack = { min = slot.min, max = slot.max, value = { comparator = "=", name = slot.name, quality = "normal", type = slot.type or nil } }
|
local item_stack = { min = slot.min, max = slot.max, value = { comparator = "=", name = slot.name, quality = "normal", type = slot.type or nil } }
|
||||||
old_section.set_slot(i, item_stack)
|
pcall(old_section.set_slot, i, item_stack)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -73,7 +73,7 @@ local function apply_logistic_network(player, saved_data)
|
|||||||
for i, slot in pairs(slots) do
|
for i, slot in pairs(slots) do
|
||||||
if slot and slot.name and check_if_item_exists(slot.name) then
|
if slot and slot.name and check_if_item_exists(slot.name) then
|
||||||
local item_stack = { min = slot.min, max = slot.max, value = { comparator = "=", name = slot.name, quality = "normal", type = slot.type or nil } }
|
local item_stack = { min = slot.min, max = slot.max, value = { comparator = "=", name = slot.name, quality = "normal", type = slot.type or nil } }
|
||||||
new_section.set_slot(i, item_stack)
|
pcall(new_section.set_slot, i, item_stack)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -281,8 +281,10 @@ function Public.add_main_frame_with_toolbar(player, align, set_frame_name, set_s
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local close_button
|
||||||
|
|
||||||
if close_main_frame_name then
|
if close_main_frame_name then
|
||||||
titlebar.add {
|
close_button = titlebar.add {
|
||||||
type = 'sprite-button',
|
type = 'sprite-button',
|
||||||
name = close_main_frame_name,
|
name = close_main_frame_name,
|
||||||
style = 'frame_action_button',
|
style = 'frame_action_button',
|
||||||
@ -304,7 +306,7 @@ function Public.add_main_frame_with_toolbar(player, align, set_frame_name, set_s
|
|||||||
name = 'inside_frame'
|
name = 'inside_frame'
|
||||||
}
|
}
|
||||||
|
|
||||||
return main_frame, inside_frame
|
return main_frame, inside_frame, close_button
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Removes data associated with LuaGuiElement and its children recursively.
|
-- Removes data associated with LuaGuiElement and its children recursively.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user