Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function render_bottlenecks(event)
- local colors = {
- {r=0,g=1,b=0}, -- defines.entity_status.working
- {r=1,g=0,b=0}, -- defines.entity_status.no_power
- {r=1,g=0,b=0}, -- defines.entity_status.no_fuel
- {r=1,g=0,b=0}, -- defines.entity_status.no_recipe
- {r=1,g=0,b=0}, -- defines.entity_status.no_input_fluid
- {r=1,g=1,b=0}, -- defines.entity_status.no_research_in_progress
- {r=1,g=0,b=0}, -- defines.entity_status.no_minable_resources
- {r=1,g=0,b=0}, -- defines.entity_status.low_input_fluid
- {r=1,g=0,b=0}, -- defines.entity_status.low_power
- {r=1,g=0,b=0}, -- defines.entity_status.disabled_by_control_behavior
- {r=1,g=0,b=0}, -- defines.entity_status.disabled_by_script
- {r=1,g=0,b=0}, -- defines.entity_status.fluid_ingredient_shortage
- {r=1,g=1,b=0}, -- defines.entity_status.fluid_production_overload
- {r=1,g=0,b=0}, -- defines.entity_status.item_ingredient_shortage
- {r=1,g=1,b=0}, -- defines.entity_status.item_production_overload
- {r=1,g=0,b=0}, -- defines.entity_status.marked_for_deconstruction
- {r=1,g=0,b=0}, -- defines.entity_status.missing_required_fluid
- {r=1,g=0,b=0}, -- defines.entity_status.missing_science_packs
- {r=1,g=0,b=0}, -- defines.entity_status.waiting_for_source_items
- {r=1,g=0,b=0}, -- defines.entity_status.waiting_for_space_in_destination
- {r=1,g=0,b=0} -- defines.entity_status.waiting_to_launch_rocket
- };
- for _,player in pairs(game.players) do
- local surface = player.surface;
- local player_pos = player.position;
- local res = player.display_resolution;
- local zoom = 0.3;
- local s = {x=res.width/zoom/64, y=res.height/zoom/64};
- local view_top_left = {x=player_pos.x-s.x, y=player_pos.y-s.y};
- local view_bottom_right = {x=player_pos.x+s.x, y=player_pos.y+s.y};
- local visible_entities = surface.find_entities_filtered{area = {view_top_left, view_bottom_right}, type={"furnace", "assembling-machine"}};
- for _, e in pairs(visible_entities) do
- local color = colors[e.status]
- rendering.draw_rectangle{players={player},surface=surface,color=color,filled="true",left_top=e,left_top_offset={-0.2,-0.2}, right_bottom=e,right_bottom_offset={0.2,0.2},time_to_live=61};
- end
- end
- end
- script.on_nth_tick(60, render_bottlenecks);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement