Page 1 of 1

Selection tool with grid

Posted: Wed Sep 18, 2019 7:28 am
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.

Re: Selection tool with grid

Posted: Thu Sep 19, 2019 9:03 am
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.

Re: Selection tool with grid

Posted: Thu Sep 19, 2019 3:29 pm
by mrvn
How do you make a (area) selection tool at all?

Re: Selection tool with grid

Posted: Thu Sep 19, 2019 6:20 pm
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})