Miner Inserter - An inserter that mines ores


Put the inserter on your ore patch and he can extract the ore. He has a drill inside that extract the ores to surface.

Content
5 years ago
0.16
5
Mining

b bug: mining area is only 2x2, and glitch: mining area is invisible, and some more questions

5 years ago
(updated 5 years ago)

glitch: mining area is invisible
there are lines in your mod that should display the radius of mining coverage, but they probably won't work on the visible inserter (because it is no miner), and also not on the invisible miner (because it is invisible and has a selection box of 0,0 to 0,0 so that it can't be pointed at to trigger that display)

bug: mining area is only 2x2
while testing the mod, i noticed that tiles above and to the left of the miner seemed to never be mined. further testing (i built a setup to count how much ore was mined around the miner and let it run for a while) confirmed that the mining area was only the tile under the miner inserter and the three tiles to its east, south and southeast.
a look at the source showed what you already had written in the description: "Searching Radius 1/2.5"
but factorio itself uses 2.49 for the miner which has an area of 5x5 and you probably should use 1.49 instead of 1.00 for your miners that are intended to cover 3x3.

yet another small hack to test that: i have extended the selection box for the miner, and thus could hover over it and see the radius: it is only 1 tile in every direction, originating from the bottom right corner of the miner inserter. no wonder that it is digging only at the inserter and its neighbors to the east/south/southeast.
my conclusion: on placing the invisible miner, its location has to be adjusted by half a tile to the center of the inserter (you already have a function "on_built" with "position=entity.position" and it should be easy to add an offset there), a range of 1.00 might work after adjusting the origin of the invisible miner, but if you somehow succeed in making the mining range visible the range probably should get the extended mining range of 1.49 or 1.5 instead of 1.00 to show the whole range and not show half tiles at its borders.

edit: during my lunch break i remembered what i had written and what i had seen in the source, and there might be an additional problem (another edge case :-) when placing many inserter miners near to each other: the inserters are only 1x1 and the miners are even smaller (0x0) so that many can be placed next to each other. but when you want to remove ONE miner, you do that by searching for miners in a range of +-0.5 around an inserter. that works when the miner is placed at the same position as the inserter, but when the miner is centered at a corner of the inserter and the search is done based on the center of the inserter, up to 4 miners might be found and removed.
but this problem probably will be solved automatically when the positions of inserters and miners are adjusted correctly (instead of the current positioning of miners at a corner of the inserter)

more questions whether that is intended :
- (unconfirmed effect) : the line for "energy-source / emissions" probably was copied from some vanilla item and thus the miner inserter probably uses the same 0.15/1.5 for pollution as the original items, with no adjustment for the smaller size
- (confirmed effect) : the miner inserter has a line fast_replaceable_group = "inserter" and thus i can replace it by any inserter (except red long handed inserters) which also removes the invisible miner. should a miner be quickly (accidentally) be replaceable by a normal inserter? shouldn't it rather be replaceable by another miner (if at all since other miners have different sizes)?
- (probably only a formality) : there are two lines "render_no_power_icon = 0" and "render_no_network_icon = false" while both are defined as boolean in the prototype (https://lua-api.factorio.com/0.16.51/LuaBurnerPrototype.html)
- (not tested) : the invisible miner has three module slots (i could access them after extending the selection box, see above) and thus nobody would be able to access those slots during normal unmodded game, but what if someone uses a mod to autoplace/replace modules in entities inside some bigger selection rectangle? should (and can) those module slots be made available as a normal feature of the mod (i would suggest 1 or 2 modules instead of 3) ? or else their count should be set to 0 !?

ps: a nice feature that is probably not intended, but i like it: using bob's adjustible inserters, i was able to use it on the miner inserter and thus freely select where to drop the ore in an area of 7x7 tiles (range up to 3 tiles for inserters) or drop the ore from up to 48 miner inserters into one single chest (unsolved problem: where do i unload the chest to, when all tiles around it are occupied by miner inserters? LOL! but using 45-46 miner inserters, 1 chest, 1 loader and 1 (underground) belt might be realistic) :-)

5 years ago

since I'm no modder and mostly can read but not write lua, a few things above (about the mining area) may have been crap, but i have experimented and searched a lot in the meantime, and i probably have found the main reason for the bad positioning ... a missing simple flag :-) :-(

the creation of the invisible mining drill is correct with "position=entity.position" and needs no adjustment by half a tile to be centered. on the contrary: the inserter is automatically centered on a tile, and the creation of the invisible mining drill would place it at the correct position IF that invisible mining drill could be positioned "off grid", but as it is now the invisible mining drill will automatically be moved to integer coordinates and thus any recalculation of centers is useless.

the fix probably is simple: i found some description about flags and with an educated lucky guess :-) i added such a flag to the definition of the invisible mining drill:

flags = {"placeable-off-grid", "placeable-neutral", "player-creation"},

now, the mining drill is placed centered on the inserter, and the mining radius can be changed 1 to 1.49 so that the mining radius is also shown properly.

resource_searching_radius = 1.49,

in addition to this, the collision_box and selection_box can be adjusted too (together with setting the direction of the miner and making it not_rotatable), to make the mining drill accessible for inserting modules by clicking on a corner of the tile where the inserter is. but i didn't get the combination of all these modifications to work since the mining drill in my version either places ore outside the pickup range of the inserter, or inside at some location which is blocked.

New response