mirror of
https://github.com/PHIDIAS0303/factorio-mod-PHI.git
synced 2025-12-27 11:05:22 +09:00
.
This commit is contained in:
@@ -79,6 +79,25 @@ if settings.startup['PHI-CT'].value then
|
||||
local range = math.max(math.abs(math.floor(pos_p.x)), math.abs(math.floor(pos_p.y)), math.abs(math.floor(pos_d.x)), math.abs(math.floor(pos_d.y)))
|
||||
table['table_' .. (3 + (pos_p.x >= 0 and math.max(math.ceil(pos_p.x), 2)) or (pos_p.x < 0 and math.min(math.ceil(pos_p.x), -2))) .. '_' .. (pos_p.y >= 0 and math.max(math.ceil(pos_p.y), 2)) or (pos_p.y < 0 and math.min(math.ceil(pos_p.y), -2))].sprite = 'virtual-signal/up-arrow'
|
||||
table['table_' .. (3 + (pos_d.x >= 0 and math.max(math.ceil(pos_d.x), 2)) or (pos_d.x < 0 and math.min(math.ceil(pos_d.x), -2))) .. '_' .. (pos_d.y >= 0 and math.max(math.ceil(pos_d.y), 2)) or (pos_d.y < 0 and math.min(math.ceil(pos_d.y), -2))].sprite = 'virtual-signal/down-arrow'
|
||||
|
||||
if range == 1 then
|
||||
for x = 1, 5 do
|
||||
table['table_' .. x .. '_1'].enabled = false
|
||||
table['table_' .. x .. '_5'].enabled = false
|
||||
end
|
||||
|
||||
for y = 2, 4 do
|
||||
table['table_1_' .. y].enabled = false
|
||||
table['table_5_' .. y].enabled = false
|
||||
end
|
||||
|
||||
elseif range == 2 then
|
||||
for x = 1, 5 do
|
||||
for y = 1, 5 do
|
||||
table['table_' .. x .. '_' .. y].enabled = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
script.on_init(function(_)
|
||||
@@ -114,7 +133,7 @@ if settings.startup['PHI-CT'].value then
|
||||
|
||||
script.on_event(defines.events.on_gui_opened, function(e)
|
||||
if e.entity and (e.entity.type == 'inserter' or (e.entity.type == 'entity-ghost' and e.entity.ghost_type == 'inserter')) then
|
||||
gui_create(game.players[e.player_index])
|
||||
gui_update(game.players[e.player_index], e.entity)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -128,6 +147,7 @@ if settings.startup['PHI-CT'].value then
|
||||
for _, player in pairs(game.players) do
|
||||
if player.opened == e.entity then
|
||||
gui_update(player, player.opened)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -138,6 +158,7 @@ if settings.startup['PHI-CT'].value then
|
||||
for _, player in pairs(game.players) do
|
||||
if player.opened == e.destination then
|
||||
gui_update(player, player.opened)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user