Debloat: Mine cliffs by hand

by marc40k

Allows cliffs to be mined by hand. A pile of rocks won't stop the engineer. Also allows bots to remove cliffs. Original idea by DemonX3 and north1605; adapted for the new Space Age cliffs.

Tweaks
22 days ago
2.0
1.60K
Environment Mining

i Options (Settings)

26 days ago

Hi,

thanks for this mod.

Could you consider adding a setting to limit mineable cliffs only to Nauvis (or maybe add a setting for cliff prototype names, prefilled with all that you want to be mineable, so players can add/remove some?

And more importantly: Could you consider adding a setting to allow configuring the mining time? Mining cliffs by hand should be tedious, so that you rarely want to do it, but possible, so you do not have to wait until you get there and to force you to go to Vulcanus as the first planet?

Cheers.

23 days ago
(updated 23 days ago)

Yes, I have considered adding the mod to Nauvis only. As a matter of fact, I didn't get my own mod to work on Vulcanus at first, so I just played on Vulcanus without it. I will add the setting to turn off certain planets.
The setting for cliff prototype names, I've never seen it done before, so I wouldn't know where/how to implement that. If you have any guidance, do let me know.
As for the mining time, I think this mod is about reducing tedium and not increasing it. But implementing a setting shouldn't be too difficult.

Edit: Bots do pick up any item they mine instantaneously. As a result, cliffs are (sadly?) included.

23 days ago
(updated 23 days ago)

Regarding bots, they use the cliff explosives to get rid of the cliffs, so that is always instantaneous, yes. Personally, I think it should be.
Also, it will always affect all cliffs, as far as I understand.

With space age, you have to Vulcanus to be able to get rid of cliffs at all, so being able to manually get rid of cliffs on Nauvis before Vulcanus is already reducing tedium. If I could mine them away that fast, it would make having to go to Vulcanus first completely unnecessary. If you just need a long time to mine them away manually, it makes it more strategic, as in making you remove only those that really and truly cause issues with your base building/blueprints, e.g. blocking a robot port, an important pipe or such. And in the end, you'd still have robots to remove them instantly.

As for affecting only specific cliffs, you'd have to do the following:

  • Remove these lines completely, they are redundant anyways:
data.raw["cliff"]["cliff"].minable = {mining_time = 1}
data.raw["cliff"]["cliff"].selectable_in_game = true
  • Add a bool setting: "Changes all cliffs", defaults to true (debloat_change_all_cliffs)
  • Add a string setting: "Limit to these cliffs (if above is unchecked)", defaults to all cliff prototypes, comma separated (debloat_cliffs_to_change)
  • Add an int setting: "Mining time", defaults to 1 (debloat_mining_time)
  • Replace the first loop with the following:
-- Fetch settings
local change_all_cliffs = settings.startup["debloat_change_all_cliffs"].value or false
local cliffs_to_change = settings.startup["debloat_cliffs_to_change"].value or ""
local mining_time = settings.startup["debloat_mining_time"].value or 1

-- Split the comma-separated string into a table
local cliffs_to_change_table = {}
for cliff in string.gmatch(cliffs_to_change, '([^,]+)') do
    cliffs_to_change_table[cliff] = true
end

-- Adjust the mineability and mining time of the cliffs
for cliff_name, cliff in pairs(data.raw["cliff"]) do
    if change_all_cliffs or cliffs_to_change_table[cliff_name] then
        cliff.minable = {mining_time = mining_time}
        cliff.selectable_in_game = true
    end
end

That should do it. (I have not tested it.)

22 days ago
(updated 22 days ago)

The ability to select which planets you want to handmine cliffs has been added. You can also now add your own modded cliffs.
Due to engine limitations (?) bots still pick up cliffs instantly without using explosives. I consider this a feature, but it does make cliff explosives useless on that particular planet.
If enabled on all planets, cliff explosives become esentially useless.

To me, that's a good thing.

22 days ago

Thanks, I will give it a try when I’m back at my computer.
About the bots I’m confused though, do you know why they stop using the explosives,
Is it when you make the cliffs mineable by hand that the robots can pick them up without explosives?

22 days ago
(updated 22 days ago)

That's right. When you make the cliffs minable by hand, the robots just "mine" it as if it was a rock or an assembler. If you don't enable the mod for certain cliffs, for example vulcanus cliffs, then the bots still need explosives to mine these.

22 days ago

I see, thanks a lot for the reply and the learning!

I guess long term I need a different approach for myself then, most likely along the lines of an early but super-expensive cliff-explosives recipe or so. (We certainly have different tastes here, not asking you do change your mod towards that. xD)

21 days ago

https://mods.factorio.com/mod/Mineable-Cliffs-SpaceAge

This mod might be more to your liking. I don't like the code though, as it seems to create a new cliff to clone the old ones.

21 days ago

Thanks, I've looked into its code already as well, even though it is more along the lines, it is a solution too complex for a problem quite simple.
The more complex a mod is, the easier it is to break and the harder it is to maintain. That made me pick yours over the linked one.

Your effort is appreciated nonetheless!

New response