mirror of
https://github.com/PHIDIAS0303/factorio-mod-PHI.git
synced 2026-07-26 21:16:23 +09:00
.
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
if settings.startup['PHI-CT'].value then
|
if settings.startup['PHI-CT'].value then
|
||||||
require('data.f.ct')
|
require('data.f.ct')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if settings.startup['PHI-MI'].value then
|
||||||
|
require('data.f.ct')
|
||||||
|
end
|
||||||
|
|||||||
+71
-66
@@ -1,80 +1,85 @@
|
|||||||
local items = require('mi-c')
|
local items = require('mi-c')
|
||||||
|
|
||||||
|
function main_entity_number_position(entity)
|
||||||
|
local box = entity.selection_box or entity.collision_box
|
||||||
|
|
||||||
|
if not box then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if not box.left_top and not box.right_bottom and type(box[1]) == 'table' and type(box[2]) == 'table' then
|
||||||
|
box = {
|
||||||
|
left_top = {x = box[1][1], y = box[1][2]},
|
||||||
|
right_bottom = {x = box[2][1], y = box[2][2]}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local w = box.right_bottom.x - box.left_top.x
|
||||||
|
local h = box.right_bottom.y - box.left_top.y
|
||||||
|
local cx = (box.left_top.x + box.right_bottom.x) / 2
|
||||||
|
local cy = (box.left_top.y + box.right_bottom.y) / 2
|
||||||
|
|
||||||
|
local positions = {
|
||||||
|
[1] = {
|
||||||
|
x = cx - 0.2 * w,
|
||||||
|
y = cy + h / 2 - 0.25
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
x = cx - 0.2 * h,
|
||||||
|
y = cy + w / 2 - 0.25
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return positions
|
||||||
|
end
|
||||||
|
|
||||||
|
function main_entity_apply(entity, graphic)
|
||||||
|
if not entity[graphic] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
entity[graphic].status_colors = items['status']
|
||||||
|
|
||||||
|
if not entity[graphic].working_visualisations then
|
||||||
|
entity[graphic].working_visualisations = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
local positions = main_entity_number_position(entity)
|
||||||
|
|
||||||
|
if positions then
|
||||||
|
entity[graphic].working_visualisations[#entity[graphic].working_visualisations + 1] = {
|
||||||
|
always_draw = true,
|
||||||
|
apply_tint = 'status',
|
||||||
|
render_layer = 'light-effect',
|
||||||
|
animation = {
|
||||||
|
filename = '__base__/graphics/icons/signal/signal_white.png',
|
||||||
|
flags = {'icon'},
|
||||||
|
size = 64,
|
||||||
|
scale = 0.15,
|
||||||
|
line_length = 1,
|
||||||
|
frame_count = 1,
|
||||||
|
animation_speed = 1,
|
||||||
|
draw_as_glow = true
|
||||||
|
},
|
||||||
|
north_position = positions[1],
|
||||||
|
east_position = positions[2],
|
||||||
|
south_position = positions[1],
|
||||||
|
west_position = positions[2],
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- MI C 11 BASE ENTITY
|
-- MI C 11 BASE ENTITY
|
||||||
-- MI C 1 RECYCLER ENTITY
|
-- MI C 1 RECYCLER ENTITY
|
||||||
-- MI C 7 SPACE_AGE ENTITY
|
-- MI C 7 SPACE_AGE ENTITY
|
||||||
if settings.startup['PHI-CT-STATUS'].value and items['status'] and items['status_ignore'] then
|
if settings.startup['PHI-MI-STATUS'].value and items['status'] and items['status_ignore'] then
|
||||||
function main_entity_number_position(entity)
|
|
||||||
local box = entity.selection_box or entity.collision_box
|
|
||||||
|
|
||||||
if not box then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if not box.left_top and not box.right_bottom and type(box[1]) == 'table' and type(box[2]) == 'table' then
|
|
||||||
box = {
|
|
||||||
left_top = {x = box[1][1], y = box[1][2]},
|
|
||||||
right_bottom = {x = box[2][1], y = box[2][2]}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
local w = box.right_bottom.x - box.left_top.x
|
|
||||||
local h = box.right_bottom.y - box.left_top.y
|
|
||||||
local cx = (box.left_top.x + box.right_bottom.x) / 2
|
|
||||||
local cy = (box.left_top.y + box.right_bottom.y) / 2
|
|
||||||
|
|
||||||
local positions = {
|
|
||||||
[1] = {
|
|
||||||
x = cx - 0.2 * w,
|
|
||||||
y = cy + h / 2 - 0.25
|
|
||||||
},
|
|
||||||
[2] = {
|
|
||||||
x = cx - 0.2 * h,
|
|
||||||
y = cy + w / 2 - 0.25
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return positions
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, c in pairs({'assembling-machine', 'furnace', 'mining-drill'}) do
|
for _, c in pairs({'assembling-machine', 'furnace', 'mining-drill'}) do
|
||||||
for _, v in pairs(data.raw[c]) do
|
for _, v in pairs(data.raw[c]) do
|
||||||
if not v.bottleneck_ignore and not items['status_ignore'][v.name] then
|
if not v.bottleneck_ignore and not items['status_ignore'][v.name] then
|
||||||
for _, a in pairs({'graphics_set', 'wet_mining_graphics_set', 'graphics_set_flipped'}) do
|
for _, a in pairs({'graphics_set', 'wet_mining_graphics_set', 'graphics_set_flipped'}) do
|
||||||
if v[a] then
|
main_entity_apply(v, a)
|
||||||
v[a].status_colors = items['status']
|
|
||||||
|
|
||||||
if not v[a].working_visualisations then
|
|
||||||
v[a].working_visualisations = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
local positions = main_entity_number_position(v)
|
|
||||||
|
|
||||||
if positions then
|
|
||||||
v[a].working_visualisations[#v[a].working_visualisations + 1] = {
|
|
||||||
always_draw = true,
|
|
||||||
apply_tint = 'status',
|
|
||||||
render_layer = 'light-effect',
|
|
||||||
animation = {
|
|
||||||
filename = '__base__/graphics/icons/signal/signal_white.png',
|
|
||||||
flags = {'icon'},
|
|
||||||
size = 64,
|
|
||||||
scale = 0.15,
|
|
||||||
line_length = 1,
|
|
||||||
frame_count = 1,
|
|
||||||
animation_speed = 1,
|
|
||||||
draw_as_glow = true
|
|
||||||
},
|
|
||||||
north_position = positions[1],
|
|
||||||
east_position = positions[2],
|
|
||||||
south_position = positions[1],
|
|
||||||
west_position = positions[2],
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user