From 0aee25d469d15794a10d5bef300d806f39707a8b Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 27 Mar 2025 00:10:58 +0900 Subject: [PATCH] . --- PHI-CL/control.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/PHI-CL/control.lua b/PHI-CL/control.lua index b08a8bc..34bf802 100644 --- a/PHI-CL/control.lua +++ b/PHI-CL/control.lua @@ -108,8 +108,8 @@ if settings.startup['PHI-CT'].value then end function inserter_utils.get_max_range(inserter) - local pickup_pos = math2d.position.ensure_xy(math2d.position.add(inserter.prototype.inserter_pickup_position, {0.5, 0.5})) - local drop_pos = math2d.position.ensure_xy(math2d.position.add(inserter.prototype.inserter_drop_position, {0.5, 0.5})) + local pickup_pos = math2d.position.ensure_xy(math2d.position.add(inserter.inserter_pickup_position, {0.5, 0.5})) + local drop_pos = math2d.position.ensure_xy(math2d.position.add(inserter.inserter_drop_position, {0.5, 0.5})) return math.max(math.abs(math.floor(pickup_pos.x)), math.abs(math.floor(pickup_pos.y)), math.abs(math.floor(drop_pos.x)), math.abs(math.floor(drop_pos.y))) end @@ -122,10 +122,9 @@ if settings.startup['PHI-CT'].value then local frame_content = frame_main.add({type = 'frame', name = 'frame_content', style = 'entity_frame'}) local flow_content = frame_content.add({type = 'flow', name = 'flow_content', direction = 'vertical'}) local table_range = 1 - local inserter_prototyes = prototypes.get_entity_filtered({{filter = 'type', type = 'inserter'}}) - for _, prototype in pairs(inserter_prototyes) do - table_range = math.max(table_range, inserter_utils.get_max_range(prototype)) + for _, inserter in pairs(prototypes.get_entity_filtered({{filter = 'type', type = 'inserter'}})) do + table_range = math.max(table_range, inserter_utils.get_max_range(inserter)) end local table_position = flow_content.add({type = 'table', name = 'table_position', column_count = 1 + table_range * 2}) @@ -161,7 +160,7 @@ if settings.startup['PHI-CT'].value then function gui.update(player, inserter) local gui_instance = player.gui.relative.inserter_config.frame_content.flow_content local table_range = (gui_instance.table_position.column_count - 1) / 2 - local inserter_range = inserter_utils.get_max_range(inserter) + local inserter_range = inserter_utils.get_max_range(inserter.prototype or inserter.ghost_prototype) local arm_positions = inserter_utils.get_arm_positions(inserter) local idx = 0 @@ -270,7 +269,7 @@ if settings.startup['PHI-CT'].value then if e.destination.type == 'inserter' or (e.destination.type == 'entity-ghost' and e.destination.ghost_type == 'inserter') then e.destination.direction = e.source.direction local arm_positions = inserter_utils.get_arm_positions(e.destination) - local max_range = inserter_utils.get_max_range(e.destination) + local max_range = inserter_utils.get_max_range(e.destination.prototype or e.destination.ghost_prototype) for _, v in pairs({'drop', 'pickup'}) do if math.max(math.abs(arm_positions[v].x), math.abs(arm_positions[v].y)) > max_range then