Jump to content

How do I disable some crafting tabs in game?


Recommended Posts

I have look around for the script, but not much of them work as I intended, so I would like some help here.
My intention is to disable some crafting tabs to let player find the blueprint from something else that I planned for later.
Or the tab will appear when use some certain items or stand next to the machine, somewhat I would think of...
 

Quote

GLOBAL.AllRecipes.researchlab.builder_tag = "nobody"

This is one I have found, it disable the science tab, so I'm thinking that, could this be adapted to disable other tab too?
 

Quote

inst.components.builder.science_bonus = -666
inst.components.builder.magic_bonus = -666
inst.components.builder.ancient_bonus = -666
inst.components.builder.shadow_bonus = -666

This is another one I found, and this just remove all the crafting tabs, which is kinda over-killed the character, pfft.
Please let me know if I could do something or some suggestion from experienced modder that would be nice, thanks :3

Link to comment
Share on other sites

Setting the builder_tag on the researchlabs, disables all the recipes it enables, which for some researchlabs are spread over several tabs. Also, this will make this change for all players on the server, if I'm reading the code correctly.

Changing the different bonuses disables all recipes gained by that bonus, again affecting recipes across several tabs. If what you want, is to disable the player from using ALL recipes requiring one or more of the bonuses, then this is what you want. You don't have to set them all to -666 at the same time.

Otherwise, the least intrusive way I can think of, is to override the DoUpdateRecipes function of the crafttabs widget, which won't remove the recipes, but will allow you to manually hide certain tabs client-side. I can't see a good way of doing this, that's compatibility-friendly towards other (UI) mods (which might change this function as well), because you have to intercept and hide the tabs, before the function selects and highlights the first available tab.

Another approach, which is annoying, a lot of work, and will not work for recipes added by mods (unless you add them manually), is to manually hide selected recipes, by extending CanBuild or KnowsRecipe in the builder-component, and returning 'false' if the player has a certain tag (like, "hide_tools_tab" or "hide_survival_tab") and the recipe is normally in that tab (look through your manually formed recipe lists for each tab).

I hope someone else has better ideas :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...