Preventing mining - possible?

Hello there! I have a quick question: Would it be possible to make it so that only one profession can mine?

I’m getting into modding, and making a new race, and it doesn’t fit to have them all going around mining, it’d instead make more sense in this case to have a job with a lot of requirements in order to be able to mine. Thanks in advance!

i’m not sure what all needs to be done, but each class has an “abilities.json” that defines what they can do, so you could probably override that file so that no one has mining as one of their ability’s.

@Drotten can probably tell you exactly what needs to be done though.

2 Likes

Yeah @8BitCrab is right, the jobs that mine have the ai_pack:mining in their abilities json, you’d need to remove it from all but the profession you have in mind.

3 Likes

@8BitCrab and @capotzalco both are correct in that regard. To accomplish that though, the best way would be to create a new abilities data file for those jobs that you don’t want to be a miner. But overriding won’t really work* though since doing that will also affect all populations that are using those jobs. So you’d have to recreate those jobs for your own mod that doesn’t have the ai_pack:mining among their abilities, note though that you don’t have to copy over their Lua script file; you can simply refer to those that already exist.

*Unless you do it when the player chooses your race to play as.

4 Likes

It seems that the first option is simpler, how would I do that though? Do I make it load another mod when you chose the race, or do I make it just load at the same point as the first option?
Thanks :slight_smile:

Would it be possible to prevent the mining of certain materials, so that the villagers can still make roads and such, but not being able to dig stone?

i’m pretty sure that mining for roads/foundations is considered building… but i could be wrong.

2 Likes

Let’s hope it is, as it would make it alot simpler!

To load up a mod at a specific time, you’d have to split up your mod into two parts: one that contains the most stuff about your new race, and the other which will be loaded when your race is chosen.

You could take a look at how radiant’s rayyas_children mod does it, since that one does exactly that, only it replaces the ui instead of overriding job files. The key part lies in its rayyas_children_client.lua script, in there it’s making the call _radiant.res.load_mod("rayyas_children_ui"), which is loading up the ui mod which replaces the ui.

This is probably possible, though it requires some big modifications on some scripts in how mining works (that is, to limit which blocks you can mine). Note that this is only my theory, I haven’t actually studied how mining works in great detail, but this is how I imagine it to be at least.

1 Like