Selection tool with grid

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Selection tool with grid

Post by darkfrei »

Is it pretty to make the selector tool, that is always clipped to the map grid?

When you choose entities on the map area it's always free, but by selection of tiles you cannot expect that you choose the right area.

So by first click the left top corner will be rounded to the nearest grid corner and by changing of rectangle's size it will be always rounded to the nearest corner.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Selection tool with grid

Post by eradicator »

+0.5

In Screenshot Hotkey i enlarge the selected area in on_player_selected_area to make pictures aligned to the grid. Wouldn't hurt if the player could actually see this happening while selecting. But it's a really minor thing for me.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
mrvn
Smart Inserter
Smart Inserter
Posts: 5969
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Selection tool with grid

Post by mrvn »

How do you make a (area) selection tool at all?
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Selection tool with grid

Post by darkfrei »

mrvn wrote: Thu Sep 19, 2019 3:29 pm How do you make a (area) selection tool at all?
Like another prototypes.
Code from https://mods.factorio.com/mod/FogRemover

Code: Select all

local name = 'fr-selection-tool'

local selection_tool = 
  {
    type = "selection-tool",
    name = name,
    icon = "__FogRemover__/icon.png",
    icon_size = 32,
    subgroup = "tool",
    order = "c[automated-construction]-b[fr-selection-tool]",
    stack_size = 10,
    selection_color = { r = 0, g = 1, b = 0 },
    alt_selection_color = { r = 0, g = 0.5, b = 1 },
    selection_mode = {"blueprint"},
    alt_selection_mode = {"blueprint"},
    selection_cursor_box_type = "copy",
    alt_selection_cursor_box_type = "copy",
  }
  
local recipe = 
  {
    type = "recipe",
    name = name,
    energy_required = 15,
    enabled = true,
    category = "crafting",
    ingredients =
    {
      {"electronic-circuit", 5},
      {"radar", 1}
    },
    result = name
  }

data:extend({selection_tool, recipe})
Post Reply

Return to “Modding interface requests”