Drill resource output type

Post Reply
Rathael
Burner Inserter
Burner Inserter
Posts: 15
Joined: Tue Mar 11, 2014 9:38 am
Contact:

Drill resource output type

Post by Rathael »

Can we get the ability to specify which resource in range of a drill will be mined?

User avatar
AlexPhoenix
Fast Inserter
Fast Inserter
Posts: 149
Joined: Tue Feb 18, 2014 7:48 am
Contact:

Re: Drill resource output type

Post by AlexPhoenix »

you can specify resource category, not exactly resources.
coal-ore,copper-ore,iron-ore => basic-solid
crude-oil => basic-fluid.

base\prototypes\categories\resource-category.lua
definition of the, here.

in resource definition this is variable:

Code: Select all

    category = "basic-fluid",
default basic-solid as i can see

so, you can use this.

Rathael
Burner Inserter
Burner Inserter
Posts: 15
Joined: Tue Mar 11, 2014 9:38 am
Contact:

Re: Drill resource output type

Post by Rathael »

Yes, I know about those two categories. I made a modular drills mod. It has a Modular Drill factory where you can exchange a Basic Mining Drill for a Modular Drill item. Then you select which drill type you want and use the Modular Drill plus some other resources to change it into a specific resource drill like an Iron Drill Mk 1, Coal Drill mk4. But there is no way to specify which resource should be mined by the drill. I want to be able to place the drill so it covers say iron and copper, but will only mine the iron and leave the copper alone.

User avatar
ludsoe
Fast Inserter
Fast Inserter
Posts: 243
Joined: Tue Feb 11, 2014 8:16 am
Contact:

Re: Drill resource output type

Post by ludsoe »

Id rather just have a UI button on we can push to change what a miner does. Maybe this can go under suggestions?

User avatar
AlexPhoenix
Fast Inserter
Fast Inserter
Posts: 149
Joined: Tue Feb 18, 2014 7:48 am
Contact:

Re: Drill resource output type

Post by AlexPhoenix »

Rathael wrote:Yes, I know about those two categories. I made a modular drills mod. It has a Modular Drill factory where you can exchange a Basic Mining Drill for a Modular Drill item. Then you select which drill type you want and use the Modular Drill plus some other resources to change it into a specific resource drill like an Iron Drill Mk 1, Coal Drill mk4. But there is no way to specify which resource should be mined by the drill. I want to be able to place the drill so it covers say iron and copper, but will only mine the iron and leave the copper alone.
i mean you can create your own cats and change standart resources cats(and then standart mining drill resource_categories, to access all solids)
and you will have what you want :)

Rathael
Burner Inserter
Burner Inserter
Posts: 15
Joined: Tue Mar 11, 2014 9:38 am
Contact:

Re: Drill resource output type

Post by Rathael »

AlexPhoenix wrote:i mean you can create your own cats and change standart resources cats(and then standart mining drill resource_categories, to access all solids)
and you will have what you want :)
Hmm I thought about that, but wouldn't it break compatibility for other mods like Dytech?

slay_mithos
Fast Inserter
Fast Inserter
Posts: 204
Joined: Tue Feb 25, 2014 7:22 am
Contact:

Re: Drill resource output type

Post by slay_mithos »

What you can do for compatibility is to make a small mod that requires dytech and makes the changes to its miners, just like you do to change the base prototypes in your mod.

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Drill resource output type

Post by FreeER »

What you can do for compatibility is to make a small mod that requires dytech and makes the changes to its miners, just like you do to change the base prototypes in your mod.
In this case what you'd probably want to use a mod dependency of "? dytech" so that dytech gets loaded before your mod does (if it exists, if it doesn't then the dependency is ignored) and then in your data.lua file use if data.raw["some-dytech-drill"] then require("file-that-modifies-dytech-miners") end. This way you only try to modify dytech if it's actually there. Replace the strings in the if statement with the proper names of course :)
But, you'd have to do the same for every mod that you want compatibility for (and adds drills) and keep the modifying files updated with the other mods...

slay_mithos
Fast Inserter
Fast Inserter
Posts: 204
Joined: Tue Feb 25, 2014 7:22 am
Contact:

Re: Drill resource output type

Post by slay_mithos »

I didn't know you could do a dependency that would not require the mod to be present, very good information, thanks.

Rathael
Burner Inserter
Burner Inserter
Posts: 15
Joined: Tue Mar 11, 2014 9:38 am
Contact:

Re: Drill resource output type

Post by Rathael »

Thanks! I will do it this way, but I don't like it. There may not be many mods right now, but that will change once more people start to play Factorio. Having to keep updated copies of every mod that touches drills or adds a new resource could become a huge problem. It would be easier if there was simply a line like resource_output = {"iron-ore"} or resource_output = {"basic-solid", "quartz-ore", "somedytech-ore"} in there.

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Drill resource output type

Post by FreeER »

Well, you could always create a regular entity and use control.lua to make it 'mine' what you want (assuming you can reach the category of the resource through lua, I would think so but I haven't tested it). You'd store a table of the nearby ore you are going to mine (using game.findentitiesfiltered{name="resource_you_want_to_mine", area=some_distance_you_want}) and then in ontick reduce the table.oreEntity.amount by 1 (after checking that exists, and removing it from the table if it doesn't) and insert that amount into the drill entity (and/or place that resource on the ground/, and/or check for an existing entity to one side of it...not sure how you could allow rotation though). I don't think that findentitiesfiltered can filter based on category, but you should be able to filter based on type="resource" and then remove any entities from the resulting table that do not match the category you want to mine (again, assuming you can reach the category of a resource through lua).

Not sure if that method is really 'better', but it is more compatible with other mods. Not certain why I didn't mention this before :lol:

edit: perhaps a different interface request would be to allow accessing the rotation of an entity through lua, then people could determine where to place items based on that...

edit2:
slay_mithos wrote:I didn't know you could do a dependency that would not require the mod to be present, very good information, thanks.
Yep, it is useful at times, and you are completely welcome :D

User avatar
Dysoch
Filter Inserter
Filter Inserter
Posts: 445
Joined: Fri Oct 18, 2013 2:27 pm
Contact:

Re: Drill resource output type

Post by Dysoch »

slay_mithos wrote:I didn't know you could do a dependency that would not require the mod to be present, very good information, thanks.
if you want to see them in action, download v1.3 of my mod and check the data.lua file in the main folder.
all the mod compatibilities are there.
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6

Post Reply

Return to “Implemented mod requests”