mirror of
https://github.com/PHIDIAS0303/factorio-mod-PHI.git
synced 2025-12-27 11:05:22 +09:00
.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user