Deadlock's Stacked Mining


Adds a mining planner that allows you to mark ores to be mined directly as their stacked version.

Content
3 years ago
0.18 - 1.0
21
Mining

i Ideas

3 years ago

Here are some ideas
- Might want to check the user has admin rights before converting the patches.
- Rename "data.lua" to "data-updates.lua" so that it runs after all the resources have been declared by other mods.
- Rather than a static list or ores, scan though data.raw.resource for resources.
- You can check if the stacked ore exists or not, if not use deadlock.add_stack to ensure its created.
- If the mod "https://mods.factorio.com/mod/CompressedFluids" is installed you could allow the conversion of fluid resources to their compressed version.

3 years ago
(updated 3 years ago)

Thanks for the tips. I don't have much experience with lua and modding/programming in general and am still learning.

- Might want to check the user has admin rights before converting the patches.
I can add a check if the player is an admin for the next version, but why is that important? I thought that crating a game in single player would always give you admin rights. I never played multiplayer, but I want to allow all players to use the stacked mining planner, not just the admin of a server. Does the check in that case even make sense?

- Rename "data.lua" to "data-updates.lua" so that it runs after all the resources have been declared by other mods.
I am currently working on adding support for modded ores and noticed that problem. I already changed it in the new version (not uploaded yet).

- Rather than a static list or ores, scan though data.raw.resource for resources.
I was trying to find a way to keep the tables from the data---.lua stage, and pass them on to the control.lua stage so that they can be used in control.lua, but without any success. So I got lazy and used a static list. It worked, but I know that it is not a good solution. Is the reason why I should change that just about having a more “elegant”/clean code or could this cause other issues?

I thought I read somewhere that in the control stage, data is no longer accessible, so I can't use data.raw["resource"][entity.name]. Is that assumption wrong?

- You can check if the stacked ore exists or not, if not use deadlock.add_stack to ensure its created.
I will do that, but is creating the stacked ore not the job of the other deadlock add-ons. I thought that as long as I set the dependencies correctly, that should not be a problem.

- If the mod "https://mods.factorio.com/mod/CompressedFluids" is installed you could allow the conversion of fluid resources to their compressed version.
Support for CompressedFluids is already on my to-do list. I just wanted to get it working for resource_category == "basic-solid" first.

Thanks for the ideas.

I am currently reworking the code and will upload a new version as soon as I get it cleaned up and working. I added working support for angels/bobs and Krastorio 2 but with emphasis on “working”, not on clean.

It took me hours just to figure out that angels resources have their mining result saved in entity.minable.results and not in entity.minable.result, so it probably will take a while.

3 years ago

"justarandomgeek" has developed an extention for Visual Studio Code that allows you to debug your code in both the data and control life cycle stages.

Its quite handy to be able to add breakpoints and explorer objects that are available.

3 years ago

Thanks. That could save a lot of time.
Until now I zipped my mod each time after I made a change, replaced the zip file in the mods folder, started up factorio and took a look at the log to see why the code failed.

3 years ago

On windows I use mklink to create a virtual juction point in mods folder linking to where I have my code. Needs to be executed from a command prompt with admin rights.

mklink /d Kythbloods_Stacked_Mining C:\code\Kythbloods_Stacked_Mining

New response